Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ESP8266_WebServer mbed
Fork of WiFiLamp by
ESP8266_WebServer/ESP8266_WebServer.h
- Committer:
- sschocke
- Date:
- 2014-12-28
- Revision:
- 11:3ab606a42227
- Parent:
- 9:319aeb6e0123
- Child:
- 20:f5a6527bfda6
File content as of revision 11:3ab606a42227:
#include "mbed.h"
#include <string>
#include <map>
#ifndef _ESP8266_WEB_SERVER_H
#define _ESP8266_WEB_SERVER_H
const char mimeHTML[] = "text/html";
const char mimeJavaScript[] = "text/javascript";
const char mimeCSS[] = "text/css";
const char mimeJPEG[] = "image/jpeg";
const char mimePNG[] = "image/png";
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, int numBytes);
public:
Serial *debugSerial;
ESP8266_WebServer(Serial *espUART);
void rxint(void);
void Initialize(void);
ESP8266_WebRequest* GetRequest(void);
void SendError(int linkID, std::string error);
void SendError(int linkID, const char* error);
void Send404Error(int linkID);
void SendReply(int linkID, std::string reply, const char* mimeType);
void SendReply(int linkID, const char* reply, int replySize, const char* mimeType);
};
#endif
