forked from esp8266/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArduinoOTA.h
35 lines (28 loc) · 879 Bytes
/
ArduinoOTA.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
#ifndef __ARDUINO_OTA_H
#define __ARDUINO_OTA_H
class WiFiUDP;
#define OTA_CALLBACK(callback) void (*callback)()
#define OTA_CALLBACK_PROGRESS(callback) void (*callback)(unsigned int, unsigned int)
class ArduinoOTA
{
int _port;
String* _mdns_host;
WiFiUDP* _udp_ota;
bool _serial_debug;
OTA_CALLBACK(_start_callback);
OTA_CALLBACK(_end_callback);
OTA_CALLBACK(_error_callback);
OTA_CALLBACK_PROGRESS(_progress_callback);
public:
ArduinoOTA(const char *mdns_host="ESP8266-OTA-",
int port=8266,
bool serial_debug=true);
~ArduinoOTA();
void setup();
void handle();
void onStart(OTA_CALLBACK(fn));
void onEnd(OTA_CALLBACK(fn));
void onProgress(OTA_CALLBACK_PROGRESS(fn));
void onError(OTA_CALLBACK (fn));
};
#endif /* __ARDUINO_OTA_H */