SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
|
ClickType is a transform that consumes button clicks and translates them as events of type ClickTypes
.
More...
#include <sensesp/transforms/click_type.h>
Static Public Member Functions | |
static bool | is_click (ClickTypes value) |
Static Public Member Functions inherited from sensesp::TransformBase | |
static const std::set< TransformBase * > & | get_transforms () |
Static Public Member Functions inherited from sensesp::Startable | |
static void | start_all () |
Protected Member Functions | |
void | on_button_press () |
Processes incoming values that represent a "ButonPress" event. | |
void | on_button_release () |
Processes incoming value that represent a "ButtonRelease" event. | |
void | on_ultra_long_click () |
void | on_click_completed () |
void | emitDelayed (ClickTypes value) |
Protected Member Functions inherited from sensesp::Configurable | |
virtual void | load_configuration () |
Protected Attributes | |
int | click_count_ |
uint16_t | long_click_delay_ |
uint16_t | ultra_long_click_delay_ |
uint16_t | double_click_interval_ |
elapsedMillis | press_duration_ |
Timmer to time button presses. | |
elapsedMillis | release_duration_ |
Timer to time interval between button releases. | |
DelayReaction * | delayed_click_report_ |
Protected Attributes inherited from sensesp::Configurable | |
String | description_ = "" |
int | sort_order_ = 1000 |
Protected Attributes inherited from sensesp::ValueProducer< T > | |
T | output |
Additional Inherited Members | |
Public Attributes inherited from sensesp::Configurable | |
const String | config_path_ |
ClickType is a transform that consumes button clicks and translates them as events of type ClickTypes
.
Definition at line 28 of file click_type.h.
sensesp::ClickType::ClickType | ( | String | config_path = "" , |
uint16_t | long_click_delay = 1300 , |
||
uint16_t | double_click_interval = 400 , |
||
uint16_t | ultra_long_click_delay = 5000 |
||
) |
The constructor
config_path | The configuration path to use if you want the end user to be able to change these values with the configuration UI. Leave as blank to disable this feature. |
long_click_delay | The number of milliseconds that an incoming button press must be held to differentiate between a SingleClick and a LongSingleClick. This value should be less than ultra_long_click_delay |
double_click_interval | The maximum number of milliseconds that can pass before two consecutive button presses are sent as two SingleClick events, or a single DoubleClick event. If the interval is less than or equal to double_click_interval milliseconds, a single DoubleClick event is emitted. |
ultra_long_click_delay | The number of milliseconds that an incoming button press must be held to register a single UltraLongSingleClick. Once a button has been held for ultra_long_click_delay milliseoncs, an UltraLongSingleClick is immediately emitted. This value should be longer than long_click_delay |
Definition at line 7 of file click_type.cpp.
|
protected |
Emits the specified value after a 5 millisecond delay. This allows translated click types like SingleClick and DoubleClick to be sent but delays its processing so the ClickTypes::ButtonReleased can propogate through the system.
Definition at line 124 of file click_type.cpp.
|
overridevirtual |
Returns a configuration schema that specifies the key/value pairs that can be expected when calling get_configuration(), or are expected by set_configuration(). The schema will be in JSON Schema format
Reimplemented from sensesp::Configurable.
Definition at line 159 of file click_type.cpp.
|
overridevirtual |
Returns the current configuration data as a JsonObject. In general, the current state of local member variables are saved to a new object created with JsonDocument::as<JsonObject>() and returned.
Reimplemented from sensesp::Configurable.
Definition at line 144 of file click_type.cpp.
|
static |
Returns TRUE if the specified value is one of the higher level click interpretations like SingleClick or UltraLongDoubleClick. It returns FALSE if the value is ButtonPress or ButtonRelease
Definition at line 27 of file click_type.cpp.
|
protected |
Processes incoming values that represent a "ButonPress" event.
Definition at line 32 of file click_type.cpp.
|
protected |
Processes incoming value that represent a "ButtonRelease" event.
Definition at line 68 of file click_type.cpp.
|
protected |
Resets click tracking variables after a press has been released so the next button press can be processed.
Definition at line 128 of file click_type.cpp.
|
protected |
Processes an ultra long click. Unlike the other click types, ultra long clicks are executed as soon as they pass the "ultra long"
Definition at line 135 of file click_type.cpp.
|
overridevirtual |
Sets the current state of local member variables using the data stored in config.
Reimplemented from sensesp::Configurable.
Definition at line 161 of file click_type.cpp.
|
protected |
A counter to specify how many clicks are currently being processed. Used to distinguish between single and double clicks.
Definition at line 70 of file click_type.h.
|
protected |
Holds a delayed "SingleClick" report that we can pull back if the second click of a double click comes through. This value will be NULL if no click report is currently queued up.
Definition at line 96 of file click_type.h.
|
protected |
The maximum number of milliseconds that can pass before two clicks in a row are combined into a single DoubleClick
Definition at line 84 of file click_type.h.
|
protected |
How many milliseconds a button is pressed to distinguish between a normal SingleClick and a LongSingleClick
Definition at line 76 of file click_type.h.
|
protected |
Timmer to time button presses.
Definition at line 87 of file click_type.h.
|
protected |
Timer to time interval between button releases.
Definition at line 90 of file click_type.h.
|
protected |
How many milliseoncs a button is pressed to distinguish between a normal SingleClick and an UltraLongSingleClick
Definition at line 80 of file click_type.h.