SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
|
An object that is capable of having configuration data that can be set remotely using a RESTful API, and can be persisted to the local file system. More...
#include <sensesp/system/configurable.h>
Public Member Functions | |
Configurable (String config_path="", String description="", int sort_order=1000) | |
virtual void | get_configuration (JsonObject &configObject) |
virtual bool | set_configuration (const JsonObject &config) |
virtual String | get_config_schema () |
String | get_description () |
void | set_description (String description) |
Set the description of the Configurable. | |
int | get_sort_order () |
void | set_sort_order (int sort_order) |
virtual void | save_configuration () |
Public Attributes | |
const String | config_path_ |
Protected Member Functions | |
virtual void | load_configuration () |
Protected Attributes | |
String | description_ = "" |
int | sort_order_ = 1000 |
An object that is capable of having configuration data that can be set remotely using a RESTful API, and can be persisted to the local file system.
Definition at line 17 of file configurable.h.
sensesp::Configurable::Configurable | ( | String | config_path = "" , |
String | description = "" , |
||
int | sort_order = 1000 |
||
) |
Create a configurable object who's configuration is saved using the specified config_path.
config_path | The partial path used for the URL when configuring this object remotely with a browser. The config_path also represents the path to the local file where the configuration data is persisted. Given this, be sure to chose a path that is both valid for URLs as well as file names. A configuration path should always start with a forward slash. Leaving the config_path blank indicates that this object does not need or want configuration data support. |
description | A description of the Configurable that can be used e.g. in the web UI. |
Definition at line 14 of file configurable.cpp.
|
virtual |
Returns a configuration schema that specifies the key/value pairs that can be expected when calling get_configuration(), or are expected by set_configuration(). The schema will be in JSON Schema format
Reimplemented in sensesp::SmartSwitchController, sensesp::Networking, sensesp::WSClient, sensesp::ConstantSensor< T >, sensesp::SKOutput< T >, sensesp::SKOutput< String >, sensesp::SKPutRequestBase, sensesp::SKOutputTime, sensesp::RgbLed, sensesp::AnalogVoltage, sensesp::AngleCorrection, sensesp::ChangeFilter, sensesp::ClickType, sensesp::CurveInterpolator, sensesp::Difference, sensesp::Enable< T >, sensesp::Frequency, sensesp::IntegratorT< C, P >, sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >, sensesp::LambdaTransform< float, float, float, float >, sensesp::LambdaTransform< float, int >, sensesp::LambdaTransform< IN, OUT, IN, IN, OUT, OUT >, sensesp::Median, sensesp::MovingAverage, sensesp::PressRepeater, sensesp::RepeatReport< T >, sensesp::FloatThreshold, sensesp::IntThreshold, sensesp::TimeCounter< T >, sensesp::VoltageDividerR1, and sensesp::VoltageDividerR2.
Definition at line 38 of file configurable.cpp.
|
virtual |
Returns the current configuration data as a JsonObject. In general, the current state of local member variables are saved to a new object created with JsonDocument::as<JsonObject>() and returned.
Reimplemented in sensesp::SmartSwitchController, sensesp::ConstantSensor< T >, sensesp::SKPutRequestBase, sensesp::SKOutputTime, sensesp::RgbLed, sensesp::AnalogVoltage, sensesp::AngleCorrection, sensesp::ChangeFilter, sensesp::ClickType, sensesp::CurveInterpolator, sensesp::Difference, sensesp::Enable< T >, sensesp::Frequency, sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >, sensesp::LambdaTransform< float, float, float, float >, sensesp::LambdaTransform< float, int >, sensesp::LambdaTransform< IN, OUT, IN, IN, OUT, OUT >, sensesp::Median, sensesp::MovingAverage, sensesp::PressRepeater, sensesp::RepeatReport< T >, sensesp::FloatThreshold, sensesp::IntThreshold, sensesp::VoltageDividerR1, sensesp::VoltageDividerR2, sensesp::Networking, sensesp::WSClient, sensesp::IntegratorT< C, P >, sensesp::SKOutput< T >, sensesp::SKOutput< String >, and sensesp::TimeCounter< T >.
Definition at line 28 of file configurable.cpp.
|
inline |
Returns a configuration description that is visible in WebUI you can use HTML tags to make description more readable
Definition at line 65 of file configurable.h.
|
inline |
|
protectedvirtual |
Loads a configuration previously saved with save_configuration() and passes the configuration to set_configuration().
Definition at line 40 of file configurable.cpp.
|
virtual |
Persists the configuration returned by get_configuration() to the local file system.
Definition at line 84 of file configurable.cpp.
|
virtual |
Sets the current state of local member variables using the data stored in config.
Reimplemented in sensesp::SmartSwitchController, sensesp::ConstantSensor< T >, sensesp::SKOutput< T >, sensesp::SKOutput< String >, sensesp::SKPutRequestBase, sensesp::SKOutputTime, sensesp::RgbLed, sensesp::AnalogVoltage, sensesp::AngleCorrection, sensesp::ChangeFilter, sensesp::ClickType, sensesp::CurveInterpolator, sensesp::Difference, sensesp::Enable< T >, sensesp::Frequency, sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >, sensesp::LambdaTransform< float, float, float, float >, sensesp::LambdaTransform< float, int >, sensesp::LambdaTransform< IN, OUT, IN, IN, OUT, OUT >, sensesp::Median, sensesp::MovingAverage, sensesp::PressRepeater, sensesp::RepeatReport< T >, sensesp::FloatThreshold, sensesp::IntThreshold, sensesp::TimeCounter< T >, sensesp::VoltageDividerR1, sensesp::VoltageDividerR2, sensesp::Networking, sensesp::WSClient, and sensesp::IntegratorT< C, P >.
Definition at line 33 of file configurable.cpp.
Set the description of the Configurable.
Definition at line 70 of file configurable.h.
Definition at line 74 of file configurable.h.
Definition at line 36 of file configurable.h.
|
protected |
Definition at line 89 of file configurable.h.
|
protected |
The sort order of Configurable on the web UI. Lower numbers have preference.
Definition at line 92 of file configurable.h.