fuchsia.bluetooth.test

PROTOCOLS

Peer

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Protocol used to drive the state of a fake peer device.

AssignConnectionStatus

Assign a HCI status for the controller to generate in response to connection requests. Applies to all successive HCI_Create_Connection and HCI_LE_Create_Connection commands. The procedure is acknowledged with an empty response.

Request

NameType
status HciError

Response

NameType

EmulateLeConnectionComplete

Emulates a LE connection event. Does nothing if the peer is already connected. The role parameter determines the link layer connection role.

Request

NameType
role fuchsia.bluetooth/ConnectionRole

EmulateDisconnectionComplete

Emulate disconnection. Does nothing if the peer is not connected.

Request

NameType

WatchConnectionStates

Watch connection state changes using the hanging get pattern. Notifies the most recent controller connection state if there has been a change since the last time this method was called.

Only one call to this method can be outstanding at a given time. The Peer channel will be closed if a call is received when one is already pending.

Request

NameType

Response

NameType
states vector<ConnectionState>

HciEmulator

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Protocol used to emulate a Bluetooth controller that supports the standard Bluetooth HCI.

Publish

Publish a bt-hci device using the provided settings. Each HciEmulator instance can only manage a single bt-hci device. Returns Emulator.HCI_ALREADY_PUBLISHED if the device has already been published.

Request

NameType
settings EmulatorSettings

Response

NameType
result HciEmulator_Publish_Result

AddLowEnergyPeer

Inserts a new LE peer device to be emulated by this controller. Once registered, the state of the fake peer can be driven and observed using the peer handle.

A reply will be sent to acknowledge the creation of the fake peer. If a peer cannot be initialized (e.g. due to a missing required field in parameters or for containing an address that is already emulated) the peer handle will be closed and an error reply will be sent.

The peer will appear in advertising reports and respond to requests according to its configuration as long as the peer channel is open. The emulator stops emulating this peer when the channel gets closed, which makes it no longer discoverable and not respond to any requests.

Request

NameType
parameters LowEnergyPeerParameters
peer request<Peer>

Response

NameType
result HciEmulator_AddLowEnergyPeer_Result

AddBredrPeer

Inserts a new BR/EDR peer device to be emulated by this controller. Once registered, the state of the fake peer can be driven and observed using the peer handle.

A reply will be sent to acknowledge the creation of the fake peer. If a peer cannot be initialized (e.g. due to a missing required field in parameters or for containing an address that is already emulated) the peer handle will be closed and an error reply will be sent.

The peer will appear in inquiry results and respond to requests according to its configuration as long as the peer channel is open. The emulator stops emulating this peer when the channel gets closed, which makes it no longer discoverable and not respond to any requests.

Request

NameType
parameters BredrPeerParameters
peer request<Peer>

Response

NameType
result HciEmulator_AddBredrPeer_Result

WatchLeScanStates

Returns the most recent set of state transitions for the link layer LE scan procedure. This method returns when there has been a state change since the last invocation of this method by this client.

Only one call to this method can be outstanding at a given time. The HciEmulator channel will be closed if a call received when one is already pending. (see hanging get pattern)

Request

NameType

Response

NameType
states vector<LeScanState>

WatchLegacyAdvertisingStates

Returns the most recent set of state transitions for the link layer LE legacy advertising procedure. This method returns when there has been a state change since the last invocation of this method by this client.

Only one call to this method can be outstanding at a given time. The HciEmulator channel will be closed if a call received when one is already pending. (see hanging get pattern)

Request

NameType

Response

NameType
states vector<LegacyAdvertisingState>

STRUCTS

HciEmulator_Publish_Response

generated

NameTypeDescriptionDefault

HciEmulator_AddLowEnergyPeer_Response

generated

NameTypeDescriptionDefault

HciEmulator_AddBredrPeer_Response

generated

NameTypeDescriptionDefault

AclBufferSettings

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

The HCI ACL data flow-control parameters.

NameTypeDescriptionDefault
data_packet_length uint16 ACL frame MTU in bytes. No default
total_num_data_packets uint8 The maximum number of ACL frames that the controller can buffer. No default

AdvertisingData

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

NameTypeDescriptionDefault
data vector<uint8>[31] No default

ENUMS

EmulatorError

Type: uint32

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Error codes that can be generated for emulator-wide configurations.

NameValueDescription
FAILED 1
HCI_ALREADY_PUBLISHED 2

EmulatorPeerError

Type: uint32

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Error codes that are generated for functions that manipulate fake peers.

