Official reference client implementation for Cumulocity SmartREST on u-blox C027.

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Revision:
80:757c3ff7b92b
Parent:
77:f6717e4eccc4
Child:
81:4a7761914901
--- a/main.cpp	Wed Mar 04 09:38:46 2015 +0000
+++ b/main.cpp	Wed Mar 04 11:14:30 2015 +0000
@@ -23,6 +23,13 @@
 //#define SIM_USER ""
 //#define SIM_PASS ""
 
+unsigned short getMNCLen(const char *imsi) {
+    if (strncmp(imsi, "310", 3) != 0) // Non American ISMI
+        return 2;
+    else
+        return 3;
+}
+
 int main()
 {
     MDMParser::DevStatus devStatus;
@@ -67,7 +74,12 @@
 #else
     if (mdm.join() == NOIP) {
 #endif
-        io.lcdPrint("Network join failure", "Wrong APN settting,", "username and password");
+        char s[8] = "unknown";
+        const char *p = devStatus.imsi;
+        if (p) {
+            snprintf(s, sizeof(s), "%.*s-%.*s", 3, p, getMNCLen(p), p+3);
+        }
+        io.lcdPrint("Wrong APN settting", "MCC-MNC:", s);
         goto error;
     }