Student project by David Berlin and Boris Dogadov made for the Embedded Systems Workshop course given in Tel-Aviv University on 2010 by Sivan Toledo. Visit the project website for more details: http://davidberlin.co.il/sadna/ .

Dependencies:   EthernetNetIf NTPClient_NetServices mbed HTTPServer HTTPClient CyaSSL

Committer:
sivan_toledo
Date:
Mon Apr 25 12:31:46 2011 +0000
Revision:
1:b05231650f32
Parent:
0:3e7d6f496a67

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sivan_toledo 0:3e7d6f496a67 1 #include "HTTPServer.h"
sivan_toledo 0:3e7d6f496a67 2
sivan_toledo 0:3e7d6f496a67 3 #ifndef HTTP_HANDLER_SETUP
sivan_toledo 0:3e7d6f496a67 4 #define HTTP_HANDLER_SETUP
sivan_toledo 0:3e7d6f496a67 5
sivan_toledo 1:b05231650f32 6 // Read password and username from the settting file (/usb/DBSet.txt)
sivan_toledo 0:3e7d6f496a67 7 bool ReadSettings(char* username, char* password);
sivan_toledo 0:3e7d6f496a67 8
sivan_toledo 1:b05231650f32 9 // Http handler that provides welcome and setup pages
sivan_toledo 0:3e7d6f496a67 10 class HttpHandlerSetup : public HTTPRequestHandler
sivan_toledo 0:3e7d6f496a67 11 {
sivan_toledo 0:3e7d6f496a67 12 public:
sivan_toledo 0:3e7d6f496a67 13 HttpHandlerSetup(const char* rootPath, const char* path, TCPSocket* pTcpSocket);
sivan_toledo 0:3e7d6f496a67 14 virtual ~HttpHandlerSetup();
sivan_toledo 0:3e7d6f496a67 15
sivan_toledo 0:3e7d6f496a67 16 static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTcpSocket) { return new HttpHandlerSetup(rootPath, path, pTcpSocket); }
sivan_toledo 0:3e7d6f496a67 17 protected:
sivan_toledo 0:3e7d6f496a67 18
sivan_toledo 0:3e7d6f496a67 19 virtual void doGet();
sivan_toledo 0:3e7d6f496a67 20 virtual void doPost();
sivan_toledo 0:3e7d6f496a67 21 virtual void doHead();
sivan_toledo 0:3e7d6f496a67 22
sivan_toledo 0:3e7d6f496a67 23 virtual void onReadable(); //Data has been read
sivan_toledo 0:3e7d6f496a67 24 virtual void onWriteable(); //Data has been written & buf is free
sivan_toledo 0:3e7d6f496a67 25 virtual void onClose(); //Connection is closing
sivan_toledo 0:3e7d6f496a67 26
sivan_toledo 0:3e7d6f496a67 27 private:
sivan_toledo 1:b05231650f32 28 void doGetPageWelcome(); // Called from doGet(), get the welcome webpage
sivan_toledo 1:b05231650f32 29 void UpdateSettingsFile(); // Updates the username and password in the settings file
sivan_toledo 0:3e7d6f496a67 30
sivan_toledo 0:3e7d6f496a67 31 bool m_WasDataRead;
sivan_toledo 0:3e7d6f496a67 32 };
sivan_toledo 0:3e7d6f496a67 33
sivan_toledo 0:3e7d6f496a67 34 #endif