Simple HTTP Server with one page index.html stored inside MBED as char vector and javascript to update a table content

Fork of HTTP_SERVER by Akifumi Takahashi

Committer:
mmdonatti
Date:
Thu May 10 20:24:03 2018 +0000
Revision:
14:f21da0acc9f6
Parent:
12:cbf97b865d76
Simple server GET and POST for one index.html page and javascript

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aktk 0:cc483bea4fe3 1 //HTTP_SERVER.h
aktk 0:cc483bea4fe3 2 #ifndef HTTP_SERVER_H
aktk 0:cc483bea4fe3 3 #define HTTP_SERVER_H
mmdonatti 14:f21da0acc9f6 4
aktk 0:cc483bea4fe3 5 #include "EthernetInterface.h"
mmdonatti 14:f21da0acc9f6 6 #include "definitions.h"
aktk 0:cc483bea4fe3 7 #include "string.h"
mmdonatti 14:f21da0acc9f6 8
mmdonatti 14:f21da0acc9f6 9 #define MAX_BUFFER_SIZE 1024
mmdonatti 14:f21da0acc9f6 10
aktk 0:cc483bea4fe3 11 using namespace std;
aktk 0:cc483bea4fe3 12
aktk 0:cc483bea4fe3 13 enum PortNum {
aktk 0:cc483bea4fe3 14 TCP_PORT = 80
aktk 0:cc483bea4fe3 15 };
aktk 9:84aca9965f9f 16 /** HttpServer class
aktk 9:84aca9965f9f 17 *
aktk 9:84aca9965f9f 18 * This is the class to make a mbed a simple HTTP Server.
aktk 9:84aca9965f9f 19 */
aktk 0:cc483bea4fe3 20 class HttpServer
aktk 0:cc483bea4fe3 21 {
aktk 0:cc483bea4fe3 22 public:
aktk 0:cc483bea4fe3 23 HttpServer();
aktk 0:cc483bea4fe3 24 ~HttpServer();
aktk 9:84aca9965f9f 25 /** HTTP SERVER Initialization.
aktk 9:84aca9965f9f 26 *
aktk 9:84aca9965f9f 27 * This function should be called first of all.
aktk 0:cc483bea4fe3 28 * @return result of init() as boolean.
aktk 0:cc483bea4fe3 29 * @retval TRUE SACCESS
aktk 0:cc483bea4fe3 30 * @retval FALSE
aktk 0:cc483bea4fe3 31 */
aktk 0:cc483bea4fe3 32 bool init();
aktk 9:84aca9965f9f 33 /** Run the surver service while listening flag is true.
aktk 9:84aca9965f9f 34 *
aktk 0:cc483bea4fe3 35 * @return state ending.
aktk 0:cc483bea4fe3 36 * @retval TRUE at error end.
aktk 0:cc483bea4fe3 37 * @retval FALSE at normal end.
aktk 0:cc483bea4fe3 38 */
mmdonatti 14:f21da0acc9f6 39 bool run(channel *CH);
aktk 0:cc483bea4fe3 40
aktk 0:cc483bea4fe3 41 // Handlers
aktk 0:cc483bea4fe3 42 TCPSocketServer tcpsvr; // TCP server
aktk 0:cc483bea4fe3 43 TCPSocketConnection tcpcon; // TCP server connection clerk
aktk 0:cc483bea4fe3 44 };
aktk 0:cc483bea4fe3 45
aktk 0:cc483bea4fe3 46 #endif