the code of obtain senor data and connect to MQTT

Dependencies:   C12832 EthernetInterface MMA7660 MQTT USBDevice mbed-rtos mbed

Fork of HelloMQTT by MQTT

Revision:
9:5beb8609e9f7
Parent:
8:a3e3113054a1
Child:
12:086a9314e8a5
diff -r a3e3113054a1 -r 5beb8609e9f7 main.cpp
--- 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);