### Start vsomeip Application with Custom Configuration Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipConfiguration.md This example demonstrates how to start a vsomeip application using environment variables to specify the application name and a custom configuration file. The application 'my_vsomeip_application' will use 'my_vsomeip_client' as its name and load settings from 'my_settings.json'. ```bash #!/bin/bash export VSOMEIP_APPLICATION_NAME=my_vsomeip_client export VSOMEIP_CONFIGURATION=my_settings.json ./my_vsomeip_application ``` -------------------------------- ### Compile vSomeIP Examples Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipUserGuide.md Build only the example applications included with vSomeIP. ```bash mkdir build cd build cmake .. make examples ``` -------------------------------- ### Start Client and Service Separately (Local and External Debug) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the external service and then launch the local client with specific environment variables and configuration. The external client is started subsequently. ```bash ./external_local_payload_test_service_client_external_start.sh & VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local \ VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json \ ./payload_test_client --dont-shutdown-service ./external_local_payload_test_client_external_start.sh ``` -------------------------------- ### Build vsomeip Hello World Example Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipUserGuide.md Build the vsomeip 'Hello World' example. Requires the vsomeip stack to be compiled beforehand. ```bash cd examples/hello_world mkdir build cd build cmake .. make ``` -------------------------------- ### Create Client Example File Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes This command creates an empty C++ source file for the client example. It's a preparatory step before writing the client code. ```bash <.>/vsomeip/test_example$ touch src/client-example.cpp ``` -------------------------------- ### vsomeip Application Output Log Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes Example console output when a basic vsomeip application starts successfully. It shows configuration loading, initialization, and service discovery status. ```bash 2024-01-16 16:35:38.310950 [info] Parsed vsomeip configuration in 1ms 2024-01-16 16:35:38.313639 [info] Configuration module loaded. 2024-01-16 16:35:38.313921 [info] Security disabled! 2024-01-16 16:35:38.314064 [info] Initializing vsomeip (3.4.10) application "World". 2024-01-16 16:35:38.315726 [info] Instantiating routing manager [Host]. 2024-01-16 16:35:38.319997 [info] create_routing_root: Routing root @ /tmp/vsomeip-0 2024-01-16 16:35:38.323864 [info] Service Discovery enabled. Trying to load module. 2024-01-16 16:35:38.334089 [info] Service Discovery module loaded. 2024-01-16 16:35:38.335544 [info] vsomeip tracing not enabled. . vsomeip service discovery tracing not enabled. 2024-01-16 16:35:38.336018 [info] Application(World, 1000) is initialized (11, 100). 2024-01-16 16:35:38.336712 [info] Starting vsomeip application "World" (1000) using 2 threads I/O nice 255 2024-01-16 16:35:38.341008 [info] Client [1000] routes unicast:127.0.0.1, netmask:255.255.255.0 2024-01-16 16:35:38.340104 [info] main dispatch thread id from application: 1000 (World) is: 7fb1d8abe640 TID: 171384 2024-01-16 16:35:38.341250 [info] shutdown thread id from application: 1000 (World) is: 7fb1d82bd640 TID: 171385 2024-01-16 16:35:38.346586 [info] Watchdog is disabled! 2024-01-16 16:35:38.348838 [info] io thread id from application: 1000 (World) is: 7fb1daedf7c0 TID: 171380 2024-01-16 16:35:38.348959 [info] io thread id from application: 1000 (World) is: 7fb1d72bb640 TID: 171387 2024-01-16 16:35:38.353054 [info] vSomeIP 3.4.10 | (default) 2024-01-16 16:35:38.354570 [info] Network interface "lo" state changed: up 2024-01-16 16:35:48.354653 [info] vSomeIP 3.4.10 | (default) ``` -------------------------------- ### Start Local Offer Test Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the local offer test executable from the test subfolder within the build directory. ```bash ./offer_test_local_starter ``` -------------------------------- ### Start Local Routing Test Service and Client Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the local routing test by running the service and client with a single starter script. Alternatively, start them separately for debugging. ```bash ./local_routing_test_starter.sh ``` ```bash ./local_routing_test_service_start.sh & ./local_routing_test_client_start.sh ``` -------------------------------- ### Minimal Fake Socket Setup and Test Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/fake_socket_tests/README.md Sets up two simulated ECUs ('ecu_one' and 'ecu_two') communicating over a fake boardnet and local transport. This snippet demonstrates how to configure and start these ECUs, offer a service from one ECU, and have a client in another ECU discover and subscribe to it. ```cpp struct my_test : public base_fake_socket_fixture { void SetUp() override { // "boardnet_client" has no fixed client ID — vsomeip assigns one dynamically ecu_one_.add_app("boardnet_client"); // "ecu_two_server" is a guest that connects to ecu_two's router over local TCP ecu_two_.add_guest({"ecu_two_server", std::nullopt}); // writes $VSOMEIP_BASE_PATH/ecu_one.json, // sets VSOMEIP_CONFIGURATION_{router_one,boardnet_client} ecu_one_.prepare(); // writes $VSOMEIP_BASE_PATH/ecu_two.json + $VSOMEIP_BASE_PATH/ecu_two_guest.json, // sets VSOMEIP_CONFIGURATION_{router_two,ecu_two_server} ecu_two_.prepare(); // starts router first (awaits connectable), then all remaining apps ecu_one_.start_apps(); ecu_two_.start_apps(); } // No TearDown needed — ecu_setup destructor stops apps and cleans up env vars // and temp config files automatically. ecu_setup ecu_one_{"ecu_one", boardnet::ecu_one_config, *socket_manager_}; ecu_setup ecu_two_{"ecu_two", boardnet::ecu_two_config, *socket_manager_}; }; TEST_F(my_test, client_discovers_guest_offered_service) { // ecu_two offers the service on the boardnet auto* server = ecu_two_.apps_["ecu_two_server"]; server->offer(interfaces::boardnet::service_3344); // ecu_one's dynamic client subscribes to it auto* client = ecu_one_.apps_["boardnet_client"]; client->subscribe(interfaces::boardnet::service_3344); EXPECT_TRUE(client->availability_record_.wait_for_last( service_availability::available(interfaces::boardnet::service_3344.instance_))); } ``` -------------------------------- ### Install Doxygen and Graphviz (Linux) Source: https://github.com/covesa/vsomeip/blob/master/README.md Install necessary tools for building vSomeIP documentation on Debian-based Linux systems. ```bash sudo apt-get install doxygen graphviz ``` -------------------------------- ### Install vsomeip_ctrl Executable Source: https://github.com/covesa/vsomeip/blob/master/tools/vsomeip_ctrl/CMakeLists.txt Installs the vsomeip_ctrl executable to the runtime destination directory. ```cmake install ( TARGETS vsomeip_ctrl RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin OPTIONAL ) ``` -------------------------------- ### Run Application Test (Manual) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the application tests by executing a starter script from the 'test' subfolder within the build directory. ```bash ./application_test_starter.sh ``` -------------------------------- ### Start Client and Service Together (Local) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Use this script to simultaneously start both the client and service for local testing. This is the primary method for running integrated tests. ```bash ./external_local_payload_test_client_local_starter.sh ``` -------------------------------- ### Start Client and Service Separately (External Debug) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the external service and client separately for debugging. This approach allows for granular control over the startup process. ```bash ./external_local_payload_test_service_client_external_start.sh ./external_local_payload_test_client_external_start.sh ``` -------------------------------- ### vsomeip Application Configuration Example Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipConfiguration.md Example configuration for applications, specifying details like name, ID, threads, logging intervals, and plugins. ```json "applications" : [ { "name" : "service-sample", "id" : "0x1277", "threads" : "4", "io_thread_nice" : "-5", "status_log_interval": "1000", "version_log_interval": "5000", "plugins" : [ { "application_plugin" : "vsomeip-hello-plugin", "application_plugin" : "vsomeip-world-plugin", } ] }, { "name" : "client-sample", "id" : "0x1344" }, { "name": "other-client", "max_dispatchers": "0", "max_dispatch_time": "500" }, ], ``` -------------------------------- ### Run Hello World Client (Linux) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Starts the Hello World client on Linux. Requires setting environment variables for configuration and application name. ```bash VSOMEIP_CONFIGURATION=../helloworld-local.json \ VSOMEIP_APPLICATION_NAME=hello_world_client \ ./hello_world_client ``` -------------------------------- ### Run Linux Request/Response Example Source: https://github.com/covesa/vsomeip/blob/master/examples/readme.md Execute the request and response samples on Linux. Ensure VSOMEIP_CONFIGURATION and VSOMEIP_APPLICATION_NAME environment variables are set correctly. ```bash # HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=client-sample ./request-sample # HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=service-sample ./response-sample ``` -------------------------------- ### Start Local Payload Test Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start local payload tests using the provided starter script. For debugging, the service and client can be started separately. ```bash ./local_payload_test_starter.sh ``` ```bash ./local_payload_test_service_start.sh & ./local_payload_test_client_start.sh ``` -------------------------------- ### vsomeip Shutdown Configuration Example Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipConfiguration.md Example JSON snippet for configuring the shutdown timeout in milliseconds. ```json "shutdown_timeout" : 1000 ``` -------------------------------- ### Build Hello World Target (Linux) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Builds only the Hello World example target on Linux after the main project is built. ```batch cd /examples/hello_world$ mkdir build cd build cmake .. make ``` -------------------------------- ### Check Docker Compose Plugin Installation Source: https://github.com/covesa/vsomeip/blob/master/documentation/network-tests.md Confirm the Docker Compose plugin is installed. If the command fails, refer to the official Docker documentation for installation or troubleshooting. ```bash docker compose version Docker Compose version v2.18.1 ``` -------------------------------- ### Run Windows Request/Response Example Source: https://github.com/covesa/vsomeip/blob/master/examples/readme.md Execute the request and response samples on Windows. Set VSOMEIP_CONFIGURATION and VSOMEIP_APPLICATION_NAME, then navigate to the build directory and run the executables. ```batch #HOST1: set "VSOMEIP_CONFIGURATION=\config\vsomeip-local.json" set "VSOMEIP_APPLICATION_NAME=service-sample" cd /d "\buildlib\examples\Release" response-sample.exe #HOST1: set "VSOMEIP_CONFIGURATION=\config\vsomeip-local.json" set "VSOMEIP_APPLICATION_NAME=client-sample" cd /d "\examples\Release" request-sample.exe ``` -------------------------------- ### Run Linux Subscribe/Notify Example Source: https://github.com/covesa/vsomeip/blob/master/examples/readme.md Execute the subscribe and notify samples on Linux. Ensure VSOMEIP_CONFIGURATION and VSOMEIP_APPLICATION_NAME environment variables are set correctly. ```bash # HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=client-sample ./subscribe-sample # HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=service-sample ./notify-sample ``` -------------------------------- ### Start Client and Service Together (Local and External) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt This script is used to start both local and external clients along with the service. It's designed for scenarios involving multiple client types. ```bash ./external_local_payload_test_client_local_and_external_starter.sh ``` -------------------------------- ### Define Example Configuration Files Source: https://github.com/covesa/vsomeip/blob/master/CMakeLists.txt Sets a list of example configuration files used by the vsomeip project. These files cover various configurations for JSON, TCP, and UDP clients and services. ```cmake set(EXAMPLE_CONFIG_FILES "config/vsomeip.json" "config/vsomeip-local.json" "config/vsomeip-tcp-client.json" "config/vsomeip-tcp-service.json" "config/vsomeip-udp-client.json" "config/vsomeip-udp-service.json" ) ``` -------------------------------- ### Start routingmanagerd Daemon Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipUserGuide.md Start the routingmanagerd daemon with a specified system-wide configuration file. ```bash VSOMEIP_CONFIGURATION=/etc/vsomeip.json ./routingmanagerd ``` -------------------------------- ### Start Client and Service Together (External) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt This script starts both the client and service for testing with an externally visible service. It's used when the service is not running on the same host as the client. ```bash ./external_local_payload_test_client_external_starter.sh ``` -------------------------------- ### Build and Install vsomeip Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes Build vsomeip using CMake, ensuring Boost is installed. The ENABLE_SIGNAL_HANDLING option is recommended for proper application termination. ```bash cd vsomeip ./vsomeip$ cmake -Bbuild -DCMAKE_INSTALL_PREFIX=../install_folder -DENABLE_SIGNAL_HANDLING=1 . ./vsomeip$ cmake --build build --target install ``` -------------------------------- ### Specify Installation Directory (Linux) Source: https://github.com/covesa/vsomeip/blob/master/README.md Customize the installation directory for vSomeIP during the CMake configuration step on Linux. ```bash cmake -DCMAKE_INSTALL_PREFIX:PATH=$YOUR_PATH .. make make install ``` -------------------------------- ### Start Client and Service Separately (Local Debug) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt For debugging purposes, start the client and service independently. Note that some checks are performed within the starter scripts, and this method is intended for development use. ```bash ./external_local_payload_test_service_start.sh & ./external_local_payload_test_client_local_start.sh ``` -------------------------------- ### Start External Local Routing Test Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Initiate external local routing tests using the provided starter script. The external client should be started manually when prompted. ```bash ./external_local_routing_test_starter.sh ``` ```bash ./external_local_routing_test_client_external_start.sh ``` -------------------------------- ### Run Windows Subscribe/Notify Example Source: https://github.com/covesa/vsomeip/blob/master/examples/readme.md Execute the subscribe and notify samples on Windows. Set VSOMEIP_CONFIGURATION and VSOMEIP_APPLICATION_NAME, then navigate to the build directory and run the executables. ```batch #HOST1: set "VSOMEIP_CONFIGURATION=\config\vsomeip-local.json" set "VSOMEIP_APPLICATION_NAME=service-sample" cd /d "\buildlib\examples\Release" notify-sample.exe #HOST1: set "VSOMEIP_CONFIGURATION=\config\vsomeip-local.json" set "VSOMEIP_APPLICATION_NAME=client-sample" cd /d "\examples\Release" subscribe-sample.exe ``` -------------------------------- ### Install pre-commit hook Source: https://github.com/covesa/vsomeip/blob/master/CONTRIBUTING.md Installs the pre-commit hook for the current repository. This ensures that code formatting is applied automatically before each commit. ```bash pre-commit install ``` -------------------------------- ### Start External Client (External Service) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Initiate the external client from an external host when the service is already running externally. This command is used in conjunction with a separately started external service. ```bash ./external_local_payload_test_client_external_start.sh ``` -------------------------------- ### Run Hello World Service (Linux) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Starts the Hello World service on Linux. Requires setting environment variables for configuration and application name. ```bash VSOMEIP_CONFIGURATION=../helloworld-local.json \ VSOMEIP_APPLICATION_NAME=hello_world_service \ ./hello_world_service ``` -------------------------------- ### Build vSomeIP Project (Windows) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Builds the entire vSomeIP project on Windows, including installation. Uses CMake with x64 architecture and specifies an installation prefix. ```batch cd rmdir /s /q build mkdir build cd build cmake .. -A x64 -DCMAKE_INSTALL_PREFIX="$YOUR_PATH" cmake --build . --config Release cmake --build . --config Release --target install ``` -------------------------------- ### vsomeip Network Configuration Example Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipConfiguration.md Example JSON snippet for configuring network settings such as unicast IP, netmask, diagnosis address, and diagnosis mask. ```json "unicast" : "10.10.3.1", "netmask" : "255.255.255.0", "diagnosis" : "0x63", "diagnosis_mask" : "0xF300" ``` -------------------------------- ### Start External Master Offer Test Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the external master offer test script from the test subfolder within the build directory. ```bash ./offer_test_external_master_starter.sh ``` -------------------------------- ### Start Magic Cookies Test Client Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Execute this script on the local host to start the client for the magic cookies test. Observe the service side for expected output. ```bash ./magic_cookies_test_client_start.sh ``` -------------------------------- ### Acceptances Configuration Example Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipConfiguration.md Configure port acceptance rules for a specific IP address. This example sets the 'optional' type for both unreliable and reliable ports, effectively treating them as 'never-secure'. ```json "acceptances" : [ { "address" : "10.3.0.10", "unreliable" : [ { "type" : "optional" } ], "reliable" : [ { "type" : "optional" } ] } ] ``` -------------------------------- ### Typical Test Setup Diagram Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/fake_socket_tests/README.md Illustrates the relationship between the test fixture, ECU setups, applications, and the central socket manager in a typical fake socket test scenario. ```text Test (derives from base_fake_socket_fixture) │ ├── ecu_setup ecu_one{"ecu_one", ecu_one_config, *socket_manager_} ← one ECU │ ├── app* router_ (routing manager) │ └── app* apps_["boardnet_client"] (added via add_app()) │ └── ecu_setup ecu_two{"ecu_two", ecu_two_config, *socket_manager_} ← another ECU ├── app* router_ (routing manager) └── app* apps_["ecu_two_server"] (added via add_guest(); connects over local TCP) socket_manager_ (owned by fixture, passed to ecu_setup at construction) └── routes all fake socket I/O between the apps above ``` -------------------------------- ### Project and Executable Setup Source: https://github.com/covesa/vsomeip/blob/master/test/unit_tests/netlink_tests/CMakeLists.txt Configures the project name, preferred threading model, and identifies source files for the executable. This is a standard CMake setup for C++ projects. ```cmake project(unit_tests_netlink_tests LANGUAGES CXX) set(THREADS_PREFER_PTHREAD_FLAG ON) file(GLOB SRCS *.cpp ../main.cpp) add_executable(${PROJECT_NAME} ${SRCS}) ``` -------------------------------- ### Build Hello World Target (Windows) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Builds only the Hello World example target on Windows after the main project is built. Configures CMake with the specified path for dependencies. ```batch cd /examples/hello_world rmdir /s /q build mkdir build cd build cmake .. -A x64 -DCMAKE_PREFIX_PATH="$YOUR_PATH" cmake --build . --config Release ``` -------------------------------- ### Set DLL Path for Windows Example Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Sets the system's PATH environment variable on Windows to include necessary DLL directories for running vSomeIP examples. This is a prerequisite for running the client and service executables. ```batch set "PATH=\build\Release;\build\test\common;\lib64-msvc-14.2;%PATH%" ``` -------------------------------- ### Build vSomeIP Project (Linux) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Builds the entire vSomeIP project on Linux, including installation. ```batch cd $ mkdir build cd build cmake .. make sudo make install ``` -------------------------------- ### Run Docker Network Tests Source: https://github.com/covesa/vsomeip/blob/master/documentation/network-tests.md Start the Docker containers to build vsomeip-lib and execute the network tests. This command should be run from the repository root. ```bash docker compose --project-directory zuul/network-tests up ``` -------------------------------- ### Start vsomeip Service Application Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipUserGuide.md Launches the vsomeip service application. Ensure the configuration file and application name are correctly set via environment variables. ```bash $ VSOMEIP_CONFIGURATION=../helloworld-local.json \ VSOMEIP_APPLICATION_NAME=hello_world_service \ ./hello_world_service 2015-04-01 11:31:13.248437 [info] Using configuration file: ../helloworld-local.json 2015-04-01 11:31:13.248766 [debug] Routing endpoint at /tmp/vsomeip-0 2015-04-01 11:31:13.248913 [info] Service Discovery disabled. Using static routing information. 2015-04-01 11:31:13.248979 [debug] Application(hello_world_service, 4444) is initialized. 2015-04-01 11:31:22.705010 [debug] Application/Client 5555 got registered! ``` -------------------------------- ### Run Magic Cookies Test (Manual Service Start) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the magic cookies test service on an external host. This requires adapting network addresses in configuration files. ```bash ./magic_cookies_test_service_start.sh ``` -------------------------------- ### SOME/IP Client Event Log Output Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes Example console output from a SOME/IP client demonstrating event registration, subscription, and acknowledgment messages. ```bash 2024-01-16 16:54:10.148417 [info] REGISTER EVENT(1001): [1234.5678.8778:eventtype=0:is_provided=false:reliable=255] 2024-01-16 16:54:10.242532 [info] SUBSCRIBE(1001): [1234.5678.4465:ffff:0] 2024-01-16 16:54:10.243183 [info] SUBSCRIBE ACK(1000): [1234.5678.4465.ffff] ``` ```bash 2024-01-16 16:56:29.782500 [info] REGISTER EVENT(1000): [1234.5678.8778:is_provider=false] 2024-01-16 16:56:34.045232 [info] SUBSCRIBE(1000): [1234.5678.4465:ffff:0] 2024-01-16 16:56:34.045672 [info] SUBSCRIBE ACK(1001): [1234.5678.4465.ffff] ``` -------------------------------- ### Client Request Sending with Event Loop Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes Demonstrates how to send a request from a client to a service using vsomeip. Ensure the application is started before sending messages to utilize the event loop. ```cpp std::shared_ptr request = std::make_shared(vsomeip::protocol::kDefaultMajorVersion, vsomeip::protocol::kDefaultMinorVersion); request->set_service(SERVICE_ID); request->set_instance(INSTANCE_ID); request->set_method(METHOD_ID); std::vector payload_data; for (int i = 0; i < 10; ++i) { payload_data.push_back(static_cast(i)); } request->set_payload(vsomeip::payload::from_vector(payload_data)); app->send(request); ``` -------------------------------- ### Run Hello World Client (Windows) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Starts the Hello World client executable on Windows. Requires setting environment variables for configuration and application name, and navigating to the build directory. ```batch set "VSOMEIP_CONFIGURATION=\examples\hello_world\helloworld-local.json" set "VSOMEIP_APPLICATION_NAME=hello_world_client" cd /d \examples\hello_world\build\Release hello_world_client.exe ``` -------------------------------- ### Run Hello World Service (Windows) Source: https://github.com/covesa/vsomeip/blob/master/examples/hello_world/readme.md Starts the Hello World service executable on Windows. Requires setting environment variables for configuration and application name, and navigating to the build directory. ```batch set "VSOMEIP_CONFIGURATION=\examples\hello_world\helloworld-local.json" set "VSOMEIP_APPLICATION_NAME=hello_world_service" cd /d \examples\hello_world\build\Release hello_world_service.exe ``` -------------------------------- ### Install Routing Manager Daemon Source: https://github.com/covesa/vsomeip/blob/master/examples/routingmanagerd/CMakeLists.txt Conditionally installs the routingmanagerd executable to the runtime destination directory if the VSOMEIP_INSTALL_ROUTINGMANAGERD option is enabled. ```cmake option(VSOMEIP_INSTALL_ROUTINGMANAGERD "Whether or not to install the routing manager daemon.") if (VSOMEIP_INSTALL_ROUTINGMANAGERD) install ( TARGETS routingmanagerd RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin ) endif() ``` -------------------------------- ### Build VSOMEIP Client Application with Builder Source: https://github.com/covesa/vsomeip/blob/master/test/common/README.md Demonstrates creating a VSOMEIP client application using the `base_vsip_app_builder`. It shows how to configure service requests and register state and availability callbacks. ```cpp #include using namespace common; int main() { // Define the service to request using C++20 designated initializers service_info_t my_service{ .service_id = 0x1234, .instance_id = 0x5678, .method_id = 0x42, // .eventgroups = { // eventgroup_info_t{ // .group_id = 0x1000, // .event_ids = {0x2000, 0x2001} // } // }, // .events = { // {0x2000, event_params_t{ // .type = VSOMEIP_v3::event_type_e::ET_EVENT, // .cycle = std::chrono::milliseconds{100}, // .change_resets_cycle = false, // .update_on_change = true, // .epsilon_change_func = nullptr, // .reliability = VSOMEIP_v3::reliability_type_e::RT_UNKNOWN // }}, // {0x2001, event_params_t{ // .type = VSOMEIP_v3::event_type_e::ET_FIELD, // .cycle = std::chrono::milliseconds{200}, // .change_resets_cycle = true, // .update_on_change = false, // .epsilon_change_func = nullptr, // .reliability = VSOMEIP_v3::reliability_type_e::RT_UNKNOWN // }} // } }; // Build the app using the builder pattern auto app = base_vsip_app_builder("my_test_client", "CLNT") .with_request(my_service) .with_state_callback( [](VSOMEIP::state_type_e state) { std::cout << "App state changed: " << static_cast(state) << std::endl; }) .with_availability_callback( [](VSOMEIP::service_t service, VSOMEIP::instance_t instance, bool available) { std::cout << "Service " << std::hex << service << ":" << instance << (available ? " is AVAILABLE" : " is NOT available") << std::endl; }) .build(); // Start the app (runs in its own thread) app->start(); // Send the request for the configured service(s) app->send_request(); // ... perform test logic, wait, etc. ... // Stop the app and clean up app->stop(); } ``` -------------------------------- ### Install pre-commit hook using pip Source: https://github.com/covesa/vsomeip/blob/master/CONTRIBUTING.md Installs the pre-commit tool, which is used to manage and run pre-commit hooks for automated code formatting. ```bash pip install pre-commit ``` -------------------------------- ### Run vsomeip Service and Client Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes These commands demonstrate how to run the vsomeip service and client applications. Ensure the LD_LIBRARY_PATH is set correctly to find the vsomeip libraries. ```bash <.>/vsomeip/test_example$ LD_LIBRARY_PATH=../../install_folder/lib/:$PWD/build/ ./build/service-example ``` ```bash <.>/vsomeip/test_example$ LD_LIBRARY_PATH=../../install_folder/lib/:$PWD/build/ ./build/client-example ``` -------------------------------- ### Start External Local Routing Test Separately Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the service and clients for external routing tests. This method is primarily for debugging purposes. ```bash ./external_local_routing_test_service_start.sh & ./local_routing_test_client_start.sh ./external_local_routing_test_client_external_start.sh ``` -------------------------------- ### Start vsomeip Client Application Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipUserGuide.md Launches the vsomeip client application. Ensure the configuration file and application name are correctly set via environment variables. This client sends a 'World' message and expects 'Hello World' in return. ```bash $ VSOMEIP_CONFIGURATION=../helloworld-local.json \ VSOMEIP_APPLICATION_NAME=hello_world_client \ ./hello_world_client 2015-04-01 11:31:22.704166 [info] Using configuration file: ../helloworld-local.json 2015-04-01 11:31:22.704417 [debug] Connecting to [0] at /tmp/vsomeip-0 2015-04-01 11:31:22.704630 [debug] Listening at /tmp/vsomeip-5555 2015-04-01 11:31:22.704680 [debug] Application(hello_world_client, 5555) is initialized. Sending: World Received: Hello World ``` -------------------------------- ### Configure Files for Build Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/start_stop_start_tests/CMakeLists.txt Sets up configuration files, such as 'start_stop_start_test.json', to be configured and copied into the build folder. ```cmake set(configuration_files start_stop_start_test.json ) configure_files("${configuration_files}") ``` -------------------------------- ### Debounce Configuration Example Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipConfiguration.md Configure event debouncing for specific services and instances. This example shows how to set intervals and disable payload change forwarding for certain events. ```json "debounce" : [ { "service" : "0x7530", "instance" : "0x0001", "events" : [ { "event" : "0x8001", "on_change" : "false", "interval" : "50" }, { "event" : "0x8002", "on_change" : "false", "interval" : "50" }, { "event" : "0x8005", "on_change" : "false", "interval" : "50" }, { "event" : "0x8006", "on_change" : "false", "interval" : "100" }, { "event" : "0x8009", "on_change" : "false", "interval" : "100" } ] } ] ``` -------------------------------- ### Build and Run vsomeip Application Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes Commands to configure, build, and execute the vsomeip application. Ensure the library path is set correctly for execution. ```bash <.>/vsomeip/test_example$ cmake -Bbuild -DCMAKE_INSTALL_PREFIX=../../install_folder -DCMAKE_PREFIX_PATH=../../install_folder . <.>/vsomeip/test_example$ cmake --build build/ <.>/vsomeip/test_example$ LD_LIBRARY_PATH=../../install_folder/lib/:$PWD/build/ ./build/service-example ``` -------------------------------- ### Create vsomeip Application Files Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes Use these bash commands to create the necessary directory structure and files for a new vsomeip application. ```bash <.>/vsomeip$ mkdir test_example <.>/vsomeip$ cd test_example <.>/vsomeip/test_example$ mkdir src <.>/vsomeip/test_example$ touch src/service-example.cpp ``` -------------------------------- ### Configure and Build Basic End-to-End Tests Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/e2e_tests/CMakeLists.txt Configures necessary files and builds the client and service executables for the default end-to-end test. It also sets up a custom test command to run the master start script. ```cmake set(configuration_files e2e_test_client_external.json e2e_test_external_master_start.sh e2e_test_external_slave_start.sh e2e_test_service_external.json ) configure_files("${configuration_files}") add_executable(e2e_test_client e2e_test_client.cpp ) add_executable(e2e_test_service e2e_test_service.cpp ) # Add build dependencies and link libraries to executables. set(executables e2e_test_client e2e_test_service ) targets_link_default_libraries("${executables}") targets_add_default_dependencies("${executables}") add_custom_test( NAME e2e_test_external COMMAND ${CMAKE_CURRENT_BINARY_DIR}/e2e_test_external_master_start.sh e2e_test_client_external.json SEQUENTIAL ) ``` -------------------------------- ### Start Big Payload Test Manually (TCP/External) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the TCP big payload test by launching the client script from the test directory. This assumes the service is already running or managed separately. ```bash ./big_payload_test_client_start.sh ``` -------------------------------- ### Start Big Payload Test Manually (Local) Source: https://github.com/covesa/vsomeip/blob/master/test/network_tests/readme.txt Manually start the local big payload test by launching the service and client scripts separately from the test directory. This provides more control over the test execution. ```bash ./big_payload_test_service_local_start.sh & ./big_payload_test_client_local_start.sh ``` -------------------------------- ### Navigate to project root directory Source: https://github.com/covesa/vsomeip/blob/master/CONTRIBUTING.md Changes the current directory to the root of the vsomeip-lib project. This is a prerequisite for installing the pre-commit hook. ```bash cd vsomeip-lib ``` -------------------------------- ### Find Google Benchmark Package Source: https://github.com/covesa/vsomeip/blob/master/test/CMakeLists.txt Locates and loads the Google Benchmark library. Ensure Google Benchmark is installed and discoverable by CMake. ```cmake find_package(benchmark) ``` -------------------------------- ### Basic vsomeip Application Structure Source: https://github.com/covesa/vsomeip/wiki/vsomeip-in-10-minutes This C++ code defines a minimal vsomeip application. It initializes and starts the application with the name 'World'. ```cpp #include std::shared_ptr< vsomeip::application > app; int main() { app = vsomeip::runtime::get()->create_application("World"); app->init(); app->start(); } ``` -------------------------------- ### Compile vsomeip tests Source: https://github.com/covesa/vsomeip/blob/master/documentation/vsomeipUserGuide.md Use this command to compile tests, setting necessary CMake variables for network setup and signal handling. ```bash mkdir build cd build export GTEST_ROOT=$PATH_TO_GTEST/gtest-1.7.0/ cmake -DENABLE_SIGNAL_HANDLING=1 -DTEST_IP_MASTER=10.0.3.1 -DTEST_IP_SLAVE=10.0.3.125 .. make check ```