Web radiation monitoring system.
Dependencies: EthernetNetIf TextLCD mbed HTTPServer
SimpleHandler.h@0:de8fcaf0fc9b, 2011-05-24 (annotated)
- Committer:
- moritams
- Date:
- Tue May 24 10:53:04 2011 +0000
- Revision:
- 0:de8fcaf0fc9b
prototype. ver0.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
moritams | 0:de8fcaf0fc9b | 1 | |
moritams | 0:de8fcaf0fc9b | 2 | /* |
moritams | 0:de8fcaf0fc9b | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
moritams | 0:de8fcaf0fc9b | 4 | |
moritams | 0:de8fcaf0fc9b | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
moritams | 0:de8fcaf0fc9b | 6 | of this software and associated documentation files (the "Software"), to deal |
moritams | 0:de8fcaf0fc9b | 7 | in the Software without restriction, including without limitation the rights |
moritams | 0:de8fcaf0fc9b | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
moritams | 0:de8fcaf0fc9b | 9 | copies of the Software, and to permit persons to whom the Software is |
moritams | 0:de8fcaf0fc9b | 10 | furnished to do so, subject to the following conditions: |
moritams | 0:de8fcaf0fc9b | 11 | |
moritams | 0:de8fcaf0fc9b | 12 | The above copyright notice and this permission notice shall be included in |
moritams | 0:de8fcaf0fc9b | 13 | all copies or substantial portions of the Software. |
moritams | 0:de8fcaf0fc9b | 14 | |
moritams | 0:de8fcaf0fc9b | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
moritams | 0:de8fcaf0fc9b | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
moritams | 0:de8fcaf0fc9b | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
moritams | 0:de8fcaf0fc9b | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
moritams | 0:de8fcaf0fc9b | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
moritams | 0:de8fcaf0fc9b | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
moritams | 0:de8fcaf0fc9b | 21 | THE SOFTWARE. |
moritams | 0:de8fcaf0fc9b | 22 | */ |
moritams | 0:de8fcaf0fc9b | 23 | |
moritams | 0:de8fcaf0fc9b | 24 | #ifndef SIMPLE_HANDLER_H |
moritams | 0:de8fcaf0fc9b | 25 | #define SIMPLE_HANDLER_H |
moritams | 0:de8fcaf0fc9b | 26 | |
moritams | 0:de8fcaf0fc9b | 27 | #include "../HTTPRequestHandler.h" |
moritams | 0:de8fcaf0fc9b | 28 | |
moritams | 0:de8fcaf0fc9b | 29 | class SimpleHandler : public HTTPRequestHandler |
moritams | 0:de8fcaf0fc9b | 30 | { |
moritams | 0:de8fcaf0fc9b | 31 | public: |
moritams | 0:de8fcaf0fc9b | 32 | SimpleHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket); |
moritams | 0:de8fcaf0fc9b | 33 | virtual ~SimpleHandler(); |
moritams | 0:de8fcaf0fc9b | 34 | |
moritams | 0:de8fcaf0fc9b | 35 | //protected: |
moritams | 0:de8fcaf0fc9b | 36 | static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new SimpleHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one |
moritams | 0:de8fcaf0fc9b | 37 | |
moritams | 0:de8fcaf0fc9b | 38 | virtual void doGet(); |
moritams | 0:de8fcaf0fc9b | 39 | virtual void doPost(); |
moritams | 0:de8fcaf0fc9b | 40 | virtual void doHead(); |
moritams | 0:de8fcaf0fc9b | 41 | |
moritams | 0:de8fcaf0fc9b | 42 | virtual void onReadable(); //Data has been read |
moritams | 0:de8fcaf0fc9b | 43 | virtual void onWriteable(); //Data has been written & buf is free |
moritams | 0:de8fcaf0fc9b | 44 | virtual void onClose(); //Connection is closing |
moritams | 0:de8fcaf0fc9b | 45 | }; |
moritams | 0:de8fcaf0fc9b | 46 | |
moritams | 0:de8fcaf0fc9b | 47 | #endif |