Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Quickstart guide #40

Merged
merged 8 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 89 additions & 1 deletion README.md
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,93 @@ This is an Android SDK for the [KUKSA Vehicle Abstraction Layer](https://github.
[![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)

## Overview
Chrylo marked this conversation as resolved.
Show resolved Hide resolved

It allows you to access VSS data from KUKSA databroker using an Android System.
The KUKSA Android SDK allows you to interact with [VSS data](https://covesa.github.io/vehicle_signal_specification/)
from the [KUKSA Databroker](https://github.com/eclipse/kuksa.val/tree/master/kuksa_databroker)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably also better to link here to the main page, instead of the sub page:
https://github.com/eclipse/kuksa.val/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little bit disagreeing here because everyone would just go instantly to the sub link from the main page. Feels more like the right entry point to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the last sentence and linked to GitHub packet

within an Android App. The main functionality consists of fetching, updating and subscribing to VSS data.

## Integration

*build.gradle*
```
implementation("org.eclipse.kuksa:kuksa-sdk:<VERSION>")
```

The latest release version can be seen [here](https://github.com/eclipse-kuksa/kuksa-android-sdk/releases).
Chrylo marked this conversation as resolved.
Show resolved Hide resolved

Snapshot builds are also available (but of course less stable): [Package view](https://github.com/eclipse-kuksa/kuksa-android-sdk/packages/1986280/versions)

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

### GitHub packages

The KUKSA SDK is currently uploaded to [GitHub packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry)
where an [authentication](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages)
is needed to download the dependency.

```
maven {
url = uri("https://maven.pkg.github.com/eclipse-kuksa/kuksa-android-sdk")
credentials {
username = <USERNAME>
password = <GITHUB_TOKEN>
}
}
```

## Usage

> [!NOTE]
> The following snippet expects an **unsecure** setup of the Databroker. See the [quickstart guide](https://github.com/eclipse-kuksa/kuksa-android-sdk/blob/main/docs/QUICKSTART.md)
> for instructions on how to establish a **secure** connection to the Databroker.

```kotlin
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
}
}
```

```kotlin
fun fetch() {
lifecycleScope.launch {
val property = Property("Vehicle.Speed", listOf(Field.FIELD_VALUE))
val response = dataBrokerConnection?.fetch(property) ?: 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](https://github.com/eclipse-kuksa/kuksa-android-sdk/tree/main/docs/QUICKSTART.md) or
[class diagrams](https://github.com/eclipse-kuksa/kuksa-android-sdk/blob/main/docs/kuksa-sdk_class-diagram.puml) for
further insight into the KUKSA SDK API. You can also checkout the [sample](https://github.com/eclipse-kuksa/kuksa-android-sdk/tree/main/samples) implementation.

## Requirements

- A working setup requires at least a running KUKSA [Databroker](https://github.com/eclipse/kuksa.val/tree/master/kuksa_databroker)
- Optional: The [KUKSA Databroker CLI](https://github.com/eclipse/kuksa.val/tree/master/kuksa_databroker) can be used to manually feed data and test your app.
See [this chapter](https://github.com/eclipse/kuksa.val/tree/master/kuksa_databroker#reading-and-writing-vss-data-using-the-cli) on how to read and write data via the CLI.
- Optional: The [Mock Service](https://github.com/eclipse/kuksa.val.services/tree/main/mock_service) can be used to simulate a "real" environment.

## Contribution

Please feel free to create [GitHub issues](https://github.com/eclipse-kuksa/kuksa-android-sdk/issues) and [contribute](https://github.com/eclipse-kuksa/kuksa-android-sdk/blob/main/docs/CONTRIBUTING.md).

## License

The KUKSA Android SDK is provided under the terms of the [Apache Software License 2.0](https://github.com/eclipse-kuksa/kuksa-android-sdk/blob/main/LICENSE).
1 change: 1 addition & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The following types are supported:
{"type": "docs", "section": "Documentation"},
{"type": "perf", "section": "Performance"},
{"type": "refactor", "section": "Refactoring"},
{"type": "revert", "section": "Reverts"},
{"type": "test", "section": "Tests"},
{"type": "chore", "hidden": true},
{"type": "style", "hidden": true},
Expand Down
Loading