SensESP 3.4.1-alpha
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::ConfigItemT< T > Class Template Reference

Class providing sufficient data for rendering a config card in the frontend. More...

#include <sensesp/ui/config_item.h>

Inheritance diagram for sensesp::ConfigItemT< T >:
[legend]

Public Member Functions

 ConfigItemT (std::shared_ptr< T > config_object)
 
virtual bool to_json (JsonObject &config) const override
 
virtual bool from_json (const JsonObject &config) const override
 
virtual bool load () override
 
virtual bool refresh () override
 
virtual bool save () override
 
virtual const String & get_config_path () const override
 
ConfigItemT< T > * set_title (const String &title)
 
ConfigItemT< T > * set_description (const String &description)
 
ConfigItemT< T > * set_sort_order (int sort_order)
 
ConfigItemT< T > * set_requires_restart (bool requires_restart)
 
ConfigItemT< T > * set_config_schema (const String &config_schema)
 
T * get_config_object ()
 Get the object that this ConfigItemT is managing.
 
- Public Member Functions inherited from sensesp::ConfigItemBase
virtual ~ConfigItemBase ()=default
 
const String & get_title () const
 
ConfigItemBaseset_title (const String &title)
 
const String & get_description () const
 
ConfigItemBaseset_description (const String &description)
 Set the description of the ConfigItemT.
 
virtual const String get_config_schema () const
 
int get_sort_order () const
 
ConfigItemBaseset_sort_order (int sort_order)
 
bool requires_restart () const
 Return true if the ConfigItemT requires restart after saving for the changes to take effect.
 
ConfigItemBaseset_requires_restart (bool requires_restart)
 Set the requires_restart flag.
 

Protected Member Functions

const String get_default_config_schema () const
 Get the default configuration schema.
 

Protected Attributes

std::shared_ptr< T > config_object_
 
- Protected Attributes inherited from sensesp::ConfigItemBase
String config_path_ = ""
 The path of the ConfigItemT. This is used to identify the ConfigItemT.
 
String config_schema_ = ""
 
String title_ = ""
 Title of the ConfigItemT to be displayed on the web UI.
 
String description_ = ""
 Description of the ConfigItemT to be displayed on the web UI.
 
int sort_order_ = 1000
 The sort order of ConfigItemT. Lower numbers have precedence.
 
bool requires_restart_ = false
 

Additional Inherited Members

- Static Public Member Functions inherited from sensesp::ConfigItemBase
static std::shared_ptr< ConfigItemBaseget_config_item (const String key)
 Get a single ConfigItemT by key.
 
static std::unique_ptr< std::vector< std::shared_ptr< ConfigItemBase > > > get_config_items ()
 Get all config items as a vector.
 
static void clear_registry ()
 Empty the config item registry.
 
- Static Protected Attributes inherited from sensesp::ConfigItemBase
static std::map< String, std::shared_ptr< ConfigItemBase > > config_items_
 

Detailed Description

template<typename T>
class sensesp::ConfigItemT< T >

Class providing sufficient data for rendering a config card in the frontend.

Definition at line 217 of file config_item.h.

Constructor & Destructor Documentation

◆ ConfigItemT()

template<typename T >
sensesp::ConfigItemT< T >::ConfigItemT ( std::shared_ptr< T >  config_object)
inline

Definition at line 225 of file config_item.h.

Member Function Documentation

◆ from_json()

template<typename T >
virtual bool sensesp::ConfigItemT< T >::from_json ( const JsonObject &  config) const
inlineoverridevirtual

Implements sensesp::ConfigItemBase.

Definition at line 232 of file config_item.h.

◆ get_config_object()

template<typename T >
T * sensesp::ConfigItemT< T >::get_config_object ( )
inline

Get the object that this ConfigItemT is managing.

Returns
T*

Definition at line 274 of file config_item.h.

◆ get_config_path()

template<typename T >
virtual const String & sensesp::ConfigItemT< T >::get_config_path ( ) const
inlineoverridevirtual

Implements sensesp::ConfigItemBase.

Definition at line 240 of file config_item.h.

◆ get_default_config_schema()

template<typename T >
const String sensesp::ConfigItemT< T >::get_default_config_schema ( ) const
inlineprotectedvirtual

Get the default configuration schema.

Returns
String

Implements sensesp::ConfigItemBase.

Definition at line 284 of file config_item.h.

Here is the call graph for this function:

◆ load()

template<typename T >
virtual bool sensesp::ConfigItemT< T >::load ( )
inlineoverridevirtual

Implements sensesp::ConfigItemBase.

Definition at line 236 of file config_item.h.

◆ refresh()

template<typename T >
virtual bool sensesp::ConfigItemT< T >::refresh ( )
inlineoverridevirtual

Implements sensesp::ConfigItemBase.

Definition at line 237 of file config_item.h.

◆ save()

template<typename T >
virtual bool sensesp::ConfigItemT< T >::save ( )
inlineoverridevirtual

Implements sensesp::ConfigItemBase.

Definition at line 238 of file config_item.h.

◆ set_config_schema()

template<typename T >
ConfigItemT< T > * sensesp::ConfigItemT< T >::set_config_schema ( const String &  config_schema)
inline

Definition at line 264 of file config_item.h.

◆ set_description()

template<typename T >
ConfigItemT< T > * sensesp::ConfigItemT< T >::set_description ( const String &  description)
inline

Definition at line 249 of file config_item.h.

Here is the call graph for this function:

◆ set_requires_restart()

template<typename T >
ConfigItemT< T > * sensesp::ConfigItemT< T >::set_requires_restart ( bool  requires_restart)
inline

Definition at line 259 of file config_item.h.

Here is the call graph for this function:

◆ set_sort_order()

template<typename T >
ConfigItemT< T > * sensesp::ConfigItemT< T >::set_sort_order ( int  sort_order)
inline

Definition at line 254 of file config_item.h.

Here is the call graph for this function:

◆ set_title()

template<typename T >
ConfigItemT< T > * sensesp::ConfigItemT< T >::set_title ( const String &  title)
inline

Definition at line 244 of file config_item.h.

Here is the call graph for this function:

◆ to_json()

template<typename T >
virtual bool sensesp::ConfigItemT< T >::to_json ( JsonObject &  config) const
inlineoverridevirtual

Implements sensesp::ConfigItemBase.

Definition at line 228 of file config_item.h.

Member Data Documentation

◆ config_object_

template<typename T >
std::shared_ptr<T> sensesp::ConfigItemT< T >::config_object_
protected

Definition at line 278 of file config_item.h.


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