Table of Contents

Interface IBluetoothEmulation

Namespace
Selenium.WebDriver.BiDi.Cdp.BluetoothEmulation
Assembly
Selenium.WebDriver.BiDi.Cdp.dll

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

[Experimental("BIDICDP001")]
public interface IBluetoothEmulation

Properties

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.

IEventSource<CharacteristicOperationReceivedEventArgs> CharacteristicOperationReceived { get; }

Property Value

IEventSource<CharacteristicOperationReceivedEventArgs>

Remarks

Event args (CharacteristicOperationReceivedEventArgs):

  • CharacteristicId
  • Type
  • Data
  • WriteType

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.

IEventSource<DescriptorOperationReceivedEventArgs> DescriptorOperationReceived { get; }

Property Value

IEventSource<DescriptorOperationReceivedEventArgs>

Remarks

Event args (DescriptorOperationReceivedEventArgs):

  • DescriptorId
  • Type
  • Data

GattOperationReceived

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

IEventSource<GattOperationReceivedEventArgs> GattOperationReceived { get; }

Property Value

IEventSource<GattOperationReceivedEventArgs>

Remarks

Event args (GattOperationReceivedEventArgs):

  • Address
  • Type

Methods

AddCharacteristicAsync(string, string, CharacteristicProperties, string?, CancellationToken)

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

Task<AddCharacteristicResult> AddCharacteristicAsync(string serviceId, string characteristicUuid, CharacteristicProperties properties, string? session = null, CancellationToken cancellationToken = default)

Parameters

serviceId string
characteristicUuid string
properties CharacteristicProperties
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<AddCharacteristicResult>

A task representing the asynchronous operation, containing a AddCharacteristicResult.

AddDescriptorAsync(string, string, string?, CancellationToken)

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

Task<AddDescriptorResult> AddDescriptorAsync(string characteristicId, string descriptorUuid, string? session = null, CancellationToken cancellationToken = default)

Parameters

characteristicId string
descriptorUuid string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<AddDescriptorResult>

A task representing the asynchronous operation, containing a AddDescriptorResult.

AddServiceAsync(string, string, string?, CancellationToken)

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

Task<AddServiceResult> AddServiceAsync(string address, string serviceUuid, string? session = null, CancellationToken cancellationToken = default)

Parameters

address string
serviceUuid string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<AddServiceResult>

A task representing the asynchronous operation, containing a AddServiceResult.

DisableAsync(string?, CancellationToken)

Disable the BluetoothEmulation domain.

Task<DisableResult> DisableAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<DisableResult>

A task representing the asynchronous operation, containing a DisableResult.

EnableAsync(CentralState, bool, string?, CancellationToken)

Enable the BluetoothEmulation domain.

Task<EnableResult> EnableAsync(CentralState state, bool leSupported, string? session = null, CancellationToken cancellationToken = default)

Parameters

state CentralState

State of the simulated central.

leSupported bool

If the simulated central supports low-energy.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<EnableResult>

A task representing the asynchronous operation, containing a EnableResult.

RemoveCharacteristicAsync(string, string?, CancellationToken)

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

Task<RemoveCharacteristicResult> RemoveCharacteristicAsync(string characteristicId, string? session = null, CancellationToken cancellationToken = default)

Parameters

characteristicId string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RemoveCharacteristicResult>

A task representing the asynchronous operation, containing a RemoveCharacteristicResult.

RemoveDescriptorAsync(string, string?, CancellationToken)

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

Task<RemoveDescriptorResult> RemoveDescriptorAsync(string descriptorId, string? session = null, CancellationToken cancellationToken = default)

Parameters

descriptorId string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RemoveDescriptorResult>

A task representing the asynchronous operation, containing a RemoveDescriptorResult.

RemoveServiceAsync(string, string?, CancellationToken)

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

Task<RemoveServiceResult> RemoveServiceAsync(string serviceId, string? session = null, CancellationToken cancellationToken = default)

Parameters

serviceId string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RemoveServiceResult>

A task representing the asynchronous operation, containing a RemoveServiceResult.

SetSimulatedCentralStateAsync(CentralState, string?, CancellationToken)

Set the state of the simulated central.

Task<SetSimulatedCentralStateResult> SetSimulatedCentralStateAsync(CentralState state, string? session = null, CancellationToken cancellationToken = default)

Parameters

state CentralState

State of the simulated central.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetSimulatedCentralStateResult>

A task representing the asynchronous operation, containing a SetSimulatedCentralStateResult.

SimulateAdvertisementAsync(ScanEntry, string?, CancellationToken)

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

Task<SimulateAdvertisementResult> SimulateAdvertisementAsync(ScanEntry entry, string? session = null, CancellationToken cancellationToken = default)

Parameters

entry ScanEntry
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SimulateAdvertisementResult>

A task representing the asynchronous operation, containing a SimulateAdvertisementResult.

SimulateCharacteristicOperationResponseAsync(string, CharacteristicOperationType, long, string?, string?, CancellationToken)

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.

Task<SimulateCharacteristicOperationResponseResult> SimulateCharacteristicOperationResponseAsync(string characteristicId, CharacteristicOperationType type, long code, string? data = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

characteristicId string
type CharacteristicOperationType
code long
data string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SimulateCharacteristicOperationResponseResult>

A task representing the asynchronous operation, containing a SimulateCharacteristicOperationResponseResult.

SimulateDescriptorOperationResponseAsync(string, DescriptorOperationType, long, string?, string?, CancellationToken)

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.

Task<SimulateDescriptorOperationResponseResult> SimulateDescriptorOperationResponseAsync(string descriptorId, DescriptorOperationType type, long code, string? data = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

descriptorId string
type DescriptorOperationType
code long
data string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SimulateDescriptorOperationResponseResult>

A task representing the asynchronous operation, containing a SimulateDescriptorOperationResponseResult.

SimulateGATTDisconnectionAsync(string, string?, CancellationToken)

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

Task<SimulateGATTDisconnectionResult> SimulateGATTDisconnectionAsync(string address, string? session = null, CancellationToken cancellationToken = default)

Parameters

address string
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SimulateGATTDisconnectionResult>

A task representing the asynchronous operation, containing a SimulateGATTDisconnectionResult.

SimulateGATTOperationResponseAsync(string, GATTOperationType, long, string?, CancellationToken)

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.

Task<SimulateGATTOperationResponseResult> SimulateGATTOperationResponseAsync(string address, GATTOperationType type, long code, string? session = null, CancellationToken cancellationToken = default)

Parameters

address string
type GATTOperationType
code long
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SimulateGATTOperationResponseResult>

A task representing the asynchronous operation, containing a SimulateGATTOperationResponseResult.

SimulatePreconnectedPeripheralAsync(string, string, ImmutableArray<ManufacturerData>, ImmutableArray<string>, string?, CancellationToken)

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

Task<SimulatePreconnectedPeripheralResult> SimulatePreconnectedPeripheralAsync(string address, string name, ImmutableArray<ManufacturerData> manufacturerData, ImmutableArray<string> knownServiceUuids, string? session = null, CancellationToken cancellationToken = default)

Parameters

address string
name string
manufacturerData ImmutableArray<ManufacturerData>
knownServiceUuids ImmutableArray<string>
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SimulatePreconnectedPeripheralResult>

A task representing the asynchronous operation, containing a SimulatePreconnectedPeripheralResult.