-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
ESP8266Client.h
56 lines (39 loc) · 1018 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
#ifndef ESP8266Client_h
#define ESP8266Client_h
#include <Client.h>
#include "ESP8266.h"
class ESP8266Client : public Client
{
public:
ESP8266Client(ESP8266& esp8266) : Client(), _esp8266(&esp8266), _id(0), _connected(false) {}
ESP8266Client(ESP8266& esp8266, unsigned int id) : Client(), _esp8266(&esp8266), _id(id), _connected(false) {}
// Prepare the client
bool begin();
// 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