![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Add ADC
Dependencies: Adafruit_GFX MbedJSONValue_v102 WIZnetInterface mbed
Fork of WIZwiki-REST-io_v101 by
HTTPServer.h@7:64db444b21f4, 2016-07-29 (annotated)
- Committer:
- joon874
- Date:
- Fri Jul 29 08:15:34 2016 +0000
- Revision:
- 7:64db444b21f4
- Parent:
- 4:0b5a199e91f3
Add ADC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joon874 | 0:5886f525a4ad | 1 | #ifndef HTTP_SERVER |
joon874 | 0:5886f525a4ad | 2 | #define HTTP_SERVER |
joon874 | 0:5886f525a4ad | 3 | |
joon874 | 0:5886f525a4ad | 4 | #include <map> |
joon874 | 0:5886f525a4ad | 5 | |
joon874 | 0:5886f525a4ad | 6 | #include "mbed.h" |
joon874 | 0:5886f525a4ad | 7 | #include <string> |
joon874 | 0:5886f525a4ad | 8 | #include "RequestHandler.h" |
joon874 | 0:5886f525a4ad | 9 | #include "EthernetInterface.h" |
joon874 | 0:5886f525a4ad | 10 | |
joon874 | 2:ca36ecca24c2 | 11 | //#define DEBUG_HTTP |
joon874 | 2:ca36ecca24c2 | 12 | |
joon874 | 0:5886f525a4ad | 13 | typedef enum _HTTP_RESULT |
joon874 | 0:5886f525a4ad | 14 | { |
joon874 | 0:5886f525a4ad | 15 | HTTP_INVALID_URI = -3, |
joon874 | 0:5886f525a4ad | 16 | HTTP_INVALID_DATA = -2, |
joon874 | 0:5886f525a4ad | 17 | HTTP_INVALID_HANDLE = -1, |
joon874 | 0:5886f525a4ad | 18 | HTTP_SUCCESS = 1 |
joon874 | 0:5886f525a4ad | 19 | }HTTP_RESULT; |
joon874 | 0:5886f525a4ad | 20 | |
joon874 | 0:5886f525a4ad | 21 | |
joon874 | 4:0b5a199e91f3 | 22 | static char HTTPBUF[600] = {0,}; |
joon874 | 4:0b5a199e91f3 | 23 | static char rest_result[532] = {0,}; |
joon874 | 0:5886f525a4ad | 24 | |
joon874 | 0:5886f525a4ad | 25 | class HTTPServer |
joon874 | 0:5886f525a4ad | 26 | { |
joon874 | 0:5886f525a4ad | 27 | public : |
joon874 | 0:5886f525a4ad | 28 | |
joon874 | 0:5886f525a4ad | 29 | HTTPServer(); |
joon874 | 0:5886f525a4ad | 30 | virtual ~HTTPServer(); |
joon874 | 0:5886f525a4ad | 31 | |
joon874 | 0:5886f525a4ad | 32 | bool init(int port); |
joon874 | 0:5886f525a4ad | 33 | |
joon874 | 0:5886f525a4ad | 34 | void run(); |
joon874 | 0:5886f525a4ad | 35 | |
joon874 | 0:5886f525a4ad | 36 | void add_request_handler(char *name, RequestHandler* handler); |
joon874 | 0:5886f525a4ad | 37 | |
joon874 | 0:5886f525a4ad | 38 | private : |
joon874 | 0:5886f525a4ad | 39 | |
joon874 | 0:5886f525a4ad | 40 | HTTP_RESULT handle_request(char *buffer); |
joon874 | 0:5886f525a4ad | 41 | |
joon874 | 0:5886f525a4ad | 42 | TCPSocketServer socket; |
joon874 | 0:5886f525a4ad | 43 | std::map<char*, RequestHandler*, bool(*)(char*, char*)> handlers; |
joon874 | 0:5886f525a4ad | 44 | //char rest_result[2048]; |
joon874 | 0:5886f525a4ad | 45 | |
joon874 | 0:5886f525a4ad | 46 | }; |
joon874 | 0:5886f525a4ad | 47 | |
joon874 | 0:5886f525a4ad | 48 | #endif |
joon874 | 0:5886f525a4ad | 49 |