Skip to content

eclipse-kuksa/kuksa-java-sdk

Repository files navigation

kuksa-java-sdk

License Gitter

SDK:main <-> Databroker:master

This is a Java SDK for the KUKSA Vehicle Abstraction Layer.

Overview

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.

Integration

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.

Maven Central

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/

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.

Requirements

Contribution

Please feel free to create GitHub issues and contribute.

License

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

About

The Java SDK for Eclipse KUKSA

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •