1

I am trying to publish binary data via sim868 MQTT but facing issues in case of some binary values. For example, When I want to publish the binary number 0 (0x00), then if I send 0x00 to sim868 through the AT command it interprets it as 0 (NULL Character) and assumes it as the end of a string. So, it publish the data before 0x00 to MQTT, but I am required to also publish 0x00.

Iam using AT command AT+SMPUB=topic,qos,retain,message mentioned in sim800 series MQTT App Note.

As there is not any parameter of the data length in this command, so its not possible to send data length via AT command.

For example, When I try to send this message in the above mentioned AT command to sim868.

msg[]={0x48,0x00,0x01,0x02,0x4F}

It only publish the first byte, seems like it interpret the 2nd byte as NULL character (end of the string).

So, I want to know how to publish 0x00 via sim868 MQTT, So that sim868 interprets it as binary 0, instead of a NULL Character.

1 Answers1

0

Try adding \ before 0x00. Using \ should treat that as a escape character. Hope that works.

AT+SMPUB="mytopic/data/pub",1,0,"{0x48,\0x00,0x01,0x02,0x4F}"