Skip to main content

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

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.

qos0pub.c:

        char *topicname = "a long topic name";
	[...]
        topic.type = MQTTSN_TOPIC_TYPE_NORMAL;
        topic.data.long_.name = topicname;
        topic.data.long_.len = 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

qos-1pub.c:
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.
Regards.


Back to the top