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

HttpHandlerSetup.h

Committer:
sivan_toledo
Date:
2011-04-25
Revision:
1:b05231650f32
Parent:
0:3e7d6f496a67

File content as of revision 1:b05231650f32:

#include "HTTPServer.h"

#ifndef HTTP_HANDLER_SETUP
#define HTTP_HANDLER_SETUP

// Read password and username from the settting file (/usb/DBSet.txt)
bool ReadSettings(char* username, char* password);

// Http handler that provides welcome and setup pages
class HttpHandlerSetup : public HTTPRequestHandler
{
public:
  HttpHandlerSetup(const char* rootPath, const char* path, TCPSocket* pTcpSocket);
  virtual ~HttpHandlerSetup();
  
  static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTcpSocket) { return new HttpHandlerSetup(rootPath, path, pTcpSocket); }
protected:

  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:
  void doGetPageWelcome(); // Called from doGet(), get the welcome webpage
  void UpdateSettingsFile(); // Updates the username and password in the settings file
  
  bool m_WasDataRead;
};

#endif