|
Lamp-Da 0.1
A compact lantern project
|
Define a command destined to the user layer. Command can only be created by the static make_* methods. More...
#include <user_commands.h>
Public Types | |
| enum class | Type { Invalid , SetUserRamp , Brightness , SetMode , OnOff , SetRealTime , SetSunsetToTime , SetSunriseToTime , SetBleCustomColorMode , SetBleMode , GoToFavoriteIndex , SetFavoriteIndex , SignalSunsetProgress , SignalSunriseProgress , SignalSuntimerCancel , BlipOutput , PrintStatus , PrintFavorites , DisableSunTimer , SetMicSensitivity } |
| Command type. More... | |
Public Member Functions | |
| Type | get_type () const |
| bool | parse_ramp (uint8_t &ramp) const |
| Parse the current command for a ramp value. | |
| bool | parse_brightness (brightness_t &brightness) const |
| Parse the current command for a brightness value. | |
| bool | parse_set_mode (uint8_t &groupId, uint8_t &modeId) const |
| Parse the current command for a set_mode values. | |
| bool | parse_turn_onoff (bool &shouldTurnOn) const |
| Parse the current command for a on/off value. | |
| bool | parse_set_real_time_command (component::time::RealTime &time) const |
| Parse the current command for a set real time value. | |
| bool | parse_set_sunset_to_time_command (component::time::RealTime &time) const |
| Parse the current command for a set sunset to time value. | |
| bool | parse_set_sunrise_to_time_command (component::time::RealTime &time) const |
| Parse the current command for a set sunrise to time value. | |
| bool | parse_set_ble_custom_color_mode_command (uint32_t &color) const |
| Parse the current command for a set current mode to BLE custom color. | |
| bool | parse_set_ble_mode_command (uint8_t &index) const |
| Parse the current command for a set current mode to BLE mode. | |
| bool | parse_go_to_favorite_command (uint8_t &index) const |
| Parse the current command for a go to favorite. | |
| bool | parse_set_favorite_command (uint8_t &index) const |
| Parse the current command for a set favorite. | |
| bool | parse_signal_sunset_progress_command (float &progress) const |
| Parse the current command for a sunset update signal. | |
| bool | parse_signal_sunrise_progress_command (float &progress) const |
| Parse the current command for a sunrise update signal. | |
| bool | parse_signal_suntimer_cancel_command () const |
| Parse the current command for a suntimer cancel signal. | |
| bool | parse_disable_sun_timer_command (bool &isSunrise) const |
| Parse the current command for a sun timer disable. | |
| bool | parse_set_mic_sensitivity_command (uint8_t &sensitivity) const |
| Parse the current command for a microphone sensitivity change. | |
| bool | parse_blip_output_command (uint32_t &duration_ms) const |
| Parse the current command for an output blip. | |
| bool | parse_print_status_command () const |
| Parse the current command for a status print. | |
| bool | parse_print_favorites_command () const |
| Parse the current command for a favorites print. | |
Static Public Member Functions | |
| static UserCommand | make_set_ramp_command (const uint8_t ramp) |
| Set this commant to handle user ramp change. | |
| static UserCommand | make_brightness_command (const brightness_t brightness) |
| Set this commant to handle brightness. | |
| static UserCommand | make_set_mode_command (const uint8_t groupId, const uint8_t modeId) |
| Set this commant to handle mode switch. | |
| static UserCommand | make_turn_onoff_command (const bool shouldTurnOn) |
| Set this commant to handle turn on/off. | |
| static UserCommand | make_set_real_time_command (const component::time::RealTime &time) |
| Set this commant to set system real time. | |
| static UserCommand | make_set_sunset_to_time_command (const component::time::RealTime &time) |
| Set this commant to set sunset to real time. | |
| static UserCommand | make_set_sunrise_to_time_command (const component::time::RealTime &time) |
| Set this commant to set sunrise to real time. | |
| static UserCommand | make_set_ble_custom_color_mode_command (const uint8_t red, const uint8_t green, const uint8_t blue) |
| Set this commant to set ble custom color. | |
| static UserCommand | make_set_ble_mode_command (const uint8_t index) |
| Set this commant to set ble mode. | |
| static UserCommand | make_go_to_favorite_command (const uint8_t index) |
| Set this commant to go to the given favorite, if possible. | |
| static UserCommand | make_set_favorite_command (const uint8_t index) |
| Set this commant to set favorite. | |
| static UserCommand | make_signal_sunset_progress_command (const float progress) |
| Set this commant to signal a sunset update. | |
| static UserCommand | make_signal_sunrise_progress_command (const float progress) |
| Set this commant to signal a sunrise update. | |
| static UserCommand | make_signal_suntimer_cancel_command () |
| Set this commant to signal a suntimer cancel event. | |
| static UserCommand | make_disable_sun_timer_command (const bool isSunrise) |
| Set this command to disable a sun timer. A disabled sunrise keeps the brightness it reached, as for a user brightness change. | |
| static UserCommand | make_set_mic_sensitivity_command (const uint8_t sensitivity) |
| Set this command to set the microphone sensitivity. | |
| static UserCommand | make_blip_output_command (const uint32_t duration_ms) |
| Set this commant to blip the output. | |
| static UserCommand | make_print_status_command () |
| Set this commant to print the user status line. | |
| static UserCommand | make_print_favorites_command () |
| Set this commant to print the favorite modes infos. | |
Static Public Attributes | |
| static constexpr uint8_t | maxDataSize = 8 |
Protected Member Functions | |
| UserCommand () | |
| Protected constructor to prevent unallowed uses. | |
Define a command destined to the user layer. Command can only be created by the static make_* methods.
|
strong |
Command type.
|
static |
Set this commant to blip the output.
| [in] | duration_ms |
|
static |
Set this commant to handle brightness.
| [in] | brightness |
|
static |
Set this command to disable a sun timer. A disabled sunrise keeps the brightness it reached, as for a user brightness change.
| [in] | isSunrise | True to disable the sunrise timer, false for the sunset timer |
|
static |
Set this commant to go to the given favorite, if possible.
| [in] | index |
|
static |
Set this commant to print the favorite modes infos.
|
static |
Set this commant to print the user status line.
|
static |
Set this commant to set ble custom color.
| [in] | red | |
| [in] | green | |
| [in] | blue |
|
static |
Set this commant to set ble mode.
| [in] | index |
|
static |
Set this commant to set favorite.
| [in] | index |
|
static |
Set this command to set the microphone sensitivity.
| [in] | sensitivity | Sensitivity, see component::microphone::set_sensitivity |
|
static |
Set this commant to handle mode switch.
| [in] | groupId | |
| [in] | modeId |
|
static |
Set this commant to handle user ramp change.
| [in] | ramp |
|
static |
Set this commant to set system real time.
| [in] | time |
|
static |
Set this commant to set sunrise to real time.
| [in] | time |
|
static |
Set this commant to set sunset to real time.
| [in] | time |
|
static |
Set this commant to signal a sunrise update.
| [in] | progress |
|
static |
Set this commant to signal a sunset update.
| [in] | progress |
|
static |
Set this commant to signal a suntimer cancel event.
|
static |
Set this commant to handle turn on/off.
| [in] | shouldTurnOn |
| bool lampda::common::UserCommand::parse_blip_output_command | ( | uint32_t & | duration_ms | ) | const |
Parse the current command for an output blip.
| [out] | duration_ms |
| bool lampda::common::UserCommand::parse_brightness | ( | brightness_t & | brightness | ) | const |
Parse the current command for a brightness value.
| [out] | brightness |
| bool lampda::common::UserCommand::parse_disable_sun_timer_command | ( | bool & | isSunrise | ) | const |
Parse the current command for a sun timer disable.
| [out] | isSunrise | True if the sunrise timer must be disabled, false for the sunset timer |
| bool lampda::common::UserCommand::parse_go_to_favorite_command | ( | uint8_t & | index | ) | const |
Parse the current command for a go to favorite.
| [out] | index |
| bool lampda::common::UserCommand::parse_print_favorites_command | ( | ) | const |
Parse the current command for a favorites print.
| bool lampda::common::UserCommand::parse_print_status_command | ( | ) | const |
Parse the current command for a status print.
| bool lampda::common::UserCommand::parse_ramp | ( | uint8_t & | ramp | ) | const |
Parse the current command for a ramp value.
Parsing functions
| [out] | ramp |
| bool lampda::common::UserCommand::parse_set_ble_custom_color_mode_command | ( | uint32_t & | color | ) | const |
Parse the current command for a set current mode to BLE custom color.
| [out] | color |
| bool lampda::common::UserCommand::parse_set_ble_mode_command | ( | uint8_t & | index | ) | const |
Parse the current command for a set current mode to BLE mode.
| [out] | index |
| bool lampda::common::UserCommand::parse_set_favorite_command | ( | uint8_t & | index | ) | const |
Parse the current command for a set favorite.
| [out] | index |
| bool lampda::common::UserCommand::parse_set_mic_sensitivity_command | ( | uint8_t & | sensitivity | ) | const |
Parse the current command for a microphone sensitivity change.
| [out] | sensitivity | The requested sensitivity |
| bool lampda::common::UserCommand::parse_set_mode | ( | uint8_t & | groupId, |
| uint8_t & | modeId | ||
| ) | const |
Parse the current command for a set_mode values.
| [out] | groupId | |
| [out] | modeId |
| bool lampda::common::UserCommand::parse_set_real_time_command | ( | component::time::RealTime & | time | ) | const |
Parse the current command for a set real time value.
| [out] | time |
| bool lampda::common::UserCommand::parse_set_sunrise_to_time_command | ( | component::time::RealTime & | time | ) | const |
Parse the current command for a set sunrise to time value.
| [out] | time |
| bool lampda::common::UserCommand::parse_set_sunset_to_time_command | ( | component::time::RealTime & | time | ) | const |
Parse the current command for a set sunset to time value.
| [out] | time |
| bool lampda::common::UserCommand::parse_signal_sunrise_progress_command | ( | float & | progress | ) | const |
Parse the current command for a sunrise update signal.
| [out] | progress |
| bool lampda::common::UserCommand::parse_signal_sunset_progress_command | ( | float & | progress | ) | const |
Parse the current command for a sunset update signal.
| [out] | progress |
| bool lampda::common::UserCommand::parse_signal_suntimer_cancel_command | ( | ) | const |
Parse the current command for a suntimer cancel signal.
| bool lampda::common::UserCommand::parse_turn_onoff | ( | bool & | shouldTurnOn | ) | const |
Parse the current command for a on/off value.
| [out] | shouldTurnOn |