-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEServer.h
More file actions
43 lines (34 loc) · 1.05 KB
/
EServer.h
File metadata and controls
43 lines (34 loc) · 1.05 KB
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
#ifndef __EmlaServer_h__
#define __EmlaServer_h__
// number of messages in history/reading
#define MESSAGE_HISTORY_SIZE 40
// length of a message summary entry (per message)
#define MESSAGE_SUMMARY_SIZE 60
#include "Arduino.h"
#include "Oled.h"
class EmlaServer
{
private:
OledDisplay & oledDisplay;
String emlaserver;
String emlaurl;
String sessionCookie;
public:
EmlaServer(OledDisplay & o) : oledDisplay(o)
{
emlaserver = "www.emlalock.com";
emlaurl = "https://" + emlaserver;
}
String GetServer() { return emlaserver; }
bool Connect2WiFi(const char *ssid, const char *password, int timeout);
String GetUrl() { return emlaurl; }
String GetSessionCookie() { return sessionCookie; }
String GetCookieHeader();
void SetCookieFromHeader(String rawCookie);
bool WGet(const String url, String & payload);
bool WPost(const String url, const String request, String & payload, bool getSessionCookie = false);
bool WDelete(const String url, const String request, String & payload);
String UrlEncode(const char *src);
};
#endif
//