fidl_fuchsia_bluetooth_host

Struct HostProxy

Source
pub struct HostProxy { /* private fields */ }

Implementations§

Source§

impl HostProxy

Source

pub fn new(channel: AsyncChannel) -> Self

Create a new Proxy for fuchsia.bluetooth.host/Host.

Source

pub fn take_event_stream(&self) -> HostEventStream

Get a Stream of events from the remote end of the protocol.

§Panics

Panics if the event stream was already taken.

Source

pub fn request_protocol(&self, payload: ProtocolRequest) -> Result<(), Error>

Fulfills a given protocol request. bt-host will start processing FIDL messages. If the request cannot be fulfilled, the bt-host device will close its end of the given channel.

Source

pub fn shutdown(&self) -> Result<(), Error>

Shuts down the host, ending all active Bluetooth procedures:

  • All FIDL interface handles associated with this host are closed and all connections initiated via FIDL clients are severed.
  • All scan, discovery, and advertising procedures are stopped.
  • Bonded devices are cleared and removed from the auto-connect lists.
  • Auto-connected peripherals are disconnected.

This effectively resets the host to its initial state and the host remains available for future requests.

The Host will continue to send OnDeviceUpdated events as procedures get terminated.

The Host protocol will close when shutdown is complete.

Source

pub fn watch_state( &self, ) -> QueryResponseFut<HostInfo, DefaultFuchsiaResourceDialect>

Returns information about the Bluetooth host subsystem and controller managed by this Host instance. If there has been no change to the state since the last call to this method, the response will be deferred until there is a change.

The returned info structure will be populated with the current state of the bt-host device. However the active parameter will never be populated. This field is managed by a higher layer.

Source

pub fn set_local_data(&self, payload: &HostData) -> Result<(), Error>

Assigns local data to this host.

Source

pub fn set_peer_watcher( &self, peer_watcher: ServerEnd<PeerWatcherMarker>, ) -> Result<(), Error>

Sets a PeerWatcher protocol that will be notified of changes to peers. Only 1 PeerWatcher can be configured at a time.

Source

pub fn set_local_name( &self, local_name: &str, ) -> QueryResponseFut<HostSetLocalNameResult, DefaultFuchsiaResourceDialect>

Sets the local name for this host device.

Source

pub fn set_device_class( &self, device_class: &DeviceClass, ) -> QueryResponseFut<HostSetDeviceClassResult, DefaultFuchsiaResourceDialect>

Sets the device class for this host device.

Source

pub fn start_discovery( &self, payload: HostStartDiscoveryRequest, ) -> Result<(), Error>

Initiates a general discovery procedure for BR/EDR and LE devices. On success, discovered peers can be monitored using the [fuchsia.bluetooth.host/Host.WatchPeers] method. On Error, an epitaph will be returned from token. If the device does not support BR/EDR, only LE discovery will be performed.

On the LE transport, only general-discoverable and connectable peripherals will be reported.

Discovery will continue until all discovery sessions are closed.

  • request token The DiscoverySession protocol that must be held open as long as discovery should be enabled. Closing it will stop discovery if no other sessions are open.
Source

pub fn set_connectable( &self, enabled: bool, ) -> QueryResponseFut<HostSetConnectableResult, DefaultFuchsiaResourceDialect>

Sets whether this host should be connectable.

Source

pub fn set_discoverable( &self, enabled: bool, ) -> QueryResponseFut<HostSetDiscoverableResult, DefaultFuchsiaResourceDialect>

Sets whether this host should be discoverable.

Source

pub fn connect( &self, id: &PeerId, ) -> QueryResponseFut<HostConnectResult, DefaultFuchsiaResourceDialect>

Establish a BR/EDR and/or LE connection to the peer with identifier id:

  • If the peer is known to support the BR/EDR transport then a logical link over that transport will be established to the device. If the connection attempt is successful, local services registered using “RequestProfile()” will be available to the peer. Traditional services discovered on the peer will be notified to local services asynchronously.

  • If the peer is known to support the LE transport then a logical link over that transport will be established to the device. If the connection attempt is successful, GATT services in the local database (populated via RequestGattServer()) will become available to the peer. Similarly, remote GATT services that are discovered on the peer will become available to holders of a gatt.Client capability and to device drivers that can bind to the bt-gatt-svc class of devices.

