A client for the SmartREST protocol from Cumulocity.
Fork of MbedSmartRest by
Diff: MbedDataSource.h
- Revision:
- 13:e76920d5e1ec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MbedDataSource.h Fri Apr 11 09:33:45 2014 +0000 @@ -0,0 +1,34 @@ +#ifndef MBEDDATASOURCE_H +#define MBEDDATASOURCE_H + +#include <stddef.h> +#include "AbstractDataSource.h" +#include "TCPSocketConnection.h" + +#define MBED_SOURCE_BUFFER_SIZE 60 + +class MbedClient; + +class MbedDataSource : public AbstractDataSource +{ +public: + MbedDataSource(TCPSocketConnection& sock); + ~MbedDataSource(); + + char read(); + uint8_t status(); + +protected: + bool receive(); + void reset(); + +private: + TCPSocketConnection& _sock; + char _buf[MBED_SOURCE_BUFFER_SIZE]; + size_t _len, _offset; + bool _timeout; + +friend class MbedClient; +}; + +#endif