Doxygen with github
|
A component responsible for providing a set of parameters to ksWifiConfigurator and managing its storage. More...
#include <ksConfigProvider.h>
Public Member Functions | |
virtual const std::size_t | getInstanceType () const |
Retrieves type ID of the object. | |
virtual bool | isA (const std::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. | |
![]() | |
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. | |
![]() | |
virtual | ~ksRtti ()=default |
Destructor. | |
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 std::size_t | getClassType () |
![]() | |
static const std::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 (misc::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 |
List of configuration parameters. | |
![]() | |
ksComponentState::TYPE | componentState { ksComponentState::NotInitialized } |
Holds current state of the component. | |
A component responsible for providing a set of parameters to ksWifiConfigurator and managing its storage.
In the configurator application, this component should be instantiated like any other, with ksWifiConfigurator included in the component stack. In this setup, it ensures the proper flow of data reading and saving.
In a standard application, however, it is typically created temporarily—often within the application's init method—to read the necessary data and return the required value. For an example, refer to the EnergySensor init method. The component is destroyed once the function returns.
Additionally, be aware that the setupRotations method may return false if there is an issue retrieving the value (e.g., if no configuration is present). This could cause the application to fail, triggering the app rotator to switch to the next defined application, which is usually an 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. |
References params.
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::misc::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.