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

Forward declaration. More...

Functions

void addClickable (Clickable *const clickable)
 Adds a clickable to the system.
 
auto getClickable (uint8_t clickableId) -> Clickable *
 Get a single clickable.
 
auto getIndex (uint8_t clickableId) -> uint8_t
 Get a single clickable index (in device vector of clickable).
 
auto clickableExists (uint8_t clickableId) -> bool
 Get if the clickable actually exists.
 
auto click (const Clickable *const clickable, constants::ClickType clickType) -> bool
 Perform a click.
 
auto click (uint8_t clickableIndex, constants::ClickType clickType) -> bool
 Perform a click action.
 
void finalizeSetup ()
 Resize vectors of all clickables to the actual needed size.
 

Variables

uint8_t totalClickables = 0U
 Device real total Clickables.
 
etl::array< Clickable *, CONFIG_MAX_CLICKABLES > clickables {}
 Device clickables.
 
etl::map< uint8_t, uint8_t, CONFIG_MAX_CLICKABLES > clickablesMap {}
 Device clickables map (UUID -> clickables index)
 

Detailed Description

Forward declaration.

Globally stores all clickables (like buttons) and to operates over them.

Function Documentation

◆ addClickable()

void Clickables::addClickable ( Clickable *const  clickable)

Adds a clickable to the system.

The clickable is stored in the main array and its ID is mapped to its index for fast lookups. If the maximum number of clickables is exceeded, the device will reset to prevent undefined behavior.

Parameters
clickableA pointer to the Clickable object to add.
Here is the call graph for this function:

◆ click() [1/2]

auto Clickables::click ( const Clickable *const  clickable,
constants::ClickType  clickType 
) -> bool

Perform a click.

Method for all types of clicks, since not all click can be done within clickable class.

Parameters
clickablethe clickable to click.
clickTypethe click type to perform.
Returns
true if any actuator state has been changed.
false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ click() [2/2]

auto Clickables::click ( uint8_t  clickableIndex,
constants::ClickType  clickType 
) -> bool

Perform a click action.

This helper function centralizes all click-related logic...

Parameters
clickableIndexThe index of the clickable to click.
clickTypeThe click type to perform.
Returns
true if any actuator state was changed.
false otherwise.
Here is the call graph for this function:

◆ clickableExists()

auto Clickables::clickableExists ( uint8_t  clickableId) -> bool

Get if the clickable actually exists.

Parameters
clickableIdUnique ID of the clickable.
Returns
true if clickable exists.
false if clickable doesn't exist.

◆ getClickable()

auto Clickables::getClickable ( uint8_t  clickableId) -> Clickable *

Get a single clickable.

Parameters
clickableIdclickable UUID.
Returns
Clickable* a single clickable.

◆ getIndex()

auto Clickables::getIndex ( uint8_t  clickableId) -> uint8_t

Get a single clickable index (in device vector of clickable).

Parameters
clickableIdclickable UUID.
Returns
uint8_t a single clickable index (in device vector of clickable).

Variable Documentation

◆ clickablesMap

etl::map< uint8_t, uint8_t, CONFIG_MAX_CLICKABLES > Clickables::clickablesMap {}

Device clickables map (UUID -> clickables index)

Device clickables map (UUID (numeric)-> clickables index)