LSH-Core
A robust C++ framework for Arduino-based home automation nodes
Loading...
Searching...
No Matches
Indicator Class Reference

Represents a state indicator for one or more attached actuators, indicators are normally connected to a digital out. More...

#include <indicator.hpp>

Collaboration diagram for Indicator:
Collaboration graph

Public Member Functions

constexpr Indicator (uint8_t pin) noexcept
 Construct a new Indicator object using standard I/O.
 
void setState (bool stateToSet)
 Set the state of the indicator.
 
void setIndex (uint8_t indexToSet)
 Set the indicator index on Indicators namespace Array.
 
auto addActuator (uint8_t actuatorIndex) -> Indicator &
 Add one actuator to controlled controlledActuators vector.
 
auto setMode (constants::IndicatorMode indicatorMode) -> Indicator &
 Set the mode of the indicator.
 
void check ()
 Switch the indicator based on controlled actuators status.
 
void resizeVectors ()
 Resize controlled actuators vector to its actual size.
 
auto getIndex () const -> uint8_t
 Get the indicator index on Indicators namespace Array.
 

Detailed Description

Represents a state indicator for one or more attached actuators, indicators are normally connected to a digital out.

Constructor & Destructor Documentation

◆ Indicator()

constexpr Indicator::Indicator ( uint8_t  pin)
inlineexplicitconstexprnoexcept

Construct a new Indicator object using standard I/O.

Parameters
pinThe Arduino pin number for the indicator.

Member Function Documentation

◆ addActuator()

auto Indicator::addActuator ( uint8_t  actuatorIndex) -> Indicator &

Add one actuator to controlled controlledActuators vector.

Parameters
actuatorIndexindex of actuator to be added.
Returns
Indicator& the object instance.

◆ check()

void Indicator::check ( )

Switch the indicator based on controlled actuators status.

The behavior depends on mode setting:

If this->mode = ANY -> If any controlled actuator is ON switch ON the indicator, OFF otherwise. If this->mode = ALL -> If all controlled actuators are ON switch ON the indicator, OFF otherwise. If this->mode = MAJORITY -> If the majority of controlled actuators are ON switch ON the indicator, OFF otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIndex()

auto Indicator::getIndex ( ) const -> uint8_t

Get the indicator index on Indicators namespace Array.

Returns
uint8_t indicator index.

◆ setIndex()

void Indicator::setIndex ( uint8_t  indexToSet)

Set the indicator index on Indicators namespace Array.

Parameters
indexToSetindex to set.
Here is the caller graph for this function:

◆ setMode()

auto Indicator::setMode ( constants::IndicatorMode  indicatorMode) -> Indicator &

Set the mode of the indicator.

Parameters
indicatorModethe mode to set.
Returns
Indicator& the object instance.

◆ setState()

void Indicator::setState ( bool  stateToSet)
inline

Set the state of the indicator.

Parameters
stateToSetthe state to set true=ON, false=OFF.
Here is the caller graph for this function:

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