au wot hackathon0314 test program
Dependencies: NySNICInterface mbed-rtos mbed
Fork of RESTServer_team4 by
HTTPServer.h
00001 #ifndef HTTP_SERVER 00002 #define HTTP_SERVER 00003 00004 #include "mbed.h" 00005 #include "SNIC_WifiInterface.h" 00006 #include "TCPSocketServer.h" 00007 #include "TCPSocketConnection.h" 00008 00009 #define HTTP_REPLY_MAX_STRING 1024 00010 00011 enum 00012 { 00013 HTTP_200_OK = 200, 00014 HTTP_400_BADREQUEST = 400, 00015 HTTP_404_NOTFOUND = 404 00016 }; 00017 00018 00019 class HTTPServer 00020 { 00021 public : 00022 HTTPServer(); 00023 virtual ~HTTPServer(); 00024 bool init(int port); 00025 void run(); 00026 00027 private : 00028 void handle_request(char* buffer); 00029 void create_response(char* buffer); 00030 TCPSocketServer socketserver; 00031 char reply[HTTP_REPLY_MAX_STRING]; 00032 int response_code; 00033 }; 00034 00035 #endif 00036
Generated on Fri Jul 15 2022 05:24:06 by 1.7.2