#[non_exhaustive]pub struct BluetoothDevice {
pub bdaddr: String,
pub name: Option<String>,
pub alias: Option<String>,
pub bt_caps: u32,
pub state: DeviceState,
}Expand description
Bluetooth device with friendly name from BlueZ.
Contains information about a Bluetooth device managed by NetworkManager, proxying data from BlueZ.
This is a specialized struct for Bluetooth devices, separate from the
general Device struct.
§Example
§Example
use nmrs::models::{BluetoothDevice, BluetoothNetworkRole, DeviceState};
let role = BluetoothNetworkRole::PanU as u32;
let device = BluetoothDevice::new(
"00:1A:7D:DA:71:13".into(),
Some("My Phone".into()),
Some("Phone".into()),
role,
DeviceState::Activated,
);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.bdaddr: StringBluetooth MAC address
name: Option<String>Friendly device name from BlueZ
alias: Option<String>Device alias from BlueZ
bt_caps: u32Bluetooth device type (DUN or PANU)
state: DeviceStateCurrent device state
Implementations§
Source§impl BluetoothDevice
impl BluetoothDevice
Sourcepub fn new(
bdaddr: String,
name: Option<String>,
alias: Option<String>,
bt_caps: u32,
state: DeviceState,
) -> Self
pub fn new( bdaddr: String, name: Option<String>, alias: Option<String>, bt_caps: u32, state: DeviceState, ) -> Self
Creates a new BluetoothDevice.
§Arguments
bdaddr- Bluetooth MAC addressname- Friendly device name from BlueZalias- Device alias from BlueZbt_caps- Bluetooth device capabilities/typestate- Current device state
§Example
use nmrs::models::{BluetoothDevice, BluetoothNetworkRole, DeviceState};
let role = BluetoothNetworkRole::PanU as u32;
let device = BluetoothDevice::new(
"00:1A:7D:DA:71:13".into(),
Some("My Phone".into()),
Some("Phone".into()),
role,
DeviceState::Activated,
);Trait Implementations§
Source§impl Clone for BluetoothDevice
impl Clone for BluetoothDevice
Source§fn clone(&self) -> BluetoothDevice
fn clone(&self) -> BluetoothDevice
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BluetoothDevice
impl Debug for BluetoothDevice
Auto Trait Implementations§
impl Freeze for BluetoothDevice
impl RefUnwindSafe for BluetoothDevice
impl Send for BluetoothDevice
impl Sync for BluetoothDevice
impl Unpin for BluetoothDevice
impl UnsafeUnpin for BluetoothDevice
impl UnwindSafe for BluetoothDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more