|
LSH-Core
A robust C++ framework for Arduino-based home automation nodes
|
A class that represents a clickable object, like a button, and its associated logic. More...
#include <clickable.hpp>

Public Member Functions | |
| constexpr | Clickable (uint8_t pin, uint8_t uniqueId) noexcept |
| Construct a new Clickable object, conventional IO version. | |
| auto | getState () -> bool |
| Get the state of the clickable if configured as INPUT with its external pulldown resistor (PIN -> BUTTON -> +12v/+5V). | |
| void | setIndex (uint8_t indexToSet) |
| Store the Clickable index on Clickables namespace Array. | |
| auto | setClickableShort (bool shortClickable) -> Clickable & |
| Set clickable short clickability. | |
| auto | setClickableLong (bool longClickable, constants::LongClickType clickType=constants::LongClickType::NORMAL, bool networkClickable=false, constants::NoNetworkClickType fallback=constants::NoNetworkClickType::LOCAL_FALLBACK) -> Clickable & |
| Set clickable long clickability locally and over network. | |
| auto | setClickableSuperLong (bool superLongClickable, constants::SuperLongClickType clickType=constants::SuperLongClickType::NORMAL, bool networkClickable=false, constants::NoNetworkClickType fallback=constants::NoNetworkClickType::LOCAL_FALLBACK) -> Clickable & |
| Set clickable super long clickability locally and over network. | |
| auto | addActuator (uint8_t actuatorIndex, constants::ClickType actuatorType) -> Clickable & |
| Add an actuator to a list of actuators controlled by the clickable. | |
| auto | addActuatorShort (uint8_t actuatorIndex) -> Clickable & |
| Add a short click actuator. | |
| auto | addActuatorLong (uint8_t actuatorIndex) -> Clickable & |
| Add a long click actuator. | |
| auto | addActuatorSuperLong (uint8_t actuatorIndex) -> Clickable & |
| Add a super long click actuator. | |
| auto | setDebounceTime (uint8_t timeToSet_ms) -> Clickable & |
| Set debounce time. | |
| auto | setLongClickTime (uint16_t timeToSet_ms) -> Clickable & |
| Set long click time. | |
| auto | setSuperLongClickTime (uint16_t timeToSet_ms) -> Clickable & |
| Set super long click time. | |
| auto | getIndex () const -> uint8_t |
| Get the Clickable index on Clickables namespace Array. | |
| auto | getId () const -> uint8_t |
| Get the unique ID of the clickable. | |
| auto | getActuators (constants::ClickType actuatorType) const -> const etl::ivector< uint8_t > * |
| Get the const vector of attached actuators. | |
| auto | getTotalActuators (constants::ClickType actuatorType) const -> uint8_t |
| Get the number of attached actuators of one kind. | |
| auto | getLongClickType () const -> constants::LongClickType |
| Get the type of long click. | |
| auto | isNetworkClickable (constants::ClickType clickType) const -> bool |
| Get if the clickable performs network clicks. | |
| auto | getNetworkFallback (constants::ClickType clickType) const -> constants::NoNetworkClickType |
| Get the fallback type for a network click type. | |
| auto | getSuperLongClickType () const -> constants::SuperLongClickType |
| Get the type of super long click. | |
| auto | check () -> bool |
| Validates the clickable's configuration. | |
| auto | shortClick () const -> bool |
| Perform a short click action. | |
| auto | longClick () const -> bool |
| Perform a long click action. | |
| auto | superLongClickSelective () const -> bool |
| Perform a super long click selective action. | |
| auto | clickDetection () -> constants::ClickResult |
| Perform the clickable state detection. | |
| void | resizeVectors () |
| Resize vectors to actual needed size. | |
Protected Attributes | |
| uint8_t | debounce_ms = constants::timings::CLICKABLE_DEBOUNCE_TIME_MS |
| Debounce time in ms. | |
A class that represents a clickable object, like a button, and its associated logic.
|
inlineexplicitconstexprnoexcept |
Construct a new Clickable object, conventional IO version.
| pin | pin number |
| uniqueId | unique ID of the clickable. |
| auto Clickable::addActuator | ( | uint8_t | actuatorIndex, |
| constants::ClickType | actuatorType | ||
| ) | -> Clickable & |
Add an actuator to a list of actuators controlled by the clickable.
| actuatorIndex | the actuator index to be attached. |
| actuatorType | the type of the actuator. |
| auto Clickable::addActuatorLong | ( | uint8_t | actuatorIndex | ) | -> Clickable & |
Add a long click actuator.
| actuatorIndex | actuator index to be attached. |
| auto Clickable::addActuatorShort | ( | uint8_t | actuatorIndex | ) | -> Clickable & |
Add a short click actuator.
| actuatorIndex | actuator index to be attached. |
| auto Clickable::addActuatorSuperLong | ( | uint8_t | actuatorIndex | ) | -> Clickable & |
Add a super long click actuator.
| actuatorIndex | actuator index to be attached. |
| auto Clickable::check | ( | ) | -> bool |
Validates the clickable's configuration.
A clickable is considered valid if it's enabled for at least one click type (short, long, or super-long) AND is configured to control at least one actuator. This check also sets internal optimization flags.
| auto Clickable::clickDetection | ( | ) | -> constants::ClickResult |
Perform the clickable state detection.

