@@ -30,18 +30,43 @@ class ArduinoOTAClass
30
30
31
31
ArduinoOTAClass ();
32
32
~ArduinoOTAClass ();
33
+
34
+ // Sets the service port. Default 8266
33
35
void setPort (uint16_t port);
36
+
37
+ // Sets the device hostname. Default esp8266-xxxxxx
34
38
void setHostname (const char *hostname);
35
39
String getHostname ();
40
+
41
+ // Sets the password that will be required for OTA. Default NULL
36
42
void setPassword (const char *password);
43
+
44
+ // Sets the password as above but in the form MD5(password). Default NULL
37
45
void setPasswordHash (const char *password);
46
+
47
+ // Sets if the device should be rebooted after successful update. Default true
48
+ void setRebootOnSuccess (bool reboot);
49
+
50
+ // This callback will be called when OTA connection has begun
38
51
void onStart (THandlerFunction fn);
52
+
53
+ // This callback will be called when OTA has finished
39
54
void onEnd (THandlerFunction fn);
55
+
56
+ // This callback will be called when OTA encountered Error
40
57
void onError (THandlerFunction_Error fn);
58
+
59
+ // This callback will be called when OTA is receiving data
41
60
void onProgress (THandlerFunction_Progress fn);
61
+
62
+ // Starts the ArduinoOTA service
42
63
void begin ();
64
+
65
+ // Call this in loop() to run the service
43
66
void handle ();
44
- int getCommand (); // get update command type after OTA started- either U_FLASH or U_SPIFFS
67
+
68
+ // Gets update command type after OTA has started. Either U_FLASH or U_SPIFFS
69
+ int getCommand ();
45
70
46
71
private:
47
72
int _port;
@@ -50,6 +75,7 @@ class ArduinoOTAClass
50
75
String _nonce;
51
76
UdpContext *_udp_ota;
52
77
bool _initialized;
78
+ bool _rebootOnSuccess;
53
79
ota_state_t _state;
54
80
int _size;
55
81
int _cmd;
0 commit comments