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

Represents an actuator (relay) attached to a digital pin. More...

#include <actuator.hpp>

Collaboration diagram for Actuator:
Collaboration graph

Public Member Functions

constexpr Actuator (uint8_t pin, uint8_t uniqueId, bool normalState=false) noexcept
 Construct a new Actuator object, conventional IO version.
 
auto setState (bool state) -> bool
 Set the new actuator state if the new state can be set.
 
void setIndex (uint8_t indexToSet)
 store the actuator index in Actuators namespace array.
 
auto setAutoOffTimer (uint32_t time_ms) -> Actuator &
 Set turn off timer, it represents the timer after that the actuator will be switched off.
 
auto setProtected (bool hasProtection) -> Actuator &
 Set protection against some turn ON/OFF behaviour.
 
auto getIndex () const -> uint8_t
 Get the actuator index on Actuators namespace array.
 
auto getId () const -> uint8_t
 Get the unique ID of the actuator.
 
auto getState () const -> bool
 Get the state of the actuator.
 
auto getDefaultState () const -> bool
 Get the default state of the actuator.
 
auto hasAutoOff () const -> bool
 Get if the actuator has a timer set.
 
auto getAutoOffTimer () const -> uint32_t
 Get the timer of the actuator in ms.
 
auto hasProtection () const -> bool
 Get if the actuators is protected against some turn ON/OFF behaviour.
 
auto toggleState () -> bool
 Switch the state of the actuator (if it was OFF is going to be ON and vice versa).
 
auto checkAutoOffTimer () -> bool
 Checks if auto off timer is over, switch OFF the actuator if it's over.
 

Detailed Description

Represents an actuator (relay) attached to a digital pin.

Constructor & Destructor Documentation

◆ Actuator()

constexpr Actuator::Actuator ( uint8_t  pin,
uint8_t  uniqueId,
bool  normalState = false 
)
inlineexplicitconstexprnoexcept

Construct a new Actuator object, conventional IO version.

Parameters
pinpin number
uniqueIdthe actuator unique id.
normalStatethe default state of the actuator.

Member Function Documentation

◆ checkAutoOffTimer()

auto Actuator::checkAutoOffTimer ( ) -> bool

Checks if auto off timer is over, switch OFF the actuator if it's over.

Returns
true if the state has been changed.
false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAutoOffTimer()

auto Actuator::getAutoOffTimer ( ) const -> uint32_t

Get the timer of the actuator in ms.

Returns
uint32_t the timer of the actuator in ms.

◆ getDefaultState()

auto Actuator::getDefaultState ( ) const -> bool

Get the default state of the actuator.

Returns
true if ON.
false if OFF.

◆ getId()

auto Actuator::getId ( ) const -> uint8_t

Get the unique ID of the actuator.

Returns
uint8_t unique ID of the actuator.
Here is the caller graph for this function:

◆ getIndex()

auto Actuator::getIndex ( ) const -> uint8_t

Get the actuator index on Actuators namespace array.

Returns
uint8_t actuator index.

◆ getState()

auto Actuator::getState ( ) const -> bool

Get the state of the actuator.

Returns
true if ON.
false if OFF.

◆ hasAutoOff()

auto Actuator::hasAutoOff ( ) const -> bool

Get if the actuator has a timer set.

Returns
true if has a timer.
false if it hasn't a timer.

◆ hasProtection()

auto Actuator::hasProtection ( ) const -> bool

Get if the actuators is protected against some turn ON/OFF behaviour.

Returns
true if it's protected.
false if it's not protected.

◆ setAutoOffTimer()

auto Actuator::setAutoOffTimer ( uint32_t  time_ms) -> Actuator &

Set turn off timer, it represents the timer after that the actuator will be switched off.

Parameters
time_mstimer time in ms, if set to 0 disable timer.
Returns
Actuator& the object instance.

◆ setIndex()

void Actuator::setIndex ( uint8_t  indexToSet)

store the actuator index in Actuators namespace array.

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

◆ setProtected()

auto Actuator::setProtected ( bool  hasProtection) -> Actuator &

Set protection against some turn ON/OFF behaviour.

Parameters
hasProtectionto set the property.
Returns
Actuator& the object instance.

◆ setState()

auto Actuator::setState ( bool  state) -> bool

Set the new actuator state if the new state can be set.

Parameters
statenew state to set.
Returns
true if the state has been applied.
false otherwise.
Here is the call graph for this function:

◆ toggleState()

auto Actuator::toggleState ( ) -> bool

Switch the state of the actuator (if it was OFF is going to be ON and vice versa).

Returns
true if the state has been changed.
false otherwise.

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