testing buffer improvements from mazgch
Fork of M2XStreamClient by
Client.h@0:f479e4f4db0e, 2014-02-12 (annotated)
- Committer:
- jb8414
- Date:
- Wed Feb 12 19:43:34 2014 +0000
- Revision:
- 0:f479e4f4db0e
- Child:
- 12:0c9041dd96a6
initial commit from github revision b98a6d0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jb8414 | 0:f479e4f4db0e | 1 | #ifndef Client_h |
jb8414 | 0:f479e4f4db0e | 2 | #define Client_h |
jb8414 | 0:f479e4f4db0e | 3 | |
jb8414 | 0:f479e4f4db0e | 4 | #include "TCPSocketConnection.h" |
jb8414 | 0:f479e4f4db0e | 5 | |
jb8414 | 0:f479e4f4db0e | 6 | #include "Print.h" |
jb8414 | 0:f479e4f4db0e | 7 | #include "Utility.h" |
jb8414 | 0:f479e4f4db0e | 8 | |
jb8414 | 0:f479e4f4db0e | 9 | /* |
jb8414 | 0:f479e4f4db0e | 10 | * TCP Client |
jb8414 | 0:f479e4f4db0e | 11 | */ |
jb8414 | 0:f479e4f4db0e | 12 | class Client : public Print { |
jb8414 | 0:f479e4f4db0e | 13 | public: |
jb8414 | 0:f479e4f4db0e | 14 | Client(); |
jb8414 | 0:f479e4f4db0e | 15 | ~Client(); |
jb8414 | 0:f479e4f4db0e | 16 | |
jb8414 | 0:f479e4f4db0e | 17 | virtual int connect(const char *host, uint16_t port); |
jb8414 | 0:f479e4f4db0e | 18 | virtual size_t write(uint8_t); |
jb8414 | 0:f479e4f4db0e | 19 | virtual size_t write(const uint8_t *buf, size_t size); |
jb8414 | 0:f479e4f4db0e | 20 | virtual int available(); |
jb8414 | 0:f479e4f4db0e | 21 | virtual int read(); |
jb8414 | 0:f479e4f4db0e | 22 | virtual void flush(); |
jb8414 | 0:f479e4f4db0e | 23 | virtual void stop(); |
jb8414 | 0:f479e4f4db0e | 24 | virtual uint8_t connected(); |
jb8414 | 0:f479e4f4db0e | 25 | private: |
jb8414 | 0:f479e4f4db0e | 26 | virtual int read(uint8_t *buf, size_t size); |
jb8414 | 0:f479e4f4db0e | 27 | uint8_t _buf[1]; |
jb8414 | 0:f479e4f4db0e | 28 | uint8_t _len; |
jb8414 | 0:f479e4f4db0e | 29 | TCPSocketConnection _sock; |
jb8414 | 0:f479e4f4db0e | 30 | }; |
jb8414 | 0:f479e4f4db0e | 31 | |
jb8414 | 0:f479e4f4db0e | 32 | #endif |