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 - π
example_model
- a handwritten example model used by some of the examples. - π
performance-subscribe
- an example application subscribing to signals and printing time and value when updates are received. - π
grpc_client
- an example application implementing a gRPC client, matching the example in Velocitas documentation. - π
grpc_server
- an example application implementing a gRPC server, matching the example in Velocitas documentation.
- π
- π
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 (including examples), 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_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")) {}
- Setup and Explore Development Environment
- Develop your own Vehicle Model
- Develop your own Vehicle App
The SDK is installed into the Velocitas Development environment by the Velocitas Package for DevContainer Setup. To release a new version re-run all GitHub actions manually and verify that they all pass. Then create a new GitHub release and tag the commit used. No need to include any additional artifacts.
After creating the GitHub release, verify that the new release can be used by the Vehicle App C++ Template. Update the conanfile.txt with the new version in the line
vehicle-app-sdk/X.Y.Z
Then verify that the example application in the template can be successfully built. After successful verification, consider creating a Pull Request in the Vehicle App C++ Template repository tp update the SDK version.