supla-device
Loading...
Searching...
No Matches
button_aggregator.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_CONTROL_BUTTON_AGGREGATOR_H_
5#define SRC_SUPLA_CONTROL_BUTTON_AGGREGATOR_H_
6
7#include <supla/control/button.h>
8#include <stdint.h>
9
10#define BUTTON_AGGREGATOR_MAX_BUTTONS 10
11
12namespace Supla {
13namespace Control {
14
16 public:
18 virtual ~ButtonAggregator();
19
20 void onTimer() override;
21 void handleAction(int event, int action) override;
22 bool addButton(Supla::Control::Button* button);
23
24 protected:
25 Supla::Control::Button* buttons[BUTTON_AGGREGATOR_MAX_BUTTONS] = {};
26 int pressCount = 0;
27 int buttonCount = 0;
28 bool stateChanged = false;
29 uint32_t allPressedTimestamp = 0;
30};
31
32} // namespace Control
33} // namespace Supla
34
35#endif // SRC_SUPLA_CONTROL_BUTTON_AGGREGATOR_H_
Definition button_aggregator.h:15
void onTimer() override
Method called on timer interupt.
Definition button_aggregator.cpp:18
Definition button.h:21