Class BluetoothModule
- Namespace
- WebDriverBiDi.Bluetooth
- Assembly
- WebDriverBiDi.dll
The Bluetooth module contains commands for simulating communication with Bluetooth devices, and events reporting the prompts and requests that simulation produces.
public sealed class BluetoothModule : Module
- Inheritance
-
BluetoothModule
- Inherited Members
Constructors
BluetoothModule(IBiDiModuleHost)
Initializes a new instance of the BluetoothModule class.
public BluetoothModule(IBiDiModuleHost driver)
Parameters
driverIBiDiModuleHostThe IBiDiModuleHost used in the module commands and events.
Fields
BluetoothModuleName
The name of the bluetooth module.
public const string BluetoothModuleName = "bluetooth"
Field Value
Properties
ModuleName
Gets the module name.
public override string ModuleName { get; }
Property Value
OnCharacteristicEventGenerated
Gets an observable event that notifies when a characteristic event is generated on a simulated Bluetooth device.
[ObservableEventName("bluetooth.characteristicEventGenerated")]
public ObservableEvent<CharacteristicEventGeneratedEventArgs> OnCharacteristicEventGenerated { get; }
Property Value
OnDescriptorEventGenerated
Gets an observable event that notifies when a descriptor event is generated on a simulated Bluetooth device.
[ObservableEventName("bluetooth.descriptorEventGenerated")]
public ObservableEvent<DescriptorEventGeneratedEventArgs> OnDescriptorEventGenerated { get; }
Property Value
OnGattConnectionAttempted
Gets an observable event that notifies when the page attempts a GATT connection to a simulated Bluetooth device.
[ObservableEventName("bluetooth.gattConnectionAttempted")]
public ObservableEvent<GattConnectionAttemptedEventArgs> OnGattConnectionAttempted { get; }
Property Value
OnRequestDevicePromptUpdated
Gets an observable event that notifies when a Bluetooth device prompt is updated.
[ObservableEventName("bluetooth.requestDevicePromptUpdated")]
public ObservableEvent<RequestDevicePromptUpdatedEventArgs> OnRequestDevicePromptUpdated { get; }
Property Value
Methods
DisableSimulationAsync(DisableSimulationCommandParameters, TimeSpan?, CancellationToken)
Disables simulation of Bluetooth devices.
public Task<DisableSimulationCommandResult> DisableSimulationAsync(DisableSimulationCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersDisableSimulationCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<DisableSimulationCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
HandleRequestDevicePromptAsync(HandleRequestDevicePromptCommandParameters, TimeSpan?, CancellationToken)
Handles the prompt requesting connection to Bluetooth devices.
public Task<HandleRequestDevicePromptCommandResult> HandleRequestDevicePromptAsync(HandleRequestDevicePromptCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersHandleRequestDevicePromptCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<HandleRequestDevicePromptCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateAdapterAsync(SimulateAdapterCommandParameters, TimeSpan?, CancellationToken)
Simulates the presence or absence of the Bluetooth adapter, along with its power settings.
public Task<SimulateAdapterCommandResult> SimulateAdapterAsync(SimulateAdapterCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateAdapterCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateAdapterCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateAdvertisementAsync(SimulateAdvertisementCommandParameters, TimeSpan?, CancellationToken)
Simulates the advertisement of availability of Bluetooth peripherals.
public Task<SimulateAdvertisementCommandResult> SimulateAdvertisementAsync(SimulateAdvertisementCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateAdvertisementCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateAdvertisementCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateCharacteristicAsync(SimulateCharacteristicCommandParameters, TimeSpan?, CancellationToken)
Simulates a characteristic for a Bluetooth device.
public Task<SimulateCharacteristicCommandResult> SimulateCharacteristicAsync(SimulateCharacteristicCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateCharacteristicCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateCharacteristicCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateCharacteristicResponseAsync(SimulateCharacteristicResponseCommandParameters, TimeSpan?, CancellationToken)
Simulates a characteristic response for a Bluetooth device.
public Task<SimulateCharacteristicResponseCommandResult> SimulateCharacteristicResponseAsync(SimulateCharacteristicResponseCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateCharacteristicResponseCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateCharacteristicResponseCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateDescriptorAsync(SimulateDescriptorCommandParameters, TimeSpan?, CancellationToken)
Simulates a descriptor for a Bluetooth device.
public Task<SimulateDescriptorCommandResult> SimulateDescriptorAsync(SimulateDescriptorCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateDescriptorCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateDescriptorCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateDescriptorResponseAsync(SimulateDescriptorResponseCommandParameters, TimeSpan?, CancellationToken)
Simulates a descriptor response for a Bluetooth device.
public Task<SimulateDescriptorResponseCommandResult> SimulateDescriptorResponseAsync(SimulateDescriptorResponseCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateDescriptorResponseCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateDescriptorResponseCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateGattConnectionResponseAsync(SimulateGattConnectionResponseCommandParameters, TimeSpan?, CancellationToken)
Simulates a GATT connection response for a Bluetooth device.
public Task<SimulateGattConnectionResponseCommandResult> SimulateGattConnectionResponseAsync(SimulateGattConnectionResponseCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateGattConnectionResponseCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateGattConnectionResponseCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateGattDisconnectionAsync(SimulateGattDisconnectionCommandParameters, TimeSpan?, CancellationToken)
Simulates a GATT disconnection for a Bluetooth device.
public Task<SimulateGattDisconnectionCommandResult> SimulateGattDisconnectionAsync(SimulateGattDisconnectionCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateGattDisconnectionCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateGattDisconnectionCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulatePreconnectedPeripheralAsync(SimulatePreconnectedPeripheralCommandParameters, TimeSpan?, CancellationToken)
Simulates the presence of a Bluetooth peripheral already connected to the page.
public Task<SimulatePreconnectedPeripheralCommandResult> SimulatePreconnectedPeripheralAsync(SimulatePreconnectedPeripheralCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulatePreconnectedPeripheralCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulatePreconnectedPeripheralCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SimulateServiceAsync(SimulateServiceCommandParameters, TimeSpan?, CancellationToken)
Simulates a service for a Bluetooth device.
public Task<SimulateServiceCommandResult> SimulateServiceAsync(SimulateServiceCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSimulateServiceCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SimulateServiceCommandResult>
An empty command result.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.- WebDriverBiDiCommandException
Thrown when the remote end returns an error response for the command.
- WebDriverBiDiSerializationException
Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.
- WebDriverBiDiTimeoutException
Thrown when the command does not complete within the timeout.
- WebDriverBiDiConnectionException
Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.
- WebDriverBiDiException
Thrown when the command is canceled, or its response carries no result or a result of the wrong type.
- OperationCanceledException
Thrown when
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.