supla-device
Loading...
Searching...
No Matches
light_relay.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_LIGHT_RELAY_H_
20#define SRC_SUPLA_CONTROL_LIGHT_RELAY_H_
21
22#include <supla-common/proto.h>
23#include <stdint.h>
24#include "relay.h"
25
26namespace Supla {
27namespace Control {
28class LightRelay : public Relay {
29 public:
30 explicit LightRelay(int pin, bool highIsOn = true);
31 void handleGetChannelState(TDSC_ChannelState *channelState);
33 void onLoadState();
34 void onSaveState();
35 void turnOn(_supla_int_t duration = 0);
36 void iterateAlways();
37
38 protected:
39 uint16_t lifespan;
40 _supla_int_t turnOnSecondsCumulative;
41 uint32_t turnOnTimestamp;
42};
43
44}; // namespace Control
45}; // namespace Supla
46
47#endif // SRC_SUPLA_CONTROL_LIGHT_RELAY_H_
void onSaveState()
Method called periodically during SuplaDevice iteration.
Definition light_relay.cpp:95
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition light_relay.cpp:109
int handleCalcfgFromServer(TSD_DeviceCalCfgRequest *request)
Handles CALCFG requests from server.
Definition light_relay.cpp:54
void handleGetChannelState(TDSC_ChannelState *channelState)
Handles "get channel state (i)" request from server.
Definition light_relay.cpp:46
void onLoadState()
Second method called on element in SuplaDevice.begin().
Definition light_relay.cpp:79
Definition proto.h:2577
Definition proto.h:2248