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 "relay.h"
23
24namespace Supla {
25namespace Control {
26class LightRelay : public Relay {
27 public:
28 explicit LightRelay(int pin, bool highIsOn = true);
29 void handleGetChannelState(TDSC_ChannelState *channelState);
31 void onLoadState();
32 void onSaveState();
33 void turnOn(_supla_int_t duration = 0);
34 void iterateAlways();
35
36 protected:
37 uint16_t lifespan;
38 _supla_int_t turnOnSecondsCumulative;
39 uint32_t turnOnTimestamp;
40};
41
42}; // namespace Control
43}; // namespace Supla
44
45#endif // SRC_SUPLA_CONTROL_LIGHT_RELAY_H_
void onSaveState()
Method called periodically during SuplaDevice iteration.
Definition light_relay.cpp:92
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition light_relay.cpp:106
int handleCalcfgFromServer(TSD_DeviceCalCfgRequest *request)
Handles CALCFG requests from server.
Definition light_relay.cpp:51
void handleGetChannelState(TDSC_ChannelState *channelState)
Handles "get channel state (i)" request from server.
Definition light_relay.cpp:43
void onLoadState()
Second method called on element in SuplaDevice.begin().
Definition light_relay.cpp:76
Definition proto.h:2575
Definition proto.h:2246