@@ -30,18 +30,43 @@ class ArduinoOTAClass
3030
3131 ArduinoOTAClass ();
3232 ~ArduinoOTAClass ();
33+
34+ // Sets the service port. Default 8266
3335 void setPort (uint16_t port);
36+
37+ // Sets the device hostname. Default esp8266-xxxxxx
3438 void setHostname (const char *hostname);
3539 String getHostname ();
40+
41+ // Sets the password that will be required for OTA. Default NULL
3642 void setPassword (const char *password);
43+
44+ // Sets the password as above but in the form MD5(password). Default NULL
3745 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
3851 void onStart (THandlerFunction fn);
52+
53+ // This callback will be called when OTA has finished
3954 void onEnd (THandlerFunction fn);
55+
56+ // This callback will be called when OTA encountered Error
4057 void onError (THandlerFunction_Error fn);
58+
59+ // This callback will be called when OTA is receiving data
4160 void onProgress (THandlerFunction_Progress fn);
61+
62+ // Starts the ArduinoOTA service
4263 void begin ();
64+
65+ // Call this in loop() to run the service
4366 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 ();
4570
4671 private:
4772 int _port;
@@ -50,6 +75,7 @@ class ArduinoOTAClass
5075 String _nonce;
5176 UdpContext *_udp_ota;
5277 bool _initialized;
78+ bool _rebootOnSuccess;
5379 ota_state_t _state;
5480 int _size;
5581 int _cmd;
0 commit comments