supla-device
Loading...
Searching...
No Matches
group_button_control_rgbw.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef SRC_SUPLA_CONTROL_GROUP_BUTTON_CONTROL_RGBW_H_
20#define SRC_SUPLA_CONTROL_GROUP_BUTTON_CONTROL_RGBW_H_
21
22#include <supla/action_handler.h>
23#include <supla/element.h>
24#include <supla/control/rgbw_base.h>
25
26#define SUPLA_MAX_GROUP_CONTROL_ELEMENTS 10
27
28namespace Supla::Control {
29
30class Button;
31class RGBWBase;
32
33class GroupButtonControlRgbw : public ActionHandler, public Element {
34 public:
35 explicit GroupButtonControlRgbw(Button *button = nullptr);
36 void attach(Button *button);
37 void addToGroup(RGBWBase *rgbwElement);
38
39 void onLoadConfig(SuplaDeviceClass *sdc) override;
40 void onInit() override;
41 void handleAction(int event, int action) override;
42
43 void setButtonControlType(int rgbwChannelNumber,
44 RGBWBase::ButtonControlType type);
45
46 private:
47 void handleTurnOn();
48 void handleTurnOff();
49 void handleToggle();
50 void handleIterate();
51
52 Button *attachedButton = nullptr;
53 RGBWBase *rgbw[SUPLA_MAX_GROUP_CONTROL_ELEMENTS] = {};
54 RGBWBase::ButtonControlType controlType[SUPLA_MAX_GROUP_CONTROL_ELEMENTS] =
55 {};
56 int rgbwCount = 0;
57};
58
59} // namespace Supla::Control
60
61#endif // SRC_SUPLA_CONTROL_GROUP_BUTTON_CONTROL_RGBW_H_
Definition button.h:30
Definition SuplaDevice.h:93
Definition button.h:30
void onLoadConfig(SuplaDeviceClass *sdc) override
First method called on element in SuplaDevice.begin().
Definition group_button_control_rgbw.cpp:217
void onInit() override
Third method called on element in SuplaDevice.begin()
Definition group_button_control_rgbw.cpp:253
Definition rgbw_base.h:58