port to cellular
Dependencies: C027_Support LM75B M2XStreamClient jsonlite mbed mbed-rtos
Fork of m2x-demo-all by
Diff: main.cpp
- Revision:
- 8:7ca1b7a712b7
- Parent:
- 7:10d3cc37fe4c
- Child:
- 9:08fdd1036e93
--- a/main.cpp Fri Jun 06 15:20:44 2014 +0000 +++ b/main.cpp Sun Sep 07 01:34:16 2014 +0000 @@ -24,7 +24,6 @@ char feedId[] = "81b9fcc5a8585c55ae622488f50d8de0"; // Feed you want to post to char m2xKey[] = "1e1133cd475954868602c0f7503d4f22"; // Your M2X access key -char streamName[] = "amb_temp"; // Stream you want to post to char name[] = "<location name>"; // Name of current location of datasource double latitude = 33.007872; @@ -57,7 +56,7 @@ int main() { MDMSerial mdm; GPSI2C gps; - //mdm.setDebug(4); // enable this for debugging issues + mdm.setDebug(4); // enable this for debugging issues if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD)) return -1; @@ -85,21 +84,22 @@ } } - if (tmr.read_ms() > 60000) { + if (tmr.read_ms() > 10000) { tmr.reset(); tmr.start(); - - // read temp - sprintf(buf, "%0.2f", tmp.read()); + int response; - // post temperature - int response = m2xClient.post(feedId, streamName, buf); - printf("Post response code: %d\r\n", response); - if (response == -1) while (true) ; + MDMParser::NetStatus status; + if (mdm.checkNetStatus(&status)) { + sprintf(buf, "%d", status.rssi); + response = m2xClient.post(feedId, "rssi", buf); + printf("Post response code: %d\r\n", response); + if (response == -1) while (true) ; + } //#define READING #ifdef READING // read temperature - response = m2xClient.fetchValues(feedId, streamName, on_data_point_found, NULL); + response = m2xClient.fetchValues(feedId, "rssi", on_data_point_found, NULL); printf("Fetch response code: %d\r\n", response); if (response == -1) while (true) ; #endif