The Vehicle App SDK for C++ allows to create Vehicle Apps
from the Velocitas Development Model in the C++ programming language.
- 📁
examples
- example vehicle apps showcasing the use of the SDK- 📁
seat-adjuster
- an example application showing how to adjust the driver seat when receiving MQTT messages - 📁
set-data-points
- an example application showing how to set single and multiple data points - 📁
vehicle_model
- a handwritten example model to be used by all examples
- 📁
- 📁
sdk
- 📁
include
- the headers which need to be included by users of the SDK - 📁
src
- contains the source code for the SDK from which the SDK library is built - 📁
test
- contains the unit test code for the SDK
- 📁
- Visual Studio Code with the Remote Containers extension
- Docker installation on the host
Before a build can be started, all dependencies required by the SDK need to be installed. Issue the following command in the SDK root directory:
./install_dependencies.sh
If you are working behind a corporate proxy, the install_dependcies.sh
(which is also called during devcontainer build!) might probably fail
downloading 3rd party packages via https with a TLS/SSL certificate validation error (we actually saw this issue in the build of gRPC trying to
download the opencensus-proto package from storage.googleapis.com).
Please have a look at our "working behind proxy" tutorial to get hints how to possibly overcome this.
To build the SDK, run the build script:
./build.sh
Open the Run Task
view in VSCode and select Local Runtime - Up
.
With the runtime running in the background, you can run the app.
Open the Run Task
view in VSCode and select Local Runtime - Start SeatAdjuster
.
You can simply launch the example in the Debugging Tab. Make sure the Example - <example of your choice>
is selected at the top. After the selection is done, you can also simply hit F5
, to start the debugging session.
Note: This launch task will also make sure to re-build the app if it has been modified!
docker run --rm -it --net="host" -e SDV_MIDDLEWARE_TYPE="native" -e SDV_MQTT_ADDRESS="localhost:1883" -e SDV_VEHICLEDATABROKER_ADDRESS="localhost:55555" localhost:12345/vehicleapp:local
You can configure the middleware to be used (currently only native
is supported) via environment variables of the app processs.
Middleware | Environment Variable | Default | Meaning |
---|---|---|---|
SDV_MIDDLEWARE_TYPE |
native |
Defines the middleware to be used by the app (currently only native is supported) |
|
| native | SDV_MQTT_ADDRESS
| localhost:1883
| Address of the MQTT broker
| | SDV_SEATSERVICE_ADDRESS
| - | Address of the seat service
| | SDV_VEHICLEDATABROKER_ADDRESS
| localhost:55555
| Address of the Kuksa (Vehicle) Data Broker
If you have configured a MQTT Broker which requires authentication, you can also configure your app to properly connect to the broker. Currently the SDK supports authentication via credentials (username and password), tokens (depends on the broker) and certificates. In order to enable this feature you need to use the native middleware (set SDV_MIDDLEWARE_TYPE
to native
). To configure the authentication, you have to provide the details directly in the constructor of the app, see the example for username and password below:
SampleApp::SampleApp()
: VehicleApp(velocitas::IVehicleDataBrokerClient::createInstance("vehicledatabroker"),
velocitas::IPubSubClient::createInstance("localhost:1883", "SampleApp",
"username", "password")) {}