-
Notifications
You must be signed in to change notification settings - Fork 0
/
htmlHelper.h
80 lines (53 loc) · 2.14 KB
/
htmlHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// htmlHelper.h
#ifndef _HTMLHELPER_h
#define _HTMLHELPER_h
#include "GlobalDefine.h"
#undef FOUND_BOARD
#ifdef ARDUINO_ARCH_ESP8266
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
#define FOUND_BOARD ESP8266
#endif
#ifdef ARDUINO_ARCH_ESP32
#include <HTTPClient.h>
#include <WiFi.h>
#define FOUND_BOARD ESP32
#endif
#ifndef FOUND_BOARD
#pragma message(Reminder "Error Target hardware not defined !")
#endif // ! FOUND_BOARD
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
String queryStringValue(String urlString, String keyString);
// html headers have [keyword: value] settings, getHeaderValue gets integer or string values
String getHeaderValue(String keyWord, String str);
void getHeaderValue(String keyWord, String str, uint& OutValue);
void getHeaderValue(String keyWord, String str, String& OutValue);
// assemble a basic header in a string given verb, host, and URL:
String htmlBasicHeaderText(String verb, const char* host, String);
//int htmlSend(WiFiClient* thisClient, const char* thisHost, int thisPort);
//int htmlSend(WiFiClient* thisClient, const char* thisHost, int thisPort, String sendHeader);
int htmlSend(WIFI_CLIENT_CLASS* thisClient, const char* thisHost, int thisPort);
int htmlSend(WIFI_CLIENT_CLASS* thisClient, const char* thisHost, int thisPort, String sendHeader);
int htmlSend(const char* thisHost, int thisPort, String sendHeader);
int htmlSendPlainText(const char* thisHost, String sendHeader);
void htmlSetClient(WIFI_CLIENT_CLASS* thisClient);
int doAcceptTermsAndConditions();
int confirmedInternetConnectivity(const char* host);
extern const char* httpText; // = "http://"; // this is defined once here to allow easy transition from http:// to https://
bool htmlExists(String targetURL);
class htmlHelper {
// depending on the USE_TLS_SSL the myClient is either WiFiClient or WiFiClientSecure (but they are different! not sure secure or not...)
const char* thisHost;
int thisPort;
String sendHeader;
public:
htmlHelper(WIFI_CLIENT_CLASS*, const char*, int, String);
htmlHelper(WIFI_CLIENT_CLASS*, const char*, int);
htmlHelper();
int Send();
};
#endif