mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 11:01:59 +00:00
OWMULTI: execute get-functions synchronous in async mode
git-svn-id: https://svn.fhem.de/fhem/trunk@5404 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bd44de273b
commit
cf195d8004
@ -70,7 +70,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
sub Log($$);
|
sub Log($$);
|
||||||
|
|
||||||
my $owx_version="5.11";
|
my $owx_version="5.12";
|
||||||
#-- flexible channel name
|
#-- flexible channel name
|
||||||
my $owg_channel;
|
my $owg_channel;
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ sub OWMULTI_Get($@) {
|
|||||||
#-- OWX interface
|
#-- OWX interface
|
||||||
if( $interface =~ /^OWX/ ){
|
if( $interface =~ /^OWX/ ){
|
||||||
#-- not different from getting all values ..
|
#-- not different from getting all values ..
|
||||||
$ret = OWXMULTI_GetValues($hash);
|
$ret = OWXMULTI_GetValues($hash,1);
|
||||||
#ASYNC: Need to wait for some return
|
#ASYNC: Need to wait for some return
|
||||||
#-- OWFS interface not yet implemented
|
#-- OWFS interface not yet implemented
|
||||||
}elsif( $interface eq "OWServer" ){
|
}elsif( $interface eq "OWServer" ){
|
||||||
@ -820,9 +820,9 @@ sub OWXMULTI_BinValues($$$$$$$$) {
|
|||||||
#
|
#
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
||||||
sub OWXMULTI_GetValues($$) {
|
sub OWXMULTI_GetValues($@) {
|
||||||
|
|
||||||
my ($hash,$final) = @_;
|
my ($hash,$sync) = @_;
|
||||||
|
|
||||||
my ($i,$j,$k,$res,$res2);
|
my ($i,$j,$k,$res,$res2);
|
||||||
|
|
||||||
@ -999,9 +999,10 @@ sub OWXMULTI_GetValues($$) {
|
|||||||
#-- NOW ask the specific device
|
#-- NOW ask the specific device
|
||||||
#-- issue the match ROM command \x55 and the read scratchpad command \xBE
|
#-- issue the match ROM command \x55 and the read scratchpad command \xBE
|
||||||
#-- reading 9 + 2 + 9 data bytes = 20 bytes
|
#-- reading 9 + 2 + 9 data bytes = 20 bytes
|
||||||
|
my $context = "ds2438.getvad";
|
||||||
#-- asynchronous mode
|
#-- asynchronous mode
|
||||||
if( $hash->{ASYNC} ){
|
if( $hash->{ASYNC} ){
|
||||||
if (!OWX_Execute( $master, "ds2438.getvad", 1, $owx_dev, "\xBE\x00", 9, undef )) {
|
if (!OWX_Execute( $master, $context, 1, $owx_dev, "\xBE\x00", 9, undef ) or ($sync and !OWX_AwaitExecuteResponse($master,$context,$owx_dev))) {
|
||||||
return "$owx_dev not accessible in 2nd step";
|
return "$owx_dev not accessible in 2nd step";
|
||||||
}
|
}
|
||||||
#-- synchronous mode
|
#-- synchronous mode
|
||||||
@ -1013,7 +1014,7 @@ sub OWXMULTI_GetValues($$) {
|
|||||||
if( $res eq 0 );
|
if( $res eq 0 );
|
||||||
return "$owx_dev has returned invalid data"
|
return "$owx_dev has returned invalid data"
|
||||||
if( length($res)!=20);
|
if( length($res)!=20);
|
||||||
OWXMULTI_BinValues($hash,"ds2438.getvad",1,undef,$owx_dev,undef,undef,substr($res,11));
|
OWXMULTI_BinValues($hash,$context,1,undef,$owx_dev,undef,undef,substr($res,11));
|
||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user