Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Revision:
100:dbcd3bc51758
Parent:
98:e369fc75c000
Child:
101:ef2827b2d00a
--- a/main.cpp	Thu May 07 13:56:19 2015 +0000
+++ b/main.cpp	Fri May 08 12:19:57 2015 +0000
@@ -4,11 +4,11 @@
 #include "rtos.h"
 #include "MDM.h"
 #include "GPS.h"
+
 #include "DeviceInfo.h"
 #include "DeviceMemory.h"
 #include "MbedAgent.h"
 #include "GPSTracker.h"
-#include "DeviceConfiguration.h"
 #include "LCDDisplay.h"
 #include "logging.h"
 
@@ -51,11 +51,13 @@
 int main()
 {
     set_time(1256729737);
-    openRelay();
     MDMRtos<MDMSerial> mdm;
     pMdm = &mdm;
     InterruptIn joystickUp(A2);
     InterruptIn joystickDown(A3);
+    joystickUp.rise(&enableDebug);
+    joystickDown.rise(&disableDebug);
+
     MDMParser::DevStatus devStatus;
     LCDDisplay::inst().setLines("Mbed Agent V2.1rc2", srHost);
     if (!mdm.init(SIM_PIN, &devStatus)) {
@@ -64,21 +66,17 @@
         mdm.powerOff();
         return 1;
     }
-    joystickUp.rise(&enableDebug);
-    joystickDown.rise(&disableDebug);
 
     DigitalIn fireButton(D4);
-
     if (fireButton) {
-        LCDDisplay::inst().setLines("Factory Reset");
-        if (resetPlatformCredentials()) {
+        if (delCredential()) {
             LCDDisplay::inst().setLines("Reset Success");
         } else {
             LCDDisplay::inst().setLines("Reset Failure");
         }
+        Thread::wait(2000);
         mdm.disconnect();
         mdm.powerOff();
-        Thread::wait(1000);
         return 0;
     }
     aInfo("Main Thread: %p\r\n", Thread::gettid());    
@@ -135,7 +133,6 @@
         switch (ret) {
             case -1: LCDDisplay::inst().setLines("Bootstrap error"); break;
             case -2: LCDDisplay::inst().setLines("Integrate failure"); break;
-            case -3: LCDDisplay::inst().setLines("Config sync failure"); break;
             default: agent.loop();
         }
         mdm.disconnect();