supla-device
Loading...
Searching...
No Matches
channel_function_parameters.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17*/
18
19#ifndef SRC_SUPLA_NETWORK_HTML_CHANNEL_FUNCTION_PARAMETERS_H_
20#define SRC_SUPLA_NETWORK_HTML_CHANNEL_FUNCTION_PARAMETERS_H_
21
22#include <stdint.h>
23#include <supla/network/html_element.h>
24
25namespace Supla {
26class Channel;
27class Element;
28class WebSender;
29
30namespace Control {
32}
33
34namespace Html {
35
36class ChannelFunctionParameters : public HtmlElement {
37 public:
38 enum class ChannelScope {
39 Primary,
40 Secondary,
41 Both,
42 };
43
44 explicit ChannelFunctionParameters(
45 Supla::Element *element,
46 const char *primaryLabel = nullptr,
47 const char *secondaryLabel = nullptr);
48 explicit ChannelFunctionParameters(
50 const char *primaryLabel = nullptr,
51 const char *secondaryLabel = nullptr,
52 ChannelScope channelScope = ChannelScope::Both);
53 ChannelFunctionParameters(Supla::Control::RelayRollerShutterPair *pair,
54 ChannelScope channelScope);
55 virtual ~ChannelFunctionParameters();
56
57 void send(Supla::WebSender *sender) override;
58 bool handleResponse(const char *key, const char *value) override;
59
60 static void renderSelectField(Supla::WebSender *sender,
61 Supla::Channel *channel,
62 const char *key,
63 const char *label);
64
65 private:
66 static bool isKnownSelectableFunction(uint32_t function);
67 static bool renderOptions(Supla::WebSender *sender,
68 Supla::Channel *channel);
69
70 bool handleSingleChannelResponse(const char *key,
71 const char *value,
72 Supla::Channel *channel);
73 bool handlePairResponse(const char *key, const char *value);
74
75 Supla::Element *element = nullptr;
77 const char *primaryLabel = nullptr;
78 const char *secondaryLabel = nullptr;
79 ChannelScope channelScope = ChannelScope::Both;
80};
81
82}; // namespace Html
83}; // namespace Supla
84
85#endif // SRC_SUPLA_NETWORK_HTML_CHANNEL_FUNCTION_PARAMETERS_H_
Definition channel.h:33
Definition relay_roller_shutter_pair.h:92
Base class for all elements of SuplaDevice.
Definition element.h:42
Definition web_sender.h:175