The ARM mbed MQTT client library is used to send/receive data to/from AT&T's M2X service (https://m2x.att.com/) using the AT&T Cellular IoT Starter Kit which is sold by Avnet (http://cloudconnectkits.org/product/att-cellular-iot-starter-kit).
Dependencies: M2XMQTTClient WNCInterface mbed-rtos mbed minimal-json minimal-mqtt-JMF
Diff: main.cpp
- Revision:
- 2:e355d362a2d8
- Parent:
- 1:ceb54785e67c
- Child:
- 3:84f5cf6f2521
--- a/main.cpp Tue Sep 27 19:54:39 2016 +0000 +++ b/main.cpp Fri Oct 07 01:15:05 2016 +0000 @@ -43,35 +43,35 @@ double hval = 101.0; pc.baud(115200); - printf(CRLF CRLF "M2X MQTT Test starting..." CRLF); + pc.printf(CRLF CRLF "M2X MQTT Test starting..." CRLF); eth.init(NULL,&pc); eth.connect(); - printf("IP Address: %s" CRLF, eth.getIPAddress()); + pc.printf("IP Address: %s" CRLF, eth.getIPAddress()); eth.doDebug(0); while (true) { tval += 0.1; - printf("\r\n\r\nSending readings #%d\r\n",cnt++); + pc.printf("\r\n\r\nSending readings #%d\r\n",cnt++); response = m2xClient.updateStreamValue(deviceId, tstreamName, tval); - printf("Sending temperature value: %lf, Response= %d" CRLF, tval, response); + pc.printf("Sending temperature value: %lf, Response= %d" CRLF, tval, response); hval -= 1.0; - printf("Sending humidity value: %lf", hval); + pc.printf("Sending humidity value: %lf", hval); response = m2xClient.updateStreamValue(deviceId, hstreamName, hval); - printf(", Response= %d" CRLF, response); + pc.printf(", Response= %d" CRLF, response); - printf("Calling postDeviceUpdates..."); + pc.printf("Calling postDeviceUpdates..."); response = m2xClient.postDeviceUpdates(deviceId, streamNum, streamNames, counts, ats, values); - printf(" Response = %d" CRLF, response); - printf("Calling updateLocation..."); + pc.printf(" Response = %d" CRLF, response); + pc.printf("Calling updateLocation..."); response = m2xClient.updateLocation(deviceId, name, latitude, longitude, elevation); - printf(" Response = %d" CRLF, response); + pc.printf(" Response = %d" CRLF, response); elevation++; delay(6000);