4#ifndef SRC_SUPLA_ELEMENT_WITH_CHANNEL_ACTIONS_H_
5#define SRC_SUPLA_ELEMENT_WITH_CHANNEL_ACTIONS_H_
8#include <supla-common/proto.h>
9#include <supla/element.h>
10#include <supla/local_action.h>
14enum class ChannelConfigState : uint8_t {
16 LocalChangePending = 1,
17 SetChannelConfigSend = 2,
18 SetChannelConfigFailed = 3,
19 WaitForConfigFinished = 4,
24enum class ApplyConfigResult : uint8_t {
28 SetChannelConfigNeeded,
36 uint8_t configFinishedReceived: 1;
37 uint8_t defaultConfig: 1;
38 uint8_t weeklySchedule: 1;
39 uint8_t altWeeklySchedule: 1;
41 uint8_t extendedDefaultConfig: 1;
47 bool isSet(
int configType)
const;
48 void clear(
int configType);
50 void setAll(uint8_t values);
51 uint8_t getAll()
const;
52 void setConfigFinishedReceived();
53 void clearConfigFinishedReceived();
54 bool isConfigFinishedReceived()
const;
55 void set(
int configType,
bool value =
true);
69 ElementMode mode = ElementMode::Registered);
72 void addAction(uint16_t action,
75 bool alwaysEnabled =
false)
override;
76 void addAction(uint16_t action,
ActionHandler *client, uint16_t event,
77 bool alwaysEnabled =
false)
override;
85 virtual void addAction(uint16_t action,
89 bool alwaysEnabled =
false);
93 virtual void addAction(uint16_t action,
ActionHandler *client,
96 bool alwaysEnabled =
false);
97 virtual void addAction(uint16_t action,
100 bool alwaysEnabled =
false);
101 virtual void addAction(uint16_t action,
ActionHandler *client,
103 bool alwaysEnabled =
false);
105 bool isEventAlreadyUsed(uint16_t event,
bool ignoreAlwaysEnabled)
override;
116 void runAction(uint16_t event)
const override;
123 virtual void fillChannelConfig(
void *channelConfig,
int *size, uint8_t index);
125 void triggerSetChannelConfig(
int configType = SUPLA_CONFIG_TYPE_DEFAULT);
129 virtual bool setAndSaveFunction(uint32_t channelFunction);
130 virtual bool loadFunctionFromConfig();
131 virtual bool saveConfigChangeFlag()
const;
132 virtual bool loadConfigChangeFlag();
133 void clearChannelConfigChangedFlag();
134 bool iterateConfigExchange();
141 Supla::ChannelConfigState channelConfigState =
142 Supla::ChannelConfigState::None;
144 uint8_t setChannelConfigAttempts = 0;
Definition action_handler.h:8
Definition condition.h:14
Definition element_with_channel_actions.h:66
void purgeConfig() override
Removes all configration data related to the element from Storage::Config.
Definition element_with_channel_actions.cpp:494
void onRegistered(Supla::Protocol::SuplaSrpc *suplaSrpc) override
Method called each time when device successfully registers to Supla server.
Definition element_with_channel_actions.cpp:302
bool isAnyUpdatePending() const override
Returns true if any update is pending.
Definition element_with_channel_actions.cpp:273
void handleSetChannelConfigResult(TSDS_SetChannelConfigResult *result) override
Handles "set channel config" reply from server.
Definition element_with_channel_actions.cpp:457
int getNextConfigType() const
Returns the next config type to be sent.
Definition element_with_channel_actions.cpp:597
uint8_t handleChannelConfig(TSD_ChannelConfig *result, bool local) override
Handles "set channel config" request from server.
Definition element_with_channel_actions.cpp:359
void handleChannelConfigFinished() override
Handles "channel config finished" message from server.
Definition element_with_channel_actions.cpp:323
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:347
Base class for all elements of SuplaDevice.
Definition element.h:27
Definition local_action.h:42
Definition supla_srpc.h:46
Definition element_with_channel_actions.h:32