7#ifdef USE_OTA_STATE_CALLBACK
63#ifdef USE_OTA_STATE_CALLBACK
84 component_->
defer([
this,
state, progress, error]() { this->
call(state, progress, error); });
95#ifdef USE_OTA_STATE_CALLBACK
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
Extended callback manager with deferred call support.
void call_deferred(ota::OTAState state, float progress, uint8_t error)
Call callbacks with deferral to main loop (for thread safety).
StateCallbackManager(OTAComponent *component)
void add_on_state_callback(std::function< void(ota::OTAState, float, uint8_t)> &&callback)
StateCallbackManager state_callback_
void register_ota(OTAComponent *ota_caller)
void add_on_state_callback(std::function< void(OTAState, float, uint8_t, OTAComponent *)> &&callback)
CallbackManager< void(OTAState, float, uint8_t, OTAComponent *)> state_callback_
void register_ota_platform(OTAComponent *ota_caller)
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_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.