A client for the SmartREST protocol from Cumulocity.
Dependencies: HTTPClient SmartRest
Diff: HTTPBuffer.h
- Revision:
- 2:1038411466a6
- Child:
- 3:ce2f116369bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPBuffer.h Fri Jan 24 11:39:32 2014 +0000 @@ -0,0 +1,33 @@ +#ifndef HTTPBUFFER_H +#define HTTPBUFFER_H + +#include <stddef.h> +#include "IHTTPData.h" +#include "AbstractDataSource.h" + +#define HTTPBUFFER_INITIAL_SIZE 128 +#define HTTPBUFFER_INCREMENT 64 + +class HTTPBuffer : public HTTPDataIn, public AbstractDataSource { +public: + HTTPBuffer(); + ~HTTPBuffer(); + + char read(); + uint8_t status(); + +protected: + void writeReset(); + int write(const char* buf, size_t len); + void setDataType(const char* type); + void setIsChunked(bool chunked); + void setDataLen(size_t len); + void bufferSize(size_t length); + +private: + // buffer, write and read pointers + char *_buf, *_wptr, *_rptr; + size_t _len; +}; + +#endif \ No newline at end of file