@@ -15,9 +15,7 @@ FSTR(BUTTONSTATE, longPress); // Long press state value
15
15
FSTR (BUTTONSTATE, setSmartButtonState); // Set state action name
16
16
17
17
// Callback type definitions for different button press events
18
- using SmartButtonSinglePressCallback = std::function<bool (const String &)>;
19
- using SmartButtonDoublePressCallback = std::function<bool (const String &)>;
20
- using SmartButtonLongPressCallback = std::function<bool (const String &)>;
18
+ using SmartButtonPressCallback = std::function<bool (const String &)>;
21
19
22
20
/* *
23
21
* @brief Controller class for managing smart button state and interactions
@@ -37,19 +35,19 @@ class SmartButtonStateController {
37
35
* @brief Register callback for single press event from app
38
36
* @param cb Callback function to handle single press
39
37
*/
40
- void onSinglePress (SmartButtonSinglePressCallback cb);
38
+ void onSinglePress (SmartButtonPressCallback cb);
41
39
42
40
/* *
43
41
* @brief Register callback for double press event from app
44
42
* @param cb Callback function to handle double press
45
43
*/
46
- void onDoublePress (SmartButtonDoublePressCallback cb);
44
+ void onDoublePress (SmartButtonPressCallback cb);
47
45
48
46
/* *
49
47
* @brief Register callback for long press event from app
50
48
* @param cb Callback function to handle long press
51
49
*/
52
- void onLongPress (SmartButtonLongPressCallback cb);
50
+ void onLongPress (SmartButtonPressCallback cb);
53
51
54
52
protected:
55
53
/* *
@@ -60,9 +58,9 @@ class SmartButtonStateController {
60
58
bool handleSmartButtonStateController (SinricProRequest &request);
61
59
62
60
private:
63
- SmartButtonSinglePressCallback smartButtonSinglePressCallback;
64
- SmartButtonDoublePressCallback smartButtonDoublePressCallback;
65
- SmartButtonLongPressCallback smartButtonLongPressCallback;
61
+ SmartButtonPressCallback smartButtonSinglePressCallback;
62
+ SmartButtonPressCallback smartButtonDoublePressCallback;
63
+ SmartButtonPressCallback smartButtonLongPressCallback;
66
64
67
65
/* *
68
66
* returns true if states match, false otherwise
@@ -85,17 +83,17 @@ SmartButtonStateController<T>::SmartButtonStateController() {
85
83
}
86
84
87
85
template <typename T>
88
- void SmartButtonStateController<T>::onSinglePress(SmartButtonSinglePressCallback cb) {
86
+ void SmartButtonStateController<T>::onSinglePress(SmartButtonPressCallback cb) {
89
87
smartButtonSinglePressCallback = cb;
90
88
}
91
89
92
90
template <typename T>
93
- void SmartButtonStateController<T>::onDoublePress(SmartButtonDoublePressCallback cb) {
91
+ void SmartButtonStateController<T>::onDoublePress(SmartButtonPressCallback cb) {
94
92
smartButtonDoublePressCallback = cb;
95
93
}
96
94
97
95
template <typename T>
98
- void SmartButtonStateController<T>::onLongPress(SmartButtonLongPressCallback cb) {
96
+ void SmartButtonStateController<T>::onLongPress(SmartButtonPressCallback cb) {
99
97
smartButtonLongPressCallback = cb;
100
98
}
101
99
0 commit comments