-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathweb_update.h
70 lines (56 loc) · 1.3 KB
/
web_update.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
#ifndef web_update_h
#define web_update_h
#include <Arduino.h>
#include <HTTPClient.h>
#include <Update.h>
#include <AsyncDelay.h>
#define UpdateOverEthernet // uncomment this line if you want to use ethernet instead of wifi
#ifdef UpdateOverEthernet
#include <Ethernet.h>
#endif
class web_update
{
public:
web_update(bool debugger = false, uint8_t timeout_seconds = 60, uint16_t read_buffer = 1, bool https = true);
void host(char *host);
void host(IPAddress host);
void hostPort(uint16_t port);
void directory(char *Dir);
void debugger(bool debugger);
void debuggerProd(bool debugger);
void https(bool https);
void buffer_size(uint16_t Buffer);
void timeout(uint8_t timeout);
uint8_t update_wifi();
bool isUpdating();
#ifdef UpdateOverEthernet
uint8_t update_ethernet();
#endif
private:
uint32_t
buffer,
totalLength,
currentLength = 0,
time_out;
uint16_t
hostPort_;
bool
debug,
debugProd = false,
Https,
updatingFirmware = false;
HTTPClient
wifi_client;
char
*HostC,
*dirC;
IPAddress
ip = IPAddress(0, 0, 0, 0);
AsyncDelay
updateAsyncDelay;
#ifdef UpdateOverEthernet
EthernetClient
ethernet_client;
#endif
};
#endif