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 <supla/io.h>
25#include "relay.h"
26
27namespace Supla {
28namespace Control {
29class LightRelay : public Relay {
30 public:
31 explicit LightRelay(Supla::Io::IoPin outputPin);
32 explicit LightRelay(int pin, bool highIsOn = true);
33 void handleGetChannelState(TDSC_ChannelState *channelState);
35 void onLoadState();
36 void onSaveState();
37 void turnOn(_supla_int_t duration = 0);
38 void iterateAlways();
39
40 protected:
41 uint16_t lifespan;
42 _supla_int_t turnOnSecondsCumulative;
43 uint32_t turnOnTimestamp;
44};
45
46}; // namespace Control
47}; // namespace Supla
48
49#endif // SRC_SUPLA_CONTROL_LIGHT_RELAY_H_
void onSaveState()
Method called periodically during SuplaDevice iteration.
Definition light_relay.cpp:110
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition light_relay.cpp:124
int handleCalcfgFromServer(TSD_DeviceCalCfgRequest *request)
Handles CALCFG requests from server.
Definition light_relay.cpp:69
void handleGetChannelState(TDSC_ChannelState *channelState)
Handles "get channel state (i)" request from server.
Definition light_relay.cpp:61
void onLoadState()
Second method called on element in SuplaDevice.begin().
Definition light_relay.cpp:94
Definition io.h:67
Definition proto.h:2646
Definition proto.h:2286