A client for the SmartREST protocol from Cumulocity.

Dependencies:   HTTPClient SmartRest

Committer:
vwochnik
Date:
Fri Jan 24 11:39:32 2014 +0000
Revision:
2:1038411466a6
Child:
3:ce2f116369bd
added abstraction

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vwochnik 2:1038411466a6 1 #ifndef HTTPBUFFER_H
vwochnik 2:1038411466a6 2 #define HTTPBUFFER_H
vwochnik 2:1038411466a6 3
vwochnik 2:1038411466a6 4 #include <stddef.h>
vwochnik 2:1038411466a6 5 #include "IHTTPData.h"
vwochnik 2:1038411466a6 6 #include "AbstractDataSource.h"
vwochnik 2:1038411466a6 7
vwochnik 2:1038411466a6 8 #define HTTPBUFFER_INITIAL_SIZE 128
vwochnik 2:1038411466a6 9 #define HTTPBUFFER_INCREMENT 64
vwochnik 2:1038411466a6 10
vwochnik 2:1038411466a6 11 class HTTPBuffer : public HTTPDataIn, public AbstractDataSource {
vwochnik 2:1038411466a6 12 public:
vwochnik 2:1038411466a6 13 HTTPBuffer();
vwochnik 2:1038411466a6 14 ~HTTPBuffer();
vwochnik 2:1038411466a6 15
vwochnik 2:1038411466a6 16 char read();
vwochnik 2:1038411466a6 17 uint8_t status();
vwochnik 2:1038411466a6 18
vwochnik 2:1038411466a6 19 protected:
vwochnik 2:1038411466a6 20 void writeReset();
vwochnik 2:1038411466a6 21 int write(const char* buf, size_t len);
vwochnik 2:1038411466a6 22 void setDataType(const char* type);
vwochnik 2:1038411466a6 23 void setIsChunked(bool chunked);
vwochnik 2:1038411466a6 24 void setDataLen(size_t len);
vwochnik 2:1038411466a6 25 void bufferSize(size_t length);
vwochnik 2:1038411466a6 26
vwochnik 2:1038411466a6 27 private:
vwochnik 2:1038411466a6 28 // buffer, write and read pointers
vwochnik 2:1038411466a6 29 char *_buf, *_wptr, *_rptr;
vwochnik 2:1038411466a6 30 size_t _len;
vwochnik 2:1038411466a6 31 };
vwochnik 2:1038411466a6 32
vwochnik 2:1038411466a6 33 #endif