1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

allow control of restart on http update

#1202
This commit is contained in:
Markus Sattler 2015-12-13 23:04:27 +01:00
parent 8f99861978
commit 4dd5d8cf7d
2 changed files with 12 additions and 12 deletions

View File

@ -42,10 +42,10 @@ ESP8266HTTPUpdate::~ESP8266HTTPUpdate(void) {
* @param httpsFingerprint const char *
* @return t_httpUpdate_return
*/
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * url, const char * current_version, const char * httpsFingerprint) {
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * url, const char * current_version, const char * httpsFingerprint, bool reboot) {
HTTPClient http;
http.begin(url, httpsFingerprint);
return handleUpdate(&http, current_version);
return handleUpdate(&http, current_version, reboot, false);
}
/**
@ -55,10 +55,10 @@ t_httpUpdate_return ESP8266HTTPUpdate::update(const char * url, const char * cur
* @param httpsFingerprint const char *
* @return t_httpUpdate_return
*/
t_httpUpdate_return ESP8266HTTPUpdate::updateSpiffs(const char * url, const char * current_version, const char * httpsFingerprint) {
t_httpUpdate_return ESP8266HTTPUpdate::updateSpiffs(const char * url, const char * current_version, const char * httpsFingerprint, bool reboot) {
HTTPClient http;
http.begin(url, httpsFingerprint);
return handleUpdate(&http, current_version, false, true);
return handleUpdate(&http, current_version, reboot, true);
}
/**
@ -70,16 +70,16 @@ t_httpUpdate_return ESP8266HTTPUpdate::updateSpiffs(const char * url, const char
* @param httpsFingerprint const char *
* @return
*/
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port, const char * url, const char * current_version, bool https, const char * httpsFingerprint) {
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port, const char * url, const char * current_version, bool https, const char * httpsFingerprint, bool reboot) {
HTTPClient http;
http.begin(host, port, url, https, httpsFingerprint);
return handleUpdate(&http, current_version);
return handleUpdate(&http, current_version, reboot, false);
}
t_httpUpdate_return ESP8266HTTPUpdate::update(String host, uint16_t port, String url, String current_version, bool https, String httpsFingerprint) {
t_httpUpdate_return ESP8266HTTPUpdate::update(String host, uint16_t port, String url, String current_version, bool https, String httpsFingerprint, bool reboot) {
HTTPClient http;
http.begin(host, port, url, https, httpsFingerprint);
return handleUpdate(&http, current_version.c_str());
return handleUpdate(&http, current_version.c_str(), reboot, false);
}
/**

View File

@ -49,11 +49,11 @@ class ESP8266HTTPUpdate {
ESP8266HTTPUpdate(void);
~ESP8266HTTPUpdate(void);
t_httpUpdate_return update(const char * url, const char * current_version = "", const char * httpsFingerprint = "");
t_httpUpdate_return update(const char * host, uint16_t port, const char * url = "/", const char * current_version = "", bool https = false, const char * httpsFingerprint = "");
t_httpUpdate_return update(String host, uint16_t port, String url = "/", String current_version = "", bool https = false, String httpsFingerprint = "");
t_httpUpdate_return update(const char * url, const char * current_version = "", const char * httpsFingerprint = "", bool reboot = true);
t_httpUpdate_return update(const char * host, uint16_t port, const char * url = "/", const char * current_version = "", bool https = false, const char * httpsFingerprint = "", bool reboot = true);
t_httpUpdate_return update(String host, uint16_t port, String url = "/", String current_version = "", bool https = false, String httpsFingerprint = "", bool reboot = true);
t_httpUpdate_return updateSpiffs(const char * url, const char * current_version = "", const char * httpsFingerprint = "");
t_httpUpdate_return updateSpiffs(const char * url, const char * current_version = "", const char * httpsFingerprint = "", bool reboot = false);
protected:
t_httpUpdate_return handleUpdate(HTTPClient * http, const char * current_version, bool reboot = true, bool spiffs = false);