Doxygen with github
Loading...
Searching...
No Matches
ksf::comps::ksWifiConfigurator Class Reference

A component that manages AP-based configuration. More...

#include <ksWifiConfigurator.h>

+ Inheritance diagram for ksf::comps::ksWifiConfigurator:

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.
 
 ksWifiConfigurator ()
 Constructs WiFi configurator object.
 
 ksWifiConfigurator (std::string devicePrefixName)
 Constructs WiFi configurator object.
 
bool loop (ksApplication *app) override
 Handles ksWifiConfigurator logic.
 
bool init (ksApplication *app) override
 Implements ksWifiConfigurator initialization logic.
 
bool postInit (ksApplication *app) override
 Implements ksWifiConfigurator post-initialization logic.
 
virtual ~ksWifiConfigurator ()
 Destructs WiFi configurator component.
 
- Public Member Functions inherited from ksf::ksComponent
- 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 handlePeriodicTasks ()
 Handles periodic tasks like WiFi management.
 

Protected Attributes

ksApplicationapp {nullptr}
 Pointer to ksApplication object that owns this component.
 
std::string deviceName
 Device name (prefix).
 
ksf::ksSimpleTimer configTimeout {120 * 1000}
 Timeout for captive portal in ms.
 
ksf::ksSimpleTimer periodicTasksTimeout {1000}
 Timeout for loop in ms.
 
- Protected Attributes inherited from ksf::ksComponent
ksComponentState::TYPE componentState { ksComponentState::NotInitialized }
 

Detailed Description

A component that manages AP-based configuration.

Handles Device Portal, where the user can configure the device like WiFi or MQTT credentials as well as custom, application-defined parameters implemented using ksConfigProvider interface.

Constructor & Destructor Documentation

◆ ksWifiConfigurator()

ksf::comps::ksWifiConfigurator::ksWifiConfigurator ( std::string devicePrefixName)

Constructs WiFi configurator object.

Parameters
devicePrefixNameDevice prefix name, will be used in AP (DEVPREFIX-112ACB84) and hostname

References deviceName.

Member Function Documentation

◆ getInstanceType()

virtual const size_t ksf::comps::ksWifiConfigurator::getInstanceType ( ) const
inlinevirtual

Retrieves type ID of the object.

Returns
Object type ID.

Reimplemented from ksf::ksComponent.

◆ init()

bool ksf::comps::ksWifiConfigurator::init ( ksApplication * app)
overridevirtual

Implements ksWifiConfigurator initialization logic.

Parameters
appPointer to ksApplication object that owns this component
Returns
True on success, false on fail.

Reimplemented from ksf::ksComponent.

References ksf::ksApplication::addComponent(), app, and deviceName.

◆ isA()

virtual bool ksf::comps::ksWifiConfigurator::isA ( const size_t id) const
inlinevirtual

Checks whether object is of given type.

Parameters
idType ID to check against.
Returns
True if object is of given type, otherwise false.

Reimplemented from ksf::ksComponent.

◆ loop()

bool ksf::comps::ksWifiConfigurator::loop ( ksApplication * app)
overridevirtual

Handles ksWifiConfigurator logic.

It starts and handles Device Portal, where the user can configure the device (that means WiFi or MQTT credential as well as custom defined device parameters).

Parameters
appPointer to ksApplication object that owns this component.
Returns
True if loop succedeed, otherwise false.

Reimplemented from ksf::ksComponent.

References configTimeout, handlePeriodicTasks(), periodicTasksTimeout, and ksf::ksSimpleTimer::triggered().

◆ postInit()

bool ksf::comps::ksWifiConfigurator::postInit ( ksApplication * app)
overridevirtual

Implements ksWifiConfigurator post-initialization logic.

Parameters
appPointer to ksApplication object that owns this component
Returns
True on success, false on fail.

Reimplemented from ksf::ksComponent.

References app, ksf::ksApplication::findComponents(), and ksf::comps::ksLed::setEnabled().


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