This commit is contained in:
Daniel Flanagan 2024-02-01 17:38:56 -06:00
parent c8eaf5c045
commit 94999fc93c
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4

View file

@ -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<DeviceProxy<'a>> 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);