Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Revision:
55:a0f7295ed6b6
Parent:
52:8f1370084268
Child:
58:4cc0ae5a7058
--- a/main.cpp	Wed Sep 03 14:36:55 2014 +0000
+++ b/main.cpp	Thu Oct 23 12:50:07 2014 +0000
@@ -4,7 +4,6 @@
 #include "GPS.h"
 #include "DeviceInfo.h"
 #include "MbedAgent.h"
-#include "apndb.h"
 #include "GPSTracker.h"
 
 /**
@@ -24,9 +23,8 @@
     MDMParser::DevStatus devStatus;
     int res;
     uint8_t status = 0;
-    apndb_t *apn;
 
-    MDMSerial mdm;
+    MDMRtos<MDMSerial> mdm;
     GPSI2C gps;
 
     if (!mdm.init(SIM_PIN, &devStatus))
@@ -38,7 +36,7 @@
 
     switch (status) {
     case 1:
-        io.lcdPrint("MODEM INIT FAILURE", "REMOVE SIM PIN");
+        io.lcdPrint("MODEM INIT FAILURE", "CHECK SIM");
         break;
     case 2:
         io.lcdPrint("GPS INIT FAILURE");
@@ -63,33 +61,22 @@
         return 0;
     }*/
 
-    io.lcdPrint("IMEI", devStatus.imei);
+    io.lcdPrint("REGISTER NETWORK", "IMEI", devStatus.imei);
 
-#ifndef SIM_APN
-    apn = apndb_get(devStatus.imsi);
-    if (apn == NULL) {
-        io.lcdPrint("NO CARRIER FOUND", "CHECK IMSI", devStatus.imsi);
-        goto error;
-    }
-#endif
-    
     if (!mdm.registerNet()) {
         io.lcdPrint("NETWORK REG ERROR");
         goto error;
     }
 
+    io.lcdPrint("JOIN NETWORK");
 #ifdef SIM_APN
     if (mdm.join(SIM_APN, SIM_USER, SIM_PASS) == NOIP) {
+#else
+    if (mdm.join() == NOIP) {
+#endif
         io.lcdPrint("NETWORK JOIN FAILURE");
         goto error;
     }
-#else
-    io.lcdPrint("JOINING CARRIER", apn->carrier);
-    if (mdm.join(apn->apn) == NOIP) {
-        io.lcdPrint("NETWORK JOIN FAILURE");
-        goto error;
-    }
-#endif
     
     {
         uint8_t tries;
@@ -119,7 +106,6 @@
     return 0;
 
 error:
-    io.lcdPrint("DISCONNECTING");
     mdm.disconnect();
     return 1;
 }