Webserver for peach-board
HTTPServer.h@1:f1f734dd23ee, 2015-03-12 (annotated)
- Committer:
- thudt90
- Date:
- Thu Mar 12 08:26:27 2015 +0000
- Revision:
- 1:f1f734dd23ee
- Parent:
- 0:6ec14f880a00
Just test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thudt90 | 0:6ec14f880a00 | 1 | #ifndef HTTP_SERVER |
thudt90 | 0:6ec14f880a00 | 2 | #define HTTP_SERVER |
thudt90 | 0:6ec14f880a00 | 3 | |
thudt90 | 0:6ec14f880a00 | 4 | #include <map> |
thudt90 | 0:6ec14f880a00 | 5 | |
thudt90 | 0:6ec14f880a00 | 6 | #include "mbed.h" |
thudt90 | 0:6ec14f880a00 | 7 | //#include "mbed_rpc.h" |
thudt90 | 0:6ec14f880a00 | 8 | #include "RequestHandler.h" |
thudt90 | 1:f1f734dd23ee | 9 | |
thudt90 | 0:6ec14f880a00 | 10 | #include "EthernetInterface.h" |
thudt90 | 0:6ec14f880a00 | 11 | #include "RPCCommand.h" |
thudt90 | 0:6ec14f880a00 | 12 | |
thudt90 | 0:6ec14f880a00 | 13 | |
thudt90 | 0:6ec14f880a00 | 14 | class HTTPServer |
thudt90 | 0:6ec14f880a00 | 15 | { |
thudt90 | 0:6ec14f880a00 | 16 | public : |
thudt90 | 0:6ec14f880a00 | 17 | |
thudt90 | 1:f1f734dd23ee | 18 | HTTPServer(); |
thudt90 | 0:6ec14f880a00 | 19 | virtual ~HTTPServer(); |
thudt90 | 0:6ec14f880a00 | 20 | |
thudt90 | 0:6ec14f880a00 | 21 | bool init(int port); |
thudt90 | 1:f1f734dd23ee | 22 | void ledinit(void); |
thudt90 | 1:f1f734dd23ee | 23 | int findstr(char *progstr,char* str,int len); |
thudt90 | 1:f1f734dd23ee | 24 | int ButtonState_str(char* str_Led, unsigned char button); |
thudt90 | 1:f1f734dd23ee | 25 | int LedState_str(char* str_Led, unsigned char Red, unsigned char Green, unsigned char Blue); |
thudt90 | 1:f1f734dd23ee | 26 | //void PressButton0(void); |
thudt90 | 1:f1f734dd23ee | 27 | //void PressButton1(void); |
thudt90 | 0:6ec14f880a00 | 28 | void run(); |
thudt90 | 0:6ec14f880a00 | 29 | |
thudt90 | 0:6ec14f880a00 | 30 | void add_request_handler(char *name, RequestHandler* handler); |
thudt90 | 0:6ec14f880a00 | 31 | |
thudt90 | 0:6ec14f880a00 | 32 | private : |
thudt90 | 0:6ec14f880a00 | 33 | |
thudt90 | 0:6ec14f880a00 | 34 | void handle_request(char *buffer); |
thudt90 | 0:6ec14f880a00 | 35 | |
thudt90 | 0:6ec14f880a00 | 36 | TCPSocketServer socket; |
thudt90 | 0:6ec14f880a00 | 37 | std::map<char*, RequestHandler*, bool(*)(char*, char*)> handlers; |
thudt90 | 0:6ec14f880a00 | 38 | char reply[RPC_MAX_STRING]; |
thudt90 | 1:f1f734dd23ee | 39 | int flagHTTP; |
thudt90 | 0:6ec14f880a00 | 40 | RPCCommand command; |
thudt90 | 0:6ec14f880a00 | 41 | }; |
thudt90 | 0:6ec14f880a00 | 42 | |
thudt90 | 0:6ec14f880a00 | 43 | #endif |
thudt90 | 0:6ec14f880a00 | 44 |