Dirk-Willem van Gulik (NXP/mbed)
/
AmpereMeter
Example self-announcing webserver which controls a servo through a smallHTML userinterface.
Diff: RestMeterHandler.h
- Revision:
- 0:a259777c45a3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RestMeterHandler.h Sat Aug 14 15:56:01 2010 +0000 @@ -0,0 +1,32 @@ +#ifndef _RESTMETERHANDLER +#define _RESTMETERHANDLER + +#include "HTTPRequestHandler.h" +#include "Servo.h" + +class RestMeterHandler : public HTTPRequestHandler +{ +public: + RestMeterHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket); + virtual ~RestMeterHandler(); + + static void attach(const char *(*)(const char *)); + +//protected: + static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { + return new RestMeterHandler(rootPath, path, pTCPSocket); + } + + virtual void doGet(); + virtual void doPost(); + virtual void doHead(); + + virtual void onReadable(); //Data has been read + virtual void onWriteable(); //Data has been written & buf is free + virtual void onClose(); //Connection is closing + +private: + static const char *(*callback)(const char *); + +}; +#endif