supla-device
Loading...
Searching...
No Matches
network_address_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_NETWORK_ADDRESS_PARAMETERS_H_
20#define SRC_SUPLA_NETWORK_HTML_NETWORK_ADDRESS_PARAMETERS_H_
21
22#include <supla/network/netif_config.h>
23
25
26namespace Supla {
27
28class WebSender;
29
30namespace Html {
31
32class NetworkAddressParameters {
33 public:
34 NetworkAddressParameters(const char* blobName, const char* prefix);
35
36 void send(Supla::WebSender* sender);
37 bool handleResponse(const char* key, const char* value);
38 void onProcessingEnd();
39
40 private:
41 void ensureLoaded();
42 void renderField(Supla::WebSender* sender,
43 const char* suffix,
44 const char* label,
45 const char* value,
46 const char* placeholder,
47 const char* pattern,
48 const char* title,
49 bool requiredWhenStatic);
50 bool matchKey(const char* key, const char* suffix) const;
51 void buildKey(char* out, size_t outSize, const char* suffix) const;
52 void buildId(char* out, size_t outSize, const char* suffix) const {
53 buildKey(out, outSize, suffix);
54 }
55
56 const char* blobName_ = nullptr;
57 const char* prefix_ = nullptr;
58 const char* sectionTitle_ = nullptr;
59 NetifConfigBlob config_ = {};
60 bool loaded_ = false;
61 bool responseSeen_ = false;
62 bool invalidInput_ = false;
63};
64
65} // namespace Html
66} // namespace Supla
67
68#endif // SRC_SUPLA_NETWORK_HTML_NETWORK_ADDRESS_PARAMETERS_H_
Definition SuplaDevice.h:163
Definition web_sender.h:175
Definition netif_config.h:37