This post is going to be short as I've already typed it once and then lost it before I pressed send so this time I'm going to post and the edit and re-post until its done!
For info on MQTT - see
I tried making this project as an exercise in seeing if it could be done in GP and I suceeded :)
I had to access some of the primitive GP blocks that haven't been exposed (mainly socket and binary data functions) by delving thru the runtime/lib .gp files but I managed to do it (and learnt a LOT in the process)
The icing on the cake came when JM explained the extension mechanism to me and so here is my first GP extension
To Do
Allow choosing of client name (currently its timervalue + random num)
Allow for non-clean sessions
Allow choosing of retained messages
Get QoS 2 to work
Handle large (and non-alphanumeric) messages
implement username/passwords
Installation
Download the attachment
Right-click on stage area and select "load extension" and load this download from wherever you've saved it
You should now see a new MQTT category below My Blocks
Usage
Presently the extension only handles simple QoS 0 and 1 traffic and the messages must be alphanumeric
MQTTConnection connects to a broker (I run a test one at cycy42.ddns.net for testing that you are free to test with)
MQTT Subscribe lets you set up subscriptions to topics
MQTTPublish lets you publish messages to topics
MQTTMessages reports a dictionary of topics and their messages that you are subscribed to
To get just a single topic value from it - click on black arrow and set topic that way
MQTTDisplayInfo (true/false) lets the extension say MQTT info messages - I use it for debugging and seeing if everything is work OK
I attached an example usage program that uses the extension
Any feedback appreciated
[extension]MQTT
Moderator: MSandro
[extension]MQTT
- Attachments
-
- MQTTPub29QoS1Pub.gpp
- (21.79 KiB) Downloaded 467 times
-
- CheerlightsDemo.gpp
- (24.25 KiB) Downloaded 411 times