forked from jcrouchley/WiFly-Shield
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWiFlyClient.h
53 lines (33 loc) · 874 Bytes
/
WiFlyClient.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
// Based on interface defined in Ethernet's Client.h
#ifndef __WIFLY_CLIENT_H__
#define __WIFLY_CLIENT_H__
#include "Stream.h"
#include "ParsedStream.h"
#include "WiFlyDevice.h"
class WiFlyClient : public Stream {
public:
WiFlyClient(uint8_t *ip, uint16_t port);
WiFlyClient(const char* domain, uint16_t port);
boolean connect();
size_t write(byte value);
size_t write(const char *str);
size_t write(const uint8_t *buffer, size_t size);
int available();
int read();
void flush(void);
int peek();
bool connected();
void stop();
operator bool();
uint8_t *_ip;
uint16_t _port;
const char *_domain;
private:
WiFlyDevice& _WiFly;
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