LSH-Core
A robust C++ framework for Arduino-based home automation nodes
Loading...
Searching...
No Matches
network_clicks.hpp
Go to the documentation of this file.
1
21#ifndef LSHCORE_CORE_NETWORK_CLICKS_HPP
22#define LSHCORE_CORE_NETWORK_CLICKS_HPP
23
24#include <etl/map.h>
25#include <stdint.h>
26
33namespace NetworkClicks
34{
35 extern etl::map<uint8_t, uint32_t, CONFIG_MAX_CLICKABLES> longClickedNetworkClickables;
36 extern etl::map<uint8_t, uint32_t, CONFIG_MAX_CLICKABLES> superLongClickedNetworkClickables;
37
38 // Network clicks
39 void request(uint8_t clickableIndex, constants::ClickType clickType); // Initiates a network click action.
40 [[nodiscard]] auto confirm(uint8_t clickableIndex, constants::ClickType clickType) -> bool; // Confirms a pending network click action after receiving an ACK
41 void storeNetworkClickTime(uint8_t clickableIndex, constants::ClickType clickType); // Store click time for a network attached clickable
42 [[nodiscard]] auto thereAreActiveNetworkCLicks() -> bool; // Returns if there are active stored network clicks
43 void eraseNetworkClick(uint8_t clickableIndex, constants::ClickType clickType); // Erase a stored network click
44 [[nodiscard]] auto isNetworkClickExpired(uint8_t clickableIndex, constants::ClickType clickType) -> bool; // Returns true if the timer of the clickable has passed the threshold, false otherwise
45 [[nodiscard]] auto checkNetworkClickTimer(uint8_t clickableIndex, constants::ClickType clickType, bool failover) -> bool; // Timeout checks for network clicked clickable, if the time it's over it performs local action and resets its timer
46 [[nodiscard]] auto checkAllNetworkClicksTimers(bool failover) -> bool; // Timeout checks for all network clicked clickables, if the time it's over it performs local action and resets its timer
47} // namespace NetworkClicks
48
49#endif // LSHCORE_CORE_NETWORK_CLICKS_HPP
Defines enums for various click types and fallback behaviors.
"static class" Used to store and check network clicks
Definition network_clicks.cpp:34
auto confirm(uint8_t clickableIndex, constants::ClickType clickType) -> bool
Confirms a pending network click action after receiving an ACK.
Definition network_clicks.cpp:101
void request(uint8_t clickableIndex, constants::ClickType clickType)
Initiates a network click action.
Definition network_clicks.cpp:87
etl::map< uint8_t, uint32_t, CONFIG_MAX_CLICKABLES > superLongClickedNetworkClickables
Map of super long clicked network clickable (<Clickable index, stored time>)
Definition network_clicks.cpp:77
auto checkAllNetworkClicksTimers(bool failover) -> bool
Timeout checks for all network clicked clickables.
Definition network_clicks.cpp:286
auto isNetworkClickExpired(uint8_t clickableIndex, constants::ClickType clickType) -> bool
Checks if a pending network click has expired.
Definition network_clicks.cpp:195
etl::map< uint8_t, uint32_t, CONFIG_MAX_CLICKABLES > longClickedNetworkClickables
Map of long clicked network clickable (<Clickable index, stored time>)
Definition network_clicks.cpp:76
auto thereAreActiveNetworkCLicks() -> bool
Get if there are active stored network clicks.
Definition network_clicks.cpp:150
void eraseNetworkClick(uint8_t clickableIndex, constants::ClickType clickType)
Erase a stored network click.
Definition network_clicks.cpp:161
void storeNetworkClickTime(uint8_t clickableIndex, constants::ClickType clickType)
Store click time for a network attached clickable.
Definition network_clicks.cpp:115
auto checkNetworkClickTimer(uint8_t clickableIndex, constants::ClickType clickType, bool failover) -> bool
Checks a specific pending network click for expiration or forced failover.
Definition network_clicks.cpp:237
ClickType
Clickable (like button) click types.
Definition clicktypes.hpp:36
Internal bridge that imports user-defined macros into the library's scope.