Class DotNetCoreBluetoothRemoteDevice
- Namespace
- Bluetooth.Maui.Platforms.DotNetCore.Scanning
- Assembly
- Bluetooth.Maui.Platforms.DotNetCore.dll
Interface representing a Bluetooth device, providing properties and methods for interacting with it.
public class DotNetCoreBluetoothRemoteDevice : BaseBluetoothRemoteDevice, IBluetoothRemoteDevice, INotifyPropertyChanged, IAsyncDisposable
- Inheritance
-
DotNetCoreBluetoothRemoteDevice
- Implements
- Inherited Members
Constructors
DotNetCoreBluetoothRemoteDevice(IBluetoothScanner, IBluetoothAdvertisement, SignalStrengthSmoothingOptions, IBluetoothRssiToSignalStrengthConverter, ILogger<IBluetoothRemoteDevice>?)
Initializes a new instance of the BaseBluetoothRemoteDevice class using the provided Bluetooth advertisement and parent scanner.
public DotNetCoreBluetoothRemoteDevice(IBluetoothScanner parentScanner, IBluetoothAdvertisement advertisement, SignalStrengthSmoothingOptions signalStrengthSmoothingOptions, IBluetoothRssiToSignalStrengthConverter rssiToSignalStrengthConverter, ILogger<IBluetoothRemoteDevice>? logger = null)
Parameters
parentScannerIBluetoothScannerThe Bluetooth scanner associated with this remote device.
advertisementIBluetoothAdvertisementThe Bluetooth advertisement containing information about the remote device.
signalStrengthSmoothingOptionsSignalStrengthSmoothingOptionsThe options for smoothing signal strength jitter.
rssiToSignalStrengthConverterIBluetoothRssiToSignalStrengthConverterThe converter for RSSI to signal strength.
loggerILogger<IBluetoothRemoteDevice>Optional logger instance for logging purposes.
Exceptions
DotNetCoreBluetoothRemoteDevice(IBluetoothScanner, string, Manufacturer, SignalStrengthSmoothingOptions, IBluetoothRssiToSignalStrengthConverter, ILogger<IBluetoothRemoteDevice>?)
Initializes a new instance of the BaseBluetoothRemoteDevice class.
public DotNetCoreBluetoothRemoteDevice(IBluetoothScanner parentScanner, string id, Manufacturer manufacturer, SignalStrengthSmoothingOptions signalStrengthSmoothingOptions, IBluetoothRssiToSignalStrengthConverter rssiToSignalStrengthConverter, ILogger<IBluetoothRemoteDevice>? logger = null)
Parameters
parentScannerIBluetoothScannerThe Bluetooth scanner associated with this device.
idstringThe unique identifier of the Bluetooth device, typically a UUID or MAC address.
manufacturerManufacturerThe manufacturer information for the Bluetooth device.
signalStrengthSmoothingOptionsSignalStrengthSmoothingOptionsThe options for smoothing signal strength jitter.
rssiToSignalStrengthConverterIBluetoothRssiToSignalStrengthConverterThe converter for RSSI to signal strength.
loggerILogger<IBluetoothRemoteDevice>The logger instance to use for logging.
Exceptions
Methods
NativeConnectAsync(ConnectionOptions, TimeSpan?, CancellationToken)
Platform-specific implementation to initiate a connection to the device.
protected override ValueTask NativeConnectAsync(ConnectionOptions connectionOptions, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
connectionOptionsConnectionOptionstimeoutTimeSpan?Optional timeout for the operation.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
Exceptions
NativeDisconnectAsync(TimeSpan?, CancellationToken)
Platform-specific implementation to initiate a disconnection from the device.
protected override ValueTask NativeDisconnectAsync(TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
timeoutTimeSpan?Optional timeout for the operation.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
Exceptions
NativeOpenL2CapChannelAsync(int)
Platform-specific implementation to open an L2CAP channel.
protected override ValueTask NativeOpenL2CapChannelAsync(int psm)
Parameters
psmint
Returns
Exceptions
NativeReadSignalStrength()
Platform-specific implementation to initiate a signal strength reading.
protected override void NativeReadSignalStrength()
Exceptions
NativeRefreshIsConnected()
Platform-specific implementation to refresh the current connection state from the native platform.
protected override void NativeRefreshIsConnected()
Exceptions
NativeRequestConnectionPriorityAsync(ConnectionPriority, TimeSpan?, CancellationToken)
Platform-specific implementation to request a connection priority change.
protected override ValueTask NativeRequestConnectionPriorityAsync(ConnectionPriority priority, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
priorityConnectionPriorityThe desired connection priority mode.
timeoutTimeSpan?Optional timeout for the operation.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- ValueTask
A task that represents the asynchronous operation.
Remarks
On platforms that don't support this feature (iOS, Windows), this should be a no-op.
Exceptions
NativeRequestMtuAsync(int)
Platform-specific implementation to request MTU.
protected override ValueTask NativeRequestMtuAsync(int requestedMtu)
Parameters
requestedMtuint
Returns
Exceptions
NativeServicesExplorationAsync(bool, TimeSpan?, CancellationToken)
Platform-specific implementation to explore services.
protected override ValueTask NativeServicesExplorationAsync(bool useCache, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
useCacheboolWhen false, platforms that maintain their own OS-level GATT cache independent of this library's cache (Android) should force a genuinely fresh read from the peripheral - confirmed against real hardware: Android can keep serving a peripheral's pre-reboot service list from its own Bluetooth stack cache even after ExploreServicesAsync's UseCache=false already bypassed this library's own cache, because that flag never reached the platform layer that actually owns the stale cache.
timeoutTimeSpan?The timeout for this operation.
cancellationTokenCancellationTokenA cancellation token to cancel this operation.
Returns
Exceptions
NativeSetPreferredPhyAsync(PhyMode, PhyMode)
Platform-specific implementation to set preferred PHY.
protected override ValueTask NativeSetPreferredPhyAsync(PhyMode txPhy, PhyMode rxPhy)