mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 06:48:43 +00:00
DevIo.pm: SimpleWrite ishex parameter ist now three state:
0=binary, 1=hex, 2=ascii (Forum #50348) git-svn-id: https://svn.fhem.de/fhem/trunk@11020 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9d8b18d994
commit
03c0e7cbf0
@ -111,13 +111,13 @@ DevIo_TimeoutRead($$)
|
|||||||
sub
|
sub
|
||||||
DevIo_SimpleWrite($$$)
|
DevIo_SimpleWrite($$$)
|
||||||
{
|
{
|
||||||
my ($hash, $msg, $ishex) = @_;
|
my ($hash, $msg, $type) = @_; # Type: 0:binary, 1:hex, 2:ASCII
|
||||||
return if(!$hash);
|
return if(!$hash);
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
Log3 ($name, 5, $ishex ? "SW: $msg" : "SW: ".unpack("H*",$msg));
|
Log3 ($name, 5, $type ? "SW: $msg" : "SW: ".unpack("H*",$msg));
|
||||||
|
|
||||||
$msg = pack('H*', $msg) if($ishex);
|
$msg = pack('H*', $msg) if($type && $type == 1);
|
||||||
if($hash->{USBDev}){
|
if($hash->{USBDev}){
|
||||||
$hash->{USBDev}->write($msg);
|
$hash->{USBDev}->write($msg);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user