-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathLinuxLocalServer.h
44 lines (35 loc) · 955 Bytes
/
LinuxLocalServer.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
#if !defined(ARDUINO)
#ifndef OTF_LINUXLOCALSERVER_H
#define OTF_LINUXLOCALSERVER_H
#include "LocalServer.h"
#include "etherport.h"
namespace OTF {
class LinuxLocalClient : public LocalClient {
friend class LinuxLocalServer;
private:
EthernetClient client;
LinuxLocalClient(EthernetClient client);
public:
bool dataAvailable();
size_t readBytes(char *buffer, size_t length);
size_t readBytesUntil(char terminator, char *buffer, size_t length);
void print(const char *data);
//int peek();
size_t write(const char *buffer, size_t size);
void setTimeout(int timeout);
void flush();
void stop();
};
class LinuxLocalServer : public LocalServer {
private:
EthernetServer server;
LinuxLocalClient *activeClient = nullptr;
public:
LinuxLocalServer(uint16_t port);
~LinuxLocalServer();
LocalClient *acceptClient();
void begin();
};
}// namespace OTF
#endif
#endif