NinebotProtocol

Coroutine-compatible facade for the synchronous Ninebot state machine.

Constructors

Link copied to clipboard
constructor(clock: EucClock = SystemEucClock)

Types

Link copied to clipboard
data class ZBmsSnapshot(val bmsIndex: Int, val rawPayloadHex: String, val voltage: Double? = null, val current: Double? = null, val cellVoltages: List<Double>? = null)
Link copied to clipboard
data class ZSettingsSnapshot(val bleVersion: String? = null, val authKeyHex: String? = null, val authKeyAscii: String? = null, val lockState: Int? = null, val limitedModeEnabled: Boolean? = null, val speedLimitKmh: Double? = null, val alarmsArmedMask: Int? = null, val alarm1SpeedKmh: Int? = null, val alarm2SpeedKmh: Int? = null, val alarm3SpeedKmh: Int? = null, val ledMode: Int? = null, val driveFlags: Int? = null, val speakerVolumeStep: Int? = null)

Properties

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
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
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()