BluetoothGattConnectionSettings.Builder
public
static
final
class
BluetoothGattConnectionSettings.Builder
extends Object
| java.lang.Object | |
| ↳ | 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(boolean autoConnectEnabled)
Setting this to true will enable the automatic connection to remote device when It is available. |
BluetoothGattConnectionSettings.Builder
|
setAutomaticMtuEnabled(boolean automaticMtuEnabled)
Sets if the MTU (Maximum Transmission Unit) needs to be negotiated for given connection or not. |
BluetoothGattConnectionSettings.Builder
|
setOpportunisticEnabled(boolean opportunisticEnabled)
Sets whether this GATT client is opportunistic. |
BluetoothGattConnectionSettings.Builder
|
setTransport(int transport)
Sets the transport for this Gatt settings. |
Inherited methods | |
|---|---|
Public constructors
Public methods
build
public BluetoothGattConnectionSettings build ()
Builds a BluetoothGattConnectionSettings object.
| Returns | |
|---|---|
BluetoothGattConnectionSettings |
A new BluetoothGattConnectionSettings object with the configured
parameters.
This value cannot be null. |
| Throws | |
|---|---|
IllegalArgumentException |
on invalid parameters |
setAutoConnectEnabled
public BluetoothGattConnectionSettings.Builder setAutoConnectEnabled (boolean autoConnectEnabled)
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. |
| Returns | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder.
This value cannot be null. |
setAutomaticMtuEnabled
public BluetoothGattConnectionSettings.Builder setAutomaticMtuEnabled (boolean automaticMtuEnabled)
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. |
| Returns | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder.
This value cannot be null. |
setOpportunisticEnabled
public BluetoothGattConnectionSettings.Builder setOpportunisticEnabled (boolean opportunisticEnabled)
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. |
| Returns | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder.
This value cannot be null. |
setTransport
public BluetoothGattConnectionSettings.Builder setTransport (int transport)
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:
|
| Returns | |
|---|---|
BluetoothGattConnectionSettings.Builder |
This builder.
This value cannot be null. |