AutoConnectUpdate API
Constructor¶
AutoConnectUpdate¶
AutoConnectUpdate(const String& host, const uint16_t port, const String& uri, const int timeout, const uint8_t ledOn)
- Parameters
- hostUpdate server address. Specifies IP address or FQDN.
- portSpecifies HTTP port for the updating process. The default is defined as the AUTOCONNECT_UPDATE_PORT macro in the
AutoConnectDefs.h
header file. - uriSpecifies a URI on the update server that has deployed available binary sketch files.
- timeoutSpecifies the maximum response time for the update server. The default is defined as the AUTOCONNECT_UPDATE_TIMEOUT macro in the
AutoConnectDefs.h
header file.- ledOnActive signal to light the LED ticker during the update. Specifies HIGH or LOW
The AutoConnectUpdate class inherits from the ESP8266HTTPUpdate (HTTPUpdate for ESP32) class.
Public member functions¶
attach¶
void AutoConnectUpdate::attach(AutoConnect& portal)
- Parameter
- portalSpecifies a reference to the AutoConnect instance to attach.
disable¶
void AutoConnectUpdate::disable(const bool activate)
- Parameter
- activateIf specified the true then the Update item will be displayed on the AutoConnect menu and OTA update will be available during the WiFi status is WL_CONNECTED. For the false, the OTA update feature is disabled.
enable¶
void AutoConnectUpdate::enable(void)
handleUpdate¶
void AutoConnectUpdate::handleUpdate(void)
isEnabled¶
bool AutoConnectUpdate::isEnabled(void)
rebootOnUpdate¶
void AutoConnectUpdate::rebootOnUpdate(bool reboot)
- Parameter
- rebootIf specified the true then the ESP module will reboot after the updating successfully completed. For the false, The module does not reboot automatically. The updated firmware remains stored in the flash update firmware area equipped on the ESP module. The boot process during the next start turn of the module by reset will copy the updated firmware to the actual program area and a new sketch program will start. The default value is the true.
This function inherits from the ESP8266HTTPUpdate (HTTPUpdate for ESP32) class.
setLedPin¶
void AutoConnectUpdate::setLedPin(int ledPin, uint8_t ledOn)
- Parameter
- ledPinSpecifies the PIN connected external LED for the ticker. The default is defined as the AUTOCONNECT_TICKER_PORT macro in the
AutoConnectDefs.h
header file and it is derived from the board-specific LED_BUILTIN. By default, the AutoConnectUpdate class does not use the ticker for boards without the LED_BUILTIN definition. If you connect the ticker LED externally, you need to specify the PIN using the setLedPin function. - ledOnSpecifies the the ON signal level of the LED PIN port. It is HIGH or LOW.
This function inherits from the ESP8266HTTPUpdate (HTTPUpdate for ESP32) class.
status¶
AC_UPDATESTATUS_t AutoConnectUpdate::status(void)
- Return value
- One of the enumerated values indicating the status of the Update class as follows:
-
- UPDATE_RESET : Update process ended, need to reset.
- UPDATE_IDLE : Update process has not started.
- UPDATE_START : Update process has been started.
- UPDATE_PROGRESS : Update process has been started.
- UPDATE_SUCCESS : Update successfully completed.
- UPDATE_NOAVAIL : No available update.
- UPDATE_FAIL : Update failed.
Public member variables¶
host¶
Update server address. Specifies IP address or FQDN.
- Type
- String
port¶
HTTP port for the updating process.
- Type
- StringThe default is defined as the AUTOCONNECT_UPDATE_PORT macro in the
AutoConnectDefs.h
header file.
uri¶
URI on the update server that has deployed available binary sketch files.
- Type
- String