supla-device
Loading...
Searching...
No Matches
light_relay.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_LIGHT_RELAY_H_
5#define SRC_SUPLA_CONTROL_LIGHT_RELAY_H_
6
7#include <supla-common/proto.h>
8#include <stdint.h>
9#include <supla/io.h>
10#include "relay.h"
11
12namespace Supla {
13namespace Control {
14class LightRelay : public Relay {
15 public:
16 explicit LightRelay(Supla::Io::IoPin outputPin);
17 explicit LightRelay(int pin, bool highIsOn = true);
18 void handleGetChannelState(TDSC_ChannelState *channelState);
20 void onLoadState();
21 void onSaveState();
22 void turnOn(_supla_int_t duration = 0);
23 void iterateAlways();
24
25 protected:
26 uint16_t lifespan;
27 _supla_int_t turnOnSecondsCumulative;
28 uint32_t turnOnTimestamp;
29};
30
31}; // namespace Control
32}; // namespace Supla
33
34#endif // SRC_SUPLA_CONTROL_LIGHT_RELAY_H_
Definition light_relay.h:14
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 relay.h:38
Definition io_pin.h:14
Definition proto.h:2705
Definition proto.h:2315