Simple demo with GPIO MQTT protocol test on STM32 broker tests.mosquitto.org WIFI interface ESP8266 Issue of topic0 by pressing the button If reception of ', switching of the led If received from 'q' end of program

Dependencies:   MQTT

This is a MQTT protocol test on STM32 NUCLEO The broker is tests.mosquitto.org The WIFI interface is ESP8266

For configuration please check mbed_app.json and #define in main.cpp

Issue of topic0 by pressing the button If received 'l' from broker then switching of the led If received 'q' from broker then end the program

Information and debug with a terminal using UART over USB https://os.mbed.com/media/uploads/cdupaty/mqtt2.jpg

This test has been checked with MQTT.fx https://os.mbed.com/media/uploads/cdupaty/mqttfx.jpg

Revision:
9:5beb8609e9f7
Parent:
8:a3e3113054a1
Child:
12:086a9314e8a5
--- a/main.cpp	Tue May 20 15:08:05 2014 +0000
+++ b/main.cpp	Thu May 22 23:58:34 2014 +0000
@@ -34,21 +34,22 @@
 int arrivedcount = 0;
 
 
-void messageArrived(MQTT::Message* message)
+void messageArrived(MQTT::MessageData& md)
 {
+    MQTT::Message &message = md.message;
     lcd.cls();
     lcd.locate(0,3);
-    printf("Message arrived: qos %d, retained %d, dup %d, packetid %d\n", message->qos, message->retained, message->dup, message->id);
-    printf("Payload %.*s\n", message->payloadlen, (char*)message->payload);
+    printf("Message arrived: qos %d, retained %d, dup %d, packetid %d\n", message.qos, message.retained, message.dup, message.id);
+    printf("Payload %.*s\n", message.payloadlen, (char*)message.payload);
     ++arrivedcount;
-    lcd.puts((char*)message->payload);
+    lcd.puts((char*)message.payload);
 }
 
 
 int main(int argc, char* argv[])
 {   
     MQTTEthernet ipstack = MQTTEthernet();
-    float version = 0.46;
+    float version = 0.47;
     char* topic = "mbed-sample";
     
     lcd.printf("Version is %f\n", version);