DeviceInfoLedger
Loading...
Searching...
No Matches
Public Member Functions
DeviceConfigWrapper Class Reference

Wrapper to simplify calling the config methods. More...

#include <DeviceInfoLedger.h>

Inheritance diagram for DeviceConfigWrapper:
DeviceInfoLedger

Public Member Functions

bool getConfigBool (const char *key, bool defaultValue=false) const
 Get a bool (boolean) configuration setting from local settings or cloud configuration (default or device override)
 
bool setLocalConfigBool (const char *key, bool value)
 Set a local config setting using a bool.
 
int getConfigInt (const char *key, int defaultValue=0) const
 Get an int (32-bit signed integer) configuration setting from local settings or cloud configuration (default or device override)
 
bool setLocalConfigInt (const char *key, int value)
 Set a local config setting using an int (signed 32-bit integer)
 
double getConfigDouble (const char *key, double defaultValue=0.0) const
 Get a double (64-bit floating point) configuration setting from local settings or cloud configuration (default or device override)
 
bool setLocalConfigDouble (const char *key, double value)
 Set a local config setting using a double (64-bit floating point)
 
String getConfigString (const char *key, const char *defaultValue="") const
 Get a String configuration setting from local settings or cloud configuration (default or device override)
 
bool setLocalConfigString (const char *key, const char *value)
 Set a local config setting using a c-string (null-terminated UTF-8, const char *)
 
Variant getConfigVariant (const char *key, Variant defaultValue={}) const
 Get a configuration setting from local settings or cloud configuration (default or device override)
 
bool setLocalConfigVariant (const char *key, Variant value)
 Set a local config setting using a Variant.
 

Detailed Description

Wrapper to simplify calling the config methods.

Since the config class is a singleton, the syntax for using the method is a little awkward, such as:

DeviceInfoConfig::instance().getConfigString("test")

You make this wrapper a parent class of your class, which makes it possible to just call:

getConfigString("test")

Member Function Documentation

◆ getConfigBool()

bool DeviceConfigWrapper::getConfigBool ( const char * key,
bool defaultValue = false ) const
inline

Get a bool (boolean) configuration setting from local settings or cloud configuration (default or device override)

Parameters
keyKey to read in the top level of the configuration object
defaultValueValue to be returned if the key does not exist
Returns
true or false depending on the configuration setting or defaultValue.

◆ getConfigDouble()

double DeviceConfigWrapper::getConfigDouble ( const char * key,
double defaultValue = 0.0 ) const
inline

Get a double (64-bit floating point) configuration setting from local settings or cloud configuration (default or device override)

Parameters
keyKey to read in the top level of the configuration object
defaultValueValue to be returned if the key does not exist
Returns
true or false depending on the configuration setting or defaultValue.

◆ getConfigInt()

int DeviceConfigWrapper::getConfigInt ( const char * key,
int defaultValue = 0 ) const
inline

Get an int (32-bit signed integer) configuration setting from local settings or cloud configuration (default or device override)

Parameters
keyKey to read in the top level of the configuration object
defaultValueValue to be returned if the key does not exist
Returns
true or false depending on the configuration setting or defaultValue.

◆ getConfigString()

String DeviceConfigWrapper::getConfigString ( const char * key,
const char * defaultValue = "" ) const
inline

Get a String configuration setting from local settings or cloud configuration (default or device override)

Parameters
keyKey to read in the top level of the configuration object
defaultValueValue to be returned if the key does not exist
Returns
true or false depending on the configuration setting or defaultValue.

◆ getConfigVariant()

Variant DeviceConfigWrapper::getConfigVariant ( const char * key,
Variant defaultValue = {} ) const
inline

Get a configuration setting from local settings or cloud configuration (default or device override)

Parameters
keyTop level key in the ledger
defaultValueValue to be returned if the key does not exist
Returns
Variant Return Variant, see also getConfigBool, getConfigInt, ... that wrap this method

◆ setLocalConfigBool()

bool DeviceConfigWrapper::setLocalConfigBool ( const char * key,
bool value )
inline

Set a local config setting using a bool.

Parameters
keyKey to set
valueValue to set to
Returns
true if successfully set, false if not

◆ setLocalConfigDouble()

bool DeviceConfigWrapper::setLocalConfigDouble ( const char * key,
double value )
inline

Set a local config setting using a double (64-bit floating point)

Parameters
keyKey to set
valueValue to set to
Returns
true if successfully set, false if not

◆ setLocalConfigInt()

bool DeviceConfigWrapper::setLocalConfigInt ( const char * key,
int value )
inline

Set a local config setting using an int (signed 32-bit integer)

Parameters
keyKey to set
valueValue to set to
Returns
true if successfully set, false if not

◆ setLocalConfigString()

bool DeviceConfigWrapper::setLocalConfigString ( const char * key,
const char * value )
inline

Set a local config setting using a c-string (null-terminated UTF-8, const char *)

Parameters
keyKey to set
valueValue to set to
Returns
true if successfully set, false if not

◆ setLocalConfigVariant()

bool DeviceConfigWrapper::setLocalConfigVariant ( const char * key,
Variant value )
inline

Set a local config setting using a Variant.

Parameters
keyKey to set
valueValue to set to
Returns
true if successfully set, false if not

See also overloads for specific types such as setLocalConfigBool, setLocalConfigInt, etc.


The documentation for this class was generated from the following file: