supla-device
Loading...
Searching...
No Matches
enter_cfg_mode_after_power_cycle.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_DEVICE_ENTER_CFG_MODE_AFTER_POWER_CYCLE_H_
5#define SRC_SUPLA_DEVICE_ENTER_CFG_MODE_AFTER_POWER_CYCLE_H_
6
7#include <supla/element.h>
8
10
11namespace Supla::Device {
13 public:
14 explicit EnterCfgModeAfterPowerCycle(uint32_t timeoutMs = 5000,
15 uint32_t powerCycles = 3,
16 bool alwaysEnabled = false);
17
18 void onLoadConfig(SuplaDeviceClass *sdc) override;
19 void iterateAlways() override;
20 void setAlwaysEnabled(bool alwaysEnabled);
21 void setIncrementOnlyOnPowerResetReason(bool value);
22 void resetCounter();
23
24 private:
25 SuplaDeviceClass *sdc = nullptr;
26 uint32_t timestampMs = 0;
27 uint32_t timeoutMs = 5000;
28 uint32_t maxPowerCycles = 3;
29 uint32_t currentPowerCycle = 0;
30 bool incremented = false;
31 bool enabled = false;
32 bool alwaysEnabled = false;
33 bool incrementOnlyOnPowerResetReason = false;
34};
35
36} // namespace Supla::Device
37
38#endif // SRC_SUPLA_DEVICE_ENTER_CFG_MODE_AFTER_POWER_CYCLE_H_
Definition SuplaDevice.h:167
Definition enter_cfg_mode_after_power_cycle.h:12
void iterateAlways() override
Method called on each SuplaDevice iteration.
Definition enter_cfg_mode_after_power_cycle.cpp:51
void onLoadConfig(SuplaDeviceClass *sdc) override
First method called on element in SuplaDevice.begin().
Definition enter_cfg_mode_after_power_cycle.cpp:28
Base class for all elements of SuplaDevice.
Definition element.h:27