ESP8266
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ESP8266HTTPUpdate Class Reference

Public Member Functions

 ESP8266HTTPUpdate (void)
 
 ~ESP8266HTTPUpdate (void)
 
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="", bool reboot=false)
 
int getLastError (void)
 
String getLastErrorString (void)
 

Protected Member Functions

t_httpUpdate_return handleUpdate (HTTPClient *http, const char *current_version, bool reboot=true, bool spiffs=false)
 
bool runUpdate (Stream &in, uint32_t size, String md5, int command=U_FLASH)
 

Protected Attributes

int lastError
 

Constructor & Destructor Documentation

ESP8266HTTPUpdate::ESP8266HTTPUpdate ( void  )
ESP8266HTTPUpdate::~ESP8266HTTPUpdate ( void  )

Member Function Documentation

int ESP8266HTTPUpdate::getLastError ( void  )

return error code as int

Returns
int error code
String ESP8266HTTPUpdate::getLastErrorString ( void  )

return error code as String

Returns
String error
t_httpUpdate_return ESP8266HTTPUpdate::handleUpdate ( HTTPClient http,
const char *  current_version,
bool  reboot = true,
bool  spiffs = false 
)
protected
Parameters
httpHTTPClient *
current_versionconst char *
Returns
t_httpUpdate_return

< OK (Start Update)

< Not Modified (No updates)

bool ESP8266HTTPUpdate::runUpdate ( Stream in,
uint32_t  size,
String  md5,
int  command = U_FLASH 
)
protected

write Update to flash

Parameters
inStream&
sizeuint32_t
md5String
Returns
true if Update ok
t_httpUpdate_return ESP8266HTTPUpdate::update ( const char *  url,
const char *  current_version = "",
const char *  httpsFingerprint = "",
bool  reboot = true 
)
Parameters
urlconst char *
current_versionconst char *
httpsFingerprintconst char *
Returns
t_httpUpdate_return
t_httpUpdate_return ESP8266HTTPUpdate::update ( const char *  host,
uint16_t  port,
const char *  url = "/",
const char *  current_version = "",
bool  https = false,
const char *  httpsFingerprint = "",
bool  reboot = true 
)
Parameters
hostconst char *
portuint16_t
urlconst char *
current_versionconst char *
httpsFingerprintconst char *
Returns
t_httpUpdate_return ESP8266HTTPUpdate::update ( String  host,
uint16_t  port,
String  url = "/",
String  current_version = "",
bool  https = false,
String  httpsFingerprint = "",
bool  reboot = true 
)
t_httpUpdate_return ESP8266HTTPUpdate::updateSpiffs ( const char *  url,
const char *  current_version = "",
const char *  httpsFingerprint = "",
bool  reboot = false 
)
Parameters
urlconst char *
current_versionconst char *
httpsFingerprintconst char *
Returns
t_httpUpdate_return

Member Data Documentation

int ESP8266HTTPUpdate::lastError
protected