ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::ota::UpdateLock Class Reference

Serializes flash updates. More...

#include <ota_backend.h>

Public Member Functions

 UpdateLock ()=default
 
 ~UpdateLock ()
 
 UpdateLock (const UpdateLock &)=delete
 
UpdateLock & operator= (const UpdateLock &)=delete
 
bool try_acquire ()
 Returns false if held elsewhere.
 
void release ()
 
bool is_held () const
 
void hold_until_reboot ()
 Keep the lock set until reboot; is_held() becomes false.
 

Static Protected Member Functions

static void force_release ()
 Tests only.
 

Protected Attributes

bool held_ {false}
 

Detailed Description

Serializes flash updates.

Taken in begin(), released when the backend is destroyed, or kept until reboot after a successful end(). Also for components writing the update partition outside OTA.

Definition at line 101 of file ota_backend.h.

Constructor & Destructor Documentation

◆ UpdateLock() [1/2]

esphome::ota::UpdateLock::UpdateLock ( )
default

◆ ~UpdateLock()

esphome::ota::UpdateLock::~UpdateLock ( )
inline

Definition at line 104 of file ota_backend.h.

◆ UpdateLock() [2/2]

esphome::ota::UpdateLock::UpdateLock ( const UpdateLock & )
delete

Member Function Documentation

◆ force_release()

void esphome::ota::UpdateLock::force_release ( )
staticprotected

Tests only.

Definition at line 89 of file ota_backend.cpp.

◆ hold_until_reboot()

void esphome::ota::UpdateLock::hold_until_reboot ( )
inline

Keep the lock set until reboot; is_held() becomes false.

Definition at line 113 of file ota_backend.h.

◆ is_held()

bool esphome::ota::UpdateLock::is_held ( ) const
inline

Definition at line 111 of file ota_backend.h.

◆ operator=()

UpdateLock & esphome::ota::UpdateLock::operator= ( const UpdateLock & )
delete

◆ release()

void esphome::ota::UpdateLock::release ( )

Definition at line 82 of file ota_backend.cpp.

◆ try_acquire()

bool esphome::ota::UpdateLock::try_acquire ( )

Returns false if held elsewhere.

Definition at line 76 of file ota_backend.cpp.

Field Documentation

◆ held_

bool esphome::ota::UpdateLock::held_ {false}
protected

Definition at line 119 of file ota_backend.h.


The documentation for this class was generated from the following files: