Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ersa::services::WakeLock Class Reference

#include <power_manager.h>

Public Member Functions

 WakeLock (const char *tag)
 
 ~WakeLock ()
 
 WakeLock (const WakeLock &)=delete
 
WakeLock & operator= (const WakeLock &)=delete
 
 WakeLock (WakeLock &&other) noexcept
 
WakeLock & operator= (WakeLock &&other) noexcept
 
void release ()
 

Private Attributes

const char * tag_ {nullptr}
 
bool active_ {false}
 

Detailed Description

RAII lease that prevents automatic sleep while a feature is active. The tag is diagnostic and must remain valid until release. Scope-based use makes cleanup reliable on early returns; move operations transfer the lease without incrementing the manager's active-lock count.

Constructor & Destructor Documentation

◆ WakeLock() [1/3]

ersa::services::WakeLock::WakeLock ( const char *  tag)
explicit

Acquire one sleep-prevention lease for a feature or operation.

◆ ~WakeLock()

ersa::services::WakeLock::~WakeLock ( )

Release the lease during destruction; repeated explicit release is safe.

◆ WakeLock() [2/3]

ersa::services::WakeLock::WakeLock ( const WakeLock &  )
delete

◆ WakeLock() [3/3]

ersa::services::WakeLock::WakeLock ( WakeLock &&  other)
noexcept

Transfer lease ownership; the moved-from object becomes inactive.

Member Function Documentation

◆ operator=() [1/2]

WakeLock & ersa::services::WakeLock::operator= ( const WakeLock &  )
delete

◆ operator=() [2/2]

WakeLock & ersa::services::WakeLock::operator= ( WakeLock &&  other)
noexcept

Release the current lease, then transfer the source object's lease.

◆ release()

void ersa::services::WakeLock::release ( )

Release before scope exit when work completes early.

Member Data Documentation

◆ active_

bool ersa::services::WakeLock::active_ {false}
private

◆ tag_

const char* ersa::services::WakeLock::tag_ {nullptr}
private

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