![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: io/DeviceMemory.cpp
- Revision:
- 69:237c01eb36c2
- Parent:
- 68:0dc778a16d0d
- Child:
- 70:f489ca11f254
--- a/io/DeviceMemory.cpp Sat Dec 06 19:47:23 2014 +0000 +++ b/io/DeviceMemory.cpp Sat Dec 13 16:07:07 2014 +0000 @@ -17,7 +17,7 @@ if ((res = _mdm.readFile(PLATFORM_CREDENTIALS_FILE, buffer, sizeof(buffer))) < 0) return false; - + buffer[(size_t)res] = '\0'; sscanf(buffer, "%s\n%s\n%n", username, password, &len2); return res == len2; @@ -31,7 +31,8 @@ if ((res < 0) || (res >= sizeof(buffer))) return false; - return ((_mdm.delFile(PLATFORM_CREDENTIALS_FILE)) && (res == _mdm.writeFile(PLATFORM_CREDENTIALS_FILE, buffer, res))); + resetPlatformCredentials(); + return (res == _mdm.writeFile(PLATFORM_CREDENTIALS_FILE, buffer, res)); } bool DeviceMemory::resetPlatformCredentials() @@ -56,7 +57,9 @@ size_t len; len = strlen(cfg); - return ((_mdm.delFile(CONFIGURATION_FILE)) && (_mdm.writeFile(CONFIGURATION_FILE, cfg, len) == len)); + + resetConfiguration(); + return (_mdm.writeFile(CONFIGURATION_FILE, cfg, len) == len); } bool DeviceMemory::resetConfiguration()