SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
click_type.h
Go to the documentation of this file.
1#ifndef SENSESP_TRANSFORMS_CLICK_TYPE_H_
2#define SENSESP_TRANSFORMS_CLICK_TYPE_H_
3
4#include <elapsedMillis.h>
5
7#include "transform.h"
8
9namespace sensesp {
10
23
29class ClickType : public Transform<bool, ClickTypes> {
30 public:
51 ClickType(const String& config_path = "", uint16_t long_click_delay = 1300,
52 uint16_t double_click_interval = 400,
53 uint16_t ultra_long_click_delay = 5000);
54
60 static bool is_click(ClickTypes value);
61
62 virtual void set(const bool& input) override;
63 virtual bool to_json(JsonObject& root) override;
64 virtual bool from_json(const JsonObject& config) override;
65
66 protected:
71
72 // User Configuration variables...
73
77
81
85
87 elapsedMillis press_duration_;
88
90 elapsedMillis release_duration_;
91
96 reactesp::DelayEvent* delayed_click_report_{};
97
99 void on_button_press();
100
102 void on_button_release();
103
107 void on_ultra_long_click();
108
113 void on_click_completed();
114
121 void emitDelayed(ClickTypes value);
122};
123
124const String ConfigSchema(const ClickType& obj);
125
126} // namespace sensesp
127
128#endif
ClickType is a transform that consumes button clicks and translates them as events of type ClickTypes...
Definition click_type.h:29
void emitDelayed(ClickTypes value)
elapsedMillis press_duration_
Timmer to time button presses.
Definition click_type.h:87
virtual bool from_json(const JsonObject &config) override
elapsedMillis release_duration_
Timer to time interval between button releases.
Definition click_type.h:90
uint16_t long_click_delay_
Definition click_type.h:76
reactesp::DelayEvent * delayed_click_report_
Definition click_type.h:96
uint16_t double_click_interval_
Definition click_type.h:84
ClickType(const String &config_path="", uint16_t long_click_delay=1300, uint16_t double_click_interval=400, uint16_t ultra_long_click_delay=5000)
Definition click_type.cpp:8
virtual void set(const bool &input) override
void on_button_press()
Processes incoming values that represent a "ButonPress" event.
void on_button_release()
Processes incoming value that represent a "ButtonRelease" event.
static bool is_click(ClickTypes value)
virtual bool to_json(JsonObject &root) override
uint16_t ultra_long_click_delay_
Definition click_type.h:80
The main Transform class. A transform is identified primarily by the type of value that is produces (...
Definition transform.h:53
const String ConfigSchema(const SmartSwitchController &obj)