web server load-drive and reading sensors based on LPC1768
Dependencies: DHT22 EthernetNetIf HTTPServer mbed
SensorHandler.h@0:3125f39d20b4, 2015-12-07 (annotated)
- Committer:
- douglasofranco
- Date:
- Mon Dec 07 14:06:24 2015 +0000
- Revision:
- 0:3125f39d20b4
Web server load-drive and reading sensors based on LPC1768
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
douglasofranco | 0:3125f39d20b4 | 1 | #ifndef SENSOR_HANDLER_H |
douglasofranco | 0:3125f39d20b4 | 2 | #define SENSOR_HANDLER_H |
douglasofranco | 0:3125f39d20b4 | 3 | |
douglasofranco | 0:3125f39d20b4 | 4 | #include <HTTPRequestHandler.h> |
douglasofranco | 0:3125f39d20b4 | 5 | |
douglasofranco | 0:3125f39d20b4 | 6 | |
douglasofranco | 0:3125f39d20b4 | 7 | class SensorHandler : public HTTPRequestHandler |
douglasofranco | 0:3125f39d20b4 | 8 | { |
douglasofranco | 0:3125f39d20b4 | 9 | public: |
douglasofranco | 0:3125f39d20b4 | 10 | SensorHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket); |
douglasofranco | 0:3125f39d20b4 | 11 | |
douglasofranco | 0:3125f39d20b4 | 12 | virtual ~SensorHandler(); |
douglasofranco | 0:3125f39d20b4 | 13 | |
douglasofranco | 0:3125f39d20b4 | 14 | static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new SensorHandler( rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one |
douglasofranco | 0:3125f39d20b4 | 15 | |
douglasofranco | 0:3125f39d20b4 | 16 | virtual void doGet(); |
douglasofranco | 0:3125f39d20b4 | 17 | virtual void doPost(); |
douglasofranco | 0:3125f39d20b4 | 18 | virtual void doHead(); |
douglasofranco | 0:3125f39d20b4 | 19 | |
douglasofranco | 0:3125f39d20b4 | 20 | virtual void onReadable(); //Data has been read |
douglasofranco | 0:3125f39d20b4 | 21 | virtual void onWriteable(); //Data has been written & buf is free |
douglasofranco | 0:3125f39d20b4 | 22 | virtual void onClose(); //Connection is closing |
douglasofranco | 0:3125f39d20b4 | 23 | |
douglasofranco | 0:3125f39d20b4 | 24 | private: |
douglasofranco | 0:3125f39d20b4 | 25 | void printString( const char* pszString ); |
douglasofranco | 0:3125f39d20b4 | 26 | void printHtml(); |
douglasofranco | 0:3125f39d20b4 | 27 | }; |
douglasofranco | 0:3125f39d20b4 | 28 | |
douglasofranco | 0:3125f39d20b4 | 29 | #endif |