2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

66_ECMD: requestSeparator can be turned off

git-svn-id: https://svn.fhem.de/fhem/trunk@9361 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2015-10-03 17:00:29 +00:00
parent c7c5325164
commit c2fe6eb60e
2 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- feature: 66_ECMD: requestSeparator can be turned off
- feature: 02_RSS: viewport configurable by attribute - feature: 02_RSS: viewport configurable by attribute
- change: 93_DbLog: removed use of perl's 'switch' feature. - change: 93_DbLog: removed use of perl's 'switch' feature.
- change: 93_DbLog: removed string length limitation for SQLITE. - change: 93_DbLog: removed string length limitation for SQLITE.

View File

@ -84,6 +84,8 @@ ECMD_Define($$)
return $msg; return $msg;
} }
$attr{$name}{"requestSeparator"}= "\000";
DevIo_CloseDev($hash); DevIo_CloseDev($hash);
$hash->{Protocol}= $protocol; $hash->{Protocol}= $protocol;
@ -550,9 +552,14 @@ ECMD_Write($$$)
my $name= $hash->{NAME}; my $name= $hash->{NAME};
my $answer; my $answer;
my $ret= ""; my $ret= "";
my $requestSeparator= AttrVal($hash, "requestSeparator", "\000"); my $requestSeparator= AttrVal($hash, "requestSeparator", undef);
my $responseSeparator= AttrVal($hash, "responseSeparator", ""); my $responseSeparator= AttrVal($hash, "responseSeparator", "");
my @ecmds= split $requestSeparator, $msg; my @ecmds;
if(defined($requestSeparator)) {
@ecmds= split $requestSeparator, $msg;
} else {
push @ecmds, $msg;
}
ECMD_Log $hash, 5, "command split into " . ($#ecmds+1) . " parts." if($#ecmds>0); ECMD_Log $hash, 5, "command split into " . ($#ecmds+1) . " parts." if($#ecmds>0);
foreach my $ecmd (@ecmds) { foreach my $ecmd (@ecmds) {
ECMD_Log $hash, 5, "sending command " . dq($ecmd); ECMD_Log $hash, 5, "sending command " . dq($ecmd);
@ -691,8 +698,9 @@ ECMD_Write($$$)
<li>requestSeparator<br> <li>requestSeparator<br>
A single request from FHEM to the device might need to be split in several datagrams. A command string is split at all A single request from FHEM to the device might need to be split in several datagrams. A command string is split at all
occurrences of the requestSeparator. The requestSeparator itself is removed from the command string and thus occurrences of the requestSeparator. The requestSeparator itself is removed from the command string and thus
not part of the request. It defaults to the not part of the request.
value \000 (octal representation of control char with code zero). This attribute is set by default. It defaults to the value \000 (octal representation of control char with code zero).
To disable this feature, delete the attribute from the device's attribute list.
</li> </li>
<li>responseSeparator<br> <li>responseSeparator<br>
In order to identify the single responses from the device to FHEM for each part of a split command, a responseSeparator In order to identify the single responses from the device to FHEM for each part of a split command, a responseSeparator