diff --git a/src/main.rs b/src/main.rs index 7b08b9a..53a8caa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use std::{ fmt::Display, time::{SystemTime, UNIX_EPOCH}, }; -use upower_dbus::{BatteryLevel, UPowerProxy}; +use upower_dbus::{BatteryLevel, DeviceProxy, UPowerProxy}; use zbus::zvariant::OwnedObjectPath; enum ChargeState { @@ -39,7 +39,13 @@ struct BatteryStatus { rate: EnergyRate, } -type BatteryIdentifier = OwnedObjectPath; +impl<'a> From> for BatteryStatus { + fn from(value: DeviceProxy) -> Self { + todo!() + } +} + +type BatteryIdentifier = String; struct Entry { timestamp: SystemTime, @@ -58,12 +64,14 @@ fn main() -> zbus::Result<()> { let device = upower.get_display_device().await?; eprintln!("Display Device: {device:?}"); + let batteries = HashMap::new(); + let does_contain = batteries.contains_key(&device.path().to_string()); println!("Battery Percentage: {:?}", device.percentage().await); let tracker = Entry { timestamp: SystemTime::now(), - batteries: HashMap::new(), + batteries, }; println!("On Battery: {:?}", upower.on_battery().await);