S3ler / arduino-mqtt-sn-client

Arduino based MQTT-SN Client
MIT License
14 stars 8 forks source link

Cannot publish because incorrect flag topic id type #3

Open nottledim opened 5 years ago

nottledim commented 5 years ago

Having trouble with your example WiFiUdpMqttSnClient program in that it does not successfully publish the test messages. I'm using paho-mqtt-sn gateway.

I'm bashing around in the dark a bit but I think this is because it publishes the messages with the flag TopicIdType set to 2. I think it should be zero (normal) because it's not pre-registered nor is it a short topic.

In file MqttSnClient.h line 216 the call to send_publish has short_topic set to true. But that's not all; in file mqttsn_messages.h around line 215 if short_topic flag is false it sets the flag to predefined.
I've removed the latter 'else' clause so the flag is set to zero and I can now publish successfully.

I suspect my hack is not a complete solution but I hope it helps you resolve this issue.

kevin0598 commented 4 years ago

Hi Sir,

What should i change so i can publish? right now i can only subscribe but i can't publish