pub enum HostRequest {
Show 21 variants RequestProtocol { payload: ProtocolRequest, control_handle: HostControlHandle, }, Shutdown { control_handle: HostControlHandle, }, WatchState { responder: HostWatchStateResponder, }, SetLocalData { payload: HostData, control_handle: HostControlHandle, }, WatchPeers { responder: HostWatchPeersResponder, }, SetLocalName { local_name: String, responder: HostSetLocalNameResponder, }, SetDeviceClass { device_class: DeviceClass, responder: HostSetDeviceClassResponder, }, StartDiscovery { payload: HostStartDiscoveryRequest, control_handle: HostControlHandle, }, SetConnectable { enabled: bool, responder: HostSetConnectableResponder, }, SetDiscoverable { enabled: bool, responder: HostSetDiscoverableResponder, }, Connect { id: PeerId, responder: HostConnectResponder, }, Disconnect { id: PeerId, responder: HostDisconnectResponder, }, Pair { id: PeerId, options: PairingOptions, responder: HostPairResponder, }, Forget { id: PeerId, responder: HostForgetResponder, }, EnableBackgroundScan { enabled: bool, control_handle: HostControlHandle, }, EnablePrivacy { enabled: bool, control_handle: HostControlHandle, }, SetBrEdrSecurityMode { bredr_security_mode: BrEdrSecurityMode, control_handle: HostControlHandle, }, SetLeSecurityMode { le_security_mode: LeSecurityMode, control_handle: HostControlHandle, }, SetPairingDelegate { input: InputCapability, output: OutputCapability, delegate: ClientEnd<PairingDelegateMarker>, control_handle: HostControlHandle, }, RestoreBonds { bonds: Vec<BondingData>, responder: HostRestoreBondsResponder, }, _UnknownMethod { ordinal: u64, control_handle: HostControlHandle, method_type: MethodType, },
}
Expand description

Interface for interacting with a Bluetooth host device (bt-host)

Variants§

§

RequestProtocol

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.

Fields

§control_handle: HostControlHandle
§

Shutdown

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.

Fields

§control_handle: HostControlHandle
§

WatchState

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.

Fields

§

SetLocalData

Assigns local data to this host.

Fields

§payload: HostData
§control_handle: HostControlHandle
§

WatchPeers

Monitors updates for connectable peers known to the system. Replies only when peers have been added, modified, or removed since the most recent call to WatchPeers().

Peers are added and updated as new information is obtained during discovery, connection establishment, and bonding procedures.

Peers are removed either: a. explicitly via [fuchsia.bluetooth.host.Host/Forget], or b. no transmission has been received from the peer for an internally determined duration of time and the peer is neither connected nor bonded.

  • response updated Peers that were added or updated since the last call to WatchPeers().
  • response removed Ids of peers that were removed since the last call to WatchPeers().

Fields

§

SetLocalName

Sets the local name for this host device.

Fields

§local_name: String
§

SetDeviceClass

Sets the device class for this host device.

Fields

§device_class: DeviceClass
§

StartDiscovery

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.

Fields

§control_handle: HostControlHandle
§

SetConnectable

Sets whether this host should be connectable.

Fields

§enabled: bool
§

SetDiscoverable

Sets whether this host should be discoverable.

Fields

§enabled: bool
§

Connect

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.

Fields

§id: PeerId
§

Disconnect

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.

Fields

§id: PeerId
§

Pair

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.

Fields

§id: PeerId
§options: PairingOptions
§

Forget

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.

Fields

§id: PeerId
§

EnableBackgroundScan

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.

Fields

§enabled: bool
§control_handle: HostControlHandle
§

EnablePrivacy

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).

Fields

§enabled: bool
§control_handle: HostControlHandle
§

SetBrEdrSecurityMode

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.

Fields

§bredr_security_mode: BrEdrSecurityMode
§control_handle: HostControlHandle
§

SetLeSecurityMode

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.

Fields

§le_security_mode: LeSecurityMode
§control_handle: HostControlHandle
§

SetPairingDelegate

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.

Fields

§input: InputCapability
§output: OutputCapability
§delegate: ClientEnd<PairingDelegateMarker>
§control_handle: HostControlHandle
§

RestoreBonds

Restores existing bonded devices to the host. An authenticated session will be established for future connections using the provided bonding data.

If bonding data for the LE transport is available, then the host will automatically establish a connection when the peer is in range and connectable.

If any of the entries in bonds could not be restored, then they will be returned in errors. This can happen for entries that are malformed and for peers that are already known to the bt-host. An empty errors list indicates that all bonds were successfully restored.

Fields

§bonds: Vec<BondingData>
§

_UnknownMethod

An interaction was received which does not match any known method.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§ordinal: u64

Ordinal of the method that was called.

§control_handle: HostControlHandle
§method_type: MethodType

Implementations§

source§

impl HostRequest

source

pub fn into_request_protocol( self ) -> Option<(ProtocolRequest, HostControlHandle)>

source

pub fn into_shutdown(self) -> Option<HostControlHandle>

source

pub fn into_watch_state(self) -> Option<HostWatchStateResponder>

source

pub fn into_set_local_data(self) -> Option<(HostData, HostControlHandle)>

source

pub fn into_watch_peers(self) -> Option<HostWatchPeersResponder>

source

pub fn into_set_local_name(self) -> Option<(String, HostSetLocalNameResponder)>

source

pub fn into_set_device_class( self ) -> Option<(DeviceClass, HostSetDeviceClassResponder)>

source

pub fn into_start_discovery( self ) -> Option<(HostStartDiscoveryRequest, HostControlHandle)>

source

pub fn into_set_connectable(self) -> Option<(bool, HostSetConnectableResponder)>

source

pub fn into_set_discoverable( self ) -> Option<(bool, HostSetDiscoverableResponder)>

source

pub fn into_connect(self) -> Option<(PeerId, HostConnectResponder)>

source

pub fn into_disconnect(self) -> Option<(PeerId, HostDisconnectResponder)>

source

pub fn into_pair(self) -> Option<(PeerId, PairingOptions, HostPairResponder)>

source

pub fn into_forget(self) -> Option<(PeerId, HostForgetResponder)>

source

pub fn into_enable_background_scan(self) -> Option<(bool, HostControlHandle)>

source

pub fn into_enable_privacy(self) -> Option<(bool, HostControlHandle)>

source

pub fn into_set_br_edr_security_mode( self ) -> Option<(BrEdrSecurityMode, HostControlHandle)>

source

pub fn into_set_le_security_mode( self ) -> Option<(LeSecurityMode, HostControlHandle)>

source

pub fn into_set_pairing_delegate( self ) -> Option<(InputCapability, OutputCapability, ClientEnd<PairingDelegateMarker>, HostControlHandle)>

source

pub fn into_restore_bonds( self ) -> Option<(Vec<BondingData>, HostRestoreBondsResponder)>

source

pub fn method_name(&self) -> &'static str

Name of the method defined in FIDL

Trait Implementations§

source§

impl Debug for HostRequest

source§

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

Formats the value using the given formatter. Read more

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
§

impl<T> Encode<Ambiguous1> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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> Encode<Ambiguous2> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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
source§

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

§

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>,

§

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