fuchsia.bluetooth.le

PROTOCOLS

Central

Defined in fuchsia.bluetooth.le/central.fidl

GetPeripherals

Returns the list of peripherals that are known to the system from previous scan, connection, and/or bonding procedures. The results can be filtered based on service UUIDs that are known to be present on the peripheral.

This method only returns peripherals (i.e. connectable devices).

Request

NameType
service_uuids vector<string>?

Response

NameType
peripherals vector<RemoteDevice>

GetPeripheral

Returns information about a single peripheral that is known to the system from previous scan, connection, and/or bonding procedures based on its unique identifier. Returns null if identifier is not recognized.

Request

NameType
identifier string

Response

NameType
peripheral RemoteDevice?

StartScan

Initiates a scan session for nearby peripherals and broadcasters. Discovered devices will be reported via CentralDelegate.OnDeviceDiscovered(). If a scan session is already in progress, filter will replace the existing session's filter.

If filter is null or empty (i.e. none of its fields has been populated) then the delegate will be notified for all discoverable devices that are found. This is not recommended; clients should generally filter results by at least one of filter.service_uuids, filter.service_data, and/or filter.manufacturer_identifier.

Request

NameType
filter ScanFilter?

Response

NameType
status fuchsia.bluetooth/Status

StopScan

Terminate a previously started scan session.

Request

NameType

ConnectPeripheral

Creates a connection to the peripheral device with the given identifier. Returns the status of the operation in status.

On success, gatt_client will be bound and can be used for GATT client role procedures. On failure, gatt_client will be closed and status will indicate an error.

Request

NameType
identifier string
gatt_client request<fuchsia.bluetooth.gatt/Client>

Response

NameType
status fuchsia.bluetooth/Status

DisconnectPeripheral

Disconnects this Central's connection to the peripheral with the given identifier.

Request

NameType
identifier string

Response

NameType
status fuchsia.bluetooth/Status

OnScanStateChanged

Called when the scan state changes, e.g. when a scan session terminates due to a call to Central.StopScan() or another unexpected condition.

Response

NameType
scanning bool

OnDeviceDiscovered

Called for each peripheral/broadcaster that is discovered during a scan session. rssi contains the received signal strength of the advertising packet that generated this event, if available.

Response

NameType
device RemoteDevice

OnPeripheralDisconnected

Called when this Central's connection to a peripheral with the given identifier is terminated.

Response

NameType
identifier string

Connection

Defined in fuchsia.bluetooth.le/peer.fidl

Protocol that represents the connection to a peer. This can be used to interact with GATT services and establish L2CAP channels.

AdvertisingHandle

Defined in fuchsia.bluetooth.le/peripheral.fidl

Capability that is valid for the duration of advertising. The caller can close the handle to stop advertising. If the system internally stops advertising for any reason, the handle will be closed to communicate this to the client.

Peripheral

Defined in fuchsia.bluetooth.le/peripheral.fidl

StartAdvertising

Start advertising as a LE peripheral. An empty response is sent to indicate when advertising has successfully initiated. If advertising cannot be initiated, then the response will contain a PeripheralError.

This method can get called any number of times and successive calls can be made to reconfigure the advertising parameters. However only the most recent AdvertisingHandle will remain valid.

An instance of Peripheral can only have one active advertisement at a time. Clients must obtain multiple Peripheral instances for multiple simultaneous advertisements.

If the client closes its end of the AdvertisingHandle channel, advertising will be stopped. If the handle is closed before the request is fulfilled, advertising will be briefly enabled before it is terminated.

  • request parameters Parameters used while configuring the advertising instance.
  • request handle Handle that remains valid for the duration of this advertising session.
  • error Returns a PeripheralError if advertising cannot be initiated. In this case the handle will be closed.

Request

NameType
parameters AdvertisingParameters
handle request<AdvertisingHandle>

Response

NameType
result Peripheral_StartAdvertising_Result

OnPeerConnected

Event delivered when a remote LE central initiates a connection to this Peripheral when connectable advertising is enabled via Peripheral.StartAdvertising.

The returned Connection handle can be used to interact with the peer. It also represents a peripheral's ownership over the connection: the client can drop the handle to request a disconnection. Similarly, the handle is closed by the system to indicate that the connection to the peer has been lost.

  • request peer Information about the central that initiated the connection.
  • request handle Represents the connection.

