LSH-Core
Deterministic firmware core for Controllino-based Labo Smart Home nodes
 
Loading...
Searching...
No Matches
clickable_manager.hpp
Go to the documentation of this file.
1
21#ifndef LSH_CORE_DEVICE_CLICKABLE_MANAGER_HPP
22#define LSH_CORE_DEVICE_CLICKABLE_MANAGER_HPP
23
24#include <stdint.h>
25
28
29class Clickable;
30
35namespace Clickables
36{
37#if defined(LSH_DEBUG) || defined(LSH_STATIC_CONFIG_RUNTIME_CHECKS)
38extern etl::array<Clickable *, CONFIG_MAX_CLICKABLES> clickables;
39#endif
40
41[[nodiscard]] auto getId(uint8_t clickableIndex) -> uint8_t; // Returns the static clickable ID for one dense runtime index
42[[nodiscard]] auto getClickable(uint8_t clickableId) -> Clickable *; // Returns a single clickable, or nullptr if the ID is unknown
43[[nodiscard]] auto getIndex(uint8_t clickableId) -> uint8_t; // Returns a single clickable index, or UINT8_MAX if the ID is unknown
44[[nodiscard]] auto tryGetIndex(uint8_t clickableId, uint8_t &clickableIndex)
45 -> bool; // Returns true and writes the clickable index when the ID exists
46[[nodiscard]] auto clickableExists(uint8_t clickableId) -> bool; // Returns true if clickable exists
47void finalizeSetup();
48} // namespace Clickables
49
50#endif // LSH_CORE_DEVICE_CLICKABLE_MANAGER_HPP
A class that represents a clickable object, like a button, and its associated logic.
Definition clickable.hpp:42
Safe wrapper for ETL array with Arduino min/max macros neutralized locally.
Globally stores all clickables (like buttons) and to operates over them.
Definition clickable_manager.cpp:33
auto getId(uint8_t clickableIndex) -> uint8_t
Return the static wire ID for one registered clickable index.
Definition clickable_manager.cpp:91
void finalizeSetup()
Validate the configured clickable table before runtime checks start.
Definition clickable_manager.cpp:174
auto tryGetIndex(uint8_t clickableId, uint8_t &clickableIndex) -> bool
Resolves a clickable ID to its dense runtime index with a single map lookup.
Definition clickable_manager.cpp:143
auto clickableExists(uint8_t clickableId) -> bool
Get if the clickable actually exists.
Definition clickable_manager.cpp:161
auto getClickable(uint8_t clickableId) -> Clickable *
Get a single clickable.
Definition clickable_manager.cpp:103
auto getIndex(uint8_t clickableId) -> uint8_t
Get a single clickable index (in device vector of clickable).
Definition clickable_manager.cpp:125
Internal bridge that imports static profile resources into the library's scope.