Webserver only w/o any other functions, single thread. Running on STM32F013+W5500

Dependencies:   NTPClient W5500Interface Watchdog device_configuration eeprom_flash mbed-rpc-nucleo mbed-rtos mbed

Fork of F103-Serial-to-Ethernet by Chau Vo

Committer:
olympux
Date:
Fri Aug 19 20:17:00 2016 +0000
Revision:
47:d92d2c5b8073
Parent:
40:c966abbe2d62
forked to create a new repo for webserver on F103+W5500. No other functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
olympux 40:c966abbe2d62 1 #ifndef HTTP_SERVER
olympux 40:c966abbe2d62 2 #define HTTP_SERVER
olympux 40:c966abbe2d62 3
olympux 40:c966abbe2d62 4 #include <map>
olympux 40:c966abbe2d62 5
olympux 40:c966abbe2d62 6 #include "mbed.h"
olympux 40:c966abbe2d62 7 #include "mbed_rpc.h"
olympux 40:c966abbe2d62 8 #include "RequestHandler.h"
olympux 40:c966abbe2d62 9 #include "Formatter.h"
olympux 40:c966abbe2d62 10 #include "EthernetInterface.h"
olympux 40:c966abbe2d62 11 #include "RPCCommand.h"
olympux 40:c966abbe2d62 12
olympux 40:c966abbe2d62 13
olympux 40:c966abbe2d62 14 class HTTPServer
olympux 40:c966abbe2d62 15 {
olympux 40:c966abbe2d62 16 public :
olympux 40:c966abbe2d62 17
olympux 40:c966abbe2d62 18 HTTPServer(Formatter *f = new Formatter());
olympux 40:c966abbe2d62 19 virtual ~HTTPServer();
olympux 40:c966abbe2d62 20
olympux 40:c966abbe2d62 21 bool init(int port);
olympux 40:c966abbe2d62 22
olympux 40:c966abbe2d62 23 void run();
olympux 40:c966abbe2d62 24
olympux 40:c966abbe2d62 25 void add_request_handler(char *name, RequestHandler* handler);
olympux 40:c966abbe2d62 26
olympux 40:c966abbe2d62 27 private :
olympux 40:c966abbe2d62 28
olympux 40:c966abbe2d62 29 void handle_request(char *buffer);
olympux 40:c966abbe2d62 30
olympux 40:c966abbe2d62 31 TCPSocketServer socket;
olympux 40:c966abbe2d62 32 std::map<char*, RequestHandler*, bool(*)(char*, char*)> handlers;
olympux 40:c966abbe2d62 33 Formatter *formatter;
olympux 40:c966abbe2d62 34 char reply[RPC_MAX_STRING];
olympux 40:c966abbe2d62 35 RPCCommand command;
olympux 40:c966abbe2d62 36 };
olympux 40:c966abbe2d62 37
olympux 40:c966abbe2d62 38 #endif
olympux 40:c966abbe2d62 39