Doxygen with github
|
A component that provides a set of parameters to the ksWifiConfigurator and is also responsible for handling its storage. More...
#include <ksConfigProvider.h>
Public Member Functions | |
virtual const size_t | getInstanceType () const |
Retrieves type ID of the object. | |
virtual bool | isA (const size_t id) const |
Checks whether object is of given type. | |
std::list< ksConfigParameter > & | getParameters () |
Provides const reference to the list of managed parameters. | |
virtual void | readParams ()=0 |
Populates the parameter list by processing the configuration file. | |
virtual void | saveParams ()=0 |
Outputs the parameter list to the configuration file. | |
Public Member Functions inherited from ksf::ksComponent | |
virtual bool | init (ksApplication *app) |
Initializes component. | |
virtual bool | loop (ksApplication *app) |
Handles component loop logic, called from application loop. | |
virtual bool | postInit (ksApplication *app) |
Method called after component initialization, used to setup references to other components. | |
Public Member Functions inherited from ksf::ksRtti | |
template<typename TType> | |
TType * | as () |
Tries to cast object to the type provided as a template parameter. | |
template<typename TType> | |
const TType * | as () const |
Tries to cast object to the type provided as a template parameter (const version). | |
Static Public Member Functions | |
static const size_t | getClassType () |
Static Public Member Functions inherited from ksf::ksComponent | |
static const size_t | getClassType () |
Protected Member Functions | |
void | addNewParam (std::string id, std::string label, std::string defaultValue, int maxLength=50, EConfigParamType::Type type={}) |
Defines new configutation parameter. | |
void | addNewParamWithConfigDefault (ksConfig &config, std::string id, std::string label={}, int maxLength=50, EConfigParamType::Type type={}) |
Defines new configuation parameter (with default value). | |
Protected Attributes | |
std::list< ksConfigParameter > | params |
Protected Attributes inherited from ksf::ksComponent | |
ksComponentState::TYPE | componentState { ksComponentState::NotInitialized } |
A component that provides a set of parameters to the ksWifiConfigurator and is also responsible for handling its storage.
In the configurator application, it should be instantiated like a typical component, and ksWifiConfigurator must be added to the component stack. In this case, it will manage the correct flow of data reading and saving.
In contrast, in a normal application, it can be created for a short period of time, usually inside the application's init method, to read the data and return the required value. Refer to the EnergySensor init method for an example. Note that the component will be destroyed upon reaching the function return. Also, note that the setupRotations method can return false in case of a problem with the value retrieval (for example, no config present yet), thus causing the application to break and triggering the app rotator to move to the next defined application, usually AP-based configurator.
|
protected |
Defines new configutation parameter.
id | Unique identificator that will be also used as property label by Device Portal. |
label | Parameter label. |
defaultValue | Default parameter value. |
maxLength | Maximum length of the value. |
type | Type of parameter, which tells the Device Portal which field type should be used. |
Referenced by addNewParamWithConfigDefault().
|
protected |
Defines new configuation parameter (with default value).
config | ksConfig reference. |
id | Unique identificator that will be also used as property label by Device Portal. |
label | Parameter label. |
maxLength | Maximum length of the value. |
type | Type of parameter, which tells the Device Portal which field type should be used. |
References addNewParam(), and ksf::ksConfig::getParam().
Referenced by ksf::comps::ksMqttConfigProvider::readParams().
|
inlinevirtual |
Retrieves type ID of the object.
Reimplemented from ksf::ksComponent.
Reimplemented in ksf::comps::ksMqttConfigProvider.
|
inlinevirtual |
Checks whether object is of given type.
id | Type ID to check against. |
Reimplemented from ksf::ksComponent.
Reimplemented in ksf::comps::ksMqttConfigProvider.
|
pure virtual |
Populates the parameter list by processing the configuration file.
Implemented in ksf::comps::ksMqttConfigProvider.
|
pure virtual |
Outputs the parameter list to the configuration file.
Implemented in ksf::comps::ksMqttConfigProvider.