mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
00_ZWCUL.pm: add explorer(?) frames, 00_ZWDongle: allow symbolic names in set/get (Forum #44905)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@10142 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a3512eecfe
commit
7ca3826d7d
@ -310,7 +310,6 @@ ZWCUL_Parse($$$$)
|
||||
($hF & 3)==3 ? " ack" : " unknownHeaderType:".($hF&0x3)).
|
||||
(($hF & 4) ? " explorer" : "").
|
||||
(($hF & 0x10)==0x10 ? " lowSpeed" : "").
|
||||
(($hF & 0x10)==0x10 ? " lowSpeed" : "").
|
||||
(($hF & 0x20)==0x20 ? " lowPower" : "").
|
||||
(($hF & 0x40)==0x40 ? " ackReq" : "").
|
||||
(($hF & 0x80)==0x80 ? " routed, rf:$rf hopCount:$hc, hops:$hops" : "");
|
||||
|
@ -41,13 +41,12 @@ my %gets = (
|
||||
"getVirtualNodes" => "a5", # ZW_GET_VIRTUAL_NODES
|
||||
"homeId" => "20", # MEMORY_GET_ID
|
||||
"isFailedNode" => "62%02x", # ZW_IS_FAILED_NODE
|
||||
"neighborList" => "80%0x", # GET_ROUTING_TABLE_LINE
|
||||
"neighborList" => "80%02x", # GET_ROUTING_TABLE_LINE
|
||||
"nodeInfo" => "41%02x", # ZW_GET_NODE_PROTOCOL_INFO
|
||||
"nodeList" => "02", # SERIAL_API_GET_INIT_DATA
|
||||
"random" => "1c%02x", # ZW_GET_RANDOM
|
||||
"version" => "15", # ZW_GET_VERSION
|
||||
"timeouts" => "06", # SERIAL_API_SET_TIMEOUTS
|
||||
|
||||
"raw" => "%s", # hex
|
||||
);
|
||||
|
||||
@ -158,6 +157,13 @@ ZWDongle_Set($@)
|
||||
return;
|
||||
}
|
||||
|
||||
if(($type eq "removeFailedNode" ||
|
||||
$type eq "replaceFailedNode" ||
|
||||
$type eq "sendNIF") &&
|
||||
$defs{$a[0]} && $defs{$a[0]}{nodeIdHex}) {
|
||||
$a[0] = hex($defs{$a[0]}{nodeIdHex});
|
||||
}
|
||||
|
||||
my $cmd = $sets{$type}{cmd};
|
||||
my $fb = substr($cmd, 0, 2);
|
||||
if($fb =~ m/^[0-8A-F]+$/i &&
|
||||
@ -196,7 +202,6 @@ ZWDongle_Set($@)
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
#####################################
|
||||
sub
|
||||
ZWDongle_Get($@)
|
||||
@ -234,6 +239,13 @@ ZWDongle_Get($@)
|
||||
|
||||
return "No $cmd for dummies" if(IsDummy($name));
|
||||
|
||||
if(($cmd eq "neighborList" ||
|
||||
$cmd eq "nodeInfo" ||
|
||||
$cmd eq "isFailedNode") &&
|
||||
$defs{$a[0]} && $defs{$a[0]}{nodeIdHex}) {
|
||||
$a[0] = hex($defs{$a[0]}{nodeIdHex});
|
||||
}
|
||||
|
||||
my $out = sprintf($gets{$cmd}, @a);
|
||||
ZWDongle_Write($hash, "", "00".$out);
|
||||
my $re = "^01".substr($out,0,2); # Start with <01><len><01><CMD>
|
||||
@ -245,18 +257,8 @@ ZWDongle_Get($@)
|
||||
my @r = map { ord($_) } split("", pack('H*', $ret)) if(defined($ret));
|
||||
|
||||
if($cmd eq "nodeList") { ############################
|
||||
return "$name: Bogus data received" if(int(@r) != 36);
|
||||
my @list;
|
||||
for my $byte (0..28) {
|
||||
my $bits = $r[5+$byte];
|
||||
for my $bit (0..7) {
|
||||
next if(!($bits & (1<<$bit)));
|
||||
my $idx = $byte*8+$bit+1;
|
||||
my @l = devspec2array(sprintf(".*:FILTER=nodeIdHex=%02x", $idx));
|
||||
push @list, ($l[0] && $defs{$l[0]} ? $l[0] : "UNKNOWN_$idx");
|
||||
}
|
||||
}
|
||||
$msg = join(" ", @list);
|
||||
$msg =~ s/^.{10}(.{58}).*/$1/;
|
||||
$msg = zwlib_parseNeighborList($hash, $msg);
|
||||
|
||||
} elsif($cmd eq "caps") { ############################
|
||||
$msg = sprintf("Vers:%d Rev:%d ", $r[2], $r[3]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user