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
Revision 88:b1de34154513, committed 2015-03-11
- Comitter:
- xinlei
- Date:
- Wed Mar 11 10:02:35 2015 +0000
- Parent:
- 87:a01faf58e938
- Child:
- 89:8ab476939897
- Commit message:
- speed up 'factory reset' by placing it before network register
Changed in this revision
--- a/C027_Support.lib Mon Mar 09 09:48:05 2015 +0000 +++ b/C027_Support.lib Wed Mar 11 10:02:35 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/xinlei/code/C027_Support/#eb1902489fdd +http://developer.mbed.org/users/xinlei/code/C027_Support/#98e685503727
--- a/MbedAgent.h Mon Mar 09 09:48:05 2015 +0000 +++ b/MbedAgent.h Wed Mar 11 10:02:35 2015 +0000 @@ -20,8 +20,8 @@ #include "LocationUpdate.h" #include "OperationSupport.h" -#define MBED_AGENT_HOST "management.m2m-devicecloud.com" -//#define MBED_AGENT_HOST "developer.cumulocity.com" +//#define MBED_AGENT_HOST "management.m2m-devicecloud.com" +#define MBED_AGENT_HOST "developer.cumulocity.com" #define MBED_AGENT_PORT 80 #define MBED_AGENT_DEVICE_IDENTIFIER "com_cumulocity_MbedAgent_1.5.2"
--- a/main.cpp Mon Mar 09 09:48:05 2015 +0000 +++ b/main.cpp Wed Mar 11 10:02:35 2015 +0000 @@ -59,9 +59,29 @@ status = 2; io.lcdPrint("GPS Init Failure"); } - if (status != 0) - goto error; + if (status != 0) { + mdm.disconnect(); + mdm.powerOff(); + return 1; + } + DeviceInfo deviceInfo(mdm, devStatus); + DeviceMemory deviceMemory(mdm); + + if (io.resetButtonPressed()) { + io.lcdPrint("Factory Reset"); + if (deviceMemory.resetPlatformCredentials()) { +// io.deviceFeedback().beepSuccess(); + io.lcdPrint("Reset Success"); + } + else { +// io.deviceFeedback().beepFailure(); + io.lcdPrint("Reset Failure"); + } + Thread::wait(1000); + return 0; + } + io.lcdPrint("Register Network", "IMEI", devStatus.imei); if (!mdm.registerNet()) { io.lcdPrint("No Network Coverage"); @@ -84,23 +104,6 @@ } { - DeviceInfo deviceInfo(mdm, devStatus); - DeviceMemory deviceMemory(mdm); - - if (io.resetButtonPressed()) { - io.lcdPrint("Factory Reset"); - if (deviceMemory.resetPlatformCredentials()) { -// io.deviceFeedback().beepSuccess(); - io.lcdPrint("Reset Success"); - } - else { -// io.deviceFeedback().beepFailure(); - io.lcdPrint("Reset Failure"); - } - Thread::wait(1000); - return 0; - } - MbedAgent agent(io, mdm, deviceInfo, deviceMemory); io.lcdPrint("Agent Init");