chore: cargo fmt & geoclue docs
This commit is contained in:
parent
c83767c7e5
commit
8b9767f6ce
7 changed files with 199 additions and 191 deletions
|
|
@ -53,6 +53,9 @@ trait Manager {
|
||||||
#[dbus_proxy(object = "Client")]
|
#[dbus_proxy(object = "Client")]
|
||||||
fn get_client(&self);
|
fn get_client(&self);
|
||||||
|
|
||||||
|
/// Use this method to explicitly destroy a client, created using GetClient() or CreateClient().
|
||||||
|
///
|
||||||
|
/// Long-running applications, should either use this to delete associated client(s) when not needed, or disconnect from the D-Bus connection used for communicating with Geoclue (which is implicit on client process termination).
|
||||||
#[dbus_proxy(object = "Client")]
|
#[dbus_proxy(object = "Client")]
|
||||||
fn delete_client<'a>(&self, client: ObjectPath<'a>);
|
fn delete_client<'a>(&self, client: ObjectPath<'a>);
|
||||||
|
|
||||||
|
|
@ -121,12 +124,17 @@ trait Client {
|
||||||
interface = "org.freedesktop.GeoClue2.Location"
|
interface = "org.freedesktop.GeoClue2.Location"
|
||||||
)]
|
)]
|
||||||
trait Location {
|
trait Location {
|
||||||
|
/// The latitude of the location, in degrees.
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn latitude(&self) -> Result<f64>;
|
fn latitude(&self) -> Result<f64>;
|
||||||
|
/// The longitude of the location, in degrees.
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn longitude(&self) -> Result<f64>;
|
fn longitude(&self) -> Result<f64>;
|
||||||
|
/// The accuracy of the location fix, in meters.
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn accuracy(&self) -> Result<f64>;
|
fn accuracy(&self) -> Result<f64>;
|
||||||
|
/// The altitude of the location fix, in meters.
|
||||||
|
/// When unknown, its set to minimum f64 value, -1.7976931348623157e+308.
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn altitude(&self) -> Result<f64>;
|
fn altitude(&self) -> Result<f64>;
|
||||||
/// Speed in meters per second.
|
/// Speed in meters per second.
|
||||||
|
|
|
||||||
|
|
@ -9,48 +9,48 @@ const CHOICES: &[&str] = &["no", "yes"];
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
pub async fn main() -> zbus::Result<()> {
|
pub async fn main() -> zbus::Result<()> {
|
||||||
let connection = zbus::Connection::system().await?;
|
let connection = zbus::Connection::system().await?;
|
||||||
let proxy = timedate_zbus::TimeDateProxy::new(&connection).await?;
|
let proxy = timedate_zbus::TimeDateProxy::new(&connection).await?;
|
||||||
|
|
||||||
let ntp_service = if proxy.ntp().await? {
|
let ntp_service = if proxy.ntp().await? {
|
||||||
"active"
|
"active"
|
||||||
} else {
|
} else {
|
||||||
"inactive"
|
"inactive"
|
||||||
};
|
};
|
||||||
|
|
||||||
let rtc_in_local = proxy.local_rtc().await?;
|
let rtc_in_local = proxy.local_rtc().await?;
|
||||||
let rtc_time_usecs = proxy.rtctime_usec().await?;
|
let rtc_time_usecs = proxy.rtctime_usec().await?;
|
||||||
let time_usecs = proxy.time_usec().await?;
|
let time_usecs = proxy.time_usec().await?;
|
||||||
let timezone = proxy.timezone().await?;
|
let timezone = proxy.timezone().await?;
|
||||||
|
|
||||||
let tz: chrono_tz::Tz = timezone.parse().unwrap();
|
let tz: chrono_tz::Tz = timezone.parse().unwrap();
|
||||||
|
|
||||||
let datetime = tz.timestamp_millis_opt((time_usecs / 1000) as i64).unwrap();
|
let datetime = tz.timestamp_millis_opt((time_usecs / 1000) as i64).unwrap();
|
||||||
|
|
||||||
let rtc_millis = (rtc_time_usecs / 1000) as i64;
|
let rtc_millis = (rtc_time_usecs / 1000) as i64;
|
||||||
let rtc_time = (if rtc_in_local {
|
let rtc_time = (if rtc_in_local {
|
||||||
tz.timestamp_millis_opt(rtc_millis).unwrap()
|
tz.timestamp_millis_opt(rtc_millis).unwrap()
|
||||||
} else {
|
} else {
|
||||||
chrono_tz::UTC.timestamp_millis_opt(rtc_millis).unwrap()
|
chrono_tz::UTC.timestamp_millis_opt(rtc_millis).unwrap()
|
||||||
})
|
})
|
||||||
.format(RTC_FORMAT);
|
.format(RTC_FORMAT);
|
||||||
|
|
||||||
let local = datetime.format(TZ_FORMAT);
|
let local = datetime.format(TZ_FORMAT);
|
||||||
let universal = datetime.with_timezone(&chrono_tz::UTC).format(TZ_FORMAT);
|
let universal = datetime.with_timezone(&chrono_tz::UTC).format(TZ_FORMAT);
|
||||||
let tz_string = datetime.format("%Z, %z");
|
let tz_string = datetime.format("%Z, %z");
|
||||||
|
|
||||||
let rtc_in_local = CHOICES[usize::from(rtc_in_local)];
|
let rtc_in_local = CHOICES[usize::from(rtc_in_local)];
|
||||||
let synchronized = CHOICES[usize::from(proxy.ntp_synchronized().await.unwrap_or_default())];
|
let synchronized = CHOICES[usize::from(proxy.ntp_synchronized().await.unwrap_or_default())];
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
" Local time: {local}
|
" Local time: {local}
|
||||||
Universal time: {universal}
|
Universal time: {universal}
|
||||||
RTC time: {rtc_time}
|
RTC time: {rtc_time}
|
||||||
Time zone: {timezone} ({tz_string})
|
Time zone: {timezone} ({tz_string})
|
||||||
System clock synchronized: {synchronized}
|
System clock synchronized: {synchronized}
|
||||||
NTP Service: {ntp_service}
|
NTP Service: {ntp_service}
|
||||||
RTC in local TZ: {rtc_in_local}"
|
RTC in local TZ: {rtc_in_local}"
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,58 +18,58 @@
|
||||||
use zbus::dbus_proxy;
|
use zbus::dbus_proxy;
|
||||||
|
|
||||||
#[dbus_proxy(
|
#[dbus_proxy(
|
||||||
interface = "org.freedesktop.timedate1",
|
interface = "org.freedesktop.timedate1",
|
||||||
default_service = "org.freedesktop.timedate1",
|
default_service = "org.freedesktop.timedate1",
|
||||||
default_path = "/org/freedesktop/timedate1"
|
default_path = "/org/freedesktop/timedate1"
|
||||||
)]
|
)]
|
||||||
trait TimeDate {
|
trait TimeDate {
|
||||||
/// A list of time zones known on the local system as an array of names.
|
/// A list of time zones known on the local system as an array of names.
|
||||||
fn list_timezones(&self) -> zbus::Result<Vec<String>>;
|
fn list_timezones(&self) -> zbus::Result<Vec<String>>;
|
||||||
|
|
||||||
/// Control whether the RTC is in local time zone or UTC.
|
/// Control whether the RTC is in local time zone or UTC.
|
||||||
#[dbus_proxy(name = "SetLocalRTC")]
|
#[dbus_proxy(name = "SetLocalRTC")]
|
||||||
fn set_local_rtc(
|
fn set_local_rtc(
|
||||||
&self,
|
&self,
|
||||||
local_rtc: bool,
|
local_rtc: bool,
|
||||||
fix_system: bool,
|
fix_system: bool,
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
) -> zbus::Result<()>;
|
) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Control whether the system clock is synchronized with the network using `systemd-timesyncd`.
|
/// Control whether the system clock is synchronized with the network using `systemd-timesyncd`.
|
||||||
#[dbus_proxy(name = "SetNTP")]
|
#[dbus_proxy(name = "SetNTP")]
|
||||||
fn set_ntp(&self, use_ntp: bool, interactive: bool) -> zbus::Result<()>;
|
fn set_ntp(&self, use_ntp: bool, interactive: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Change the system clock.
|
/// Change the system clock.
|
||||||
fn set_time(&self, usec_utc: i64, relative: bool, interactive: bool) -> zbus::Result<()>;
|
fn set_time(&self, usec_utc: i64, relative: bool, interactive: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Set the system time zone.
|
/// Set the system time zone.
|
||||||
fn set_timezone(&self, timezone: &str, interactive: bool) -> zbus::Result<()>;
|
fn set_timezone(&self, timezone: &str, interactive: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Shows whether a service to perform time synchronization over network is available.
|
/// Shows whether a service to perform time synchronization over network is available.
|
||||||
#[dbus_proxy(property, name = "CanNTP")]
|
#[dbus_proxy(property, name = "CanNTP")]
|
||||||
fn can_ntp(&self) -> zbus::Result<bool>;
|
fn can_ntp(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// Shows whether the RTC is configured to use UTC or the local time zone.
|
/// Shows whether the RTC is configured to use UTC or the local time zone.
|
||||||
#[dbus_proxy(property, name = "LocalRTC")]
|
#[dbus_proxy(property, name = "LocalRTC")]
|
||||||
fn local_rtc(&self) -> zbus::Result<bool>;
|
fn local_rtc(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// Shows whether the NTP service is enabled.
|
/// Shows whether the NTP service is enabled.
|
||||||
#[dbus_proxy(property, name = "NTP")]
|
#[dbus_proxy(property, name = "NTP")]
|
||||||
fn ntp(&self) -> zbus::Result<bool>;
|
fn ntp(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// Shows whether the kernel reports the time as synchronized.
|
/// Shows whether the kernel reports the time as synchronized.
|
||||||
#[dbus_proxy(property, name = "NTPSynchronized")]
|
#[dbus_proxy(property, name = "NTPSynchronized")]
|
||||||
fn ntp_synchronized(&self) -> zbus::Result<bool>;
|
fn ntp_synchronized(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// Shows the current time in RTC.
|
/// Shows the current time in RTC.
|
||||||
#[dbus_proxy(property, name = "RTCTimeUSec")]
|
#[dbus_proxy(property, name = "RTCTimeUSec")]
|
||||||
fn rtctime_usec(&self) -> zbus::Result<u64>;
|
fn rtctime_usec(&self) -> zbus::Result<u64>;
|
||||||
|
|
||||||
/// Shows the current time.
|
/// Shows the current time.
|
||||||
#[dbus_proxy(property, name = "TimeUSec")]
|
#[dbus_proxy(property, name = "TimeUSec")]
|
||||||
fn time_usec(&self) -> zbus::Result<u64>;
|
fn time_usec(&self) -> zbus::Result<u64>;
|
||||||
|
|
||||||
/// Shows the currently-configured time zone.
|
/// Shows the currently-configured time zone.
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn timezone(&self) -> zbus::Result<String>;
|
fn timezone(&self) -> zbus::Result<String>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,21 @@ extern crate upower_dbus;
|
||||||
use upower_dbus::UPowerProxy;
|
use upower_dbus::UPowerProxy;
|
||||||
|
|
||||||
fn main() -> zbus::Result<()> {
|
fn main() -> zbus::Result<()> {
|
||||||
futures::executor::block_on(async move {
|
futures::executor::block_on(async move {
|
||||||
let connection = zbus::Connection::system().await?;
|
let connection = zbus::Connection::system().await?;
|
||||||
|
|
||||||
let upower = UPowerProxy::new(&connection).await?;
|
let upower = UPowerProxy::new(&connection).await?;
|
||||||
|
|
||||||
let device = upower.get_display_device().await?;
|
let device = upower.get_display_device().await?;
|
||||||
|
|
||||||
println!("BatteryLevel: {:?}", device.battery_level().await);
|
println!("BatteryLevel: {:?}", device.battery_level().await);
|
||||||
println!("IconName: {:?}", device.icon_name().await);
|
println!("IconName: {:?}", device.icon_name().await);
|
||||||
println!("IsPresent: {:?}", device.is_present().await);
|
println!("IsPresent: {:?}", device.is_present().await);
|
||||||
println!("Online: {:?}", device.online().await);
|
println!("Online: {:?}", device.online().await);
|
||||||
println!("Percentage: {:?}", device.percentage().await);
|
println!("Percentage: {:?}", device.percentage().await);
|
||||||
println!("State: {:?}", device.state().await);
|
println!("State: {:?}", device.state().await);
|
||||||
println!("Type: {:?}", device.type_().await);
|
println!("Type: {:?}", device.type_().await);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,19 +7,19 @@ use futures::stream::StreamExt;
|
||||||
use upower_dbus::UPowerProxy;
|
use upower_dbus::UPowerProxy;
|
||||||
|
|
||||||
fn main() -> zbus::Result<()> {
|
fn main() -> zbus::Result<()> {
|
||||||
futures::executor::block_on(async move {
|
futures::executor::block_on(async move {
|
||||||
let connection = zbus::Connection::system().await?;
|
let connection = zbus::Connection::system().await?;
|
||||||
|
|
||||||
let upower = UPowerProxy::new(&connection).await?;
|
let upower = UPowerProxy::new(&connection).await?;
|
||||||
|
|
||||||
println!("On Battery: {:?}", upower.on_battery().await);
|
println!("On Battery: {:?}", upower.on_battery().await);
|
||||||
|
|
||||||
let mut stream = upower.receive_on_battery_changed().await;
|
let mut stream = upower.receive_on_battery_changed().await;
|
||||||
|
|
||||||
while let Some(event) = stream.next().await {
|
while let Some(event) = stream.next().await {
|
||||||
eprintln!("{:?}", event.get().await);
|
eprintln!("{:?}", event.get().await);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,115 +8,115 @@ use zbus::zvariant::OwnedValue;
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize_repr, Serialize_repr, OwnedValue)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize_repr, Serialize_repr, OwnedValue)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum BatteryState {
|
pub enum BatteryState {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Charging = 1,
|
Charging = 1,
|
||||||
Discharging = 2,
|
Discharging = 2,
|
||||||
Empty = 3,
|
Empty = 3,
|
||||||
FullyCharged = 4,
|
FullyCharged = 4,
|
||||||
PendingCharge = 5,
|
PendingCharge = 5,
|
||||||
PendingDischarge = 6,
|
PendingDischarge = 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize_repr, Serialize_repr, OwnedValue)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize_repr, Serialize_repr, OwnedValue)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum BatteryType {
|
pub enum BatteryType {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
LinePower = 1,
|
LinePower = 1,
|
||||||
Battery = 2,
|
Battery = 2,
|
||||||
Ups = 3,
|
Ups = 3,
|
||||||
Monitor = 4,
|
Monitor = 4,
|
||||||
Mouse = 5,
|
Mouse = 5,
|
||||||
Keyboard = 6,
|
Keyboard = 6,
|
||||||
Pda = 7,
|
Pda = 7,
|
||||||
Phone = 8,
|
Phone = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize_repr, Serialize_repr, OwnedValue)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize_repr, Serialize_repr, OwnedValue)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum BatteryLevel {
|
pub enum BatteryLevel {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
None = 1,
|
None = 1,
|
||||||
Low = 3,
|
Low = 3,
|
||||||
Critical = 4,
|
Critical = 4,
|
||||||
Normal = 6,
|
Normal = 6,
|
||||||
High = 7,
|
High = 7,
|
||||||
Full = 8,
|
Full = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_proxy(
|
#[dbus_proxy(
|
||||||
interface = "org.freedesktop.UPower.Device",
|
interface = "org.freedesktop.UPower.Device",
|
||||||
default_service = "org.freedesktop.UPower",
|
default_service = "org.freedesktop.UPower",
|
||||||
assume_defaults = false
|
assume_defaults = false
|
||||||
)]
|
)]
|
||||||
trait Device {
|
trait Device {
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn battery_level(&self) -> zbus::Result<BatteryLevel>;
|
fn battery_level(&self) -> zbus::Result<BatteryLevel>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn capacity(&self) -> zbus::Result<f64>;
|
fn capacity(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn energy(&self) -> zbus::Result<f64>;
|
fn energy(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn energy_empty(&self) -> zbus::Result<f64>;
|
fn energy_empty(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn energy_full(&self) -> zbus::Result<f64>;
|
fn energy_full(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn energy_full_design(&self) -> zbus::Result<f64>;
|
fn energy_full_design(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn has_history(&self) -> zbus::Result<bool>;
|
fn has_history(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn has_statistics(&self) -> zbus::Result<bool>;
|
fn has_statistics(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn icon_name(&self) -> zbus::Result<String>;
|
fn icon_name(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn is_present(&self) -> zbus::Result<bool>;
|
fn is_present(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn is_rechargeable(&self) -> zbus::Result<bool>;
|
fn is_rechargeable(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn luminosity(&self) -> zbus::Result<f64>;
|
fn luminosity(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn model(&self) -> zbus::Result<String>;
|
fn model(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn native_path(&self) -> zbus::Result<String>;
|
fn native_path(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn online(&self) -> zbus::Result<bool>;
|
fn online(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn percentage(&self) -> zbus::Result<f64>;
|
fn percentage(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn power_supply(&self) -> zbus::Result<bool>;
|
fn power_supply(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
fn refresh(&self) -> zbus::Result<()>;
|
fn refresh(&self) -> zbus::Result<()>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn serial(&self) -> zbus::Result<String>;
|
fn serial(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn state(&self) -> zbus::Result<BatteryState>;
|
fn state(&self) -> zbus::Result<BatteryState>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn temperature(&self) -> zbus::Result<f64>;
|
fn temperature(&self) -> zbus::Result<f64>;
|
||||||
|
|
||||||
#[dbus_proxy(property, name = "Type")]
|
#[dbus_proxy(property, name = "Type")]
|
||||||
fn type_(&self) -> zbus::Result<BatteryType>;
|
fn type_(&self) -> zbus::Result<BatteryType>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn vendor(&self) -> zbus::Result<String>;
|
fn vendor(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn voltage(&self) -> zbus::Result<f64>;
|
fn voltage(&self) -> zbus::Result<f64>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,37 +7,37 @@ use crate::device::{DeviceProxy, DeviceProxyBlocking};
|
||||||
|
|
||||||
#[dbus_proxy(interface = "org.freedesktop.UPower", assume_defaults = true)]
|
#[dbus_proxy(interface = "org.freedesktop.UPower", assume_defaults = true)]
|
||||||
trait UPower {
|
trait UPower {
|
||||||
/// EnumerateDevices method
|
/// EnumerateDevices method
|
||||||
fn enumerate_devices(&self) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>;
|
fn enumerate_devices(&self) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>;
|
||||||
|
|
||||||
/// GetCriticalAction method
|
/// GetCriticalAction method
|
||||||
fn get_critical_action(&self) -> zbus::Result<String>;
|
fn get_critical_action(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
/// GetDisplayDevice method
|
/// GetDisplayDevice method
|
||||||
#[dbus_proxy(object = "Device")]
|
#[dbus_proxy(object = "Device")]
|
||||||
fn get_display_device(&self);
|
fn get_display_device(&self);
|
||||||
|
|
||||||
/// DeviceAdded signal
|
/// DeviceAdded signal
|
||||||
#[dbus_proxy(signal)]
|
#[dbus_proxy(signal)]
|
||||||
fn device_added(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
|
fn device_added(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// DeviceRemoved signal
|
/// DeviceRemoved signal
|
||||||
#[dbus_proxy(signal)]
|
#[dbus_proxy(signal)]
|
||||||
fn device_removed(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
|
fn device_removed(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// DaemonVersion property
|
/// DaemonVersion property
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn daemon_version(&self) -> zbus::Result<String>;
|
fn daemon_version(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
/// LidIsClosed property
|
/// LidIsClosed property
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn lid_is_closed(&self) -> zbus::Result<bool>;
|
fn lid_is_closed(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// LidIsPresent property
|
/// LidIsPresent property
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn lid_is_present(&self) -> zbus::Result<bool>;
|
fn lid_is_present(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// OnBattery property
|
/// OnBattery property
|
||||||
#[dbus_proxy(property)]
|
#[dbus_proxy(property)]
|
||||||
fn on_battery(&self) -> zbus::Result<bool>;
|
fn on_battery(&self) -> zbus::Result<bool>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue