dbus-settings-bindings/networkmanager/src/device/wireless.rs

31 lines
703 B
Rust
Raw Normal View History

2022-01-11 15:23:09 -05:00
// SPDX-License-Identifier: MPL-2.0
2022-01-11 16:41:10 -05:00
use crate::interface::{device::wireless::WirelessDeviceProxy, enums::WifiCapabilities};
2022-01-11 15:23:09 -05:00
use std::ops::Deref;
2022-01-11 16:41:10 -05:00
use zbus::Result;
2022-01-11 15:23:09 -05:00
pub struct WirelessDevice<'a>(WirelessDeviceProxy<'a>);
2022-01-11 16:41:10 -05:00
impl<'a> WirelessDevice<'a> {
pub async fn wireless_capabilities(&self) -> Result<WifiCapabilities> {
self.0
.wireless_capabilities()
.await
.map(WifiCapabilities::from_bits_truncate)
}
}
2022-01-11 15:23:09 -05:00
impl<'a> Deref for WirelessDevice<'a> {
type Target = WirelessDeviceProxy<'a>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
2022-01-11 16:41:10 -05:00
impl<'a> From<WirelessDeviceProxy<'a>> for WirelessDevice<'a> {
fn from(device: WirelessDeviceProxy<'a>) -> Self {
WirelessDevice(device)
}
}