Check for identical first two bytes

git-svn-id: https://svn.fhem.de/fhem/trunk@785 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2010-12-28 16:46:32 +00:00
parent b632ca2b65
commit 8eca47b0dc
2 changed files with 16 additions and 2 deletions

View File

@ -111,6 +111,21 @@ CUL_Define($$)
my $dev = $a[2]; my $dev = $a[2];
return "FHTID must be H1H2, with H1 and H2 hex and both smaller than 64" return "FHTID must be H1H2, with H1 and H2 hex and both smaller than 64"
if(uc($a[3]) !~ m/^[0-6][0-9A-F][0-6][0-9A-F]$/); if(uc($a[3]) !~ m/^[0-6][0-9A-F][0-6][0-9A-F]$/);
if(uc($a[3]) =~ m/^([0-6][0-9A-F])/ && $1 ne "00") {
my $x = $1;
foreach my $d (keys %defs) {
next if($d eq $name);
if($defs{$d}{TYPE} eq "CUL") {
if(uc($defs{$d}{FHTID}) =~ m/^$x/) {
my $m = "$name: Cannot define multiple CULs with identical ".
"first two digits ($x)";
Log 1, $m;
return $m;
}
}
}
}
$hash->{FHTID} = uc($a[3]); $hash->{FHTID} = uc($a[3]);
$hash->{initString} = "X21"; $hash->{initString} = "X21";
$hash->{Clients} = $clientsSlowRF; $hash->{Clients} = $clientsSlowRF;
@ -911,9 +926,9 @@ CUL_SimpleWrite(@)
# Prefix $msg with RRBBU and return the corresponding CUL hash. # Prefix $msg with RRBBU and return the corresponding CUL hash.
($hash, $msg) = CUL_RFR_AddPrefix($hash, $msg); ($hash, $msg) = CUL_RFR_AddPrefix($hash, $msg);
} }
Log 1, "SW: $msg";
$msg .= "\n" unless($nonl); $msg .= "\n" unless($nonl);
#Log 1, "SW: $msg";
$hash->{USBDev}->write($msg . "\n") if($hash->{USBDev}); $hash->{USBDev}->write($msg . "\n") if($hash->{USBDev});
syswrite($hash->{TCPDev}, $msg) if($hash->{TCPDev}); syswrite($hash->{TCPDev}, $msg) if($hash->{TCPDev});

View File

@ -1,5 +1,4 @@
FHEM: FHEM:
- Avoid same firstbyte CUL id for multi-CUL
- HomeMatic signing - HomeMatic signing
- autocreate for HomeMatic - autocreate for HomeMatic
- autodetect physical hardware - autodetect physical hardware