mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-25 16:05:19 +00:00
00_MQTT2_CLIENT.pm/SERVER.pm: enable traffic display of binary data
git-svn-id: https://svn.fhem.de/fhem/trunk@27654 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3a3b9b1034
commit
b8e053a68f
@ -799,6 +799,8 @@ MQTT2_CLIENT_feedTheList($$$;$)
|
|||||||
my $fl = $server->{".feedList"};
|
my $fl = $server->{".feedList"};
|
||||||
if($fl) {
|
if($fl) {
|
||||||
my $now = gettimeofday();
|
my $now = gettimeofday();
|
||||||
|
my $informVal = $val; # Convert it to text for websocket
|
||||||
|
$informVal =~ s/([^ -~])/"(".ord($1).")"/ge;
|
||||||
my $ts = sprintf("%s.%03d", FmtTime($now), 1000*($now-int($now)));
|
my $ts = sprintf("%s.%03d", FmtTime($now), 1000*($now-int($now)));
|
||||||
foreach my $fwid (keys %{$fl}) {
|
foreach my $fwid (keys %{$fl}) {
|
||||||
my $cl = $FW_id2inform{$fwid};
|
my $cl = $FW_id2inform{$fwid};
|
||||||
@ -806,7 +808,8 @@ MQTT2_CLIENT_feedTheList($$$;$)
|
|||||||
delete($fl->{$fwid});
|
delete($fl->{$fwid});
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
FW_AsyncOutput($cl,"",toJSON([$ts,defined($cid)?"RCVD":"SENT",$tp,$val]));
|
FW_AsyncOutput($cl, "",
|
||||||
|
toJSON([$ts, defined($cid)?"RCVD":"SENT", $tp, $informVal]));
|
||||||
}
|
}
|
||||||
delete($server->{".feedList"}) if(!keys %{$fl});
|
delete($server->{".feedList"}) if(!keys %{$fl});
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,8 @@ MQTT2_SERVER_Read($@)
|
|||||||
}
|
}
|
||||||
$val = (length($pl)>$off ? substr($pl, $off) : "");
|
$val = (length($pl)>$off ? substr($pl, $off) : "");
|
||||||
if($unicodeEncoding) {
|
if($unicodeEncoding) {
|
||||||
if(!$shash->{binaryTopicRegexp} || $tp !~ m/^$shash->{binaryTopicRegexp}$/) {
|
if(!$shash->{binaryTopicRegexp} ||
|
||||||
|
$tp !~ m/^$shash->{binaryTopicRegexp}$/) {
|
||||||
$val = Encode::decode('UTF-8', $val);
|
$val = Encode::decode('UTF-8', $val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,13 +586,16 @@ MQTT2_SERVER_doPublish($$$$;$)
|
|||||||
my $fl = $server->{".feedList"};
|
my $fl = $server->{".feedList"};
|
||||||
if($fl) {
|
if($fl) {
|
||||||
my $ts = sprintf("%s.%03d", FmtTime($now), 1000*($now-int($now)));
|
my $ts = sprintf("%s.%03d", FmtTime($now), 1000*($now-int($now)));
|
||||||
|
my $informVal = $val; # Convert it to text for websocket
|
||||||
|
$informVal =~ s/([^ -~])/"(".ord($1).")"/ge;
|
||||||
foreach my $fwid (keys %{$fl}) {
|
foreach my $fwid (keys %{$fl}) {
|
||||||
my $cl = $FW_id2inform{$fwid};
|
my $cl = $FW_id2inform{$fwid};
|
||||||
if(!$cl || !$cl->{inform}{filter} || $cl->{inform}{filter} ne '^$') {
|
if(!$cl || !$cl->{inform}{filter} || $cl->{inform}{filter} ne '^$') {
|
||||||
delete($fl->{$fwid});
|
delete($fl->{$fwid});
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
FW_AsyncOutput($cl, "", toJSON([$ts,defined($cid)?$cid:"SENT",$tp,$val]));
|
FW_AsyncOutput($cl, "",
|
||||||
|
toJSON([$ts, defined($cid)?$cid:"SENT", $tp, $informVal]));
|
||||||
}
|
}
|
||||||
delete($server->{".feedList"}) if(!keys %{$fl});
|
delete($server->{".feedList"}) if(!keys %{$fl});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user