PROTOCOLS
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.
Central
Defined in fuchsia.bluetooth.le/central.fidl
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
Name | Type |
---|---|
identifier |
fuchsia.bluetooth/PeerIdString
|
options |
ConnectionOptions
|
gatt_client |
request<fuchsia.bluetooth.gatt/Client>
|
Response
Name | Type |
---|---|
status |
fuchsia.bluetooth/Status
|
DisconnectPeripheral
Disconnects this Central's connection to the peripheral with the given identifier.
Request
Name | Type |
---|---|
identifier |
fuchsia.bluetooth/PeerIdString
|
Response
Name | Type |
---|---|
status |
fuchsia.bluetooth/Status
|
GetPeripheral
This method is not implemented by the Fuchsia core stack- TODO(fxbug.dev/1424)
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
Name | Type |
---|---|
identifier |
fuchsia.bluetooth/PeerIdString
|
Response
Name | Type |
---|---|
peripheral |
RemoteDevice?
|
GetPeripherals
This method is not implemented by the Fuchsia core stack- TODO(fxbug.dev/1424)
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
Name | Type |
---|---|
service_uuids |
vector<string>?
|
Response
Name | Type |
---|---|
peripherals |
vector<RemoteDevice>
|
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
Name | Type |
---|---|
device |
RemoteDevice
|
OnPeripheralDisconnected
Called when this Central's connection to a peripheral with the given identifier is terminated.
Response
Name | Type |
---|---|
identifier |
fuchsia.bluetooth/PeerIdString
|
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
Name | Type |
---|---|
scanning |
bool
|
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
Name | Type |
---|---|
filter |
ScanFilter?
|
Response
Name | Type |
---|---|
status |
fuchsia.bluetooth/Status
|
StopScan
Terminate a previously started scan session.
Request
Name | Type |
---|
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.
Peripheral
Defined in fuchsia.bluetooth.le/peripheral.fidl
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
Name | Type |
---|---|
peer |
Peer
|
connection |
Connection
|
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
Name | Type |
---|---|
parameters |
AdvertisingParameters
|
handle |
request<AdvertisingHandle>
|
Response
Name | Type |
---|---|
result |
Peripheral_StartAdvertising_Result
|
STRUCTS
AdvertisingDataDeprecated
Defined in fuchsia.bluetooth.le/types_deprecated.fidl
Represents advertising and scan response data advertised by a broadcaster or peripheral.
Name | Type | Description | Default |
---|---|---|---|
name |
fuchsia.bluetooth/DeviceName
|
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 |
ManufacturerData
Defined in fuchsia.bluetooth.le/advertising_data.fidl
Entry in the manufacturer_data
field of a AdvertisingData.
Name | Type | Description | Default |
---|---|---|---|
company_id |
uint16
|
No default | |
data |
vector<uint8>[252]
|
No default |
ManufacturerSpecificDataEntry
Defined in fuchsia.bluetooth.le/types_deprecated.fidl
Name | Type | Description | Default |
---|---|---|---|
company_id |
uint16
|
No default | |
data |
vector<uint8>
|
No default |
Peripheral_StartAdvertising_Response
Defined in fuchsia.bluetooth.le/peripheral.fidl
Name | Type | Description | 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.
Name | Type | Description | Default |
---|---|---|---|
identifier |
fuchsia.bluetooth/PeerIdString
|
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.
Name | Type | Description | Default |
---|---|---|---|
service_uuids |
vector<string>?
|
Filter based on advertised service UUIDs. A peripheral that advertises at least one of the
entries in |
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 |
fuchsia.bluetooth/DeviceName
|
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:
|
No default |
ServiceData
Defined in fuchsia.bluetooth.le/advertising_data.fidl
Entry in the service_data
field of a AdvertisingData.
Name | Type | Description | Default |
---|---|---|---|
uuid |
fuchsia.bluetooth/Uuid
|
No default | |
data |
vector<uint8>[252]
|
No default |
ServiceDataEntry
Defined in fuchsia.bluetooth.le/types_deprecated.fidl
Name | Type | Description | Default |
---|---|---|---|
uuid |
fuchsia.bluetooth/UuidString
|
No default | |
data |
vector<uint8>
|
No default |
ENUMS
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.
Name | Value | Description |
---|---|---|
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 |
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. |
PeripheralError
Type: uint32
Defined in fuchsia.bluetooth.le/peripheral.fidl
Name | Value | Description |
---|---|---|
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. |
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.
Ordinal | Name | Type | Description |
---|---|---|---|
1 | name |
fuchsia.bluetooth/DeviceName
|
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:
|
AdvertisingParameters
Defined in fuchsia.bluetooth.le/peripheral.fidl
Represents the parameters for configuring advertisements.
Ordinal | Name | Type | Description |
---|---|---|---|
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
|
[[DEPRECATED]]: Prefer to use the ConnectionOptions field for new code. 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. |
5 | connection_options |
ConnectionOptions
|
If present, the controller will broadcast connectable advertisements which allow remote LE centrals to initiate connections to the Peripheral. The fields of ConnectionOptions will configure any connections set up from advertising. |
ConnectionOptions
Defined in fuchsia.bluetooth.le/connection_options.fidl
Represents parameters that are set on a per-connection basis by FIDL protocols that create Low Energy connections.
Ordinal | Name | Type | Description |
---|---|---|---|
1 | bondable_mode |
bool
|
When true, the connection operates in bondable mode. This means pairing will form a bond, or persist across disconnections, if the peer is also in bondable mode. When not present, the connection defaults to bondable mode. When false, the connection operates in non- bondable mode, which means the local device only allows pairing that does not form a bond. |
2 | service_filter |
fuchsia.bluetooth/Uuid
|
When present, service discovery performed following the connection is restricted to primary services that match this field. Otherwise, by default all available services are discovered. |
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.
Ordinal | Name | Type | Description |
---|---|---|---|
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. |
UNIONS
Peripheral_StartAdvertising_Result
Defined in fuchsia.bluetooth.le/peripheral.fidl
Name | Type | Description |
---|---|---|
response |
Peripheral_StartAdvertising_Response
|
|
err |
PeripheralError
|
CONSTANTS
Name | Value | Type | Description |
---|---|---|---|
MAX_MANUFACTURER_DATA_LENGTH |
252
|
uint8 |
|
MAX_SERVICE_DATA_LENGTH |
252
|
uint8 |
|
MAX_URI_LENGTH |
278
|
uint16 |