astarte-platform / stream-qt5-test

Simple Qt5 data generator that streams data to Astarte
http://astarte-platform.org/
Apache License 2.0
6 stars 9 forks source link
iot-application mqtt-client qt qt5

Astarte Stream Qt5 Test

Astarte Qt5 SDK based data stream test.

Requirements

Getting started

Choosing a Device ID

A Base64 url-encoded uuid should be used, you can use astartectl to generate one:

astartectl utils device-id generate-random

Configuring the application

Create a configuration directory using the given template (astarte-device-DEVICE_ID_HERE-conf), substituting the previously generated device ID to DEVICE_ID_HERE. Make sure to have your realm's private key at hand. Then customize the following fields:

Build and run

Build the application using following commands:

$ qmake .
$ make

Then run the application with:

./stream-qt5-test --device <your device ID>

Several options are available:

Using the Docker image

Make sure to have astartectl installed and your realm's private key at hand.

Pull the image with:

docker pull astarte/astarte-stream-qt5-test:1.0.4

If you are running the container on a different machine than your Astarte instance, you can invoke the application with:

docker run -e "DEVICE_ID=$(astartectl utils device-id generate-random)" -e "PAIRING_URL=<your pairing url>" -e "REALM=<realm name>" -e "PAIRING_JWT=$(astartectl utils gen-jwt pairing -k <realm private key>)" -e astarte/astarte-stream-qt5-test:1.0.4

Otherwise, to make localhost work, you need to specify an additional docker option:

docker run --net="host" -e "DEVICE_ID=$(astartectl utils device-id generate-random)" -e "PAIRING_URL=http://localhost:4003" -e "REALM=<realm name>" -e "PAIRING_JWT=$(astartectl utils gen-jwt pairing -k <realm private key>)" -e astarte/astarte-stream-qt5-test:1.0.4

Both commands will generate a random datastream from a brand new, random Device ID.

You can have the same Device ID send longer streams of data by saving the container's persistency through a Docker Volume. If you wish to do so, simply add -v /persistency:<your persistency path> to your docker run invocation.

You can refer to the previous section for more details on which variables (function, interface, etc...) can be passed to the container.