mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
70_ONKYO_AVR.pm: use non-blocking connect for TCP connections (forum #msg464119)
git-svn-id: https://svn.fhem.de/fhem/trunk@11717 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fc8a5e1965
commit
ac2b9ab8f9
@ -159,13 +159,30 @@ sub ONKYO_AVR_Define($$$) {
|
|||||||
$modules{ONKYO_AVR_ZONE}{defptr}{$name}{1} = $hash;
|
$modules{ONKYO_AVR_ZONE}{defptr}{$name}{1} = $hash;
|
||||||
|
|
||||||
$hash->{DeviceName} = @$a[2];
|
$hash->{DeviceName} = @$a[2];
|
||||||
$hash->{DeviceName} = $hash->{DeviceName} . ":60128"
|
|
||||||
if ( $hash->{DeviceName} =~
|
|
||||||
/^\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\b$/
|
|
||||||
);
|
|
||||||
|
|
||||||
my $ret = DevIo_OpenDev( $hash, 0, "ONKYO_AVR_DevInit" );
|
# connect using serial connection (old blocking style)
|
||||||
return $ret;
|
if ( $hash->{DeviceName} =~ m/^UNIX:(SEQPACKET|STREAM):(.*)$/
|
||||||
|
|| $hash->{DeviceName} =~ m/^FHEM:DEVIO:(.*)(:(.*))/ )
|
||||||
|
{
|
||||||
|
my $ret = DevIo_OpenDev( $hash, 0, "ONKYO_AVR_DevInit" );
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
# connect using TCP connection (non-blocking style)
|
||||||
|
else {
|
||||||
|
# add missing port if required
|
||||||
|
$hash->{DeviceName} = $hash->{DeviceName} . ":60128"
|
||||||
|
if ( $hash->{DeviceName} !~ m/^(.+):([0-9]+)$/ );
|
||||||
|
|
||||||
|
DevIo_OpenDev(
|
||||||
|
$hash, 0,
|
||||||
|
"ONKYO_AVR_DevInit",
|
||||||
|
sub() {
|
||||||
|
my ( $hash, $err ) = @_;
|
||||||
|
Log3 $name, 2, "ONKYO_AVR $name: $err" if ($err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user