Stuff
This commit is contained in:
parent
c8eaf5c045
commit
94999fc93c
1 changed files with 11 additions and 3 deletions
14
src/main.rs
14
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<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);
|
||||
|
|
Loading…
Reference in a new issue