Table of Contents

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

parentScanner IBluetoothScanner

The Bluetooth scanner associated with this remote device.

advertisement IBluetoothAdvertisement

The Bluetooth advertisement containing information about the remote device.

signalStrengthSmoothingOptions SignalStrengthSmoothingOptions

The options for smoothing signal strength jitter.

rssiToSignalStrengthConverter IBluetoothRssiToSignalStrengthConverter

The converter for RSSI to signal strength.

logger ILogger<IBluetoothRemoteDevice>

Optional logger instance for logging purposes.

Exceptions

PlatformNotSupportedException

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

parentScanner IBluetoothScanner

The Bluetooth scanner associated with this device.

id string

The unique identifier of the Bluetooth device, typically a UUID or MAC address.

manufacturer Manufacturer

The manufacturer information for the Bluetooth device.

signalStrengthSmoothingOptions SignalStrengthSmoothingOptions

The options for smoothing signal strength jitter.

rssiToSignalStrengthConverter IBluetoothRssiToSignalStrengthConverter

The converter for RSSI to signal strength.

logger ILogger<IBluetoothRemoteDevice>

The logger instance to use for logging.

Exceptions

PlatformNotSupportedException

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

connectionOptions ConnectionOptions
timeout TimeSpan?

Optional timeout for the operation.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

ValueTask

Exceptions

PlatformNotSupportedException

NativeDisconnectAsync(TimeSpan?, CancellationToken)

Platform-specific implementation to initiate a disconnection from the device.

protected override ValueTask NativeDisconnectAsync(TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

timeout TimeSpan?

Optional timeout for the operation.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

ValueTask

Exceptions

PlatformNotSupportedException

NativeOpenL2CapChannelAsync(int)

Platform-specific implementation to open an L2CAP channel.

protected override ValueTask NativeOpenL2CapChannelAsync(int psm)

Parameters

psm int

Returns

ValueTask

Exceptions

PlatformNotSupportedException

NativeReadSignalStrength()

Platform-specific implementation to initiate a signal strength reading.

protected override void NativeReadSignalStrength()

Exceptions

PlatformNotSupportedException

NativeRefreshIsConnected()

Platform-specific implementation to refresh the current connection state from the native platform.

protected override void NativeRefreshIsConnected()

Exceptions

PlatformNotSupportedException

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

priority ConnectionPriority

The desired connection priority mode.

timeout TimeSpan?

Optional timeout for the operation.

cancellationToken CancellationToken

Token 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

PlatformNotSupportedException

NativeRequestMtuAsync(int)

Platform-specific implementation to request MTU.

protected override ValueTask NativeRequestMtuAsync(int requestedMtu)

Parameters

requestedMtu int

Returns

ValueTask

Exceptions

PlatformNotSupportedException

NativeServicesExplorationAsync(bool, TimeSpan?, CancellationToken)

Platform-specific implementation to explore services.

protected override ValueTask NativeServicesExplorationAsync(bool useCache, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

useCache bool

When 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.

timeout TimeSpan?

The timeout for this operation.

cancellationToken CancellationToken

A cancellation token to cancel this operation.

Returns

ValueTask

Exceptions

PlatformNotSupportedException

NativeSetPreferredPhyAsync(PhyMode, PhyMode)

Platform-specific implementation to set preferred PHY.

protected override ValueTask NativeSetPreferredPhyAsync(PhyMode txPhy, PhyMode rxPhy)

Parameters

txPhy PhyMode
rxPhy PhyMode

Returns

ValueTask

Exceptions

PlatformNotSupportedException