BluetoothEmulation
ExperimentalThis domain allows configuring virtual Bluetooth devices to test the web-bluetooth API.
No symbols match your filter.
Commands
BluetoothEmulation.enable
Enable the BluetoothEmulation domain.
Parameters
| Name | Type | Description |
|---|---|---|
state
|
CentralState |
State of the simulated central. |
leSupported
|
boolean |
If the simulated central supports low-energy. |
BluetoothEmulation.setSimulatedCentralState
Set the state of the simulated central.
Parameters
| Name | Type | Description |
|---|---|---|
state
|
CentralState |
State of the simulated central. |
BluetoothEmulation.disable
Disable the BluetoothEmulation domain.
BluetoothEmulation.simulatePreconnectedPeripheral
Simulates a peripheral with |address|, |name| and |knownServiceUuids|
that has already been connected to the system.
Parameters
| Name | Type | Description |
|---|---|---|
address
|
string |
|
name
|
string |
|
manufacturerData
|
array<ManufacturerData> |
|
knownServiceUuids
|
array<string> |
BluetoothEmulation.simulateAdvertisement
Simulates an advertisement packet described in |entry| being received by
the central.
Parameters
| Name | Type | Description |
|---|---|---|
entry
|
ScanEntry |
BluetoothEmulation.simulateGATTOperationResponse
Simulates the response code from the peripheral with |address| for a
GATT operation of |type|. The |code| value follows the HCI Error Codes from
Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.
Parameters
| Name | Type | Description |
|---|---|---|
address
|
string |
|
type
|
GATTOperationType |
|
code
|
integer |
BluetoothEmulation.simulateCharacteristicOperationResponse
Simulates the response from the characteristic with |characteristicId| for a
characteristic operation of |type|. The |code| value follows the Error
Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
The |data| is expected to exist when simulating a successful read operation
response.
Parameters
| Name | Type | Description |
|---|---|---|
characteristicId
|
string |
|
type
|
CharacteristicOperationType |
|
code
|
integer |
|
data
(optional) |
binary |
BluetoothEmulation.simulateDescriptorOperationResponse
Simulates the response from the descriptor with |descriptorId| for a
descriptor operation of |type|. The |code| value follows the Error
Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
The |data| is expected to exist when simulating a successful read operation
response.
Parameters
| Name | Type | Description |
|---|---|---|
descriptorId
|
string |
|
type
|
DescriptorOperationType |
|
code
|
integer |
|
data
(optional) |
binary |
BluetoothEmulation.addService
Adds a service with |serviceUuid| to the peripheral with |address|.
Parameters
| Name | Type | Description |
|---|---|---|
address
|
string |
|
serviceUuid
|
string |
Return Object
| Name | Type | Description |
|---|---|---|
serviceId
|
string |
An identifier that uniquely represents this service. |
BluetoothEmulation.removeService
Removes the service respresented by |serviceId| from the simulated central.
Parameters
| Name | Type | Description |
|---|---|---|
serviceId
|
string |
BluetoothEmulation.addCharacteristic
Adds a characteristic with |characteristicUuid| and |properties| to the
service represented by |serviceId|.
Parameters
| Name | Type | Description |
|---|---|---|
serviceId
|
string |
|
characteristicUuid
|
string |
|
properties
|
CharacteristicProperties |
Return Object
| Name | Type | Description |
|---|---|---|
characteristicId
|
string |
An identifier that uniquely represents this characteristic. |
BluetoothEmulation.removeCharacteristic
Removes the characteristic respresented by |characteristicId| from the
simulated central.
Parameters
| Name | Type | Description |
|---|---|---|
characteristicId
|
string |
BluetoothEmulation.addDescriptor
Adds a descriptor with |descriptorUuid| to the characteristic respresented
by |characteristicId|.
Parameters
| Name | Type | Description |
|---|---|---|
characteristicId
|
string |
|
descriptorUuid
|
string |
Return Object
| Name | Type | Description |
|---|---|---|
descriptorId
|
string |
An identifier that uniquely represents this descriptor. |
BluetoothEmulation.removeDescriptor
Removes the descriptor with |descriptorId| from the simulated central.
Parameters
| Name | Type | Description |
|---|---|---|
descriptorId
|
string |
BluetoothEmulation.simulateGATTDisconnection
Simulates a GATT disconnection from the peripheral with |address|.
Parameters
| Name | Type | Description |
|---|---|---|
address
|
string |
Events
BluetoothEmulation.gattOperationReceived
Event for when a GATT operation of |type| to the peripheral with |address|
happened.
Parameters
| Name | Type | Description |
|---|---|---|
address
|
string |
|
type
|
GATTOperationType |
BluetoothEmulation.characteristicOperationReceived
Event for when a characteristic operation of |type| to the characteristic
respresented by |characteristicId| happened. |data| and |writeType| is
expected to exist when |type| is write.
Parameters
| Name | Type | Description |
|---|---|---|
characteristicId
|
string |
|
type
|
CharacteristicOperationType |
|
data
(optional) |
binary |
|
writeType
(optional) |
CharacteristicWriteType |
BluetoothEmulation.descriptorOperationReceived
Event for when a descriptor operation of |type| to the descriptor
respresented by |descriptorId| happened. |data| is expected to exist when
|type| is write.
Parameters
| Name | Type | Description |
|---|---|---|
descriptorId
|
string |
|
type
|
DescriptorOperationType |
|
data
(optional) |
binary |
Types
CentralState
(string)
Indicates the various states of Central.
Allowed Values
absentpowered-offpowered-on
GATTOperationType
(string)
Indicates the various types of GATT event.
Allowed Values
connectiondiscovery
CharacteristicWriteType
(string)
Indicates the various types of characteristic write.
Allowed Values
write-default-deprecatedwrite-with-responsewrite-without-response
CharacteristicOperationType
(string)
Indicates the various types of characteristic operation.
Allowed Values
readwritesubscribe-to-notificationsunsubscribe-from-notifications
DescriptorOperationType
(string)
Indicates the various types of descriptor operation.
Allowed Values
readwrite
ManufacturerData
(object)
Stores the manufacturer data
Properties
| Name | Type | Description |
|---|---|---|
key
|
integer |
Company identifier https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/company_identifiers/company_identifiers.yaml https://usb.org/developers |
data
|
binary |
Manufacturer-specific data |
ScanRecord
(object)
Stores the byte data of the advertisement packet sent by a Bluetooth device.
Properties
| Name | Type | Description |
|---|---|---|
name
(optional) |
string |
|
uuids
(optional) |
array<string> |
|
appearance
(optional) |
integer |
Stores the external appearance description of the device. |
txPower
(optional) |
integer |
Stores the transmission power of a broadcasting device. |
manufacturerData
(optional) |
array<ManufacturerData> |
Key is the company identifier and the value is an array of bytes of manufacturer specific data. |
ScanEntry
(object)
Stores the advertisement packet information that is sent by a Bluetooth device.
Properties
| Name | Type | Description |
|---|---|---|
deviceAddress
|
string |
|
rssi
|
integer |
|
scanRecord
|
ScanRecord |
CharacteristicProperties
(object)
Describes the properties of a characteristic. This follows Bluetooth Core
Specification BT 4.2 Vol 3 Part G 3.3.1. Characteristic Properties.
Properties
| Name | Type | Description |
|---|---|---|
broadcast
(optional) |
boolean |
|
read
(optional) |
boolean |
|
writeWithoutResponse
(optional) |
boolean |
|
write
(optional) |
boolean |
|
notify
(optional) |
boolean |
|
indicate
(optional) |
boolean |
|
authenticatedSignedWrites
(optional) |
boolean |
|
extendedProperties
(optional) |
boolean |