Skip to content

eclipse-kuksa/kuksa-android-sdk

Repository files navigation

kuksa-sdk-android

License Gitter

SDK:main <-> Databroker:master

This is an Android SDK for the KUKSA Vehicle Abstraction Layer.

Overview

The KUKSA Android SDK allows you to interact with VSS data from the KUKSA Databroker within an Android App. The main functionality consists of fetching, updating and subscribing to VSS data.

Integration

app/build.gradle.kts

implementation("org.eclipse.kuksa:kuksa-sdk:<VERSION>")

The latest release version can be seen here.

Snapshot builds are also available (but of course less stable): Package view

See the quickstart guide for additional integration options.

Maven Central

The KUKSA SDK is currently uploaded to Maven Central.

Usage

Note

The following snippet expects an unsecure setup of the Databroker. See the quickstart guide for instructions on how to establish a secure connection to the Databroker.

private var dataBrokerConnection: DataBrokerConnection? = null

fun connectInsecure(host: String, port: Int) {
    lifecycleScope.launch {
        val managedChannel = ManagedChannelBuilder.forAddress(host, port)
            .usePlaintext()
            .build()

        val connector = DataBrokerConnector(managedChannel)
        dataBrokerConnection = connector.connect()
        // Connection to the Databroker successfully established
    } catch (e: DataBrokerException) {
        // Connection to the Databroker failed
    }
}
fun fetch() {
    lifecycleScope.launch {
        val request = FetchRequest("Vehicle.Speed", listOf(Field.FIELD_VALUE))
        val response = dataBrokerConnection?.fetch(request) ?: return@launch
        val entry = entriesList.first() // Don't forget to handle empty responses
        val value = entry.value
        val speed = value.float
    }
}

Refer to the quickstart guide or class diagrams for further insight into the KUKSA SDK API. You can also checkout the sample implementation.

Requirements

  • A working setup requires at least a running KUKSA Databroker
  • Optional: The KUKSA Databroker CLI can be used to manually feed data and test your app. See this chapter on how to read and write data via the CLI.
  • Optional: The Mock Service can be used to simulate a "real" environment.

Contribution

Please feel free to create GitHub issues and contribute.

License

The KUKSA Android SDK is provided under the terms of the Apache Software License 2.0.