SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::Configurable Class Reference

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>

Inheritance diagram for sensesp::Configurable:
[legend]

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Configurable()

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.

Parameters
config_pathThe 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.
descriptionA description of the Configurable that can be used e.g. in the web UI.

Definition at line 14 of file configurable.cpp.

Member Function Documentation

◆ get_config_schema()

◆ get_configuration()

◆ get_description()

String sensesp::Configurable::get_description ( )
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.

Here is the caller graph for this function:

◆ get_sort_order()

int sensesp::Configurable::get_sort_order ( )
inline

Definition at line 72 of file configurable.h.

Here is the caller graph for this function:

◆ load_configuration()

void sensesp::Configurable::load_configuration ( )
protectedvirtual

Loads a configuration previously saved with save_configuration() and passes the configuration to set_configuration().

Definition at line 40 of file configurable.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_configuration()

void sensesp::Configurable::save_configuration ( )
virtual

Persists the configuration returned by get_configuration() to the local file system.

Definition at line 84 of file configurable.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_configuration()

◆ set_description()

void sensesp::Configurable::set_description ( String  description)
inline

Set the description of the Configurable.

Definition at line 70 of file configurable.h.

◆ set_sort_order()

void sensesp::Configurable::set_sort_order ( int  sort_order)
inline

Definition at line 74 of file configurable.h.

Member Data Documentation

◆ config_path_

const String sensesp::Configurable::config_path_

Definition at line 36 of file configurable.h.

◆ description_

String sensesp::Configurable::description_ = ""
protected

Definition at line 89 of file configurable.h.

◆ sort_order_

int sensesp::Configurable::sort_order_ = 1000
protected

The sort order of Configurable on the web UI. Lower numbers have preference.

Definition at line 92 of file configurable.h.


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