Skip to main content

PowerManager

Trait PowerManager 

Source
pub trait PowerManager: Send + Sync {
    // Required methods
    fn suspend(&self) -> Result<(), PowerError>;
    fn resume(&self) -> Result<(), PowerError>;

    // Provided methods
    fn init_cores(&self) -> Result<(), PowerError> { ... }
    fn restore_cores(&self) -> Result<(), PowerError> { ... }
}
Expand description

Trait for device power state management (suspend and resume).

Required Methods§

Source

fn suspend(&self) -> Result<(), PowerError>

Suspends the device to RAM.

This method deactivates the touch screen, flushes dirty pages, and triggers low-power mode.

§Errors

Returns PowerError if any write or sync operation fails.

Source

fn resume(&self) -> Result<(), PowerError>

Resumes the device from suspend.

This method reactivates the touch screen and applies any necessary model-specific wake up commands.

§Errors

Returns PowerError if any write operation fails.

Provided Methods§

Source

fn init_cores(&self) -> Result<(), PowerError>

Initializes and enables all available CPU cores on startup.

§Errors

Returns PowerError if scanning or enabling fails.

Source

fn restore_cores(&self) -> Result<(), PowerError>

Restores CPU cores to their initial state on shutdown.

§Errors

Returns PowerError if writing the saved states fails.

Implementors§