Response

NameType
peer Peer
connection Connection

STRUCTS

ServiceData

Defined in fuchsia.bluetooth.le/advertising_data.fidl

Entry in the service_data field of a AdvertisingData.

NameTypeDescriptionDefault
uuid fuchsia.bluetooth/Uuid No default
data vector<uint8> No default

ManufacturerData

Defined in fuchsia.bluetooth.le/advertising_data.fidl

Entry in the manufacturer_data field of a AdvertisingData.

NameTypeDescriptionDefault
company_id uint16 No default
data vector<uint8> No default

Peripheral_StartAdvertising_Response

generated

NameTypeDescriptionDefault

ServiceDataEntry

Defined in fuchsia.bluetooth.le/types_deprecated.fidl

[[DEPRECATED]]

NameTypeDescriptionDefault
uuid string No default
data vector<uint8> No default

ManufacturerSpecificDataEntry

Defined in fuchsia.bluetooth.le/types_deprecated.fidl

[[DEPRECATED]]

NameTypeDescriptionDefault
company_id uint16 No default
data vector<uint8> No default

AdvertisingDataDeprecated

Defined in fuchsia.bluetooth.le/types_deprecated.fidl

Represents advertising and scan response data advertised by a broadcaster or peripheral. [[DEPRECATED]]

NameTypeDescriptionDefault
name string?

Name of the device.

No default
tx_power_level fuchsia.bluetooth/Int8?

The radio transmission power level reported in the advertisement.

No default
appearance fuchsia.bluetooth/UInt16?

The appearance reported in the advertisemet.

No default
service_uuids vector<string>?

List of service UUIDs reported in the advertisement.

No default
service_data vector<ServiceDataEntry>?

Service data included in the advertisement.

No default
manufacturer_specific_data vector<ManufacturerSpecificDataEntry>?

Manufacturer specific data entries.

No default
solicited_service_uuids vector<string>?

Service UUIDs that were solicited in the advertisement. Peripherals can invite centrals that expose certain services to connect to them using service solicitation.

No default
uris vector<string>?

URIs included in the advertising packet. These are full URIs (they are encoded/decoded automatically)

No default

RemoteDevice

Defined in fuchsia.bluetooth.le/types_deprecated.fidl

Represents a remote Bluetooth Low Energy device. A RemoteDevice can represent a central, broadcaster, or peripheral based on the API from which it was received. [[DEPRECATED]]

NameTypeDescriptionDefault
identifier string

Identifier that uniquely identifies this device on the current system.

No default
connectable bool

Whether or not this device is connectable. Non-connectable devices are typically acting in the LE broadcaster role.

No default
rssi fuchsia.bluetooth/Int8?

The last known RSSI of this device, if known.

No default
advertising_data AdvertisingDataDeprecated?

Advertising data broadcast by this device if this device is a broadcaster or peripheral.

No default

ScanFilter

Defined in fuchsia.bluetooth.le/types_deprecated.fidl

Filter parameters for use during a scan. A discovered peripheral or broadcaster will be reported to applications only if it satisfies all of the provided filter parameters. Null fields will be ignored. [[DEPRECATED]]

NameTypeDescriptionDefault
service_uuids vector<string>?

Filter based on advertised service UUIDs. A peripheral that advertises at least one of the entries in service_uuids will satisfy this filter.

No default
service_data_uuids vector<string>?

Filter based on service data containing one of the given UUIDs.

No default
manufacturer_identifier fuchsia.bluetooth/UInt16?

Filter based on a company identifier present in the manufacturer data. If this filter parameter is set, then the advertising payload must contain manufacturer specific data with the provided company identifier to satisfy this filter.

No default
connectable fuchsia.bluetooth/Bool?

Filter based on whether or not a device is connectable. For example, a client that is only interested in peripherals that it can connect to can set this to true. Similarly a client can scan only for braodcasters by setting this to false.

No default
name_substring string?

Filter results based on a portion of the advertised device name.

No default
max_path_loss fuchsia.bluetooth/Int8?

Filter results based on the path loss of the radio wave. A device that matches this filter must satisfy the following:

  1. Radio transmission power level and received signal strength must be available for the path loss calculation;
  2. The calculated path loss value must be less than, or equal to, max_path_loss.
No default

ENUMS

PeripheralError

Type: uint32