| auto Clickable::getActuators | ( | constants::ClickType | actuatorType | ) | const -> const etl::ivector<uint8_t> * |
Get the const vector of attached actuators.
| actuatorType | the type of actuator vector to get. |
| auto Clickable::getId | ( | ) | const -> uint8_t |
Get the unique ID of the clickable.

| auto Clickable::getIndex | ( | ) | const -> uint8_t |
Get the Clickable index on Clickables namespace Array.
| auto Clickable::getLongClickType | ( | ) | const -> constants::LongClickType |
Get the type of long click.
| auto Clickable::getNetworkFallback | ( | constants::ClickType | clickType | ) | const -> constants::NoNetworkClickType |
Get the fallback type for a network click type.
| clickType | the click type. |
|
inline |
Get the state of the clickable if configured as INPUT with its external pulldown resistor (PIN -> BUTTON -> +12v/+5V).
| auto Clickable::getSuperLongClickType | ( | ) | const -> constants::SuperLongClickType |
Get the type of super long click.
| auto Clickable::getTotalActuators | ( | constants::ClickType | actuatorType | ) | const -> uint8_t |
Get the number of attached actuators of one kind.
| actuatorType | the type of the actuator. |

| auto Clickable::isNetworkClickable | ( | constants::ClickType | clickType | ) | const -> bool |
Get if the clickable performs network clicks.
| clickType | for which click type you want to know the network clickability. |
| auto Clickable::longClick | ( | ) | const -> bool |
Perform a long click action.
The action depends on the longClickType configuration. If NORMAL -> Switch ON if less than half of attached long actuators are OFF, switch OFF otherwise. If ON_ONLY -> Switch ON attached long actuators. If OFF_ONLY -> Switch OFF attached long actuators.

| auto Clickable::setClickableLong | ( | bool | longClickable, |
| constants::LongClickType | clickType = constants::LongClickType::NORMAL, |
||
| bool | networkClickable = false, |
||
| constants::NoNetworkClickType | fallback = constants::NoNetworkClickType::LOCAL_FALLBACK |
||
| ) | -> Clickable & |
Set clickable long clickability locally and over network.
| longClickable | if the clickable is long clickable. |
| clickType | to set the type of long click. |
| networkClickable | if the clickable is long clickable over network. |
| fallback | the fallback type (if network isn't working). |
| auto Clickable::setClickableShort | ( | bool | shortClickable | ) | -> Clickable & |
Set clickable short clickability.
| shortClickable | if the clickable is short clickable. |
| auto Clickable::setClickableSuperLong | ( | bool | superLongClickable, |
| constants::SuperLongClickType | clickType = constants::SuperLongClickType::NORMAL, |
||
| bool | networkClickable = false, |
||
| constants::NoNetworkClickType | fallback = constants::NoNetworkClickType::LOCAL_FALLBACK |
||
| ) | -> Clickable & |
Set clickable super long clickability locally and over network.
| superLongClickable | if the clickable is super long clickable. |
| clickType | to set the type of super long click. |
| networkClickable | if the clickable is super long clickable over network. |
| fallback | the fallback type (if network isn't working). |
| auto Clickable::setDebounceTime | ( | uint8_t | timeToSet_ms | ) | -> Clickable & |
Set debounce time.
| timeToSet_ms | debounce time in ms. |
| void Clickable::setIndex | ( | uint8_t | indexToSet | ) |
Store the Clickable index on Clickables namespace Array.
| indexToSet | index to set. |

| auto Clickable::setLongClickTime | ( | uint16_t | timeToSet_ms | ) | -> Clickable & |
Set long click time.
| timeToSet_ms | long click time in ms. |
| auto Clickable::setSuperLongClickTime | ( | uint16_t | timeToSet_ms | ) | -> Clickable & |
Set super long click time.
| timeToSet_ms | super long click time in ms. |
| auto Clickable::shortClick | ( | ) | const -> bool |
Perform a short click action.
It toggles the state of the actuator, if it was ON it turns it OFF and vice versa.
| auto Clickable::superLongClickSelective | ( | ) | const -> bool |
Perform a super long click selective action.
Turns off super long unprotected actuators.