Compare commits
5 Commits
635273589f
...
2d73921bc7
Author | SHA1 | Date | |
---|---|---|---|
|
2d73921bc7 | ||
|
7b80f7a95c | ||
|
9148e61911 | ||
|
2cca10ec5a | ||
|
c29d4edbd7 |
@ -242,11 +242,11 @@ public:
|
||||
_next = NULL;
|
||||
}
|
||||
|
||||
const char *stringValue() const {return _value == NULL ? "" : _value->toString();}
|
||||
const char *stringValue() const {return _value == NULL ? NULL : _value->toString();}
|
||||
const char *getParameter(const unsigned int index)
|
||||
{
|
||||
unsigned int position(0);
|
||||
if(isListEmpty(_head->_next))return "";
|
||||
if(isListEmpty(_head->_next))return NULL;
|
||||
|
||||
Dictionary *cursor = _head->_next;
|
||||
|
||||
@ -257,7 +257,7 @@ public:
|
||||
cursor = cursor->_next;
|
||||
}
|
||||
|
||||
return "";
|
||||
return NULL;
|
||||
}
|
||||
protected:
|
||||
Dictionary(const char *parameter, T *value) : Dictionary()
|
||||
|
@ -1,11 +0,0 @@
|
||||
#include "HtmlClient.h"
|
||||
|
||||
HtmlClient::HtmlClient() : WiFiClient()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
HtmlClient::~HtmlClient()
|
||||
{
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#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
|
||||
};
|
||||
*/
|
15
src/app/HttpConstants.h
Normal file
15
src/app/HttpConstants.h
Normal file
@ -0,0 +1,15 @@
|
||||
#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,14 +112,16 @@ TaskSchedulerManager::TaskSchedulerManager(RtcManager &rtcManager) : _nextTaskIn
|
||||
boolean TaskSchedulerManager::addTask(const char *name, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData)
|
||||
{
|
||||
boolean result = _taskDataDictio.add(name, new TaskData({*schedule, taskRoutine, pData}));
|
||||
delete schedule;
|
||||
delete schedule;schedule = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
boolean TaskSchedulerManager::addTask(uint16_t id, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData)
|
||||
{
|
||||
boolean result = _taskDataDictio.add(id, new TaskData({*schedule, taskRoutine, pData}));
|
||||
delete schedule;
|
||||
delete schedule;schedule = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -4,20 +4,17 @@
|
||||
#include "TCPServer.h"
|
||||
#include "Dictionary.h"
|
||||
#include "SDCardManager.h"
|
||||
#include "HttpConstants.h"
|
||||
//#define DEBUG_WEBS
|
||||
#define READ_WRITE_BUFFER_SIZE 2500
|
||||
|
||||
template <typename T>
|
||||
class WEBServer : public TCPServer<T>
|
||||
class WEBServer : public TCPServer<T>, public 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 HttpParserStatus {HTTP_VERB, HTTP_RESSOURCE, HTTP_VERSION, HTTP_PARAMS, POST_DATA, HEADER_PARAMS};
|
||||
enum WEBClientState {ACCEPTED, PARSING, QUERY_PARSED, RESPONSE_SENT, DONE};
|
||||
enum HTTP_CODE {_100, _101, _200, _400, _401, _403, _404, _405, _500, _501};
|
||||
|
||||
|
||||
struct HttpRequestData
|
||||
{
|
||||
HttpRequestMethod HRM;
|
||||
|
Loading…
Reference in New Issue
Block a user