Defined in fuchsia.bluetooth.le/peripheral.fidl

NameValueDescription
NOT_SUPPORTED 1

The operation or parameters requested are not supported on the current hardware.

ADVERTISING_DATA_TOO_LONG 2

The provided advertising data exceeds the maximum allowed length when encoded.

SCAN_RESPONSE_DATA_TOO_LONG 3

The provided scan response data exceeds the maximum allowed length when encoded.

INVALID_PARAMETERS 4

The requested parameters are invalid.

ABORTED 5

The request to start advertising was aborted, for example by issuing a new request with new parameters.

FAILED 6

Advertising could not be initiated due to a hardware or system error.

AdvertisingModeHint

Type: uint8

Defined in fuchsia.bluetooth.le/peripheral.fidl

A client can indicate the transmission rate of advertising packets by specifying a mode. The mode provides a hint to the system when configuring the controller with advertising interval and window parameters.

The mode affects how quickly a scanner or central is able to discover the peripheral; however it can have an adverse effect on power consumption. While the system will try to honor a client's request, it is not guaranteed to do so.

NameValueDescription
VERY_FAST 1

Advertise with a very short interval and window for fast discovery at the cost of higher power consumption. This corresponds to a 30-60ms interval on the 1M PHYs and 90-180ms on the coded PHY.

FAST 2

Advertise with a short interval and window that uses less power than VERY_FAST. This corresponds to a 100-150ms interval on the 1M PHYs and 300-450ms on the coded PHY.

SLOW 3

Advertise with a moderate interval and window. This corresponds to 1-1.2s on the 1M PHYs and 3s on the coded PHY.

TABLES

AdvertisingData

Defined in fuchsia.bluetooth.le/advertising_data.fidl

Represents advertising and scan response data that are transmitted by a LE peripheral or broadcaster.

OrdinalNameTypeDescription
1 name string

Long or short name of the device.

2 appearance fuchsia.bluetooth/Appearance

The appearance of the device.

3 tx_power_level int8

The radio transmit power level reported by an advertising peer. This field is disallowed when used with the Peripheral API.

4 service_uuids vector<fuchsia.bluetooth/Uuid>

Service UUIDs.

5 service_data vector<ServiceData>

Service data entries.

6 manufacturer_data vector<ManufacturerData>

Manufacturer-specific data entries.

7 uris vector<string>

String representing a URI to be advertised, as defined in IETF STD 66. Each entry should be a UTF-8 string including the scheme. For more information, see:

  • https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml for allowed schemes;
  • https://www.bluetooth.com/specifications/assigned-numbers/uri-scheme-name-string-mapping for code-points used by the system to compress the scheme to save space in the payload.

Peer

Defined in fuchsia.bluetooth.le/peer.fidl

Represents a Bluetooth Low Energy peer that may act in the broadcaster, peripheral, or central role. The peer's role depends on whether it is obtained from the Central or Peripheral protocol.

OrdinalNameTypeDescription
1 id fuchsia.bluetooth/PeerId

Uniquely identifies this peer on the current system.

This field is always present.

2 connectable bool

Whether or not this peer is connectable. Non-connectable peers are typically in the LE broadcaster role.

This field is always present.

3 rssi int8

The last observed RSSI of this peer.

4 advertising_data AdvertisingData

Advertising and scan response data broadcast by this peer. Present in broadcasters and peripherals.

AdvertisingParameters

Defined in fuchsia.bluetooth.le/peripheral.fidl

Represents the parameters for configuring advertisements.

OrdinalNameTypeDescription
1 data AdvertisingData

The fields that will be encoded in the data section of advertising packets.

This field is required.

2 scan_response AdvertisingData

The fields that are to be sent in a scan response packet. Clients may use this to send additional data that does not fit inside an advertising packet on platforms that do not support the advertising data length extensions.

If present advertisements will be configured to be scannable.

3 mode_hint AdvertisingModeHint

The desired advertising frequency. See AdvertisingModeHint. Defaults to AdvertisingModeHint.SLOW if not present.

4 connectable bool

If present and true then the controller will broadcast connectable advertisements which allows remote LE centrals to initiate a connection to the Peripheral. If false or otherwise not present then the advertisements will be non-connectable.

UNIONS

Peripheral_StartAdvertising_Result

generated

NameTypeDescription
response Peripheral_StartAdvertising_Response
err PeripheralError