BluetoothEmulationDomain

This domain allows configuring virtual Bluetooth devices to test the web-bluetooth API.

Official doc

Functions

Link copied to clipboard
suspend fun addCharacteristic(serviceId: String, characteristicUuid: String, properties: CharacteristicProperties): AddCharacteristicResponse

Adds a characteristic with |characteristicUuid| and |properties| to the service represented by |serviceId|.

Link copied to clipboard
suspend fun addDescriptor(characteristicId: String, descriptorUuid: String): AddDescriptorResponse

Adds a descriptor with |descriptorUuid| to the characteristic respresented by |characteristicId|.

Link copied to clipboard
suspend fun addService(address: String, serviceUuid: String): AddServiceResponse

Adds a service with |serviceUuid| to the peripheral with |address|.

Link copied to clipboard

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.

Link copied to clipboard

Event for when a descriptor operation of |type| to the descriptor respresented by |descriptorId| happened. |data| is expected to exist when |type| is write.

Link copied to clipboard
suspend fun disable(): DisableResponse

Disable the BluetoothEmulation domain.

Link copied to clipboard
suspend fun enable(input: EnableRequest): EnableResponse
suspend fun enable(state: CentralState, leSupported: Boolean): EnableResponse

Enable the BluetoothEmulation domain.

Link copied to clipboard

Subscribes to all events related to this domain.

Link copied to clipboard

Event for when a GATT operation of |type| to the peripheral with |address| happened.

Link copied to clipboard

Removes the characteristic respresented by |characteristicId| from the simulated central.

Link copied to clipboard

Removes the descriptor with |descriptorId| from the simulated central.

Link copied to clipboard
suspend fun removeService(serviceId: String): RemoveServiceResponse

Removes the service respresented by |serviceId| from the simulated central.

Link copied to clipboard

Simulates an advertisement packet described in |entry| being received by the central.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

Simulates a GATT disconnection from the peripheral with |address|.

Link copied to clipboard

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.

Link copied to clipboard
suspend fun simulatePreconnectedPeripheral(address: String, name: String, manufacturerData: List<ManufacturerData>, knownServiceUuids: List<String>): SimulatePreconnectedPeripheralResponse

Simulates a peripheral with |address|, |name| and |knownServiceUuids| that has already been connected to the system.