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,

qos1pub works because that is using a short topic name.

qos-1pub works because that is using an extension to the MQTT-SN specification that was requested by Dave Conway-Jones. I'd forgotten that we hadn't updated or suggested an alteration to, the spec. Because a qos -1 publish does not entail a connection to the broker, it seems really useful to have some way of encoding a long topic name. I should add this as a possible update to the spec.

qos0pub doesn't work because I copied qos-1pub which used the qos -1 long topic name method. This sample needs updating to work like qos1pub.

I hope that makes things clearer!

Ian

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.

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.
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev



Back to the top