fuchsia.bluetooth.host

PROTOCOLS

Host

Defined in fuchsia.bluetooth.host/host.fidl

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

RequestLowEnergyCentral

The following methods fulfill a given interface request. bt-host device will start processing FIDL messages. If the request cannot be fulfilled, the bt-host device will close its end of the given channel.

Request

NameType
central request<fuchsia.bluetooth.le/Central>

RequestLowEnergyPeripheral

Request

NameType
peripheral request<fuchsia.bluetooth.le/Peripheral>

RequestGattServer

Request

NameType
server request<fuchsia.bluetooth.gatt/Server>

RequestProfile

Request

NameType
profile request<fuchsia.bluetooth.bredr/Profile>

Close

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.

Request

NameType

GetInfo

Returns information about the Bluetooth adapter managed by this host.

Request

NameType

Response

NameType
info fuchsia.bluetooth.control/AdapterInfo

SetLocalData

Assigns local data to this host.

Request

NameType
host_data fuchsia.bluetooth.control/HostData

ListDevices

Returns a list of all known connectable devices, included those that are currently connected and/or bonded. This list does not include non-connectable devices such as LE broadcasters.

Notes:

  • When used in the GAP central role (BR/EDR or LE) the listed devices are obtained during discovery and connection procedures. While in the peripheral role, this will contain devices that have successfully initiated connections to this host.

  • This list contains connectable devices that are discovered or connected via other interfaces obtained using the interface request methods declared above.

Request

NameType

Response

NameType
devices vector<fuchsia.bluetooth.control/RemoteDevice>

SetLocalName

Sets the local name for this adapter.

Request

NameType
local_name string

Response

NameType
status fuchsia.bluetooth/Status

SetDeviceClass

Sets the device class for this adapter.

Request

NameType
device_class fuchsia.bluetooth.control/DeviceClass

Response

NameType
status fuchsia.bluetooth/Status

StartDiscovery

Initiates a general discovery procedure for BR/EDR and LE devices. On success, discovered devices will be reported via AdapterDelegate.OnDeviceDiscovered().

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

Discovery will continue until it is terminated via StopDiscovery() or if the proxy to the Adapter gets disconnected. If the device does not support BR/EDR, only LE discovery will be performed.

An OnDeviceUpdated event will be sent when the discovery procedures are started.

Request

NameType

Response

NameType
status fuchsia.bluetooth/Status

StopDiscovery

Terminates discovery if one was started via StartDiscovery(). The AdapterDelegate will stop receiving device discovery notifications.

NOTE: If another client is performing discovery (e.g. via its own le.Central interface handle), then the system will continue performing device discovery even if this method results in success.

Request

NameType

Response

NameType
status fuchsia.bluetooth/Status

SetConnectable

Sets whether this host should be connectable.

Request

NameType
enabled bool

Response

NameType
status fuchsia.bluetooth/Status

SetDiscoverable

Sets whether this host should be discoverable.

Request

NameType
enabled bool

Response

NameType
status fuchsia.bluetooth/Status

Connect

Establish a BR/EDR and/or LE connection to the remote device with identifier device_id:

  • If the device 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 device 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.

Request

NameType
device_id string

Response

NameType
status fuchsia.bluetooth/Status

Disconnect

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

  • request peer_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.

Request

NameType
peer_id string

Response

NameType
status fuchsia.bluetooth/Status

Forget

Deletes a peer from the Bluetooth host. If the peer is connected, it will be disconnected, then OnDeviceUpdated will be sent. OnDeviceRemoved will be sent. device_id will no longer refer to any peer, even if a device with the same address(es) 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.

Request

NameType
device_id string

Response

NameType
status fuchsia.bluetooth/Status

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.

Request

NameType
enabled bool

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

Request

NameType
enabled bool

SetPairingDelegate

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

Request

NameType
input fuchsia.bluetooth.control/InputCapabilityType
output fuchsia.bluetooth.control/OutputCapabilityType
delegate fuchsia.bluetooth.control/PairingDelegate?

AddBondedDevices

Adds existing bonded devices to the host. The host will be configured to automatically connect to these devices when they are in range and connectable. Future connections will be encrypted using the provided bonding data.

Request

NameType
bonds vector<fuchsia.bluetooth.control/BondingData>

Response

NameType
status fuchsia.bluetooth/Status

OnAdapterStateChanged

Notifies when the adapter state changes.

Response

NameType
state fuchsia.bluetooth.control/AdapterState

OnDeviceUpdated

Events that are sent when a connectable device is added, updated, or removed as a result of connection and discovery procedures.

Response

NameType
device fuchsia.bluetooth.control/RemoteDevice

OnDeviceRemoved

Response

NameType
identifier string

OnNewBondingData

Notifies when bonding data for a device has been updated.

Response

NameType
data fuchsia.bluetooth.control/BondingData