Crate battery_client

source ·
Expand description

A wrapper around the fuchsia.power.battery.BatteryManager capability.

This library provides an API for receiving updates about the current battery information on the local Fuchsia device. A Stream implementation is provided for clients that rely on notification-style updates. Additional methods are also provided to get the most recently received battery information.

§Example Usage:

// Create the BatteryClient. Under the hood, this will connect to the BatteryManager // capability. let batt_client = BatteryClient::create()?;

// Listen for events from the BatteryClient stream implementation. if let Some(battery_info) = { if let Some(level_percent) = battery_info.level() { // Report to peer. } }


  • Manages the connection to the Fuchsia BatteryManager service.