NameValueDescription
ADDRESS_REPEATED 1
PARAMETERS_INVALID 2
NOT_FOUND 3

HciConfig

Type: uint32

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Pre-set HCI configurations.

NameValueDescription
DUAL_MODE 1 Support both BR/EDR and LE in LMP features.
LE_ONLY 2 Limits supported features and HCI commands to those that are required for LE only.

ConnectionState

Type: uint32

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

NameValueDescription
CONNECTED 1
DISCONNECTED 2

HciError

Type: uint8

Defined in fuchsia.bluetooth.test/hci_errors.fidl

Defines the list of HCI protocol error codes that a Bluetooth controller can report. These values are taken from Bluetooth Core Specification v5.1, Vol 2, Part D.

NameValueDescription
SUCCESS 0
UNKNOWN_COMMAND 1
UNKNOWN_CONNECTION_ID 2
HARDWARE_FAILURE 3
PAGE_TIMEOUT 4
AUTHENTICATION_FAILURE 5
PIN_OR_KEY_MISSING 6
MEMORY_CAPACITY_EXCEEDED 7
CONNECTION_TIMEOUT 8
CONNECTION_LIMIT_EXCEEDED 9
SYNCHRONOUS_CONNECTION_LIMIT_EXCEEDED 10
CONNECTION_ALREADY_EXISTS 11
COMMAND_DISALLOWED 12
CONNECTION_REJECTED_LIMITED_RESOURCES 13
CONNECTION_REJECTED_SECURITY 14
CONNECTION_REJECTED_BAD_BD_ADDR 15
CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 16
UNSUPPORTED_FEATURE_OR_PARAMETER 17
INVALID_HCICOMMAND_PARAMETERS 18
REMOTE_USER_TERMINATED_CONNECTION 19
REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES 20
REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF 21
CONNECTION_TERMINATED_BY_LOCAL_HOST 22
REPEATED_ATTEMPTS 23
PAIRING_NOT_ALLOWED 24
UNKNOWN_LMP_PDU 25
UNSUPPORTED_REMOTE_FEATURE 26
SCO_OFFSET_REJECTED 27
SCO_INTERVAL_REJECTED 28
SCO_AIR_MODE_REJECTED 29
INVALID_LMP_OR_LL_PARAMETERS 30
UNSPECIFIED_ERROR 31
UNSUPPORTED_LMP_OR_LL_PARAMETER_VALUE 32
ROLE_CHANGE_NOT_ALLOWED 33
LMP_OR_LL_RESPONSE_TIMEOUT 34
LMP_ERROR_TRANSACTION_COLLISION 35
LMP_PDU_NOT_ALLOWED 36
ENCRYPTION_MODE_NOT_ACCEPTABLE 37
LINK_KEY_CANNOT_BE_CHANGED 38
REQUESTED_QOS_NOT_SUPPORTED 39
INSTANT_PASSED 40
PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 41
DIFFERENT_TRANSACTION_COLLISION 42
RESERVED0 43
QOS_UNACCEPTABLE_PARAMETER 44
QOS_REJECTED 45
CHANNEL_CLASSIFICATION_NOT_SUPPORTED 46
INSUFFICIENT_SECURITY 47
PARAMETER_OUT_OF_MANDATORY_RANGE 48
RESERVED1 49
ROLE_SWITCH_PENDING 50
RESERVED2 51
RESERVED_SLOT_VIOLATION 52
ROLE_SWITCH_FAILED 53
EXTENDED_INQUIRY_RESPONSE_TOO_LARGE 54
SECURE_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 55
HOST_BUSY_PAIRING 56
CONNECTION_REJECTED_NO_SUITABLE_CHANNEL_FOUND 57
CONTROLLER_BUSY 58
UNACCEPTABLE_CONNECTION_PARAMETERS 59
DIRECTED_ADVERTISING_TIMEOUT 60
CONNECTION_TERMINATED_MIC_FAILURE 61
CONNECTION_FAILED_TO_BE_ESTABLISHED 62
MAC_CONNECTION_FAILED 63
COARSE_CLOCK_ADJUSTMENT_REJECTED 64
TYPE0_SUBMAP_NOT_DEFINED 65
UNKNOWN_ADVERTISING_IDENTIFIER 66
LIMIT_REACHED 67
OPERATION_CANCELLED_BY_HOST 68

LegacyAdvertisingType

Type: uint8

Defined in fuchsia.bluetooth.test/le_procedures.fidl

LE legacy advertising types from Bluetooth Core Specification 5.1 Vol 2, Part E, Section 7.8.5.

