[−][src]Struct core_bluetooth::central::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]
&self,
services_uuids: &[Uuid],
tag: Tag
)
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]
fn clone(&self) -> CentralManager
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for CentralManager
impl Send for CentralManager
impl Sync for CentralManager
impl Unpin for CentralManager
impl UnwindSafe for CentralManager
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,