-
Notifications
You must be signed in to change notification settings - Fork 4
/
WiFiMgr.h
53 lines (40 loc) · 917 Bytes
/
WiFiMgr.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
// WiFiMgr.h
#ifndef _WIFIMGR_h
#define _WIFIMGR_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#include <ESP8266WiFi.h>
class WiFiMgrClass
{
public:
WiFiMgrClass();
void setSTAIPdhcp(bool dhcp);
void setSTAIPip(IPAddress ip, IPAddress gw, IPAddress mask, IPAddress dns);
void setAPssid(String ssid, String key = "");
void tryToConnect(String ssid, String key, String devicename);
bool handle();
protected:
private:
String _STAssid;
String _STAkey;
String _devicename;
unsigned int _STAlastTry;
unsigned int _STAtryTimeout;
String _APssid;
String _APkey;
unsigned int _APlastTry;
unsigned int _APtryTimeout;
bool _STAconnected;
IPAddress _STAIPip;
IPAddress _STAIPgw;
IPAddress _STAIPmask;
IPAddress _STAIPdns;
bool _STADHCP;
void tryToReconnect();
void setAPMode();
};
extern WiFiMgrClass WiFiMgr;
#endif