Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HTTP_SERVER by
handlers/FileHandler.h@17:ce5845164001, 2018-03-23 (annotated)
- Committer:
- aktk
- Date:
- Fri Mar 23 07:39:28 2018 +0000
- Revision:
- 17:ce5845164001
- Parent:
- 0:cc483bea4fe3
THe program hang up when fopen()@FileHandler::open()@HTTPServer::run() is called after EthernetInterface::connect()@HTTPServer::init() is done.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| aktk | 0:cc483bea4fe3 | 1 | /*FileHandler.h*/ |
| aktk | 0:cc483bea4fe3 | 2 | #ifndef FILE_HANDLER_H |
| aktk | 0:cc483bea4fe3 | 3 | #define FILE_HANDLER_H |
| aktk | 0:cc483bea4fe3 | 4 | #include "mbed.h" |
| aktk | 0:cc483bea4fe3 | 5 | #include "string.h" |
| aktk | 0:cc483bea4fe3 | 6 | #include <stdlib.h> |
| aktk | 17:ce5845164001 | 7 | extern LocalFileSystem local; |
| aktk | 0:cc483bea4fe3 | 8 | using namespace std; |
| aktk | 0:cc483bea4fe3 | 9 | class FileHandler |
| aktk | 0:cc483bea4fe3 | 10 | { |
| aktk | 0:cc483bea4fe3 | 11 | public: |
| aktk | 0:cc483bea4fe3 | 12 | FileHandler(); |
| aktk | 0:cc483bea4fe3 | 13 | ~FileHandler(); |
| aktk | 0:cc483bea4fe3 | 14 | FILE* open(const char*, const char*); |
| aktk | 0:cc483bea4fe3 | 15 | int close(); |
| aktk | 0:cc483bea4fe3 | 16 | virtual int getc(); |
| aktk | 0:cc483bea4fe3 | 17 | bool arrival(); |
| aktk | 0:cc483bea4fe3 | 18 | bool atEOF(); |
| aktk | 0:cc483bea4fe3 | 19 | bool hasError(); |
| aktk | 0:cc483bea4fe3 | 20 | char *getFullpath(); |
| aktk | 0:cc483bea4fe3 | 21 | char *getFilename(); |
| aktk | 0:cc483bea4fe3 | 22 | char *getSuffix(); |
| aktk | 0:cc483bea4fe3 | 23 | int getFileSize(); |
| aktk | 0:cc483bea4fe3 | 24 | private: |
| aktk | 0:cc483bea4fe3 | 25 | FILE *fp; |
| aktk | 0:cc483bea4fe3 | 26 | char *fullpath; |
| aktk | 0:cc483bea4fe3 | 27 | char *filename; |
| aktk | 0:cc483bea4fe3 | 28 | char *suffix; |
| aktk | 0:cc483bea4fe3 | 29 | char content_buffer[1024]; |
| aktk | 0:cc483bea4fe3 | 30 | int file_size; |
| aktk | 0:cc483bea4fe3 | 31 | }; |
| aktk | 0:cc483bea4fe3 | 32 | #endif |
