-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathClient.h
51 lines (33 loc) · 878 Bytes
/
Client.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
// Based on interface defined in Ethernet's Client.h
#ifndef __WIFLY_CLIENT_H__
#define __WIFLY_CLIENT_H__
#include "Print.h"
#include "ParsedStream.h"
#include "WiFlyDevice.h"
// TODO: Call this 'WiFlyClient' instead?
class Client : public Print {
public:
Client(uint8_t *ip, uint16_t port);
Client(const char* domain, uint16_t port);
boolean connect();
void write(byte value);
void write(const char *str);
void write(const uint8_t *buffer, size_t size);
int available();
int read();
void flush(void);
bool connected();
void stop();
operator bool();
private:
WiFlyDevice& _WiFly;
uint8_t *_ip;
uint16_t _port;
const char *_domain;
bool isOpen;
ParsedStream stream;
// TODO: Work out why alternate instantiation code in
// Server.available() doesn't work and thus requires this:
friend class Server;
};
#endif