improve AES reject handling

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@3924 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-09-19 08:00:49 +00:00
parent d41426fa45
commit e065d80964
2 changed files with 18 additions and 15 deletions

View File

@ -368,6 +368,7 @@ sub HMLAN_Parse($$) {##########################################################
if ($HMcnd == 0x01){#HMLAN responded to AES request
# $CULinfo = "AESresp";# General needs approval
}
if ($stat){# message with status information
HMLAN_condUpdate($hash,$HMcnd)if ($hash->{helper}{q}{HMcndN} != $HMcnd);
@ -380,6 +381,7 @@ sub HMLAN_Parse($$) {##########################################################
return;
}elsif (($stat & 0x70) == 0x30){Log $ll5, "HMLAN_Parse: $name AES code rejected for $dst $stat";
$CULinfo = "AESerrReject";
HMLAN_qResp($hash,$src,0);
}elsif (($stat & 0x70) == 0x20){$CULinfo = "AESok";
}elsif (($stat & 0x70) == 0x40){;#$CULinfo = "???";
}

View File

@ -489,20 +489,14 @@ sub CUL_HM_Parse($$) {##############################
my ($len,$mNo,$mFlg,$mTp,$src,$dst,$p) = ($1,$2,$3,$4,$5,$6,$7);
$p = "" if(!defined($p));
my @mI = unpack '(A2)*',$p; # split message info to bytes
if ($msgStat){
return "" if($msgStat eq 'NACK');#discard if lowlevel error
}
return "" if($src eq $id);#discard mirrored messages
return "" if( ($msgStat && $msgStat eq 'NACK')# lowlevel error
||($src eq $id)); # mirrored messages
# $shash will be replaced for multichannel commands
my $shash = $modules{CUL_HM}{defptr}{$src};
my $dhash = $modules{CUL_HM}{defptr}{$dst};
if ($msgStat){
$shash->{"protEvt_$msgStat"} = 0 if (!$shash->{"protEvt_$msgStat"});
$shash->{"protEvt_$msgStat"}++;
}
$respRemoved = 0; #set to 'no response in this message' at start
if(!$shash) { # Unknown source
# Generate an UNKNOWN event for pairing requests, ignore everything else
@ -518,6 +512,7 @@ sub CUL_HM_Parse($$) {##############################
}
return "";
}
CUL_HM_eventP($shash,"Evt_$msgStat")if ($msgStat);#log io-events
CUL_HM_eventP($shash,"Rcv");
my $name = $shash->{NAME};
my $dname = ($dst eq "000000") ? "broadcast" :
@ -1534,7 +1529,7 @@ sub CUL_HM_parseCommon(@){#####################################################
my $reply;
my $success;
if ($subType =~ m/^8/){ #NACK
if ($subType =~ m/^8/){#NACK
$success = "no";
CUL_HM_eventP($shash,"Nack");
$reply = "NACK";
@ -1559,13 +1554,19 @@ sub CUL_HM_parseCommon(@){#####################################################
}
}
}
elsif($subType eq "04"){ #ACK-AES, interim########
#$success = ""; #result not final, another response should come
$reply = "done";
}
else{ #ACK
$success = "yes";
$reply = "ACK";
}
if($success){#do we have a final ack?
readingsSingleUpdate($chnhash,"CommandAccepted",$success,0);
CUL_HM_ProcessCmdStack($shash)
if($dhash->{DEF} && (CUL_HM_IOid($shash) eq $dhash->{DEF}));
}
$ret = $reply;
}
elsif($mTp eq "00"){######################################
@ -3273,7 +3274,7 @@ sub CUL_HM_eventP($$) {#handle protocol events
my ($evntCnt,undef) = split(' last_at:',$evnt);
$nAttr->{"prot".$evntType} = ++$evntCnt." last_at:".TimeNow();
if ($evntType ne "Snd"){#count unusual events
if ($evntType !~ m/(Snd|Evt_AESok)/){#count abnormal events
$hash->{helper}{burstEvtCnt}=0 if(!defined $hash->{helper}{burstEvtCnt});
$hash->{helper}{burstEvtCnt}++;
}