Dependents: SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1
services/http/client/data/HttpFile.h@0:a2dd0ba6cd2d, 2010-05-24 (annotated)
- Committer:
- donatien
- Date:
- Mon May 24 10:24:38 2010 +0000
- Revision:
- 0:a2dd0ba6cd2d
- Child:
- 1:7043cc0db03c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:a2dd0ba6cd2d | 1 | #ifndef HTTP_FILE_H |
donatien | 0:a2dd0ba6cd2d | 2 | #define HTTP_FILE_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 | class HttpFile : public HttpData //Read or Write data from a file |
donatien | 0:a2dd0ba6cd2d | 8 | { |
donatien | 0:a2dd0ba6cd2d | 9 | public: |
donatien | 0:a2dd0ba6cd2d | 10 | HttpFile(const char* path, const char* mode); //mode is "r", "w", "a", etc |
donatien | 0:a2dd0ba6cd2d | 11 | virtual ~HttpFile(); |
donatien | 0:a2dd0ba6cd2d | 12 | |
donatien | 0:a2dd0ba6cd2d | 13 | protected: |
donatien | 0:a2dd0ba6cd2d | 14 | virtual int read(char* buf, int len); |
donatien | 0:a2dd0ba6cd2d | 15 | virtual int write(const char* buf, int len); |
donatien | 0:a2dd0ba6cd2d | 16 | |
donatien | 0:a2dd0ba6cd2d | 17 | virtual string getDataType(); //Internet media type for Content-Type header |
donatien | 0:a2dd0ba6cd2d | 18 | virtual void setDataType(const string& type); //Internet media type from Content-Type header |
donatien | 0:a2dd0ba6cd2d | 19 | |
donatien | 0:a2dd0ba6cd2d | 20 | virtual bool getIsChunked(); //For Transfer-Encoding header |
donatien | 0:a2dd0ba6cd2d | 21 | virtual void setIsChunked(bool chunked); //From Transfer-Encoding header virtual |
donatien | 0:a2dd0ba6cd2d | 22 | |
donatien | 0:a2dd0ba6cd2d | 23 | virtual int getDataLen(); //For Content-Length header |
donatien | 0:a2dd0ba6cd2d | 24 | virtual void setDataLen(int len); //From Content-Length header |
donatien | 0:a2dd0ba6cd2d | 25 | |
donatien | 0:a2dd0ba6cd2d | 26 | private: |
donatien | 0:a2dd0ba6cd2d | 27 | FILE* m_fp; |
donatien | 0:a2dd0ba6cd2d | 28 | int m_len; |
donatien | 0:a2dd0ba6cd2d | 29 | bool m_chunked; |
donatien | 0:a2dd0ba6cd2d | 30 | }; |
donatien | 0:a2dd0ba6cd2d | 31 | |
donatien | 0:a2dd0ba6cd2d | 32 | #endif |