Home Alert System
Dependencies: PWM_Tone_Library DHT
M2XStreamClient/Client.h@3:78f223d34f36, 2019-03-05 (annotated)
- Committer:
- ethaderu
- Date:
- Tue Mar 05 02:34:44 2019 +0000
- Revision:
- 3:78f223d34f36
Publish 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ethaderu | 3:78f223d34f36 | 1 | #ifndef Client_h |
ethaderu | 3:78f223d34f36 | 2 | #define Client_h |
ethaderu | 3:78f223d34f36 | 3 | |
ethaderu | 3:78f223d34f36 | 4 | #include "TCPSocketConnection.h" |
ethaderu | 3:78f223d34f36 | 5 | |
ethaderu | 3:78f223d34f36 | 6 | #include "Print.h" |
ethaderu | 3:78f223d34f36 | 7 | #include "Utility.h" |
ethaderu | 3:78f223d34f36 | 8 | |
ethaderu | 3:78f223d34f36 | 9 | /* |
ethaderu | 3:78f223d34f36 | 10 | * TCP Client |
ethaderu | 3:78f223d34f36 | 11 | */ |
ethaderu | 3:78f223d34f36 | 12 | class Client : public Print { |
ethaderu | 3:78f223d34f36 | 13 | public: |
ethaderu | 3:78f223d34f36 | 14 | Client(); |
ethaderu | 3:78f223d34f36 | 15 | ~Client(); |
ethaderu | 3:78f223d34f36 | 16 | |
ethaderu | 3:78f223d34f36 | 17 | virtual int connect(const char *host, uint16_t port); |
ethaderu | 3:78f223d34f36 | 18 | virtual size_t write(uint8_t); |
ethaderu | 3:78f223d34f36 | 19 | virtual size_t write(const uint8_t *buf, size_t size); |
ethaderu | 3:78f223d34f36 | 20 | virtual int available(); |
ethaderu | 3:78f223d34f36 | 21 | virtual int read(); |
ethaderu | 3:78f223d34f36 | 22 | virtual void flush(); |
ethaderu | 3:78f223d34f36 | 23 | virtual void stop(); |
ethaderu | 3:78f223d34f36 | 24 | virtual uint8_t connected(); |
ethaderu | 3:78f223d34f36 | 25 | private: |
ethaderu | 3:78f223d34f36 | 26 | virtual int read(uint8_t *buf, size_t size); |
ethaderu | 3:78f223d34f36 | 27 | void _fillin(void); |
ethaderu | 3:78f223d34f36 | 28 | uint8_t _inbuf[128]; |
ethaderu | 3:78f223d34f36 | 29 | uint8_t _incnt; |
ethaderu | 3:78f223d34f36 | 30 | void _flushout(void); |
ethaderu | 3:78f223d34f36 | 31 | uint8_t _outbuf[128]; |
ethaderu | 3:78f223d34f36 | 32 | uint8_t _outcnt; |
ethaderu | 3:78f223d34f36 | 33 | TCPSocketConnection _sock; |
ethaderu | 3:78f223d34f36 | 34 | }; |
ethaderu | 3:78f223d34f36 | 35 | |
ethaderu | 3:78f223d34f36 | 36 | #endif |