19#ifndef SRC_SUPLA_ELEMENT_WITH_CHANNEL_ACTIONS_H_
20#define SRC_SUPLA_ELEMENT_WITH_CHANNEL_ACTIONS_H_
22#include <supla/element.h>
23#include <supla/channels/channel.h>
24#include <supla/local_action.h>
25#include <supla/action_handler.h>
26#include <supla/condition.h>
30enum class ChannelConfigState : uint8_t {
32 LocalChangePending = 1,
33 SetChannelConfigSend = 2,
34 SetChannelConfigFailed = 3,
35 WaitForConfigFinished = 4,
37 SetChannelOcrConfigSend = 6,
45 void addAction(uint16_t action,
48 bool alwaysEnabled =
false)
override;
49 void addAction(uint16_t action,
ActionHandler *client, uint16_t event,
50 bool alwaysEnabled =
false)
override;
51 virtual void addAction(uint16_t action,
54 bool alwaysEnabled =
false);
55 virtual void addAction(uint16_t action,
ActionHandler *client,
57 bool alwaysEnabled =
false);
59 bool isEventAlreadyUsed(uint16_t event,
bool ignoreAlwaysEnabled)
override;
68 void clearChannelConfigChangedFlag();
70 void runAction(uint16_t event)
const override;
73 virtual bool setAndSaveFunction(_supla_int_t channelFunction);
74 virtual bool loadFunctionFromConfig();
75 virtual bool saveConfigChangeFlag();
76 virtual bool loadConfigChangeFlag();
81 virtual void fillChannelConfig(
void *channelConfig,
int *size);
82 virtual void fillChannelOcrConfig(
void *channelConfig,
int *size);
84 void triggerSetChannelConfig();
87 virtual bool hasOcrConfig()
const;
88 virtual bool isOcrConfigMissing()
const;
89 virtual void clearOcrConfig();
90 Supla::ChannelConfigState channelConfigState =
91 Supla::ChannelConfigState::None;
92 bool configFinishedReceived =
false;
93 uint8_t setChannelConfigAttempts = 0;
Definition action_handler.h:21
Definition condition.h:27
Definition element_with_channel_actions.h:42
void purgeConfig() override
Removes all configration data related to the element from Storage::Config.
Definition element_with_channel_actions.cpp:422
bool isAnyUpdatePending() override
Returns true if any update is pending.
Definition element_with_channel_actions.cpp:162
void onRegistered(Supla::Protocol::SuplaSrpc *suplaSrpc) override
Method called each time when device successfully registers to Supla server.
Definition element_with_channel_actions.cpp:193
void handleSetChannelConfigResult(TSDS_SetChannelConfigResult *result) override
Handles "set channel config" reply from server.
Definition element_with_channel_actions.cpp:389
uint8_t handleChannelConfig(TSD_ChannelConfig *result, bool local) override
Handles "set channel config" request from server.
Definition element_with_channel_actions.cpp:313
void handleChannelConfigFinished() override
Handles "channel config finished" message from server.
Definition element_with_channel_actions.cpp:214
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:222
Definition local_action.h:53
Definition supla_srpc.h:55