pub trait GaugeBase {
fn path(&self) -> &'static str;
fn get_capacity(&self) -> Result<u32> { ... }
fn get_voltage(&self) -> Result<u32> { ... }
fn get_current(&self) -> Result<i32> { ... }
fn get_full_charge_capacity(&self) -> Result<u32> { ... }
fn get_charge_now_capacity(&self) -> Result<u32> { ... }
}
Expand description
A gauge chip provide basic sysfs interfaces for the application which include capacity (SOC), current, voltage, full chargerd capacity and charge now capacity.
GaugeBase
trait implement the get functions for all the above info when
user set the right path.
Additionally, BMW provides a procedural macro called Gauge
to automatically
generate GaugeBase
implementations for structs in your program.