Language

BluetoothGattConnectionSettings.Builder.SetPathlossThresholdDb(Int32) Method

Definition

Sets the Pathloss threshold for initiating a connection.

[Android.Runtime.Register("setPathlossThresholdDb", "(I)Landroid/bluetooth/BluetoothGattConnectionSettings$Builder;", "", ApiSince=37)]
public Android.Bluetooth.BluetoothGattConnectionSettings.Builder SetPathlossThresholdDb(int pathlossThresholdDb);
[<Android.Runtime.Register("setPathlossThresholdDb", "(I)Landroid/bluetooth/BluetoothGattConnectionSettings$Builder;", "", ApiSince=37)>]
member this.SetPathlossThresholdDb : int -> Android.Bluetooth.BluetoothGattConnectionSettings.Builder

Parameters

pathlossThresholdDb
Int32

the pathloss threshold in dB for initiating connection. Value is between -1 and 100 inclusive

Returns

This builder. This value cannot be null.

Attributes

Remarks

Sets the Pathloss threshold for initiating a connection. If the device is already connected, then the GATT connection will succeed regardless of the Pathloss Threshold.

The Pathloss threshold is used to initiate an LE connection to a remote device when autoConnect is enabled. When autoConnect is enabled, the Bluetooth controller will add the remote device to the accept list and initiate the connection when the device is in range and has minimal pathloss. The Bluetooth controller will initiate the connection if the Pathloss is lower than the given Pathloss threshold value.

This is just a preference for the Bluetooth controller; the controller may or may not use this pathloss threshold value to initiate the connection.

When multiple applications request connections with different pathloss threshold values, the Bluetooth system will use the maximum of pathloss threshold among all active requests when initiating the next LE connection based on pathloss threshold.

Default pathloss threshold will be set to BluetoothGattConnectionSettings.PATHLOSS_THRESHOLD_NOT_SET which indicates that pathloss based LE connection trigger is not enabled.

When the Pathloss is not available, or this value is BluetoothGattConnectionSettings.PATHLOSS_THRESHOLD_NOT_SET, then system will fall back to the RSSI threshold based connection trigger if RSSI threshold is set using setRssiThresholdDbm(int)

Android reference for android.bluetooth.BluetoothGattConnectionSettings.Builder.setPathlossThresholdDb.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to