Clinton Lee Taylor / Mbed 2 deprecated WiFiLamp

Dependencies:   ESP8266_WebServer mbed

Fork of WiFiLamp by Sebastian Schocke

ESP8266_WebServer/ESP8266_WebServer.h

Committer:
sschocke
Date:
2014-12-27
Revision:
9:319aeb6e0123
Parent:
7:f15c81074400
Child:
11:3ab606a42227

File content as of revision 9:319aeb6e0123:

#include "mbed.h"
#include <string>
#include <map>

#ifndef _ESP8266_WEB_SERVER_H
#define _ESP8266_WEB_SERVER_H

class ESP8266_WebRequest
{
    char httpMethod[64];
    char httpURI[512];
    
    public:
        ESP8266_WebRequest(int linkID, const char* packet, Serial* debugSerial);
        int LinkID;
        std::string Method;
        std::string URI;
        std::map<std::string, std::string> Parameters;
};

class ESP8266_WebServer
{
    Serial *serial;
    char buffer[1024];
    char reply[1024];
    char response[2048];
    char* rxptr;
    
    private:
        short data_waiting(void);
        short string_waiting(const char*);
        void readBuffer(void);
        void sendResponse(int linkID);
        
    public:
        Serial *debugSerial;
        
        ESP8266_WebServer(Serial *espUART);
        void rxint(void);
        void Initialize(void);
        ESP8266_WebRequest* GetRequest(void);
        void SendHTMLReply(int linkID, std::string reply);
        void Send404Reply(int linkID);
};

#endif