Direct

data class Direct(val timeout: Duration = 10.seconds, val retry: Int = 2, val retryDelay: Duration = 300.milliseconds, val automaticallyRequestHighestValueLength: Boolean = true, val opportunistic: Boolean = false) : CentralManager.ConnectionOptions

Connection options for direct connection.

Direct connection has a maximum timeout which depends on the device manufacturer and is usually 30 seconds or less. It may be shortened using the timeout parameter.

Constructors

Link copied to clipboard
constructor(timeout: Duration = 10.seconds, retry: Int = 2, retryDelay: Duration = 300.milliseconds, automaticallyRequestHighestValueLength: Boolean = true, opportunistic: Boolean = false)

Properties

Link copied to clipboard

If true, the manager will automatically request the highest MTU supported by the remote device immediately after establishing the connection.

Link copied to clipboard
open override val opportunistic: Boolean

Opportunistic connection is available from Android 17 onwards. An opportunistic GATT client does not hold a GATT connection. It automatically disconnects when no other GATT connections are active for the remote device.

Link copied to clipboard
val retry: Int

The number of connection retries. Value N indicates N+1 connection attempts.

Link copied to clipboard

The delay between connection retries, defaults to 300 ms.

Link copied to clipboard

The connection timeout, defaults to 10 seconds. If set to a longer time than the system timeout (around 30 seconds) the connection will still timeout after the default timer. Use AutoConnect instead.