Device can now be downcasted to a specific type of device (and upcasted back)

This commit is contained in:
Lucy 2022-01-11 17:51:15 -05:00
parent 2acdb272fb
commit e40c3e7787
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
7 changed files with 106 additions and 6 deletions

View file

@ -182,7 +182,7 @@ pub trait Device {
/// Path property
#[dbus_proxy(property)]
fn path(&self) -> zbus::Result<String>;
fn path_(&self) -> zbus::Result<String>;
/// PhysicalPortId property
#[dbus_proxy(property)]

View file

@ -51,6 +51,7 @@ pub enum DeviceType {
Ethernet,
Wifi,
Bluetooth,
Generic,
Other,
Unknown,
}
@ -61,7 +62,8 @@ impl From<u32> for DeviceType {
1 => DeviceType::Ethernet,
2 => DeviceType::Wifi,
5 => DeviceType::Bluetooth,
3..=4 | 6..=32 => DeviceType::Other,
14 => DeviceType::Generic,
3..=32 => DeviceType::Other,
_ => DeviceType::Unknown,
}
}

View file

@ -19,6 +19,7 @@
//! * [`zbus::fdo::PeerProxy`]
//!
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
#![allow(clippy::type_complexity)]
pub mod access_point;
pub mod config;