NameValueDescription
ADV_IND 0 Connectable and scannable.
ADV_DIRECT_IND 1 Connectable, high-duty cycle, directed.
ADV_SCAN_IND 2 Scannable, undirected.
ADV_NONCONN_IND 3 Non-connectable, undirected
SCAN_RSP 4 Scan response

TABLES

EmulatorSettings

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Controller settings used by the emulator.

OrdinalNameTypeDescription
1 address fuchsia.bluetooth/Address The `BD_ADDR` (BR/EDR) or LE Public Device Address. Defaults to "00:00:00:00:00:00".
2 hci_config HciConfig Supported HCI command configuration. Defaults to "`DUAL_MODE`".
3 extended_advertising bool True if the 5.0 extended advertising features are supported. Defaults to "false".
4 acl_buffer_settings AclBufferSettings The ACL-U data buffer settings. Defaults to data_packet_length: 1024 total_num_data_packets: 5 IF `hci_config` is set to `DUAL_MODE`. Defaults to null otherwise.
5 le_acl_buffer_settings AclBufferSettings The LE-U ACL data buffer settings. Defaults to data_packet_length: 251 total_num_data_packets: 5

LowEnergyPeerParameters

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Parameters used to emulate a peer's behavior over the Low Energy transport.

OrdinalNameTypeDescription
1 address fuchsia.bluetooth/Address The LE identity address of the peer. This field is mandatory.
2 connectable bool When present and true, the peer will send connectable advertisements and accept connection requests. The peer will ignore connection requests if not connectable.
3 advertisement AdvertisingData The advertising data contents. If not present, the advertising data sent by this peer will be empty.
4 scan_response AdvertisingData The scan response data contents. When present, the fake controller will generate scannable advertising packets and scan response events.

BredrPeerParameters

Defined in fuchsia.bluetooth.test/hci_emulator.fidl

Parameters used to emulate a peer's behavior over the BR/EDR transport.

OrdinalNameTypeDescription
1 address fuchsia.bluetooth/Address The BD_ADDR of the peer. This field is mandatory.
2 connectable bool When present and true, the peer will accept connection requests. The peer will ignore connection requests if not connectable.
3 device_class fuchsia.bluetooth/DeviceClass The device class reported in the inquiry response for this peer during device discovery.

LegacyAdvertisingState

Defined in fuchsia.bluetooth.test/le_procedures.fidl

Controller parameters for legacy advertising.

OrdinalNameTypeDescription
1 enabled bool True if advertising has been enabled using the HCI_LE_Set_Advertising_Enable command. This field is always present.
2 type LegacyAdvertisingType The most recently configured advertising type. This field is always present. Defaults to LegacyAdvertisingType.ADV_IND.
3 address_type fuchsia.bluetooth/AddressType The LE address type being used for advertising. This field is always present. Defaults to fuchsia.bluetooth/AddressType.PUBLIC.
4 interval_min uint16 The host-specified advertising interval range parameters. Present only if configured.
5 interval_max uint16
6 advertising_data vector<uint8>[31] Any configured advertising and scan response data. Present only if either field is non-zero.
7 scan_response vector<uint8>[31]

LeScanState

Defined in fuchsia.bluetooth.test/le_procedures.fidl

Represents the LE scan state. The fields are present if scan parameters have been configured.

OrdinalNameTypeDescription
1 enabled bool True if a scan is enabled.
2 active bool True if an active scan is enabled. Otherwise the scan is passive.
3 interval uint16 The scan interval and window parameters. These are defined in Bluetooth controller "timeslices" where 1 slice = 0.625 ms. Valid values range from 0x4 (2.5 ms) to 0x4000 (10.24 ms).
4 window uint16
5 filter_duplicates bool True if duplicate filtering has been enabled.
6 address_type fuchsia.bluetooth/AddressType The type of local device address used.

UNIONS

HciEmulator_Publish_Result

generated

NameTypeDescription
response HciEmulator_Publish_Response
err EmulatorError

HciEmulator_AddLowEnergyPeer_Result

generated

NameTypeDescription
response HciEmulator_AddLowEnergyPeer_Response
err EmulatorPeerError

HciEmulator_AddBredrPeer_Result

generated

NameTypeDescription
response HciEmulator_AddBredrPeer_Response
err EmulatorPeerError

CONSTANTS

NameValueTypeDescription
MAX_LEGACY_ADVERTISING_DATA_LENGTH 31 uint8
MAX_EXTENDED_ADVERTISING_DATA_LENGTH 251 uint8