2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

OWX_ASYNC: add attribute 'timeout' (for synchronous gets)

git-svn-id: https://svn.fhem.de/fhem/trunk@5399 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-04-01 13:13:55 +00:00
parent eb71896959
commit ca193cd9f7

View File

@ -256,7 +256,7 @@ sub OWX_ASYNC_Disconnect($) {
if (defined $async) {
$async->exit($hash);
};
my $times = AttrVal($hash,"timeout",5000) / 50; #timeout in ms, defaults to 1 sec?
my $times = AttrVal($hash->{NAME},"timeout",5000) / 50; #timeout in ms, defaults to 1 sec?
for (my $i=0;$i<$times;$i++) {
OWX_ASYNC_Poll($hash);
if ($hash->{STATE} ne "Active") {
@ -327,7 +327,7 @@ sub OWX_ASYNC_AwaitAlarmsResponse($) {
#-- get the interface
my $async = $hash->{ASYNC};
if (defined $async) {
my $times = AttrVal($hash,"timeout",5000) / 50; #timeout in ms, defaults to 1 sec #TODO add attribute timeout?
my $times = AttrVal($hash->{NAME},"timeout",5000) / 50; #timeout in ms, defaults to 1 sec #TODO add attribute timeout?
for (my $i=0;$i<$times;$i++) {
if(! defined $hash->{ALARMDEVS} ) {
select (undef,undef,undef,0.05);
@ -490,7 +490,7 @@ sub OWX_ASYNC_AwaitSearchResponse($) {
#-- Discover all devices on the 1-Wire bus, they will be found in $hash->{DEVS}
if (defined $async) {
my $times = AttrVal($hash,"timeout",5000) / 50; #timeout in ms, defaults to 1 sec #TODO add attribute timeout?
my $times = AttrVal($hash->{NAME},"timeout",5000) / 50; #timeout in ms, defaults to 1 sec #TODO add attribute timeout?
for (my $i=0;$i<$times;$i++) {
if(! defined $hash->{DEVS} ) {
select (undef,undef,undef,0.05);
@ -849,7 +849,7 @@ sub OWX_ASYNC_Set($@) {
}
Log3 ($name,3, "OWX_ASYNC_Set $name ".join(" ",@a)." => $res");
DoTrigger($name, undef) if($init_done);
DoTrigger($name, undef) if($main::init_done);
return "OWX_ASYNC_Set => $name ".join(" ",@a)." => $res";
}
@ -943,7 +943,7 @@ sub OWX_AwaitExecuteResponse($$$) {
#-- Discover all devices on the 1-Wire bus, they will be found in $hash->{DEVS}
if (defined $async and defined $owx_dev and defined $context) {
my $times = AttrVal($hash,"timeout",5000) / 50; #timeout in ms, defaults to 1 sec
my $times = AttrVal($hash->{NAME},"timeout",5000) / 50; #timeout in ms, defaults to 1 sec
for (my $i=0;$i<$times;$i++) {
if(! defined $hash->{replies}{$owx_dev}{$context}) {
select (undef,undef,undef,0.05);