ProtocolSessionDriver

class ProtocolSessionDriver(val protocol: SyncEucProtocol, scope: CoroutineScope? = null, logger: Logger = NoOpLogger(), now: () -> Long = { MonotonicClock.millis() }) : EUCProtocol(source)

Coroutine/Flow driver for a pure ProtocolSession, preserving the public EUCProtocol API.

When no scope is given the driver owns one and cancels it in close; a caller-provided scope is never cancelled (only this driver's timer jobs are).

Constructors

Link copied to clipboard
constructor(protocol: SyncEucProtocol, scope: CoroutineScope? = null, logger: Logger = NoOpLogger(), now: () -> Long = { MonotonicClock.millis() })

Properties

Link copied to clipboard

Number of currently armed timers (for diagnostics and tests).

Link copied to clipboard
open override val dataFlow: Flow<EUCData>
Link copied to clipboard
open override val manufacturer: String
Link copied to clipboard
open override val parentProtocolId: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val protocolId: String
Link copied to clipboard
open override val rawFrameFlow: Flow<ByteArray>

Defensive copies of incoming notification chunks.

Link copied to clipboard
open override val securityEventFlow: Flow<WheelSecurityEvent>
Link copied to clipboard

Latest notification-confirmed security state, or null when unsupported/unknown.

Link copied to clipboard
open override val securityStateFlow: Flow<WheelSecurityState>
Link copied to clipboard
Link copied to clipboard
open override val writeFlow: Flow<ByteArray>

Functions

Link copied to clipboard
open override fun canRetryCommand(payload: ByteArray): Boolean
Link copied to clipboard
open override fun canSendCommand(payload: ByteArray): Boolean
Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun commandStateError(commandId: String): String?
Link copied to clipboard
open override fun createCommand(commandType: CommandType, value: CommandValue): ByteArray

Keeps legacy custom implementations working when polling supplies typed values.

open override fun createCommand(commandType: CommandType, value: Any): ByteArray

Legacy extension point. Built-in facades check and convert values at the JVM boundary.

open override fun createCommand(commandId: String, value: CommandValue): ByteArray
Link copied to clipboard
open override fun decode(data: ByteArray): EUCData?
Link copied to clipboard
open override fun encodeCommand(commandId: String, value: CommandValue): CommandEncodingResult
Link copied to clipboard
open override fun getBMSData(): List<BMSData>?
Link copied to clipboard
Link copied to clipboard
open override fun getCommandSupport(commandType: CommandType): CommandSupport
Link copied to clipboard
open override fun getDataCharacteristicUUID(): EucUuid
Link copied to clipboard
Link copied to clipboard
open override fun getPollingPlan(): ProtocolPollingPlan
Link copied to clipboard
open override fun getSecurityState(): WheelSecurityState?
Link copied to clipboard
open override fun getServiceUUID(): EucUuid
Link copied to clipboard
open override fun getWriteCharacteristicUUID(): EucUuid
Link copied to clipboard
open override fun hasSpeedMeasurement(data: EUCData): Boolean
Link copied to clipboard
open override fun isDeviceReady(data: EUCData): Boolean
Link copied to clipboard

Latest measured speed, or null when the protocol cannot identify a speed sample.

Link copied to clipboard
open override fun matchesDeviceName(deviceName: String): Boolean
Link copied to clipboard
open override fun matchesQueryResponse(query: ProtocolQuerySpec, data: ByteArray): Boolean
Link copied to clipboard
open override fun onCommandSubmitted(payload: ByteArray)
Link copied to clipboard
open override fun resetSession()