Work on bindings some more

This commit is contained in:
Lucy 2022-01-11 16:41:10 -05:00
parent da5c6ed172
commit 2acdb272fb
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
11 changed files with 290 additions and 2 deletions

View file

@ -12,3 +12,9 @@ impl<'a> Deref for BluetoothDevice<'a> {
&self.0
}
}
impl<'a> From<BluetoothDeviceProxy<'a>> for BluetoothDevice<'a> {
fn from(device: BluetoothDeviceProxy<'a>) -> Self {
BluetoothDevice(device)
}
}

View file

@ -12,3 +12,9 @@ impl<'a> Deref for WiredDevice<'a> {
&self.0
}
}
impl<'a> From<WiredDeviceProxy<'a>> for WiredDevice<'a> {
fn from(device: WiredDeviceProxy<'a>) -> Self {
WiredDevice(device)
}
}

View file

@ -1,10 +1,20 @@
// SPDX-License-Identifier: MPL-2.0
use crate::interface::device::wireless::WirelessDeviceProxy;
use crate::interface::{device::wireless::WirelessDeviceProxy, enums::WifiCapabilities};
use std::ops::Deref;
use zbus::Result;
pub struct WirelessDevice<'a>(WirelessDeviceProxy<'a>);
impl<'a> WirelessDevice<'a> {
pub async fn wireless_capabilities(&self) -> Result<WifiCapabilities> {
self.0
.wireless_capabilities()
.await
.map(WifiCapabilities::from_bits_truncate)
}
}
impl<'a> Deref for WirelessDevice<'a> {
type Target = WirelessDeviceProxy<'a>;
@ -12,3 +22,9 @@ impl<'a> Deref for WirelessDevice<'a> {
&self.0
}
}
impl<'a> From<WirelessDeviceProxy<'a>> for WirelessDevice<'a> {
fn from(device: WirelessDeviceProxy<'a>) -> Self {
WirelessDevice(device)
}
}