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
Services/Network/RestApiServer/HttpServer.h
- Committer:
- wyunreal
- Date:
- 2015-01-02
- Revision:
- 11:9366140ebe5f
File content as of revision 11:9366140ebe5f:
#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
