Building SOME/IP application using CommonAPI C++ SOME/IP
CommonAPI C++ SOMEIP is a suite of toolchain and library that provides convenient way to perform SOME-IP using vsomeip.
In other words, CommonAPI wraps vsomeip.
Overall
CommonAPI C++ is a C++ framework for inter-process and network communication. It defines a high-level C++ API, which can be used for different IPC mechanisms. CommonAPI C++ SOMEIP, as the name implies, has 2 part:
- CommonAPI C++
- SOMEIP IPC stack (the implementation of the basic communication and the service discovery by vsomeip)
Client and Server communicate via the Interface that the Server provides and the Client requires. Interface is defined in Franca IDL and include methods, attributes and broadcasts.
Implementation workflow
- Interface definition
This step is usually managed by the architect with an overview of the global system and the functional flow between services and clients. Architect describes service interface by a Interface definition language, specifically Franca IDL.
- Implementation
From Franca file, Code-generator-tools generate code for the services, called skeleton, and generate code for clients, call proxy. Then, developers can focus on implementing the business logic at both client and server sides
- Network deployment
Configure the connection of service and client. It must be ensure that addresses (serviceId, instanceId, methodId…) are consistent over the network
Let’s start!
We will implement two simple console applications. One will act as the server, providing certain functions, while the other will act as the client, calling the server’s functions. These two applications will communicate via SOMEIP. Naturally, we will implement this using CommonAPI C++ SOMEIP.
Prerequisites
-
gcc >= 5.2
check version: gcc –version
install: https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/ -
boost.asio >= 1.55
in this tutorial, we use vsomeip 2.10.0 then boost.asio version must < 1.66 as well.
vsomeip does not support boost.aio >= 1.66 before vsomeip 3.0.
check version: dpkg -s libboost-dev | grep ‘Version’
install boost.asio 1.56.0:sudo apt-get update sudo apt-get install build-essential g++ python3-dev autotools-dev libicu-dev libbz2-dev wget https://sourceforge.net/projects/boost/files/boost/1.56.0/boost_1_56_0.tar.gz/download -O boost_1_56_0.tar.gz tar -xvzf boost_1_56_0.tar.gz cd boost_1_56_0 ./bootstrap.sh sudo ./b2 install
-
CMake systembuild
check version: cmake –version
install: sudo apt-get -y install cmake -
git
Please make sure that you use code generators and runtime libraries with the same version.
this tutorial uses:
- capicxx-core-runtime 3.1.12,
- capicxx-someip-runtime 3.1.12,
- vsomeip 2.10.0,
- capicxx-core-tool 3.1.12,
- capicxx-someip-tool 3.1.12
Build libraries
- Build CommonAPI core runtime
git clone https://github.com/COVESA/capicxx-core-runtime.git
cd capicxx-core-runtime
git checkout 99ebf3461f51e4899f06457d6aafdaa4adecd278
mkdir build
cd build
cmake ..
make
sudo make install
after buiding, you should get log similar this:
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Project name: libcommonapi
-- This is CMake for Common API C++ Version 3.1.12.
-- CMAKE_INSTALL_PREFIX set to: /usr/local
-- BUILD_SHARED_LIBS is set to value: ON
-- MAX_LOG_LEVEL is set to value: DEBUG
-- Setting build type to 'RelWithDebInfo' as none was specified.
-- USE_FILE is set to value: OFF
-- USE_CONSOLE is set to value: OFF
-- RPM packet version set to r0
-- Build type: RelWithDebInfo
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Doxygen is not installed. Documentation can not be built.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntoan/someip/capicxx-core-runtime/build
- Build vsomeip libary:
( Previous step, I cloned commonAPI source code into /home/ubuntoan/someip and built it. Now i would like clone vsomeip source code into /home/ubuntoan/someip as well. You can clone sources to your different favorite directories but dont forget make install
to install compiled libraries to standard directories )
git clone https://github.com/COVESA/vsomeip.git
cd vsomeip
git checkout 79fd5f7a34ed33392f71fa914a60b2e68b28de68
mkdir build
cd build
cmake -DENABLE_SIGNAL_HANDLING=1 ..
make
sudo make install
- Build CommonAPI SOMEIP runtime
git clone https://github.com/COVESA/capicxx-someip-runtime.git
….updating 😁…