feat: add upower-dbus for org.freedesktop.UPower

This commit is contained in:
Michael Aaron Murphy 2023-02-01 17:31:08 +01:00
parent 943c2a8bf2
commit 4d8815361d
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
10 changed files with 677 additions and 1 deletions

43
upower/src/upower.rs Normal file
View file

@ -0,0 +1,43 @@
// Copyright 2021 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
use zbus::dbus_proxy;
use crate::device::{DeviceProxy, DeviceProxyBlocking};
#[dbus_proxy(interface = "org.freedesktop.UPower", assume_defaults = true)]
trait UPower {
/// EnumerateDevices method
fn enumerate_devices(&self) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>;
/// GetCriticalAction method
fn get_critical_action(&self) -> zbus::Result<String>;
/// GetDisplayDevice method
#[dbus_proxy(object = "Device")]
fn get_display_device(&self);
/// DeviceAdded signal
#[dbus_proxy(signal)]
fn device_added(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
/// DeviceRemoved signal
#[dbus_proxy(signal)]
fn device_removed(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
/// DaemonVersion property
#[dbus_proxy(property)]
fn daemon_version(&self) -> zbus::Result<String>;
/// LidIsClosed property
#[dbus_proxy(property)]
fn lid_is_closed(&self) -> zbus::Result<bool>;
/// LidIsPresent property
#[dbus_proxy(property)]
fn lid_is_present(&self) -> zbus::Result<bool>;
/// OnBattery property
#[dbus_proxy(property)]
fn on_battery(&self) -> zbus::Result<bool>;
}