A sprinkler controller that takes HTTP command for zone and duration.

Dependencies:   EthernetNetIf mbed HTTPServer

Committer:
dminear
Date:
Wed Mar 09 03:44:43 2011 +0000
Revision:
1:91c2c52b4691
Parent:
0:810ec1936452
Fixed constant setting of time via NTP.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dminear 0:810ec1936452 1 /*
dminear 0:810ec1936452 2 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
dminear 0:810ec1936452 3
dminear 0:810ec1936452 4 Permission is hereby granted, free of charge, to any person obtaining a copy
dminear 0:810ec1936452 5 of this software and associated documentation files (the "Software"), to deal
dminear 0:810ec1936452 6 in the Software without restriction, including without limitation the rights
dminear 0:810ec1936452 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
dminear 0:810ec1936452 8 copies of the Software, and to permit persons to whom the Software is
dminear 0:810ec1936452 9 furnished to do so, subject to the following conditions:
dminear 0:810ec1936452 10
dminear 0:810ec1936452 11 The above copyright notice and this permission notice shall be included in
dminear 0:810ec1936452 12 all copies or substantial portions of the Software.
dminear 0:810ec1936452 13
dminear 0:810ec1936452 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dminear 0:810ec1936452 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dminear 0:810ec1936452 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
dminear 0:810ec1936452 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dminear 0:810ec1936452 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
dminear 0:810ec1936452 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
dminear 0:810ec1936452 20 THE SOFTWARE.
dminear 0:810ec1936452 21 */
dminear 0:810ec1936452 22
dminear 0:810ec1936452 23 #ifndef SPRINKLER_HANDLER_H
dminear 0:810ec1936452 24 #define SPRINKLER_HANDLER_H
dminear 0:810ec1936452 25
dminear 0:810ec1936452 26 #include "../HTTPRequestHandler.h"
dminear 0:810ec1936452 27 #include "mbed.h"
dminear 0:810ec1936452 28
dminear 0:810ec1936452 29 class SprinklerHandler : public HTTPRequestHandler
dminear 0:810ec1936452 30 {
dminear 0:810ec1936452 31 public:
dminear 0:810ec1936452 32 SprinklerHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
dminear 0:810ec1936452 33 virtual ~SprinklerHandler();
dminear 0:810ec1936452 34
dminear 0:810ec1936452 35 //protected:
dminear 0:810ec1936452 36 static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new SprinklerHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one
dminear 0:810ec1936452 37 int parsekv( char **from, char *to, int max );
dminear 0:810ec1936452 38 virtual void doGet();
dminear 0:810ec1936452 39 virtual void doPost();
dminear 0:810ec1936452 40 virtual void doHead();
dminear 0:810ec1936452 41
dminear 0:810ec1936452 42 virtual void onReadable(); //Data has been read
dminear 0:810ec1936452 43 virtual void onWriteable(); //Data has been written & buf is free
dminear 0:810ec1936452 44 virtual void onClose(); //Connection is closing
dminear 0:810ec1936452 45
dminear 0:810ec1936452 46 void turnOffZone1();
dminear 0:810ec1936452 47 void turnOffZone2();
dminear 0:810ec1936452 48 void turnOffZone3();
dminear 0:810ec1936452 49 void turnOffZone4();
dminear 0:810ec1936452 50 };
dminear 0:810ec1936452 51
dminear 0:810ec1936452 52 #endif