EUC BLE Library

BLE library for Electric Unicycles — real-device tested protocols

FR | EN

EUC BLE Library

Bluetooth Low Energy library for Electric Unicycles (EUC) – designed for modern Android applications, with a protocol layer tested against real wheels and a modular BLE backend.

GroupId: io.github.tritbool
ArtifactId: euc-ble-library
Module: euc-ble-core


Why this library?

Most EUC BLE libraries rely on a handful of hand‑crafted frames and a monolithic BLE engine.
This project takes a different approach:


Key features


Architecture at a glance

flowchart LR
    App[Android App / UI] -->|scan, connect, commands| EucBleClient

    subgraph Core BLE
        EucBleClient --> BLEManager
        BLEManager --> BleBackend
        BleBackend --> FrameworkBleBackend
        BleBackend --> LegacyBleBackend
    end

    subgraph Protocols
        BLEManager --> KingsongProtocol
        BLEManager --> GotwayProtocol
        BLEManager --> InMotionProtocol
        BLEManager --> NinebotProtocol
        BLEManager --> NinebotZProtocol
        BLEManager --> LeaperkimProtocol
        BLEManager --> NosfetProtocol
    end

    Protocols -->|decoded frames| EUCData[(EUCData)]
    EUCData --> App

Asynchrony & data flows

Example usage on the app side:

val client = EucBleClient(context)

client.setConnectionCallback(object : ConnectionCallback() {
    override fun onDeviceDiscovered(device: EUCDevice) {
        client.connect(device)
    }
})

client.setDataCallback(object : DataCallback {
    override fun onDataReceived(data: EUCData) {
        // process telemetry on an appropriate dispatcher
    }
})

client.setErrorCallback(object : ErrorCallback {
    override fun onError(error: BLEException) {
        // fine-grained error handling
    }
})

client.initialize()
client.startScan()

Test coverage & quality

Code coverage

HTML coverage reports are published under:

(See the “Test coverage reports” section below.)

Test methodology

Protocols are tested against real BLE captures:

Additionally:


Test coverage reports

To make coverage visible:


Using it in an app

Maven Central dependency

dependencies {
    implementation("io.github.tritbool:euc-ble-library:0.0.1")
}

Android BLE permissions

Android BLE requires:

The library exposes structured errors via BLEException and ErrorCallback to handle these cases.


API documentation

The Dokka reference is automatically regenerated on every push to main and published under /api/ via GitHub Actions.


Roadmap


Contributing

Issues, PRs, and additional WheelLog captures (new wheels, new firmwares, tricky edge cases) are all welcome.
Repository: https://github.com/Tritbool/euc_ble_library.