Upper Version Add PUT method Delete POST method
Dependencies: Adafruit_GFX MbedJSONValue_v102 WIZnetInterface mbed
Fork of WIZwiki-REST-io_v102 by
HTTPServer.h
00001 #ifndef HTTP_SERVER 00002 #define HTTP_SERVER 00003 00004 #include <map> 00005 00006 #include "mbed.h" 00007 #include <string> 00008 #include "RequestHandler.h" 00009 #include "EthernetInterface.h" 00010 00011 #define DEBUG_HTTP 00012 00013 typedef enum _HTTP_RESULT 00014 { 00015 HTTP_INVALID_URI = -3, 00016 HTTP_INVALID_DATA = -2, 00017 HTTP_INVALID_HANDLE = -1, 00018 HTTP_SUCCESS = 1 00019 }HTTP_RESULT; 00020 00021 00022 static char HTTPBUF[600] = {0,}; 00023 static char rest_result[300] = {0,}; 00024 00025 class HTTPServer 00026 { 00027 public : 00028 00029 HTTPServer(); 00030 virtual ~HTTPServer(); 00031 00032 bool init(int port); 00033 00034 void run(); 00035 00036 void add_request_handler(char *name, RequestHandler* handler); 00037 00038 private : 00039 00040 HTTP_RESULT handle_request(char *buffer); 00041 00042 TCPSocketServer socket; 00043 std::map<char*, RequestHandler*, bool(*)(char*, char*)> handlers; 00044 //char rest_result[2048]; 00045 00046 }; 00047 00048 #endif 00049
Generated on Sat Jul 16 2022 05:32:29 by 1.7.2