An application to log WiFi SSIDs for position lookup testing
Dependencies: C027_Support SWO mbed-rtos mbed picojson
Fork of lpc4088_ebb_ublox_Cellular_PubNubDemo_rtos by
DeviceMemory.cpp
00001 #include "DeviceMemory.h" 00002 #include <stdlib.h> 00003 #include <stdio.h> 00004 #include <string.h> 00005 00006 #define CONFIGURATION_FILE "001_CONFIGURATION" 00007 00008 DeviceMemory::DeviceMemory(MDMSerial& mdm) : 00009 _mdm(mdm) 00010 { 00011 } 00012 00013 bool DeviceMemory::loadConfiguration(char *cfg, size_t len) 00014 { 00015 int res; 00016 00017 if ((res = _mdm.readFile(CONFIGURATION_FILE, cfg, len)) < 0) 00018 return false; 00019 00020 cfg[(size_t)res] = '\0'; 00021 return true; 00022 } 00023 00024 bool DeviceMemory::saveConfiguration(char *cfg) 00025 { 00026 size_t len; 00027 00028 len = strlen(cfg); 00029 00030 resetConfiguration(); 00031 return (_mdm.writeFile(CONFIGURATION_FILE, cfg, len) == len); 00032 } 00033 00034 bool DeviceMemory::resetConfiguration() 00035 { 00036 return _mdm.delFile(CONFIGURATION_FILE); 00037 }
Generated on Sun Jul 17 2022 02:39:36 by 1.7.2