Class DeviceNotConnectedException
- Namespace
- Bluetooth.Abstractions.Scanning.Exceptions
- Assembly
- Bluetooth.Abstractions.Scanning.dll
Represents an exception that occurs when a Bluetooth device is not connected.
public class DeviceNotConnectedException : DeviceException, ISerializable
- Inheritance
-
DeviceNotConnectedException
- Implements
- Inherited Members
Constructors
DeviceNotConnectedException(IBluetoothRemoteDevice, string, Exception?)
Initializes a new instance of the DeviceNotConnectedException class.
public DeviceNotConnectedException(IBluetoothRemoteDevice device, string message = "Device needs to be connected to execute this operation", Exception? innerException = null)
Parameters
deviceIBluetoothRemoteDeviceThe Bluetooth device associated with the exception.
messagestringA message that describes the error.
innerExceptionExceptionThe inner exception that caused the current exception, if any.
Methods
ThrowIfNotConnected(IBluetoothRemoteDevice)
Throws a DeviceNotConnectedException if the specified device is not connected.
public static void ThrowIfNotConnected(IBluetoothRemoteDevice serviceDevice)
Parameters
serviceDeviceIBluetoothRemoteDeviceThe Bluetooth device to check.