njh / mqtt-sn-tools

Command line tools written in C for the MQTT-SN (MQTT for Sensor Networks) protocol
MIT License
195 stars 84 forks source link

Bugfix: Use msg ID 0 for QoS levels < 1 #46

Closed vera closed 3 years ago

vera commented 3 years ago

mqtt-sn-pub used non-zero message IDs regardless of the QoS level, while the specification states:

MsgId: same meaning as the MQTT “Message ID”; only relevant in case of QoS levels 1 and 2, otherwise coded 0x0000.

(page 14)

njh commented 3 years ago

Thank you very much for this fix. And fantastic that you added tests too 😀