/test-someip-service

Primary LanguageC++Mozilla Public License 2.0MPL-2.0

Introduction

The SOME/IP server provides mocked data for testing and validating the Playground API.

This server can be used to test the C++ GraphQL VSS Data Server.

TODO: update the C++ GraphQL VSS Data Server URL to COVESA's repository once it is available.

Playground API

The Playground API is composed of a subset of the VSS tree:

Vehicle
├── Cabin
│   ├── Door
│   └── Seat
├── CurrentLocation
└── Powertrain
    ├── CombustionEngine
    │   └── Engine
    ├── FuelSystem
    └── Transmission

Mocked data are supplyed for the following attributes:

  • consumption: Current comsuption of fuel
  • capacity: Capacity of fuel in the tank
  • volume: Volume of fuel in the tank
  • engineSpeed: Engine rotational speed (in revolutions per minute)
  • currentGear: Current gear of vehicle
  • isReverseGearOn: Status of the reverse gear (true indicates that the gear is enabled)
  • drivePowerTransmission: location of the power tranmission drive
  • doorsOpeningStatus: Opening status for doors in the vehicle
  • seatHeatingStatus: Status of the seat heating (true indicates that the seat heating is enabled)
  • seatHeatingLevel: Level of the seat heating

Getting Started

For this project, you need the following dependencies:

You can install these dependencies manually, but an installation script for them is provided on the COVESA's repository containing the GraphQL VSS Server example implementation.

It is good practice to install CommonAPI-SomeIP, VSomeIP and CommonAPI Core Runtime on a user space directory (somewhere under /home/your_user).

C++ Franca Interfaces

The CommonAPI wrappers are generated by the CommonAPI generator and CommonAPI-SomeIP generator.

We provide already-generated headers and sources of the CommonAPI Franca C++ interfaces under the directory commonapi-wrappers. You must compile it.

The PREFIX_PATH must be set if some dependency is installed outside the default directories (/usr and /usr/local). If you used the installation script provided on GraphQL VSS Server repository, this will be the path that you specified in the --install-prefix option. If you specified, for example, ~/usr:

PREFIX_PATH=$HOME/usr
cd commonapi-wrappers
CMAKE_PREFIX_PATH=$PREFIX_PATH ./gen_wrappers.sh
cd ..

Build

To build the server, please follow the steps:

Set PREFIX_PATH to the path where you installed the dependencies, for example:

PREFIX_PATH=$HOME/usr

Create a build directory and change into the newly created directory:

mkdir build && cd build

Configure the project:

cmake -G Ninja \
  -DCMAKE_PREFIX_PATH="$PREFIX_PATH" \
  -DCMAKE_CXX_COMPILER=$(which clang++) \
  -DCMAKE_STATIC_LINKER_FLAGS="" \
  -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld -L/usr/local/lib -L$PREFIX_PATH/lib" \
  -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld -L/usr/local/lib" ..

Then, execute the building:

cmake --build .
cd ..

If you have chosen to generate the CommonAPI wrappers by yourself, please add the path for it to CMAKE_PREFIX_PATH.

Run

First, export the LD_LIBRARY_PATH with the path to directory containing the libraries of the dependencies that you installed outside your /usr. It will be the $PREFIX_PATH/lib with the same PREFIX_PATH (or CMAKE_PREFI_PATH) that you used in the build.

Again, if the dependencies are installed in ~/usr, export as:

export LD_LIBRARY_PATH=~/usr/lib

To run the SOME/IP server, you can execute:

VSOMEIP_CONFIGURATION=vsomeip.json VSOMEIP_APPLICATION_NAME=playground-service ./build/PlaygroundService

You should start to see messages telling that it is ready for calls:

Waiting for calls... (Abort with CTRL+C)
Waiting for calls... (Abort with CTRL+C)
Waiting for calls... (Abort with CTRL+C)

Along with the SOME/IP server, an example client PlaygroundClient was built.

You can use it to validate the SOME/IP server and ensure it is running properly:

VSOMEIP_CONFIGURATION=vsomeip.json VSOMEIP_APPLICATION_NAME=graphql ./build/PlaygroundClient

Now the SOME/IP server PlaygroundService is up and will provide mocked data for the Playground Client.


Note:

  • The VSOMEIP_CONFIGURATION contains the path to a .json that configures the addresses used by SOME/IP;
  • The VSOMEIP_APPLICATION_NAME is the name of the server or client application, specified at the vsomeip.json. The name graphql for the client is used just because this project was created to serve a SOME/IP mocked server to the GraphQL VSS Server project. However, in the scope of this project, this name could be arbitrary.


Note:

  • If you see the message Could not load modules, you forgot to export the LD_LIBRARY_PATH with the correct path to libvsomeip directory. When doing:
ls "$LD_LIBRARY_PATH"

The libraries libvsomeip, libCommonAPI and libCommonAPI-SomeIP should be listed.


References

CommonAPI User Guide

CommonAPI C++ Tutorial

VSomeIP User Guide