CUL_MAX: check for good cul firmware

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2417 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre
2013-01-03 14:03:01 +00:00
parent d029c60ffb
commit 3e3ccb7da2

View File

@@ -69,6 +69,7 @@ CUL_MAX_Define($$)
$hash->{retryCount} = 0;
$hash->{devices} = ();
AssignIoPort($hash);
CUL_MAX_Check($hash);
#This interface is shared with 00_MAXLAN.pm
$hash->{SendDeviceCmd} = \&CUL_MAX_SendDeviceCmd;
@@ -95,6 +96,24 @@ CUL_MAX_DisablePairmode($)
$hash->{pairmode} = 0;
}
sub
CUL_MAX_Check($@)
{
my ($hash) = @_;
return if(!defined($hash->{IODev}));
return if(!defined($hash->{IODev}{TYPE}));
return if($hash->{IODev}{TYPE} ne "CUL");
return if(!defined($hash->{IODev}{VERSION}));
my $version = $hash->{IODev}{VERSION};
#Looks like "V 1.49 CUL868"
$version =~ m/V (.*)\.(.*) CUL.*/;
my ($major_version,$minorversion) = ($1, $2);
if($major_version == 1 and $minorversion < 50) {
Log 2, "The current firmware of the CUL has known bugs with respect to MAX! support. Please update."
}
}
sub
CUL_MAX_Set($@)
{
@@ -234,12 +253,15 @@ CUL_MAX_SendAck($$$)
}
#All inputs are hex strings, $cmd is one from %msgCmd2Id
#This is deprecated as part of the MAX backend interface
sub
CUL_MAX_Send(@)
{
# $cmd is one of
my ($hash, $cmd, $dst, $payload, $flags, $groupId, $msgcnt) = @_;
CUL_MAX_Check($hash);
$flags = "00" if(!$flags);
$groupId = "00" if(!defined($groupId));
if(!defined($msgcnt)) {
@@ -313,6 +335,8 @@ CUL_MAX_SendDeviceCmd($$)
{
my ($hash,$payload) = @_;
CUL_MAX_Check($hash);
my $dstaddr = unpack("H6",substr($payload,6,3));
my $dhash = CUL_MAX_DeviceHash($dstaddr);