[][src]Struct core_bluetooth::central::CentralManager

pub struct CentralManager(_);

An object that scans for, discovers, connects to, and manages peripherals.

Before calling the CentralManager methods, ManagerStateChanged event must be received indicating the PoweredOn state.

Implementations

impl CentralManager[src]

pub fn new() -> (Self, Receiver<CentralEvent>)[src]

pub fn get_peripherals(&self, uuids: &[Uuid])[src]

Returns a list of known peripherals by their identifiers. The result is returned as GetPeripheralsWithServicesResult.

pub fn get_peripherals_tagged(&self, uuids: &[Uuid], tag: Tag)[src]

Allows tagging an asynchronous get_peripherals call with arbitrary tag.

pub fn get_peripherals_with_services(&self, services_uuids: &[Uuid])[src]

Retrieves a list of the peripherals connected to the system whose services match the specified services_uuids. The result is returned as GetPeripheralsWithServicesResult.

pub fn get_peripherals_with_services_tagged(
    &self,
    services_uuids: &[Uuid],
    tag: Tag
)
[src]

Allows tagging an asynchronous get_peripherals_with_services call with arbitrary tag.

pub fn scan(&self)[src]

Scans for peripherals with default options. See scan_with_options.

pub fn scan_with_options(&self, options: ScanOptions)[src]

Scans for peripherals that are advertising services with the specified options.

If the central manager is actively scanning with one set of parameters and it receives another set to scan, the new parameters override the previous set. When the central manager discovers a peripheral, it triggers PeripheralDiscovered event.

pub fn cancel_scan(&self)[src]

Asks the central manager to stop scanning for peripherals.

pub fn connect(&self, peripheral: &Peripheral)[src]

Establishes a local connection to the peripheral.

After successfully establishing a local connection to a peripheral, the central manager object triggers PeripheralConnected event. If the connection attempt fails, the central manager object calls the PeripheralConnectFailed instead. Attempts to connect to a peripheral don’t time out. To explicitly cancel a pending connection to a peripheral, call the cancel_connect method. Dropping the Peripheral also implicitly cancels connection.

pub fn cancel_connect(&self, peripheral: &Peripheral)[src]

Cancels an active or pending local connection to a peripheral.

This method is nonblocking, and any other commands that are still pending to peripheral may not complete. Because other apps may still have a connection to the peripheral, canceling a local connection doesn’t guarantee that the underlying physical link is immediately disconnected. From the app’s perspective, however, the peripheral is effectively disconnected, and the central manager object trigger PeripheralDisconnected event.

Trait Implementations

impl Clone for CentralManager[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.