19#ifndef SRC_SUPLA_ELEMENT_WITH_CHANNEL_ACTIONS_H_
20#define SRC_SUPLA_ELEMENT_WITH_CHANNEL_ACTIONS_H_
23#include <supla-common/proto.h>
24#include <supla/element.h>
25#include <supla/local_action.h>
29enum class ChannelConfigState : uint8_t {
31 LocalChangePending = 1,
32 SetChannelConfigSend = 2,
33 SetChannelConfigFailed = 3,
34 WaitForConfigFinished = 4,
39enum class ApplyConfigResult : uint8_t {
43 SetChannelConfigNeeded,
51 uint8_t configFinishedReceived: 1;
52 uint8_t defaultConfig: 1;
53 uint8_t weeklySchedule: 1;
54 uint8_t altWeeklySchedule: 1;
56 uint8_t extendedDefaultConfig: 1;
62 bool isSet(
int configType)
const;
63 void clear(
int configType);
65 void setAll(uint8_t values);
66 uint8_t getAll()
const;
67 void setConfigFinishedReceived();
68 void clearConfigFinishedReceived();
69 bool isConfigFinishedReceived()
const;
70 void set(
int configType,
bool value =
true);
84 void addAction(uint16_t action,
87 bool alwaysEnabled =
false)
override;
88 void addAction(uint16_t action,
ActionHandler *client, uint16_t event,
89 bool alwaysEnabled =
false)
override;
90 virtual void addAction(uint16_t action,
93 bool alwaysEnabled =
false);
94 virtual void addAction(uint16_t action,
ActionHandler *client,
96 bool alwaysEnabled =
false);
98 bool isEventAlreadyUsed(uint16_t event,
bool ignoreAlwaysEnabled)
override;
107 void clearChannelConfigChangedFlag();
109 void runAction(uint16_t event)
const override;
112 virtual bool setAndSaveFunction(_supla_int_t channelFunction);
113 virtual bool loadFunctionFromConfig();
114 virtual bool saveConfigChangeFlag()
const;
115 virtual bool loadConfigChangeFlag();
121 virtual void fillChannelConfig(
void *channelConfig,
int *size, uint8_t index);
123 void triggerSetChannelConfig(
int configType = SUPLA_CONFIG_TYPE_DEFAULT);
126 bool iterateConfigExchange();
133 Supla::ChannelConfigState channelConfigState =
134 Supla::ChannelConfigState::None;
136 uint8_t setChannelConfigAttempts = 0;
Definition action_handler.h:21
Definition condition.h:27
Definition element_with_channel_actions.h:81
void purgeConfig() override
Removes all configration data related to the element from Storage::Config.
Definition element_with_channel_actions.cpp:485
bool isAnyUpdatePending() override
Returns true if any update is pending.
Definition element_with_channel_actions.cpp:271
void onRegistered(Supla::Protocol::SuplaSrpc *suplaSrpc) override
Method called each time when device successfully registers to Supla server.
Definition element_with_channel_actions.cpp:300
void handleSetChannelConfigResult(TSDS_SetChannelConfigResult *result) override
Handles "set channel config" reply from server.
Definition element_with_channel_actions.cpp:448
int getNextConfigType() const
Returns the next config type to be sent.
Definition element_with_channel_actions.cpp:588
uint8_t handleChannelConfig(TSD_ChannelConfig *result, bool local) override
Handles "set channel config" request from server.
Definition element_with_channel_actions.cpp:350
void handleChannelConfigFinished() override
Handles "channel config finished" message from server.
Definition element_with_channel_actions.cpp:321
bool iterateConnected() override
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition element_with_channel_actions.cpp:338
Definition local_action.h:52
Definition supla_srpc.h:55
Definition element_with_channel_actions.h:47