The result of the procedure will be communicated via status. If the remote device supports both BR/EDR and LE transports and a link cannot be established over both, then an error Status will be returned and neither transport will be connected.

Source

pub fn disconnect( &self, id: &PeerId, ) -> QueryResponseFut<HostDisconnectResult, DefaultFuchsiaResourceDialect>

Terminate all connections (BR/EDR or LE) to the remote peer with identifier id.

  • request id The identifier of the peer to disconnect.
  • response status Contains an error if either LE or BR/EDR transport fails to disconnect. Contains success when both transports are successfully disconnected or if the peer is already disconnected.
Source

pub fn pair( &self, id: &PeerId, options: &PairingOptions, ) -> QueryResponseFut<HostPairResult, DefaultFuchsiaResourceDialect>

Initiates pairing to the peer with the supplied id and options. Returns an error if no connected peer with id is found or the pairing procedure fails.

If options specifies a higher security level than the current pairing, this method attempts to raise the security level. Otherwise this method has no effect and returns success.

NOTE: This is intended to satisfy test scenarios that require pairing procedures to be initiated without relying on service access. In normal operation, Bluetooth security is enforced during service access.

Source

pub fn forget( &self, id: &PeerId, ) -> QueryResponseFut<HostForgetResult, DefaultFuchsiaResourceDialect>

Deletes a peer from the Bluetooth host. If the peer is connected, it will be disconnected. device_id will no longer refer to any peer, even if a device with the same address is discovered again.

Returns success after no peer exists that’s identified by device_id (even if it didn’t exist before Forget), failure if the peer specified by device_id could not be disconnected or deleted and still exists.

Source

pub fn enable_background_scan(&self, enabled: bool) -> Result<(), Error>

Enable or disable a passive LE background scan. When enabled, the bt-host device will continuously perform a passive LE scan in the background when no device discovery sessions are active and accept connection requests from bonded peripherals.

Source

pub fn enable_privacy(&self, enabled: bool) -> Result<(), Error>

Enable or disable the LE privacy feature. When enabled, the bt-host device will use a private device address in all LE procedures. When disabled, the public identity address will be used instead (which is the default).

Source

pub fn set_br_edr_security_mode( &self, bredr_security_mode: BrEdrSecurityMode, ) -> Result<(), Error>

Set the GAP BR/EDR Security Mode of the host. bt-host only supports encrypted, connection-based security modes, i.e. Mode 4 and Secure Connections Only mode. If the security mode is set to Secure Connections Only, any existing encrypted connections which do not meet the security requirements of Secure Connections Only mode will be disconnected.

Source

pub fn set_le_security_mode( &self, le_security_mode: LeSecurityMode, ) -> Result<(), Error>

Set the GAP LE Security Mode of the host. bt-host only supports encrypted, connection-based security modes, i.e. Mode 1 and Secure Connections Only mode. If the security mode is set to Secure Connections Only, any existing encrypted connections which do not meet the security requirements of Secure Connections Only mode will be disconnected.

Source

pub fn set_pairing_delegate( &self, input: InputCapability, output: OutputCapability, delegate: ClientEnd<PairingDelegateMarker>, ) -> Result<(), Error>

Assigns the pairing delegate that will respond to authentication challenges using the given I/O capabilities. Calling this method cancels any on-going pairing procedure started using a previous delegate. Pairing requests will be rejected if no PairingDelegate has been assigned.

Source

pub fn set_bonding_delegate( &self, delegate: ServerEnd<BondingDelegateMarker>, ) -> Result<(), Error>

Set a BondingDelegate protocol that will be notified of new and removed bonds that need to be persisted. If a delegate is already set, the new delegate will be closed with ALREADY_BOUND

Trait Implementations§

Source§

impl Clone for HostProxy

Source§

