working

Dependencies:   C027_Support IBMIoTClientCellularExample MQTT mbed

Fork of MQTT-GSM-GPS-CAN-SMS by Babu Alikapati

Revision:
16:a931c0a6d987
Parent:
15:7c3279ac3c52
Child:
17:b08722ede282
--- a/main.cpp	Thu Jul 02 08:19:04 2015 +0000
+++ b/main.cpp	Thu Jul 02 12:54:15 2015 +0000
@@ -31,7 +31,8 @@
 #include "rtos.h"
 
 // Update this to the next number *before* a commit
-#define __APP_SW_REVISION__ "10"
+#define __APP_SW_REVISION__ "11"
+#define BOARD_NAME "IoT u-blox"
 
 // Configuration values needed to connect to IBM IoT Cloud
 #define ORG "quickstart"             // For a registered connection, replace with your org
@@ -154,7 +155,7 @@
     switch (menuItem)
     {
         case 0:
-            lcd.printf("IBM IoT Cloud");
+            lcd.printf("IBM/u-blox IoT Cloud");
             lcd.locate(0,16);
             lcd.printf("Scroll with joystick");
             break;
@@ -215,7 +216,7 @@
 {
     lcd.cls();
     lcd.locate(0,0);        
-    lcd.printf("IBM IoT Cloud");
+    lcd.printf("IBM/u-blox IoT Cloud");
     lcd.locate(0,16);
     lcd.printf(message);
 }
@@ -307,7 +308,7 @@
             
     char buf[250];
     int l = 0;
-    l += sprintf(buf+l,"{\"d\":{\"myName\":\"IoT mbed\"");
+    l += sprintf(buf+l,"{\"d\":{\"myName\":\"%s\"", BOARD_NAME);
     if (shieldConnected) {
         l += sprintf(buf+l,",\"accelX\":%0.4f,\"accelY\":%0.4f,\"accelZ\":%0.4f", MMA.x(), MMA.y(), MMA.z());
         l += sprintf(buf+l,",\"temp\":%0.4f", sensor.temp());
@@ -407,6 +408,8 @@
         else if (*dev.meid) strncpy(id, dev.meid, sizeof(id)-1);
     }
     
+    LOG("IBM Quickstart: https://quickstart.internetofthings.ibmcloud.com/#/device/%s/sensor/\n", id);
+    
     attemptConnect(&client, &ipstack);
     
     if (!quickstartMode) 
@@ -449,7 +452,9 @@
                                 gps.getNmeaItem(6,buf,len,ch) &&
                                 gps.getNmeaItem(9,buf,len,elevation)) {
                                 //printf("GPS Location: %.5f %.5f %.1f %c\r\n", latitude, longitude, elevation, ch); 
-                                if ((ch == '1' || ch == '2' || ch == '6') && (latitude != lastLat) && (lastLon != longitude)) {
+                                if ((ch == '1' || ch == '2' || ch == '6') && 
+                                    (fabs(lastLat - latitude)  < 0.0000001) && 
+                                    (fabs(lastLon - longitude) < 0.0000001)) {
                                     publishGps(&client, &ipstack, latitude, longitude);
                                     lastLat = latitude;
                                     lastLon = longitude;