supla-device
Loading...
Searching...
No Matches
web_server.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_WEB_SERVER_H_
20#define SRC_SUPLA_NETWORK_WEB_SERVER_H_
21
22#include <supla/network/html_generator.h>
23#include "supla/network/html_element.h"
24
26
27#define HTML_KEY_LENGTH 16
28#define HTML_VAL_LENGTH 4000
29
30namespace Supla {
31
32extern const unsigned char favico[1150];
33
34class WebServer {
35 public:
36 static WebServer *Instance();
37 explicit WebServer(Supla::HtmlGenerator *);
38 virtual ~WebServer();
39 virtual void start() = 0;
40 virtual void stop() = 0;
41 void setSuplaDeviceClass(SuplaDeviceClass *);
42 void notifyClientConnected();
43 virtual void parsePost(const char *postContent,
44 int size,
45 bool lastChunk = true);
46 virtual void resetParser();
47 void setBetaProcessing();
48
49 Supla::HtmlGenerator *htmlGenerator = nullptr;
50
51 protected:
52 static WebServer *webServerInstance;
53 bool destroyGenerator = false;
54 SuplaDeviceClass *sdc = nullptr;
55 bool keyFound = false;
56 int partialSize = 0;
57 char key[HTML_KEY_LENGTH] = {};
58 char *value = nullptr;
59 enum Supla::HtmlSection excludeSection =
60 Supla::HtmlSection::HTML_SECTION_BETA_FORM;
61};
62
63}; // namespace Supla
64
65#endif // SRC_SUPLA_NETWORK_WEB_SERVER_H_
Definition SuplaDevice.h:93
Definition html_generator.h:26