简体   繁体   English

如何显示二进制 MQTT 数据?

[英]How to display binary MQTT data?

I am using the Mosquitto command mosquitto_sub to display data from an MQTT server:我正在使用 Mosquitto 命令mosquitto_sub显示来自 MQTT 服务器的数据:

mosquitto_sub -t "#" -v

The messages I want to display contains binary data, which Mosquitto tries to display as text.我要显示的消息包含二进制数据,Mosquitto 试图将其显示为文本。

Is there any way to display the MQTT messages in a better way for binary data?有什么方法可以更好地显示二进制数据的 MQTT 消息? For example as the hex-values of the bytes?例如作为字节的十六进制值?

The mosquitto_sub man page has a section called "Output format" which covers this. mosquitto_sub手册有一个名为“输出格式”的部分涵盖了这一点。

You can use the -F option to specify a formatting string.您可以使用-F选项指定格式字符串。

eg例如

mosquitto_sub -v -t '#' -F %X

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM