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

Base component class. More...

#include <ksComponent.h>

+ Inheritance diagram for ksf::ksComponent:

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.
 
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 ()
 

Protected Attributes

ksComponentState::TYPE componentState { ksComponentState::NotInitialized }
 

Friends

class ksApplication
 

Detailed Description

Base component class.

A component is a part of the application that can be configured and managed by the application. As it is using ksRtti, it must use KSF_RTTI_DECLARATIONS for proper initialization.

Member Function Documentation

◆ getInstanceType()

◆ init()

bool ksf::ksComponent::init ( ksApplication * app)
virtual

Initializes component.

Parameters
appPointer to the parent ksApplication.
Returns
True on success, false on fail.

Reimplemented in ksf::comps::ksDevicePortal, ksf::comps::ksLed, ksf::comps::ksMqttConnector, ksf::comps::ksResetButton, ksf::comps::ksWifiConfigurator, and ksf::comps::ksWifiConnector.

Referenced by ksf::comps::ksMqttConnector::init().

◆ isA()

virtual bool ksf::ksComponent::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::ksRtti.

Reimplemented in ksf::comps::ksConfigProvider, ksf::comps::ksDevicePortal, ksf::comps::ksDevStatMqttReporter, ksf::comps::ksLed, ksf::comps::ksMqttConfigProvider, ksf::comps::ksMqttConnector, ksf::comps::ksResetButton, ksf::comps::ksWifiConfigurator, and ksf::comps::ksWifiConnector.

◆ loop()

bool ksf::ksComponent::loop ( ksApplication * app)
virtual

Handles component loop logic, called from application loop.

Parameters
appPointer to the parent ksApplication.
Returns
True on success, false on fail.

Reimplemented in ksf::comps::ksDevicePortal, ksf::comps::ksDevStatMqttReporter, ksf::comps::ksLed, ksf::comps::ksMqttConnector, ksf::comps::ksResetButton, ksf::comps::ksWifiConfigurator, and ksf::comps::ksWifiConnector.

◆ postInit()

bool ksf::ksComponent::postInit ( ksApplication * app)
virtual

Method called after component initialization, used to setup references to other components.

Parameters
appPointer to the parent ksApplication.
Returns
True on success, false on fail.

Reimplemented in ksf::comps::ksDevicePortal, ksf::comps::ksDevStatMqttReporter, ksf::comps::ksMqttConnector, and ksf::comps::ksWifiConfigurator.

Member Data Documentation

◆ componentState

ksComponentState::TYPE ksf::ksComponent::componentState { ksComponentState::NotInitialized }
protected

Current component state.


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