-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathWiFiServer.h
56 lines (45 loc) · 1.99 KB
/
WiFiServer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
This file is part of the WiFiEspAT library for Arduino
https://github.com/jandrassy/WiFiEspAT
Copyright 2019 Juraj Andrassy
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _WIFISERVER_H_
#define _WIFISERVER_H_
#include "WiFiClient.h"
#ifndef WIFIESPAT_SERVER_MAX_CLIENTS
#define WIFIESPAT_SERVER_MAX_CLIENTS 1
#endif
#ifndef WIFIESPAT_SERVER_CLIENT_TIMEOUT
#define WIFIESPAT_SERVER_CLIENT_TIMEOUT 60 // seconds
#endif
class WiFiServer {
public:
WiFiServer(uint16_t port = 80);
void begin() { begin(WIFIESPAT_SERVER_MAX_CLIENTS, WIFIESPAT_SERVER_CLIENT_TIMEOUT); }
void begin(uint8_t maxConnCount, uint16_t serverTimeout);
void begin(uint16_t port) { begin(port, WIFIESPAT_SERVER_MAX_CLIENTS, WIFIESPAT_SERVER_CLIENT_TIMEOUT); }
void begin(uint16_t port, uint8_t maxConnCount, uint16_t serverTimeout);
void beginSSL() { beginSSL(false, WIFIESPAT_SERVER_MAX_CLIENTS, WIFIESPAT_SERVER_CLIENT_TIMEOUT); }
void beginSSL(bool ca, uint8_t maxConnCount, uint16_t serverTimeout);
void beginSSL(uint16_t port) { beginSSL(port, false, WIFIESPAT_SERVER_MAX_CLIENTS, WIFIESPAT_SERVER_CLIENT_TIMEOUT); }
void beginSSL(uint16_t port, bool ca, uint8_t maxConnCount, uint16_t serverTimeout);
void end();
uint8_t status();
WiFiClient available() __attribute__((deprecated("Use accept().")));
WiFiClient accept();
virtual operator bool();
private:
uint16_t port;
uint8_t state;
};
#endif