forked from anakod/ESP8266pro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathESP8266pro.h
58 lines (44 loc) · 1.57 KB
/
ESP8266pro.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
57
58
// ESP8266pro
// This software distributed under the terms of the MIT license
// (c) Skurydin Alexey, 2014
#ifndef _ESP8266pro_H_
#define _ESP8266pro_H_
class IESP8266proBaseReceiver;
#include "ESP8266pro_Parser.h"
#include "ESP8266proConnectionBase.h"
enum EncriptionMode
{
eEM_OPEN = 0,
eEM_WEP = 1,
eEM_WPA_PSK = 2,
eEM_WPA2_PSK = 3,
eEM_WPA_WPA2_PSK = 4
};
#define NULL_IP "0.0.0.0"
typedef void (*ConnectionDataCallback) (ESP8266proConnection* source, char* buffer, int length, boolean completed);
class ESP8266pro : public ESP8266pro_Parser
{
public:
ESP8266pro(Stream &espStreamReference);
ESP8266pro(Stream &espStreamReference, Stream &debugStreamReference);
bool begin(OutputDebugMode debugOutMode = eODM_Data);
bool stationConnect(const String& ssid, const String& password);
bool stationDisconnect();
String stationIP();
String stationMAC();
bool accessPointStart(const String& ssid, const String& password, EncriptionMode encription = eEM_WPA2_PSK, uint8_t wifiChannel = 5);
bool accessPointStop();
String accessPointIP();
String accessPointMAC();
// Internal methods!
uint8_t addConnection(IESP8266proBaseReceiver* target);
uint8_t getConnectionId(IESP8266proBaseReceiver* target);
void removeConnection(IESP8266proBaseReceiver* target);
bool setServer(IESP8266proBaseReceiver* serverInstance);
protected:
virtual void onDataReceive(uint8_t connectionId, char* buffer, int length, DataReceiveAction action);
private:
IESP8266proBaseReceiver* connections[ESP_MAX_CONNECTIONS];
IESP8266proBaseReceiver* server;
};
#endif