Compare commits
No commits in common. "2d73921bc7e469c687bb18743ba5bafb97277dd3" and "635273589f18ae47e4c6d7fc571da93a9dbebb2c" have entirely different histories.
2d73921bc7
...
635273589f
@ -242,11 +242,11 @@ public:
|
|||||||
_next = NULL;
|
_next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *stringValue() const {return _value == NULL ? NULL : _value->toString();}
|
const char *stringValue() const {return _value == NULL ? "" : _value->toString();}
|
||||||
const char *getParameter(const unsigned int index)
|
const char *getParameter(const unsigned int index)
|
||||||
{
|
{
|
||||||
unsigned int position(0);
|
unsigned int position(0);
|
||||||
if(isListEmpty(_head->_next))return NULL;
|
if(isListEmpty(_head->_next))return "";
|
||||||
|
|
||||||
Dictionary *cursor = _head->_next;
|
Dictionary *cursor = _head->_next;
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ public:
|
|||||||
cursor = cursor->_next;
|
cursor = cursor->_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return "";
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
Dictionary(const char *parameter, T *value) : Dictionary()
|
Dictionary(const char *parameter, T *value) : Dictionary()
|
||||||
|
11
src/app/HtmlClient.cpp
Normal file
11
src/app/HtmlClient.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "HtmlClient.h"
|
||||||
|
|
||||||
|
HtmlClient::HtmlClient() : WiFiClient()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
HtmlClient::~HtmlClient()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
35
src/app/HtmlClient.h
Normal file
35
src/app/HtmlClient.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef HTMLCLIENT_H
|
||||||
|
#define HTMLCLIENT_H
|
||||||
|
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
|
||||||
|
class HtmlClient : WiFiClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HtmlClient();
|
||||||
|
virtual ~HtmlClient();
|
||||||
|
|
||||||
|
boolean sendHtmlQuery();
|
||||||
|
uint16_t readHtmlResponse(uint8_t *buffer);
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //HTMLCLIENT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TCP status codes :
|
||||||
|
* enum tcp_state {
|
||||||
|
CLOSED = 0,
|
||||||
|
LISTEN = 1,
|
||||||
|
SYN_SENT = 2,
|
||||||
|
SYN_RCVD = 3,
|
||||||
|
ESTABLISHED = 4,
|
||||||
|
FIN_WAIT_1 = 5,
|
||||||
|
FIN_WAIT_2 = 6,
|
||||||
|
CLOSE_WAIT = 7,
|
||||||
|
CLOSING = 8,
|
||||||
|
LAST_ACK = 9,
|
||||||
|
TIME_WAIT = 10
|
||||||
|
};
|
||||||
|
*/
|
@ -1,15 +0,0 @@
|
|||||||
#ifndef HTTPCONSTANTS_H
|
|
||||||
#define HTTPCONSTANTS_H
|
|
||||||
|
|
||||||
class HttpConstants
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum HttpRequestMethod {UNDEFINED, GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH};
|
|
||||||
enum HttpVersion {UNKNOWN, HTTP_0_9, HTTP_1_1, HTTP_1_0, HTTP_2_0};
|
|
||||||
enum HttpMIMEType{UNKNOWN_MIME, TEXT_PLAIN, TEXT_CSS, TEXT_HTML, TEXT_JAVASCRIPT, APPLICATION_JSON, APPLICATION_X_WWW_FORM_URLENCODED, IMAGE_PNG, IMAGE_JPEG, AUDIO_MPEG, APPLICATION_OCTET_STREAM};
|
|
||||||
enum HTTP_CODE {UNDEFINED_CODE, _100, _101, _200, _400, _401, _403, _404, _405, _500, _501};
|
|
||||||
protected:
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif//HTTPCONSTANTS_H
|
|
@ -112,16 +112,14 @@ TaskSchedulerManager::TaskSchedulerManager(RtcManager &rtcManager) : _nextTaskIn
|
|||||||
boolean TaskSchedulerManager::addTask(const char *name, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData)
|
boolean TaskSchedulerManager::addTask(const char *name, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData)
|
||||||
{
|
{
|
||||||
boolean result = _taskDataDictio.add(name, new TaskData({*schedule, taskRoutine, pData}));
|
boolean result = _taskDataDictio.add(name, new TaskData({*schedule, taskRoutine, pData}));
|
||||||
delete schedule;schedule = NULL;
|
delete schedule;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean TaskSchedulerManager::addTask(uint16_t id, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData)
|
boolean TaskSchedulerManager::addTask(uint16_t id, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData)
|
||||||
{
|
{
|
||||||
boolean result = _taskDataDictio.add(id, new TaskData({*schedule, taskRoutine, pData}));
|
boolean result = _taskDataDictio.add(id, new TaskData({*schedule, taskRoutine, pData}));
|
||||||
delete schedule;schedule = NULL;
|
delete schedule;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,20 @@
|
|||||||
#include "TCPServer.h"
|
#include "TCPServer.h"
|
||||||
#include "Dictionary.h"
|
#include "Dictionary.h"
|
||||||
#include "SDCardManager.h"
|
#include "SDCardManager.h"
|
||||||
#include "HttpConstants.h"
|
|
||||||
//#define DEBUG_WEBS
|
//#define DEBUG_WEBS
|
||||||
#define READ_WRITE_BUFFER_SIZE 2500
|
#define READ_WRITE_BUFFER_SIZE 2500
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class WEBServer : public TCPServer<T>, public HttpConstants
|
class WEBServer : public TCPServer<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum HttpRequestMethod {UNDEFINED, GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH};
|
||||||
|
enum HttpVersion {UNKNOWN, HTTP_0_9, HTTP_1_1, HTTP_1_0, HTTP_2_0};
|
||||||
|
enum HttpMIMEType{UNKNOWN_MIME, TEXT_PLAIN, TEXT_CSS, TEXT_HTML, TEXT_JAVASCRIPT, APPLICATION_JSON, APPLICATION_X_WWW_FORM_URLENCODED, IMAGE_PNG, IMAGE_JPEG, AUDIO_MPEG, APPLICATION_OCTET_STREAM};
|
||||||
enum HttpParserStatus {HTTP_VERB, HTTP_RESSOURCE, HTTP_VERSION, HTTP_PARAMS, POST_DATA, HEADER_PARAMS};
|
enum HttpParserStatus {HTTP_VERB, HTTP_RESSOURCE, HTTP_VERSION, HTTP_PARAMS, POST_DATA, HEADER_PARAMS};
|
||||||
enum WEBClientState {ACCEPTED, PARSING, QUERY_PARSED, RESPONSE_SENT, DONE};
|
enum WEBClientState {ACCEPTED, PARSING, QUERY_PARSED, RESPONSE_SENT, DONE};
|
||||||
|
enum HTTP_CODE {_100, _101, _200, _400, _401, _403, _404, _405, _500, _501};
|
||||||
|
|
||||||
struct HttpRequestData
|
struct HttpRequestData
|
||||||
{
|
{
|
||||||
HttpRequestMethod HRM;
|
HttpRequestMethod HRM;
|
||||||
|
Loading…
Reference in New Issue
Block a user