dbus-settings-bindings/upower/src/upower.rs

44 lines
1.1 KiB
Rust
Raw Normal View History

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