Development of this project has moved to the Eclipse hara-ddiclient GitHub repository and this repository is now read-only.
Hara-ddiclient is a Kotlin library that facilitates and speeds up the development of DDI API clients for devices connecting to hawkBit servers. It can be used from any JVM compatible language (Java, Kotlin, etc). Hara-ddiclient is part of the Eclipse Hara™ project
The hara-ddiclient project provides several software modules:
ddiapi-client
: implementation of a REST client for hawkBit DDI APIcore
: implementation of communication logic using actors (usesddiapi-client
)virtual-device
: a simple application using the hara-ddiclient library (usescore
). Its purpose is to provide a configurable "virtual device" and a reference example on how to use the library. Some features, like the Updater, are not implemented in the virtual device and are just mocked.
To import this project use jitpack plugin.
To build this project from source:
./gradlew assemble
to build this project and run the tests (docker 17.09.0+
and docker-compose 1.27.0+
required):
./gradlew build
to build the hara-virtual-device
docker image:
./gradlew buildImage
to connect the virtual devices to the hawkBit sandbox:
docker run -e HAWKBIT_GATEWAY_TOKEN=<gatewaytokenvalue> -e HAWKBIT_CONTROLLER_ID=<mycontrollerid> hara-virtual-device:<virtual-device-version>
for example:
docker run -e HAWKBIT_GATEWAY_TOKEN=50f600c6e7e517b98b008311b0a325eb -e HAWKBIT_CONTROLLER_ID=mydevice hara-virtual-device:1.0.0
Make sure the authentication method provided in the parameters is enabled in the "System Config" page. Available virtual device parameters can be found in the Configuration class.
Create a class that implements the DirectoryForArtifactsProvider interface:
class DirectoryForArtifactsProviderImpl(): DirectoryForArtifactsProvider {
override fun directoryForArtifacts(): File {
...
}
}
Create a class that implements the ConfigDataProvider interface:
class ConfigDataProviderImpl(): ConfigDataProvider {
override fun configData(): Map<String, String> {
...
}
}
Create a class that implements the DeploymentPermitProvider interface:
class DeploymentPermitProviderImpl: DeploymentPermitProvider {
override fun downloadAllowed(): Deferred<Boolean> {
...
}
override fun updateAllowed(): Deferred<Boolean> {
...
}
}
Create a class that implements the MessageListener interface:
class MessageListenerImpl(): MessageListener {
override fun onMessage(message: MessageListener.Message) {
...
}
}
Create a class that implements the Updater interface:
class UpdaterImpl(): Updater {
override fun apply(modules: Set<Updater.SwModuleWithPath>,messenger: Updater.Messenger){
...
}
Create the Client, add the provider and return the client:
val client = HaraClientDefaultImpl()
client.init(
clientData,
DirectoryForArtifactsProviderImpl(),
ConfigDataProviderImpl(),
DeploymentPermitProviderImpl(),
listOf(MessageListenerImpl()),
listOf(UpdaterImpl())
)
return client
To contribute to this project please open a GitHub pull request.
- Having questions about hara-ddiclient? Subscribe to the hara-dev mailing list and post a question!
- Having issues with hara-ddiclient? Please open a GitHub issue.
For information on the libraries used by this project see NOTICE.
- Daniele Sergio - Initial work - danielesergio.
See also the list of contributors who participated in this project.
Copyright © 2017-2021, Kynetics LLC.
Released under the EPLv2 License.