7#ifdef USE_OTA_STATE_LISTENER
75#ifdef USE_OTA_STATE_LISTENER
88 this->
defer([
this, state, progress, error]() { this->
notify_state_(state, progress, error); });
95#ifdef USE_OTA_STATE_LISTENER
void defer(const std::string &name, std::function< void()> &&f)
Defer a callback to the next loop() call.
virtual OTAResponseTypes end()=0
virtual OTAResponseTypes begin(size_t image_size)=0
virtual ~OTABackend()=default
virtual bool supports_compression()=0
virtual OTAResponseTypes write(uint8_t *data, size_t len)=0
virtual void set_update_md5(const char *md5)=0
void notify_state_deferred_(OTAState state, float progress, uint8_t error)
Notify state with deferral to main loop (for thread safety).
void add_state_listener(OTAStateListener *listener)
std::vector< OTAStateListener * > state_listeners_
void notify_state_(OTAState state, float progress, uint8_t error)
Global callback that aggregates OTA state from all OTA components.
std::vector< OTAGlobalStateListener * > global_listeners_
void notify_ota_state(OTAState state, float progress, uint8_t error, OTAComponent *component)
void add_global_state_listener(OTAGlobalStateListener *listener)
Listener interface for global OTA state changes (includes OTA component pointer).
virtual void on_ota_global_state(OTAState state, float progress, uint8_t error, OTAComponent *component)=0
virtual ~OTAGlobalStateListener()=default
Listener interface for OTA state changes.
virtual ~OTAStateListener()=default
virtual void on_ota_state(OTAState state, float progress, uint8_t error)=0
const Component * component
OTAGlobalCallback * get_global_ota_callback()
std::unique_ptr< ota::OTABackend > make_ota_backend()
@ OTA_RESPONSE_ERROR_MD5_MISMATCH
@ OTA_RESPONSE_ERROR_ESP32_NOT_ENOUGH_SPACE
@ OTA_RESPONSE_UPDATE_PREPARE_OK
@ OTA_RESPONSE_ERROR_WRONG_NEW_FLASH_CONFIG
@ OTA_RESPONSE_SUPPORTS_COMPRESSION
@ OTA_RESPONSE_ERROR_WRONG_CURRENT_FLASH_CONFIG
@ OTA_RESPONSE_BIN_MD5_OK
@ OTA_RESPONSE_UPDATE_END_OK
@ OTA_RESPONSE_RECEIVE_OK
@ OTA_RESPONSE_ERROR_WRITING_FLASH
@ OTA_RESPONSE_ERROR_ESP8266_NOT_ENOUGH_SPACE
@ OTA_RESPONSE_ERROR_UPDATE_END
@ OTA_RESPONSE_ERROR_AUTH_INVALID
@ OTA_RESPONSE_ERROR_RP2040_NOT_ENOUGH_SPACE
@ OTA_RESPONSE_ERROR_UNKNOWN
@ OTA_RESPONSE_REQUEST_SHA256_AUTH
@ OTA_RESPONSE_ERROR_NO_UPDATE_PARTITION
@ OTA_RESPONSE_ERROR_MAGIC
@ OTA_RESPONSE_ERROR_UPDATE_PREPARE
@ OTA_RESPONSE_REQUEST_AUTH
@ OTA_RESPONSE_ERROR_INVALID_BOOTSTRAPPING
Providing packet encoding functions for exchanging data with a remote host.