fn clone(&self) -> HostProxy

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HostProxy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HostProxyInterface for HostProxy

Source§

type WatchStateResponseFut = QueryResponseFut<HostInfo>

Source§

type SetLocalNameResponseFut = QueryResponseFut<Result<(), Error>>

Source§

type SetDeviceClassResponseFut = QueryResponseFut<Result<(), Error>>

Source§

type SetConnectableResponseFut = QueryResponseFut<Result<(), Error>>

Source§

type SetDiscoverableResponseFut = QueryResponseFut<Result<(), Error>>

Source§

type ConnectResponseFut = QueryResponseFut<Result<(), Error>>

Source§

type DisconnectResponseFut = QueryResponseFut<Result<(), Error>>

Source§

type PairResponseFut = QueryResponseFut<Result<(), Error>>

Source§

type ForgetResponseFut = QueryResponseFut<Result<(), Error>>

Source§

fn request_protocol(&self, payload: ProtocolRequest) -> Result<(), Error>

Source§

fn shutdown(&self) -> Result<(), Error>

Source§

fn watch_state(&self) -> Self::WatchStateResponseFut

Source§

fn set_local_data(&self, payload: &HostData) -> Result<(), Error>

Source§

fn set_peer_watcher( &self, peer_watcher: ServerEnd<PeerWatcherMarker>, ) -> Result<(), Error>

Source§

fn set_local_name(&self, local_name: &str) -> Self::SetLocalNameResponseFut

Source§

fn set_device_class( &self, device_class: &DeviceClass, ) -> Self::SetDeviceClassResponseFut

Source§

fn start_discovery( &self, payload: HostStartDiscoveryRequest, ) -> Result<(), Error>

Source§

fn set_connectable(&self, enabled: bool) -> Self::SetConnectableResponseFut

Source§

fn set_discoverable(&self, enabled: bool) -> Self::SetDiscoverableResponseFut

Source§

fn connect(&self, id: &PeerId) -> Self::ConnectResponseFut

Source§

fn disconnect(&self, id: &PeerId) -> Self::DisconnectResponseFut

Source§

fn pair(&self, id: &PeerId, options: &PairingOptions) -> Self::PairResponseFut

Source§

fn forget(&self, id: &PeerId) -> Self::ForgetResponseFut

Source§

fn enable_background_scan(&self, enabled: bool) -> Result<(), Error>

Source§

fn enable_privacy(&self, enabled: bool) -> Result<(), Error>

Source§

fn set_br_edr_security_mode( &self, bredr_security_mode: BrEdrSecurityMode, ) -> Result<(), Error>

Source§

fn set_le_security_mode( &self, le_security_mode: LeSecurityMode, ) -> Result<(), Error>

Source§

fn set_pairing_delegate( &self, input: InputCapability, output: OutputCapability, delegate: ClientEnd<PairingDelegateMarker>, ) -> Result<(), Error>

Source§

fn set_bonding_delegate( &self, delegate: ServerEnd<BondingDelegateMarker>, ) -> Result<(), Error>

Source§

impl Proxy for HostProxy

Source§

type Protocol = HostMarker

The protocol which this Proxy controls.
Source§

fn from_channel(inner: AsyncChannel) -> Self

Create a proxy over the given channel.
Source§

fn into_channel(self) -> Result<AsyncChannel, Self>

Attempt to convert the proxy back into a channel. Read more
Source§

fn as_channel(&self) -> &AsyncChannel

Get a reference to the proxy’s underlying channel. Read more
§

fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>

Attempt to convert the proxy back into a client end. Read more
§

fn is_closed(&self) -> bool

Returns true if the proxy has received the PEER_CLOSED signal.
§

fn on_closed(&self) -> OnSignals<'_, Unowned<'_, Handle>>

Returns a future that completes when the proxy receives the PEER_CLOSED signal.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> ProxyHasClient for T
where T: Proxy,

§

fn client(&self) -> Result<ZirconClient, Infallible>

Get a “client” for this proxy. This is just an object which has methods for a few common handle creation operations.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more