forked from Diaoul/arduino-ESP8266
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathESP8266Client.h
59 lines (43 loc) · 978 Bytes
/
ESP8266Client.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
59
#ifndef ESP8266Client_h
#define ESP8266Client_h
#include <Client.h>
#include "ESP8266.h"
class ESP8266Client : public Client
{
public:
ESP8266Client()
{
_id = 0;
_connected = false;
}
// Set the underlying ESP8266 and prepare the client
bool begin(ESP8266& esp8266);
bool begin(ESP8266& esp8266, unsigned int id);
// Connect
int connect(const char* host, uint16_t port);
int connect(IPAddress ip, uint16_t port);
// Available
int available();
// Read
int read();
int read(uint8_t* buffer, size_t size);
// Write
size_t write(uint8_t b);
size_t write(const char* data);
size_t write(const uint8_t* buffer, size_t size);
// Peek
int peek();
// Flush
void flush();
// Stop
void stop();
// Connected
uint8_t connected();
// Connected
operator bool();
protected:
ESP8266* _esp8266;
unsigned int _id;
bool _connected;
};
#endif