Richard Osterloh / Mbed 2 deprecated WiFi_Scanner

Dependencies:   C027_Support SWO mbed-rtos mbed picojson

Fork of lpc4088_ebb_ublox_Cellular_PubNubDemo_rtos by EmbeddedArtists AB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ConfigurationProperties.cpp Source File

ConfigurationProperties.cpp

00001 #include "ConfigurationProperties.h"
00002 #include <stdlib.h>
00003 #include <stdio.h>
00004 #include <string.h>
00005 
00006 ConfigurationProperties::ConfigurationProperties(DeviceConfiguration& deviceConfiguration) :
00007     _deviceConfiguration(deviceConfiguration)
00008 {
00009 }
00010 
00011 bool ConfigurationProperties::resetConfiguration()
00012 {
00013     return (_deviceConfiguration.clear(), _deviceConfiguration.set("interval", CONFIGURATION_PROPERTY_INTERVAL));
00014 }
00015 
00016 bool ConfigurationProperties::validateProperties()
00017 {
00018     return (readInterval() > 0);
00019 }
00020 
00021 int ConfigurationProperties::readInterval()
00022 {
00023     const char *prop; int res, ln;
00024     
00025     if ((prop = _deviceConfiguration.get("interval")) == NULL)
00026         prop = CONFIGURATION_PROPERTY_INTERVAL;
00027     
00028     ln = -1;
00029     if ((sscanf(prop, "%d%n", &res, &ln) != 1) || (ln != strlen(prop)))
00030         return 0;
00031 
00032     return res;
00033 }