|
|
static constexpr size_t | to_index (const Behavior behavior) |
| |
|
static constexpr bool | has_click_action (const Behavior behavior) |
| |
|
static constexpr bool | has_hold_action (const Behavior behavior) |
| |
|
static constexpr bool | share_an_action (const Behavior a, const Behavior b) |
| | Two behaviors using the same action cannot share a click count.
|
| |
|
static bool | is_allowed (const Behavior behavior, const uint8_t clicks) |
| |
|
static bool | is_coherent (const std::array< uint8_t, behaviorCount > &clicks) |
| | Check that every behavior of this lamp is on an allowed click count, and alone on its actions.
|
| |
|
uint8_t | get_min_clicks (const Behavior behavior) |
| | Return the lowest click count this behavior can be linked to.
|
| |
|
bool | is_supported (const Behavior behavior) |
| | Return true if this lamp type has this behavior.
|
| |
|
Behavior | get_click_behavior (const uint8_t clicks) |
| | Return the behavior whose click action is linked to this click count, or Behavior::None.
|
| |
|
Behavior | get_hold_behavior (const uint8_t clicks) |
| | Return the behavior whose hold action is linked to this click count, or Behavior::None.
|
| |
|
uint8_t | get_clicks (const Behavior behavior) |
| | Return the click count linked to this behavior, or 0 if this lamp type does not have this behavior.
|
| |
|
const char * | get_name (const Behavior behavior) |
| | Return the name of this behavior, as used by the command line.
|
| |
| Behavior | get_behavior_from_name (const char *name) |
| | Find a behavior from its command line name.
|
| |
| SetResult | set_binding (const Behavior behavior, const uint8_t clicks) |
| | Link a behavior to a click count.
|
| |
|
void | reset_to_defaults () |
| | Restore the default links.
|
| |
|
void | load_from_memory () |
| | Load the links from the user parameters. Missing or incoherent values give the default links.
|
| |
|
void | write_to_memory () |
| | Store the links in the user parameters.
|
| |
|
|
static constexpr uint32_t | storageKey = utils::hash("btnBindings") & 0x7fffffffu |
| | Modes store their named keys on 31 bits, and their indexed keys above. Stay out of the indexed key space.
|
| |
|
static constexpr size_t | storedBitsPerBehavior = 4 |
| | Number of stored bits per behavior, enough for maxClicks.
|
| |
|
static constexpr std::array< uint8_t, behaviorCount > | defaultClicks = {4, 6, 5, 3, 7, 6} |
| |
| static constexpr std::array< const char *, behaviorCount > | names |
| |
|
static std::array< uint8_t, behaviorCount > | currentClicks = defaultClicks |
| |
|
static constexpr size_t | behaviorCount = static_cast<size_t>(Behavior::None) |
| | Number of configurable behaviors.
|
| |
|
static constexpr uint8_t | maxClicks = 9 |
| | Highest click count a behavior can be linked to.
|
| |
Handle the links between click counts and the configurable default behaviors.