createMdocTransports

fun createMdocTransports(connectionMethods: List<MdocConnectionMethod>, role: MdocRole, options: MdocTransportOptions = MdocTransportOptions(), centralConfig: BleCentralConfig = BleCentralConfig(), centralHalFactory: () -> BleCentralHal, peripheralHalFactory: () -> BlePeripheralHal, nonBleTransportFactory: (MdocConnectionMethod) -> MdocTransport): List<MdocTransport>

Creates the MdocTransport instances needed to serve connectionMethods for role, coalescing co-hosted BLE Peripheral modes (direct-L2CAP + GATT sharing the same non-null service UUID) onto a single dual-mode BLE Peripheral MdocTransport and delegating non-BLE methods to nonBleTransportFactory.

If connectionMethods is empty, this returns emptyList().

Return

the created MdocTransport instances, or emptyList() if connectionMethods is empty.

Parameters

connectionMethods

the connection methods to create transports for.

role
options

options for the MdocTransport instances.

centralConfig

retry, scan-restart, and L2CAP parameters used when acting as BLE Central.

centralHalFactory

factory invoked to create a BleCentralHal when acting as BLE Central.

peripheralHalFactory

factory invoked to create a BlePeripheralHal when acting as BLE Peripheral.

nonBleTransportFactory

factory invoked to create a transport for each non-BLE MdocConnectionMethod.

Throws

if any entry in connectionMethods is missing required uuid/psm parameters or is unsupported by nonBleTransportFactory.