2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

10_ZWave.pm: Some reformatting/simplifying

git-svn-id: https://svn.fhem.de/fhem/trunk@11660 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-06-13 19:26:33 +00:00
parent 5cf6e2449a
commit d4499ca15a

View File

@ -766,18 +766,13 @@ ZWave_Cmd($$@)
my $isMc = ($id =~ m/(....)/); my $isMc = ($id =~ m/(....)/);
if(!$isMc) { if(!$isMc) {
if($type eq "set") { if($type eq "set") {
$cmdList{neighborUpdate}{fmt} = "48$id"; $cmdList{neighborUpdate} = { fmt=>"48$id", id=>"" };
$cmdList{neighborUpdate}{id} = ""; $cmdList{returnRouteAdd} = { fmt=>"46$id%02x", id=>"" };
$cmdList{returnRouteAdd}{fmt} = "46$id%02x"; $cmdList{returnRouteDel} = { fmt=>"47$id", id=>"" };
$cmdList{returnRouteAdd}{id} = "";
$cmdList{returnRouteDel}{fmt} = "47$id";
$cmdList{returnRouteDel}{id} = "";
my $iohash = $hash->{IODev}; my $iohash = $hash->{IODev};
if($iohash && ReadingsVal($iohash->{NAME}, "sucNodeId","no") ne "no") { if($iohash && ReadingsVal($iohash->{NAME}, "sucNodeId","no") ne "no") {
$cmdList{sucRouteAdd}{fmt} = "51$id"; $cmdList{sucRouteAdd} = { fmt=>"51$id", id=>"" };
$cmdList{sucRouteAdd}{id} = ""; $cmdList{sucRouteDel} = { fmt=>"55$id", id=>"" };
$cmdList{sucRouteDel}{fmt} = "55$id";
$cmdList{sucRouteDel}{id} = "";
} }
} }
$cmdList{neighborList}{fmt} = "x" if($type eq "get"); # Add meta command $cmdList{neighborList}{fmt} = "x" if($type eq "get"); # Add meta command
@ -885,11 +880,7 @@ ZWave_Cmd($$@)
} }
my $data; my $data;
if($cmd eq "neighborUpdate" || if(!$cmdId) {
$cmd eq "returnRouteAdd" ||
$cmd eq "returnRouteDel" ||
$cmd eq "sucRouteAdd" ||
$cmd eq "sucRouteDel" ) {
$data = $cmdFmt; $data = $cmdFmt;
$data .= ZWave_callbackId($baseHash); $data .= ZWave_callbackId($baseHash);
@ -931,11 +922,7 @@ ZWave_Cmd($$@)
return (AttrVal($name,"verbose",3) > 2 ? $r : undef) if($r); return (AttrVal($name,"verbose",3) > 2 ? $r : undef) if($r);
if($type ne "get") { if($type ne "get") {
if($cmd eq "neighborUpdate" || if(!$cmdId) {
$cmd eq "returnRouteAdd" ||
$cmd eq "returnRouteDel" ||
$cmd eq "sucRouteAdd" ||
$cmd eq "sucRouteDel" ) {
ZWave_processSendStack($baseHash, "next"); ZWave_processSendStack($baseHash, "next");
} }
$cmd .= " ".join(" ", @a) if(@a); $cmd .= " ".join(" ", @a) if(@a);
@ -3626,6 +3613,7 @@ ZWave_processSendStack($$;$)
if($ackType eq "ack" && $hash->{lastMsgSent}); if($ackType eq "ack" && $hash->{lastMsgSent});
return; return;
} }
#Log 1, "pSS: $hash->{NAME}, $ackType $ss->[0]";
if($ackType eq "retry") { if($ackType eq "retry") {
$ss->[0] =~ m/^(.*)(set|get):(.*)$/; $ss->[0] =~ m/^(.*)(set|get):(.*)$/;
@ -3691,6 +3679,7 @@ ZWave_addToSendStack($$$)
} }
my $ss = $hash->{SendStack}; my $ss = $hash->{SendStack};
push @{$ss}, "$type:$cmd"; push @{$ss}, "$type:$cmd";
#Log 1, "aTSS: $hash->{NAME}, $type, $cmd / L:".int(@{$ss});
if(ZWave_isWakeUp($hash)) { if(ZWave_isWakeUp($hash)) {
# SECURITY XXX # SECURITY XXX
@ -4154,7 +4143,7 @@ ZWave_Parse($$@)
if(AttrVal($name, "eventForRaw", undef)); if(AttrVal($name, "eventForRaw", undef));
readingsEndUpdate($hash, 1); readingsEndUpdate($hash, 1);
if($hash->{asyncGet} && $msg =~ m/$hash->{asyncGet}->{re}/) { if($hash->{asyncGet} && $msg =~ m/$hash->{asyncGet}{re}/) {
RemoveInternalTimer($hash->{asyncGet}); RemoveInternalTimer($hash->{asyncGet});
asyncOutput($hash->{asyncGet}{CL}, join("\n", @event)); asyncOutput($hash->{asyncGet}{CL}, join("\n", @event));
delete($hash->{asyncGet}); delete($hash->{asyncGet});