Skip to content

Commit

Permalink
Merge pull request #8 from boschglobal/add-kuksa-val-v2-protocol
Browse files Browse the repository at this point in the history
Add kuksa val v2 protocol
  • Loading branch information
wba2hi authored Jan 15, 2025
2 parents ca4cb83 + e4ea538 commit eb3e4a0
Show file tree
Hide file tree
Showing 57 changed files with 2,579 additions and 164 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: SDK:main <-> Databroker:master
name: SDK:main <-> Databroker:main

on:
schedule:
Expand All @@ -20,5 +20,5 @@ jobs:
uses: ./.github/actions/run-tests
with:
upload-test-reports: true
databroker-version: master
databroker-version: main
kotest-tag: "Integration"
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
[![Gitter](https://img.shields.io/gitter/room/kuksa-val/community)](https://gitter.im/kuksa-val/community)

[![SDK:main <-> Databroker:master](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main-master.yaml/badge.svg)](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main-master.yaml?query=branch%3Amain)
[![SDK:main <-> Databroker:main](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main.yaml/badge.svg)](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main.yaml?query=branch%3Amain)

This is a Java SDK for the [KUKSA Vehicle Abstraction Layer](https://github.com/eclipse-kuksa/kuksa-databroker).

Expand All @@ -13,6 +13,41 @@ The KUKSA Java SDK allows you to interact with [VSS data](https://covesa.github.
from the [KUKSA Databroker](https://github.com/eclipse-kuksa/kuksa-databroker/tree/main/)
within a Java Application. The main functionality consists of fetching, updating and subscribing to VSS data.

Currently the following protocols are supported:
- kuksa.val.v1
- kuksa.val.v2

## kuksa.val.v1

You can interact with the Databroker using the kuksa.val.v1 interface by using the
org.eclipse.kuksa.connectivity.databroker.v1.DataBrokerConnector class.

After successfully connecting the following methods are supported by org.eclipse.kuksa.connectivity.databroker.v1.DataBrokerConnection:
- subscribe(SubscribeRequest, VssPathListener)
- unsubscribe(SubscribeRequest, VssPathListener)
- subscribe(VssNodeSubscribeRequest<T>, VssNodeListener<T>)
- unsubscribe(VssNodeSubscribeRequest<T>, VssNodeListener<T>)
- fetch(FetchRequest): GetResponse
- fetch(VssNodeFetchRequest<T>): T
- update(UpdateRequest): SetResponse
- update(VssNodeUpdateRequest<T>): VssNodeUpdateResponse

## kuksa.val.v2

You can interact with the Databroker using the kuksa.val.v1 interface by using the
org.eclipse.kuksa.connectivity.databroker.v2.DataBrokerConnectorV2 class.

After successfully connecting the following methods are supported by org.eclipse.kuksa.connectivity.databroker.v2.DataBrokerConnectionV2:
- fetchValue(FetchValueRequestV2): GetValueResponse
- fetchValues(FetchValuesRequestV2): GetValuesResponse
- subscribeById(SubscribeByIdRequestV2): Flow<SubscribeByIdResponse>
- subscribe(SubscribeRequestV2): Flow<SubscribeResponse>
- actuate(ActuateRequestV2): ActuateResponse
- batchActuate(BatchActuateRequestV2): BatchActuateResponse
- listMetadata(ListMetadataRequestV2): ListMetadataResponse
- publishValue(PublishValueRequestV2): PublishValueResponse
- openProviderStream(StreamObserver<OpenProviderStreamResponse>): StreamObserver<OpenProviderStreamRequest>

## Integration

*app/build.gradle.kts*
Expand All @@ -23,8 +58,7 @@ implementation("org.eclipse.kuksa:kuksa-java-sdk:<VERSION>")
The latest release version can be seen [here](https://github.com/eclipse-kuksa/kuksa-java-sdk/releases).


See the [quickstart guide](https://github.com/eclipse-kuksa/kuksa-java-sdk/tree/main/docs/QUICKSTART.md) for
additional integration options.
See the [quickstart guide](https://github.com/eclipse-kuksa/kuksa-java-sdk/tree/main/docs/QUICKSTART.md) for additional integration options.

### Maven Central

Expand Down
5 changes: 5 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ kotlin = "1.9.22"
tomcatAnnotations = "6.0.53"
ktlint = "0.0" # Maintained inside ktlint.gradle.kts
grpc = "1.65.1"
grpcKotlin = "1.4.1"
protobufGradlePlugin = "0.9.4"
protobuf = "3.25.3"
kotest = "5.7.2"
Expand All @@ -20,6 +21,10 @@ docker-java-transport-httpclient5 = { module = "com.github.docker-java:docker-ja
grpc-okhttp = { group = "io.grpc", name = "grpc-okhttp", version.ref = "grpc" }
grpc-protobuf = { group = "io.grpc", name = "grpc-protobuf-lite", version.ref = "grpc" }
grpc-stub = { group = "io.grpc", name = "grpc-stub", version.ref = "grpc" }
grpc-kotlin-stub = { group = "io.grpc", name = "grpc-kotlin-stub", version.ref = "grpcKotlin" }
protoc-gen-grpc-kotlin = { group = "io.grpc", name = "protoc-gen-grpc-kotlin", version.ref = "grpcKotlin" }
protobuf-kotlin-lite = { group = "com.google.protobuf", name = "protobuf-kotlin-lite", version.ref = "protobuf" }

tomcat-annotations = { group = "org.apache.tomcat", name = "annotations-api", version.ref = "tomcatAnnotations" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
Expand Down
36 changes: 23 additions & 13 deletions kuksa-java-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,6 @@

@file:Suppress("UnstableApiUsage")

import com.google.protobuf.gradle.id
import org.eclipse.kuksa.version.SemanticVersion
import org.eclipse.kuksa.version.VERSION_FILE_DEFAULT_PATH_KEY
import org.jetbrains.dokka.gradle.DokkaTask
Expand Down Expand Up @@ -95,11 +94,13 @@ dependencies {

// needs to be api as long as we expose ProtoBuf specific objects
api(libs.grpc.protobuf)
api(libs.protobuf.kotlin.lite)

implementation(kotlin("reflect"))

implementation(libs.grpc.okhttp)
implementation(libs.grpc.stub)
implementation(libs.grpc.kotlin.stub)
implementation(libs.tomcat.annotations)
implementation(libs.kotlinx.coroutines.core)

Expand All @@ -116,20 +117,29 @@ protobuf {
artifact = libs.protobuf.protoc.get().toString()
}
plugins {
id("grpc") {
create("grpc") {
artifact = libs.grpc.protoc.java.gen.get().toString()
}
generateProtoTasks {
all().forEach {
it.builtins {
named("java") {
option("lite")
}
create("grpckt") {
artifact = libs.protoc.gen.grpc.kotlin.get().toString() + ":jdk8@jar"
}
}
generateProtoTasks {
all().forEach {
it.builtins {
named("java") {
option("lite")
}
create("kotlin") {
option("lite")
}
}
it.plugins {
create("grpc") {
option("lite")
}
it.plugins {
create("grpc") {
option("lite")
}
create("grpckt") {
option("lite")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,10 @@
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.kuksa.connectivity.databroker.listener
package org.eclipse.kuksa.connectivity.databroker

import org.eclipse.kuksa.pattern.listener.Listener

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,27 +14,29 @@
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.kuksa.connectivity.databroker
package org.eclipse.kuksa.connectivity.databroker.v1

import io.grpc.ConnectivityState
import io.grpc.ManagedChannel
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.eclipse.kuksa.connectivity.authentication.JsonWebToken
import org.eclipse.kuksa.connectivity.databroker.listener.DisconnectListener
import org.eclipse.kuksa.connectivity.databroker.listener.VssNodeListener
import org.eclipse.kuksa.connectivity.databroker.listener.VssPathListener
import org.eclipse.kuksa.connectivity.databroker.request.FetchRequest
import org.eclipse.kuksa.connectivity.databroker.request.SubscribeRequest
import org.eclipse.kuksa.connectivity.databroker.request.UpdateRequest
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeFetchRequest
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeSubscribeRequest
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeUpdateRequest
import org.eclipse.kuksa.connectivity.databroker.response.VssNodeUpdateResponse
import org.eclipse.kuksa.connectivity.databroker.subscription.DataBrokerSubscriber
import org.eclipse.kuksa.connectivity.databroker.DataBrokerException
import org.eclipse.kuksa.connectivity.databroker.DisconnectListener
import org.eclipse.kuksa.connectivity.databroker.v1.listener.VssNodeListener
import org.eclipse.kuksa.connectivity.databroker.v1.listener.VssPathListener
import org.eclipse.kuksa.connectivity.databroker.v1.request.FetchRequest
import org.eclipse.kuksa.connectivity.databroker.v1.request.SubscribeRequest
import org.eclipse.kuksa.connectivity.databroker.v1.request.UpdateRequest
import org.eclipse.kuksa.connectivity.databroker.v1.request.VssNodeFetchRequest
import org.eclipse.kuksa.connectivity.databroker.v1.request.VssNodeSubscribeRequest
import org.eclipse.kuksa.connectivity.databroker.v1.request.VssNodeUpdateRequest
import org.eclipse.kuksa.connectivity.databroker.v1.response.VssNodeUpdateResponse
import org.eclipse.kuksa.connectivity.databroker.v1.subscription.DataBrokerSubscriber
import org.eclipse.kuksa.extension.TAG
import org.eclipse.kuksa.extension.datapoint
import org.eclipse.kuksa.extension.vss.copy
Expand All @@ -59,7 +61,6 @@ class DataBrokerConnection internal constructor(
private val dispatcher: CoroutineDispatcher = Dispatchers.Default,
private val dataBrokerTransporter: DataBrokerTransporter = DataBrokerTransporter(
managedChannel,
dispatcher,
),
private val dataBrokerSubscriber: DataBrokerSubscriber = DataBrokerSubscriber(dataBrokerTransporter),
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,10 @@
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.kuksa.connectivity.databroker
package org.eclipse.kuksa.connectivity.databroker.v1

import io.grpc.ConnectivityState
import io.grpc.ManagedChannel
Expand All @@ -25,6 +26,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
import org.eclipse.kuksa.connectivity.authentication.JsonWebToken
import org.eclipse.kuksa.connectivity.databroker.DataBrokerException
import org.eclipse.kuksa.extension.TAG
import org.eclipse.kuksa.model.TimeoutConfig
import java.util.logging.Logger
Expand Down
Loading

0 comments on commit eb3e4a0

Please sign in to comment.