This is a Java SDK for the KUKSA Vehicle Abstraction Layer.
The KUKSA Java SDK allows you to interact with VSS data from the KUKSA Databroker within a Java Application. The main functionality consists of fetching, updating and subscribing to VSS data.
app/build.gradle.kts
implementation("org.eclipse.kuksa:kuksa-java-sdk:<VERSION>")
The latest release version can be seen here.
See the quickstart guide for additional integration options.
The KUKSA Java SDK is currently uploaded to Maven Central. Snapshot builds are also available (but of course less stable): https://oss.sonatype.org/content/repositories/snapshots/
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.
- 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 KUKSA Mock Provider can be used to simulate a "real" environment.
Please feel free to create GitHub issues and contribute.
The KUKSA Java SDK is provided under the terms of the Apache Software License 2.0.