5#ifdef USE_OTA_STATE_LISTENER
19 static_assert(
OTA_ERROR <= 0xFF,
"OTAState must fit in 8 bits for packing");
21 static_cast<uint16_t
>(progress * 100.0f);
22 this->
defer([
this, packed]() {
23 this->
notify_state_(
static_cast<OTAState>(packed >> 24),
static_cast<float>(packed & 0xFFFF) / 100.0f,
24 static_cast<uint8_t
>(packed >> 16));
30 listener->on_ota_state(
state, progress, error);
ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") void defer(const std voi defer)(const char *name, std::function< void()> &&f)
Defer a callback to the next loop() call.
void notify_state_deferred_(OTAState state, float progress, uint8_t error)
Notify state with deferral to main loop (for thread safety).
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.
void notify_ota_state(OTAState state, float progress, uint8_t error, OTAComponent *component)
OTAGlobalCallback * get_global_ota_callback()
OTAGlobalCallback * global_ota_callback