Trait rumble::api::Central [] [src]

pub trait Central<P: Peripheral>: Send + Sync + Clone {
    fn on_event(&self, handler: EventHandler);
fn start_scan(&self) -> Result<()>;
fn stop_scan(&self) -> Result<()>;
fn peripherals(&self) -> Vec<P>;
fn peripheral(&self, address: BDAddr) -> Option<P>; }

Central is the "client" of BLE. It's able to scan for and establish connections to peripherals.

Required Methods

Registers a function that will receive notifications when events occur for this Central module. See Event for the full set of events. Note that the handler will be called in a common thread, so it should not block.

Starts a scan for BLE devices. This scan will generally continue until explicitly stopped, although this may depend on your bluetooth adapter. Discovered devices will be announced to subscribers of on_event and will be available via peripherals().

Stops scanning for BLE devices.

Returns the list of Peripherals that have been discovered so far. Note that this list may contain peripherals that are no longer available.

Returns a particular Peripheral by its address if it has been discovered.

Implementors