Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Revision:
42:104746744af8
Parent:
41:804f6a0bda26
Child:
43:eff77697d88c
--- a/DeviceBootstrap.cpp	Tue Jul 15 12:44:34 2014 +0000
+++ b/DeviceBootstrap.cpp	Thu Jul 24 14:17:07 2014 +0000
@@ -35,7 +35,7 @@
 bool DeviceBootstrap::obtainFromStorage()
 {
     char buf[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH*2+2], *ptr;
-
+    
     int res = _mdm.readFile(CREDENTIALS_FILE, buf, sizeof(buf));
 
     if (res < 0)
@@ -56,14 +56,16 @@
 bool DeviceBootstrap::obtainFromPlatform()
 {
     uint8_t ret;
-
-    printf("Starting device bootstrap with '%s'\n", _deviceInfo.imei());
+    const char *id;
+    
+    id = _deviceInfo.imsi();
+    printf("Starting device bootstrap with '%s'\n", id);
     
     ComposedRecord record;
     ParsedRecord recvdRecord;
 
     IntegerValue msgId(61);
-    CharValue identifier(_deviceInfo.imei());
+    CharValue identifier(id);
     if ((!record.add(msgId)) || (!record.add(identifier)))
         return false;
 
@@ -85,7 +87,11 @@
             Thread::wait(2000);
             continue;
         }
+        _client.stop();
         
+        for (size_t q = 0; q < recvdRecord.values(); q++)
+            puts(recvdRecord.rawValue(q));
+            
         if ((recvdRecord.values() < 1) ||
             (recvdRecord.value(0).integerValue() == 50)) {
             puts("No credentials available yet. Retrying.");