HwTransportProvider

Transport-agnostic provider for hardware device discovery and connection.

Each transport type (BLE, USB, etc.) implements this interface to handle its own scanning, connection, and disconnection semantics.

  • BLE: Active scanning via Kable, connect by advertisement/device ID

  • USB: Device enumeration via platform APIs, connect by vendor/product ID

Properties

Link copied to clipboard
abstract val connectionState: StateFlow<ConnectionState>

Observable connection state.

Link copied to clipboard

Functions

Link copied to clipboard
abstract suspend fun connect(deviceId: String): HwTransport

Connect to a specific device by ID (e.g. from QR code or previous scan).

Link copied to clipboard
abstract suspend fun disconnect()

Disconnect from the currently connected device.

Link copied to clipboard
abstract fun scan(): Flow<DeviceInfo>

Continuous stream of discovered devices. Cancel the Flow collection to stop scanning.