Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed
Fork of HTTPServerHelloWorld by
Diff: Services/Network/RestApiServer/HttpServer.h
- Revision:
- 11:9366140ebe5f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Services/Network/RestApiServer/HttpServer.h Fri Jan 02 22:44:42 2015 +0000
@@ -0,0 +1,40 @@
+#ifndef HTTP_SERVER_H
+#define HTTP_SERVER_H
+
+#include "rtos.h"
+
+class HttpServer {
+ private:
+ static const unsigned short int FAULTY_REPORTS_COUNT = 10;
+ static const unsigned short int STATUS_CHECK_TIMEOUT_MILLIS = 50;
+ static const unsigned short int STATUS_CHECK_NO_BLOCKING = 0;
+ static const unsigned short int WAITING_SHUTDOWN_ATTEMPTS = 10;
+ static const unsigned short int SHUTDOWN_TIMEOUT_MILLIS = 50;
+
+ enum HttpServerSignals{
+ // rtos signals are flags, assign values with care
+ STATUS_CHECK_SIGNAL = 1,
+ STATUS_CHECK_ACK_SIGNAL = 2,
+ CLOSE_SIGNAL = 4,
+ };
+
+ short unsigned int slaveThreadStatusCounter;
+ osThreadId mainThreadId;
+ Thread* listeningThread;
+
+ osThreadId getMainThreadId() {return mainThreadId;}
+ static void httpServerListeningThread(void const *serverInstance);
+ static void handleServerAliveRequests(osThreadId mainThreadId);
+
+ public:
+ HttpServer();
+ ~HttpServer();
+
+ bool start();
+ bool stop();
+ bool restart();
+
+ bool isAlive();
+};
+
+#endif
\ No newline at end of file
