Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] mqtt-sn.embedded-c/samples

Hi Sergio,

thanks for your comments. I'll take a look at this tomorrow - the samples need working on and I intend to add some more when I get the time.

What I will say is that I find the MQTT-SN topic type settings confusing even now, and I wouldn't be suprised if the samples aren't correct! For a long time, RSMB was not implementing topic types correctly, until I was chatting to Andy Stanford-Clark one day, and I realized I had misunderstood the intent of the specification. I'm pretty sure that RSMB itself is correct in its behaviour now.


On 12/08/14 17:32, Sergio R. Caprile wrote:
Hi guys, yesterday I rushed to run the samples for mqtt-sn.embedded-c,
and spent some time figuring out why one of them didn't work for me...
here is what I've found so far.

My setup is RSMB from git head bridging to Mosquitto 1.3.4, configured
to forward every topic both ways as a MQTT-SN Gateway.


         char *topicname = "a long topic name";
         topic.type = MQTTSN_TOPIC_TYPE_NORMAL; = topicname; = strlen(topicname);
         len = MQTTSNSerialize_publish(buf, buflen, dup, qos, retained,
               packetid, topic, payload, payloadlen);

however, NORMAL topics are not copied by MQTTSNSerialize_publish() for
QoS types other than -1; so the topic name is not actually sent, but its
topicid is.
As I read the MQTT-SN_spec_v1.2 in section 6.8, "PUBLISH with QoS Level -1":
"TopicIdType flag: either “0b01” for pre-defined topic id or “0b10” for
short topic name;"
So, if my understanding is correct, then src/MQTTSNSerializePublish.c
should do exactly the opposite

This one works with RSMB, however, it is sending a NORMAL topic type,
and, as above, it shouldn't.
So, I'm glad it works, but isnt it violating the specs ? (I know it is
my call whether to do it or not, I just want to know if my understanding
is correct)

I can help with the fixes providing I'm in the right path here.
paho-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top