Dependents:   SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1

Committer:
donatien
Date:
Mon May 24 10:24:38 2010 +0000
Revision:
0:a2dd0ba6cd2d
Child:
1:7043cc0db03c

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:a2dd0ba6cd2d 1 #ifndef HTTP_STREAM_H
donatien 0:a2dd0ba6cd2d 2 #define HTTP_STREAM_H
donatien 0:a2dd0ba6cd2d 3
donatien 0:a2dd0ba6cd2d 4 #include "../HttpData.h"
donatien 0:a2dd0ba6cd2d 5 #include "mbed.h"
donatien 0:a2dd0ba6cd2d 6
donatien 0:a2dd0ba6cd2d 7 typedef uint8_t byte;
donatien 0:a2dd0ba6cd2d 8
donatien 0:a2dd0ba6cd2d 9 class HttpStream : public HttpData //Streaming buf
donatien 0:a2dd0ba6cd2d 10 {
donatien 0:a2dd0ba6cd2d 11 public:
donatien 0:a2dd0ba6cd2d 12 HttpStream();
donatien 0:a2dd0ba6cd2d 13 virtual ~HttpStream();
donatien 0:a2dd0ba6cd2d 14
donatien 0:a2dd0ba6cd2d 15 void readNext(byte* buf, int size);
donatien 0:a2dd0ba6cd2d 16
donatien 0:a2dd0ba6cd2d 17 bool readable();
donatien 0:a2dd0ba6cd2d 18
donatien 0:a2dd0ba6cd2d 19 int readLen();
donatien 0:a2dd0ba6cd2d 20
donatien 0:a2dd0ba6cd2d 21 protected:
donatien 0:a2dd0ba6cd2d 22 virtual int read(char* buf, int len);
donatien 0:a2dd0ba6cd2d 23 virtual int write(const char* buf, int len);
donatien 0:a2dd0ba6cd2d 24
donatien 0:a2dd0ba6cd2d 25 virtual string getDataType(); //Internet media type for Content-Type header
donatien 0:a2dd0ba6cd2d 26 virtual void setDataType(const string& type); //Internet media type from Content-Type header
donatien 0:a2dd0ba6cd2d 27
donatien 0:a2dd0ba6cd2d 28 virtual bool getIsChunked(); //For Transfer-Encoding header
donatien 0:a2dd0ba6cd2d 29 virtual void setIsChunked(bool chunked); //From Transfer-Encoding header
donatien 0:a2dd0ba6cd2d 30
donatien 0:a2dd0ba6cd2d 31 virtual int getDataLen(); //For Content-Length header
donatien 0:a2dd0ba6cd2d 32 virtual void setDataLen(int len); //From Content-Length header, or if the transfer is chunked, next chunk length
donatien 0:a2dd0ba6cd2d 33
donatien 0:a2dd0ba6cd2d 34 private:
donatien 0:a2dd0ba6cd2d 35 byte* m_buf;
donatien 0:a2dd0ba6cd2d 36 int m_size; //Capacity
donatien 0:a2dd0ba6cd2d 37 int m_len; //Length
donatien 0:a2dd0ba6cd2d 38 };
donatien 0:a2dd0ba6cd2d 39
donatien 0:a2dd0ba6cd2d 40 #endif