EucBleClient

class EucBleClient(context: Context, val logger: Logger = AndroidLogger(), coroutineScope: CoroutineScope? = null)(source)

Main public entry point for EUC BLE discovery, connection and telemetry.

Protocol registration is fully managed internally; client applications should not register brand-specific protocols, but may inspect and manually select from the registered protocols using getRegisteredProtocols.

When a caller scope is supplied, this client creates child jobs and cancels only those jobs during cleanup, leaving the supplied scope and unrelated work active.

Constructors

Link copied to clipboard
constructor(context: Context, logger: Logger = AndroidLogger(), coroutineScope: CoroutineScope? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

RX-only view of trafficFlow. Bytes are shared, read-only notification chunks.

Link copied to clipboard

Individual status notifications, including repeats. No replay; see BLEManager.securityEventFlow.

Link copied to clipboard

Latest wheel-confirmed security state. Null when unavailable; collect for client PIN UI.

Link copied to clipboard
val trafficFlow: SharedFlow<TrafficEvent>

Bidirectional BLE capture; see BLEManager.trafficFlow for delivery and buffering semantics.

Functions

Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun authenticate(pin: String)

Submit a four-ASCII-digit KingSong PIN. No persistent storage or reconnect replay.

Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun cancelDiagnosticLog()

Cancels an active diagnostic-log download.

Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun changePassword(oldPassword: String, newPassword: String)
Link copied to clipboard
@RequiresPermission(allOf = ["android.permission.BLUETOOTH_CONNECT", "android.permission.BLUETOOTH_SCAN"])
fun cleanup()
Link copied to clipboard
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun connect(device: EUCDevice)
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun connectExternalDevice(device: BluetoothDevice, advertisedName: String? = null, rssi: Int = 0)

Connect an Android device discovered by the application, without a library scan. Pass the advertised name when available, since it can affect protocol selection. An RSSI of zero means that the signal strength was not supplied.

Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun disconnect()
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun forceProtocol(protocol: EUCProtocol): Boolean
Link copied to clipboard

Returns the latest BMS snapshot of the connected wheel (cell voltages, temperatures, pack voltage/current, charging status), or null when the wheel does not expose BMS data.

Link copied to clipboard

Refresh after protocol identification, model updates or reconnects; not a wheel safety guarantee.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Latest diagnostic-log download snapshot, or null when none was started.

Link copied to clipboard

Returns all registered protocols. Callers can use this list to freely choose a protocol for manual selection via selectProtocol or forceProtocol.

Link copied to clipboard
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun lock()

Explicit request only; confirmation arrives via securityStateFlow.

Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun removePassword(currentPassword: String)
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun requestDiagnosticLog()

Starts downloading the wheel diagnostic log (InMotion P6/V9). Poll getDiagnosticLogTransfer for progress; the verified binary is available via DiagnosticLogTransfer.copyData once the state is COMPLETED. Saving or sharing the file is up to the client application.

Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun requestLockState()
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun selectProtocol(protocol: EUCProtocol): Boolean
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun sendCommand(commandType: CommandType, value: Any = Unit)

@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun sendCommand(commandId: String, value: CommandValue = CommandValue.None)

Validates against the current contract; rejected inputs are reported through ErrorCallback.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun setPassword(newPassword: String)

Explicit KingSong request; observe securityEventFlow for confirmation or timeout.

Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun setProtocolSelectionMode(mode: ProtocolSelectionMode)
Link copied to clipboard
@RequiresApi(value = 23)
@RequiresPermission(value = "android.permission.BLUETOOTH_SCAN")
fun startScan()
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_SCAN")
fun stopScan()
Link copied to clipboard
@RequiresPermission(value = "android.permission.BLUETOOTH_CONNECT")
fun unlock()

Explicit unlock request; verify behavior on the specific wheel and firmware.