IoT::Settings

class SettingsService

File Information

Library: IoT/Settings
Package: SettingsService
Header: IoT/Settings/SettingsService.h

Description

The SettingsService provides a service interface to the configuration system. Specifically it allows to change configuration parameters and to save changed parameters in a file.

Inheritance

Known Derived Classes: SettingsServiceImpl

Member Summary

Member Functions: getBool, getDouble, getInt16, getInt32, getInt64, getString, getUInt16, getUInt32, getUInt64, haveKey, haveSettingsKey, keys, remove, save, setBool, setDouble, setInt16, setInt32, setInt64, setString, setUInt16, setUInt32, setUInt64, settingsKeys

Types Aliases

Ptr

using Ptr = Poco::SharedPtr < SettingsService >;

Constructors

SettingsService

SettingsService();

Creates the SettingsService.

Destructor

~SettingsService virtual

virtual ~SettingsService();

Destroys the SettingsService.

Member Functions

getBool virtual

virtual Poco::Optional < double > getBool(
    const std::string & key,
    const Poco::Optional < double > & deflt = Poco::Optional < double > ()
) const = 0;

Returns the boolean value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException if the property value can not be converted to a boolean value.

The following string values can be converted into a boolean:

  • numerical values: non-zero becomes true, zero becomes false
  • strings: "true", "yes", "on" become true, "false", "no", "off" become false

Case does not matter.

getDouble virtual

virtual Poco::Optional < double > getDouble(
    const std::string & key,
    const Poco::Optional < double > & deflt = Poco::Optional < double > ()
) const = 0;

Returns the double value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException if the property value can not be converted to a double value.

getInt16 virtual

virtual Poco::Optional < Poco::Int16 > getInt16(
    const std::string & key,
    const Poco::Optional < Poco::Int16 > & deflt = Poco::Optional < Poco::Int16 > ()
) const = 0;

Returns the 16-bit integer value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException or a Poco::RangeException if the property value can not be converted to an Int16 value.

getInt32 virtual

virtual Poco::Optional < Poco::Int32 > getInt32(
    const std::string & key,
    const Poco::Optional < Poco::Int32 > & deflt = Poco::Optional < Poco::Int32 > ()
) const = 0;

Returns the 32-bit integer value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException or a Poco::RangeException if the property value can not be converted to an Int32 value.

getInt64 virtual

virtual Poco::Optional < Poco::Int64 > getInt64(
    const std::string & key,
    const Poco::Optional < Poco::Int64 > & deflt = Poco::Optional < Poco::Int64 > ()
) const = 0;

Returns the 64-bit integer value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException if the property value can not be converted to an Int64 value.

getString virtual

virtual Poco::Optional < std::string > getString(
    const std::string & key,
    const Poco::Optional < std::string > & deflt = Poco::Optional < std::string > ()
) const = 0;

Returns the string value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

getUInt16 virtual

virtual Poco::Optional < Poco::UInt16 > getUInt16(
    const std::string & key,
    const Poco::Optional < Poco::UInt16 > & deflt = Poco::Optional < Poco::UInt16 > ()
) const = 0;

Returns the 16-bit unsigned integer value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException or a Poco::RangeException if the property value can not be converted to an UInt16 value.

getUInt32 virtual

virtual Poco::Optional < Poco::UInt32 > getUInt32(
    const std::string & key,
    const Poco::Optional < Poco::UInt32 > & deflt = Poco::Optional < Poco::UInt32 > ()
) const = 0;

Returns the 32-bit unsigned integer value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException or a Poco::RangeException if the property value can not be converted to an UInt32 value.

getUInt64 virtual

virtual Poco::Optional < Poco::UInt64 > getUInt64(
    const std::string & key,
    const Poco::Optional < Poco::UInt64 > & deflt = Poco::Optional < Poco::UInt64 > ()
) const = 0;

Returns the 64-bit unsigned integer value of the property with the given key, or the given default value if the key does not exist. If the value contains references to other properties (${<property>}, or ${<property>:-<default>}), these are expanded.

Throws a Poco::SyntaxException or a Poco::RangeException if the property value can not be converted to an UInt64 value.

haveKey virtual

virtual bool haveKey(
    const std::string & key
) const = 0;

Returns true if the given key exists (either in the settings configuration, or in the global configuration), otherwise false.

haveSettingsKey virtual

virtual bool haveSettingsKey(
    const std::string & key
) const = 0;

Returns true if the given key is defined in the settings configuration object, otherwise false.

keys virtual

virtual std::vector < std::string > keys(
    const std::string & key = std::string ()
) const = 0;

Returns in range the names of all subkeys under the given key. If an empty key is passed, all root level keys are returned.

remove virtual

virtual void remove(
    const std::string & key
) = 0;

Removes the value with the given key from the settings configuration.

save virtual

virtual void save() const = 0;

Saves the settings file to disk.

setBool virtual

virtual void setBool(
    const std::string & key,
    bool value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setDouble virtual

virtual void setDouble(
    const std::string & key,
    double value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setInt16 virtual

virtual void setInt16(
    const std::string & key,
    Poco::Int16 value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setInt32 virtual

virtual void setInt32(
    const std::string & key,
    Poco::Int32 value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setInt64 virtual

virtual void setInt64(
    const std::string & key,
    Poco::Int64 value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setString virtual

virtual void setString(
    const std::string & key,
    const std::string & value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setUInt16 virtual

virtual void setUInt16(
    const std::string & key,
    Poco::UInt16 value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setUInt32 virtual

virtual void setUInt32(
    const std::string & key,
    Poco::UInt32 value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

setUInt64 virtual

virtual void setUInt64(
    const std::string & key,
    Poco::UInt64 value
) = 0;

Sets the property with the given key to the given value. An already existing value for the key is overwritten.

The new value is not persisted. Call save() to persist changes.

settingsKeys virtual

virtual std::vector < std::string > settingsKeys(
    const std::string & key = std::string ()
) const = 0;

Returns in range the names of all subkeys under the given key. If an empty key is passed, all root level keys are returned.

Only keys from the underlying settings configuration object are returned.

Securely control IoT edge devices from anywhere   Connect a Device