BleTransport

fun BleTransport(address: String, builderAction: PeripheralBuilder.() -> Unit = {}): BleTransport(source)

Android-specific factory that creates a BleTransport from a persisted MAC address string.

On Android, Kable's Identifier is a type alias for String, but toIdentifier is the canonical conversion and remains correct across Kable versions.

After each successful link establishment the transport negotiates the ATT MTU (PREFERRED_MTU) and requests a high connection priority for the handshake window (downgraded to Balanced after CONNECTION_PRIORITY_BOOST_MS; the pending downgrade is cancelled if the session disconnects first). Both are best-effort: a failure leaves the OS defaults in place and never fails the connect.

Example — bonded device (no fresh advertisement, must use autoConnect):

val transport = BleTransport(address = "AA:BB:CC:DD:EE:FF") {
autoConnectIf { true }
}

Parameters

address

Bluetooth MAC address string (e.g. "AA:BB:CC:DD:EE:FF").

builderAction

Optional PeripheralBuilder action for GATT configuration (threading, autoConnect, etc.). For bonded devices without a fresh advertisement, add autoConnectIf { true } to avoid GATT error 133.