Skip to content

SoftwareDefinedVehicle/vehicle-app-cpp-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Vehicle App C++ SDK

SDK CI Workflow License: Apache

The Vehicle App SDK for C++ allows to create Vehicle Apps from the Velocitas Development Model in the C++ programming language.

Folder structure

  • 📁 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

Prerequisites

  • Visual Studio Code with the Remote Containers extension
  • Docker installation on the host

Building

Installing dependencies

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

Proxy Issues

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.

Building the SDK

To build the SDK, run the build script:

./build.sh

Starting the runtime

Open the Run Task view in VSCode and select Local Runtime - Up.

Launching the example

With the runtime running in the background, you can run the app.

Without debugging

Open the Run Task view in VSCode and select Local Runtime - Start SeatAdjuster.

With debugging

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!

Run App as Docker container

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

Middleware configuration for the example apps

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

Using MQTT Broker with authentication

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")) {}

Documentation

Quickstart Tutorials

  1. Setup and Explore Development Environment
  2. Develop your own Vehicle Model
  3. Develop your own Vehicle App

Contribution

Packages

 
 
 

Languages

  • C++ 81.7%
  • Shell 9.0%
  • CMake 4.7%
  • Python 4.2%
  • Dockerfile 0.4%