Builder
class Builder
| kotlin.Any | |
| ↳ | android.bluetooth.BluetoothGattConnectionSettings.Builder |
Builder for BluetoothGattConnectionSettings.
Summary
| Public constructors | |
|---|---|
Builder()Creates a new Builder for |
|
| Public methods | |
|---|---|
| BluetoothGattConnectionSettings |
build()Builds a |
| BluetoothGattConnectionSettings.Builder |
setAutoConnectEnabled(autoConnectEnabled: Boolean)Setting this to true will enable the automatic connection to remote device when It is available. |
| BluetoothGattConnectionSettings.Builder |
setAutomaticMtuEnabled(automaticMtuEnabled: Boolean)Sets if the MTU (Maximum Transmission Unit) needs to be negotiated for given connection or not. |
| BluetoothGattConnectionSettings.Builder |
setOpportunisticEnabled(opportunisticEnabled: Boolean)Sets whether this GATT client is opportunistic. |
| BluetoothGattConnectionSettings.Builder |
setTransport(transport: Int)Sets the transport for this Gatt settings. |
Public constructors
Public methods
build
fun build(): BluetoothGattConnectionSettings
Builds a BluetoothGattConnectionSettings object.
| Return | |
|---|---|
BluetoothGattConnectionSettings |
A new BluetoothGattConnectionSettings object with the configured parameters. This value cannot be null. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
on invalid parameters |
setAutoConnectEnabled
fun setAutoConnectEnabled(autoConnectEnabled: Boolean): BluetoothGattConnectionSettings.Builder
Setting this to true will enable the automatic connection to remote device when It is available. Setting it to False would trigger direct connect to remote device
| Parameters | |
|---|---|
autoConnectEnabled |
Boolean: true if auto connection is enabled, false otherwise. |
| Return | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder. This value cannot be null. |
setAutomaticMtuEnabled
fun setAutomaticMtuEnabled(automaticMtuEnabled: Boolean): BluetoothGattConnectionSettings.Builder
Sets if the MTU (Maximum Transmission Unit) needs to be negotiated for given connection or not. This is set to true by default so that MTU exchange happens after the connection. Applications have to set it to false to disable the automatic negotiation. Setting this to false does not prevent MTU negotiation if a client explicitly requests it using BluetoothGatt.requestMtu or if it's triggered internally by other profiles.
| Parameters | |
|---|---|
automaticMtuEnabled |
Boolean: true if Default MTU setting needs to be applied on this connection, false otherwise. |
| Return | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder. This value cannot be null. |
setOpportunisticEnabled
fun setOpportunisticEnabled(opportunisticEnabled: Boolean): BluetoothGattConnectionSettings.Builder
Sets whether this GATT client is opportunistic. An opportunistic GATT client does not hold a GATT connection. It automatically disconnects when no other GATT connections are active for the remote device
| Parameters | |
|---|---|
opportunisticEnabled |
Boolean: true if this connection is opportunistic, false otherwise. |
| Return | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder. This value cannot be null. |
setTransport
fun setTransport(transport: Int): BluetoothGattConnectionSettings.Builder
Sets the transport for this Gatt settings. preferred transport for GATT connections to remote dual-mode devices.
| Parameters | |
|---|---|
transport |
Int: Value is one of the following: |
| Return | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder. This value cannot be null. |