tunnel component & update vehicle abstraction example (#8)

This commit is contained in:
tompzf
2026-04-02 17:37:00 +02:00
committed by GitHub
parent 6ed5fdb951
commit 07cf4f654b
94 changed files with 9268 additions and 830 deletions

View File

@@ -118,3 +118,4 @@ add_subdirectory(system_demo_example)
add_subdirectory(door_demo_example)
add_subdirectory(auto_headlamp_example)
add_subdirectory(open_trunk_example)
add_subdirectory(vehicle_abstraction_example)

View File

@@ -65,7 +65,7 @@ execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/autoheadlig
# REMARK: Proxy/stub and vehicle device and basic service code was generated during the configuration phase of CMake. Following
# below are the build steps to build the components that were generated.
message("Include: auto headlight proxy/stub for vehicle devices and basic services")
message("Include: auto headlight proxy/stub for basic services")
include_directories(${CMAKE_CURRENT_LIST_DIR}/generated/vss_files)
add_subdirectory(generated/vss_files/ps)
@@ -107,7 +107,6 @@ add_executable(auto_headlight_app
autoheadlight_app/autoheadlight_simulate.cpp
autoheadlight_app/autoheadlight_console.h
autoheadlight_app/autoheadlight_console.cpp
autoheadlight_app/signal_names.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

View File

@@ -12,7 +12,7 @@
#include <fstream>
#include <support/app_control.h>
#include <support/signal_support.h>
#include "signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
#include "autoheadlight_simulate.h"
#include "autoheadlight_console.h"

View File

@@ -108,14 +108,14 @@ void CConsole::PrintHeader()
bool CConsole::PrepareDataConsumers()
{
// Vehicle Device
auto pVDCurrentLatitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLatitude_Device").GetInterface<vss::Vehicle::Position::CurrentLatitudeDevice::IVSS_CurrentLatitude>();
auto pVDCurrentLatitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLatitude_Device").GetInterface<vss::Vehicle::Position::CurrentLatitudeDevice::IVSS_ReadCurrentLatitude>();
if (!pVDCurrentLatitudeSvc)
{
SDV_LOG_ERROR("Could not get interface 'IVSS_GetVDCurrentLatitude': [CAutoHeadlightService]");
return false;
}
auto pVDCurrentLongitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLongitude_Device").GetInterface<vss::Vehicle::Position::CurrentLongitudeDevice::IVSS_CurrentLongitude>();
auto pVDCurrentLongitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLongitude_Device").GetInterface<vss::Vehicle::Position::CurrentLongitudeDevice::IVSS_ReadCurrentLongitude>();
if (!pVDCurrentLongitudeSvc)
{
SDV_LOG_ERROR("Could not get interface 'IVSS_GetVDCurrentLongitude': [CAutoHeadlightService]");
@@ -212,11 +212,11 @@ void CConsole::ResetSignals()
SetCursorPos(g_sCursor);
// Vehicle Device
auto pVDCurrentLatitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLatitude_Device").GetInterface<vss::Vehicle::Position::CurrentLatitudeDevice::IVSS_CurrentLatitude>();
auto pVDCurrentLatitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLatitude_Device").GetInterface<vss::Vehicle::Position::CurrentLatitudeDevice::IVSS_ReadCurrentLatitude>();
if (pVDCurrentLatitudeSvc)
pVDCurrentLatitudeSvc->UnregisterCurrentLatitudeEvent(static_cast<vss::Vehicle::Position::CurrentLatitudeDevice::IVSS_WriteCurrentLatitude_Event*> (this));
auto pVDCurrentLongitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLongitude_Device").GetInterface<vss::Vehicle::Position::CurrentLongitudeDevice::IVSS_CurrentLongitude>();
auto pVDCurrentLongitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLongitude_Device").GetInterface<vss::Vehicle::Position::CurrentLongitudeDevice::IVSS_ReadCurrentLongitude>();
if (pVDCurrentLongitudeSvc)
pVDCurrentLongitudeSvc->UnregisterCurrentLongitudeEvent(static_cast<vss::Vehicle::Position::CurrentLongitudeDevice::IVSS_WriteCurrentLongitude_Event*> (this));

View File

@@ -19,7 +19,7 @@
#include <support/component_impl.h>
#include <support/timer.h>
#include <atomic>
#include "signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
#include <fcntl.h>
#include "vss_vehiclepositioncurrentlatitude_vd_rx.h"
#include "vss_vehiclepositioncurrentlongitude_vd_rx.h"
@@ -187,7 +187,7 @@ private:
* @param[in] sPos The location to print the value at.
* @param[in] rssName Reference to the value.
* @param[in] tValue The value.
* @param[in] rssStatus Status, becuse we have signals of type bool
* @param[in] rssStatus Status, because we have signals of type bool
*/
template <typename TValue>
void PrintValue(SConsolePos sPos, const std::string& rssName, TValue tValue, const std::string& rssStatus);
@@ -204,7 +204,6 @@ private:
std::thread m_threadReadTxSignals; ///< Simulation datalink thread.
bool m_bThreadStarted = false; ///< Set when initialized.
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
mutable std::mutex m_mPrintToConsole; ///< Mutex to print complete message
sdv::core::CSignal m_signalCurrentLatitude; ///< Signal Current latitude
sdv::core::CSignal m_signalCurrentLongitude; ///< Signal Current longitude
@@ -244,7 +243,7 @@ inline void CConsole::PrintValue(SConsolePos sPos, const std::string& rssName, T
std::string(nValueNameLen - std::min(rssName.size(), static_cast<size_t>(nValueNameLen - 1)) - 1, '.') <<
" " << std::fixed << std::setprecision(6) << tValue << " " << rssUnits << " ";
std::lock_guard<std::mutex> lock(m_mPrintToConsole);
std::lock_guard<std::mutex> lock(m_mtxPrintToConsole);
SetCursorPos(sPos);
std::cout << sstreamValueText.str();
}

View File

@@ -15,7 +15,7 @@
#include <support/app_control.h>
#include <support/component_impl.h>
#include <support/timer.h>
#include "signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
// VSS interfaces - located in ../generated/vss_files/include
#include "vss_vehiclepositioncurrentlatitude_bs_rx.h"

View File

@@ -1,35 +0,0 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
/**
* namespace for the signal names
* in case /generated/vss_files/signal_identifier.h
* exists, use the file, otherwise define the namespace
*/
#ifndef SIGNAL_NAMES_H
#define SIGNAL_NAMES_H
#ifdef __has_include
#if __has_include("../generated/vss_files/signal_identifier.h")
#include "../generated/vss_files/signal_identifier.h"
#else
namespace headlight
{
// Data Dispatch Service signal names to dbc variable names C-type RX/TX vss name space
static std::string dsFCurrentLatitude = "CAN_Input.Current_Latitude" ; ///< float RX Vehicle.Position.CurrentLatitude
static std::string dsFCurrentLongitude = "CAN_Input.Current_Longitude" ; ///< float RX Vehicle.Position.CurrentLongitude
static std::string dsBHeadlightLowBeam = "CAN_Output.HeadLight_LowBeam"; ///< bool TX Vehicle.Body.Light.Front.Lowbeam
} // headlight
#endif
#endif
#endif // ! defined SIGNAL_NAMES_H

View File

@@ -132,7 +132,6 @@ add_executable(door_demo_example
"door_app/door_application.cpp"
"door_app/include/console.h"
"door_app/console.cpp"
"door_app/include/signal_names.h"
"door_service/lock_doors_thread.h")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@@ -156,7 +155,6 @@ add_executable(door_external_app
"door_app/door_extern_application.cpp"
"door_app/include/console.h"
"door_app/console.cpp"
"door_app/include/signal_names.h"
"door_service/lock_doors_thread.h")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

View File

@@ -144,7 +144,7 @@ bool CConsole::PrepareDataConsumers()
auto basicServiceL1 = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_GetIsOpenL1>();
if (!basicServiceL1)
{
SDV_LOG_ERROR("Could not get interface 'LeftService::IVSS_IsOpen': [CConsole]");
SDV_LOG_ERROR("Could not get interface 'LeftService::IVSS_ReadIsOpen': [CConsole]");
return false;
}
else
@@ -207,7 +207,7 @@ void CConsole::ResetSignals()
// Registrate for the vehicle device & basic service of the front left door. Front left door mzust exist, the others are optional
auto vehicleDevice =
sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface < vss::Vehicle::Body::Door::Axle::_01 ::LeftDevice::IVSS_IsOpen > ();
sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface < vss::Vehicle::Body::Door::Axle::_01 ::LeftDevice::IVSS_ReadIsOpen > ();
if (vehicleDevice)
vehicleDevice->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
@@ -227,7 +227,7 @@ void CConsole::ResetSignals()
if (basicServiceR2)
basicServiceR2->UnregisterOnSignalChangeOfRightDoorIsOpen02(dynamic_cast<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event*> (this));
// Unregister the data link signalss
// Unregister the data link signals
if (m_SignalFrontLeftDoorIsOpen)
m_SignalFrontLeftDoorIsOpen.Reset();
if (m_SignalFrontRightDoorIsOpen)
@@ -338,10 +338,10 @@ bool CConsole::PrepareDataConsumersForStandAlone()
}
// Registrate for the vehicle device & basic service of the front left door. Front left door mzust exist, the others are optional
auto vehicleDevice = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_IsOpen>();
auto vehicleDevice = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_ReadIsOpen>();
if (!vehicleDevice)
{
SDV_LOG_ERROR("Could not get interface 'LeftDevice::IVSS_IsOpen': [CConsole]");
SDV_LOG_ERROR("Could not get interface 'LeftDevice::IVSS_ReadIsOpen': [CConsole]");
return false;
}
vehicleDevice->RegisterIsOpenEvent(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));

View File

@@ -9,7 +9,7 @@
********************************************************************************/
#include "../door_app/include/door_application.h"
#include "../door_app/include/signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
#ifdef _WIN32
#include <conio.h> // Needed for _kbhit

View File

@@ -9,7 +9,7 @@
********************************************************************************/
#include "../door_app/include/door_extern_application.h"
#include "../door_app/include/signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
#ifdef _WIN32
#include <conio.h> // Needed for _kbhit

View File

@@ -19,7 +19,7 @@
#include <support/app_control.h>
#include <support/component_impl.h>
#include <support/timer.h>
#include "signal_names.h"
#include "../../generated/vss_files/signal_identifier.h"
#include <fcntl.h>
#include <atomic>
@@ -202,7 +202,7 @@ private:
* @param[in] sPos The location to print the value at.
* @param[in] rssName Reference to the value.
* @param[in] tValue The value.
* @param[in] rssStatus Status, becuse we have signals of type bool
* @param[in] rssStatus Status, because we have signals of type bool
*/
template <typename TValue>
void PrintValue(SConsolePos sPos, const std::string& rssName, TValue tValue, const std::string& rssStatus);
@@ -219,7 +219,6 @@ private:
bool m_bThreadStarted = false; ///< Set when initialized.
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
bool m_isExternalApp = false; ///< True when we have an external application
mutable std::mutex m_mPrintToConsole; ///< Mutex to print complete message
std::thread m_threadReadTxSignals; ///< Simulation datalink thread.
@@ -269,7 +268,7 @@ inline void CConsole::PrintValue(SConsolePos sPos, const std::string& rssName, T
" " << std::fixed << std::setprecision(2) << tValue << " " << rssUnits <<
std::string(nEndNameLen - std::min(endName.size(), static_cast<size_t>(nEndNameLen - 1)) - 1, ' ');
std::lock_guard<std::mutex> lock(m_mPrintToConsole);
std::lock_guard<std::mutex> lock(m_mtxPrintToConsole);
SetCursorPos(sPos);
std::cout << sstreamValueText.str();
}

View File

@@ -64,7 +64,7 @@ private:
bool IsSDVFrameworkEnvironmentSet();
/**
* @brief Loac config file and register vehicle device and basic service.
* @brief Load config file and register vehicle device and basic service.
* @remarks It is expected that each config file has the complete door:
* vehicle device & basic service for input and output
* @param[in] inputMsg message string to be printed on console in case of success and failure

View File

@@ -21,12 +21,11 @@ public:
/**
* @brief Start and initialize the application control and load vehicle devices and
* basic services depending on the numerb of doors
* basic services depending on the number of doors
* @return Return true on success otherwise false
*/
bool Initialize();
/**
* @brief Run loop as long as user input does not exit
* Allow user to open/close each door.

View File

@@ -1,33 +0,0 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
/**
* namespace for the signal names
* in case /interfaces/signal_identifier.h
* exists, use the file, otherwise define the namespace
*/
#ifndef SIGNAL_NAMES_H
#define SIGNAL_NAMES_H
namespace doors
{
// Data Dispatch Service signal names to dbc variable names C-type RX/TX vss name space
static std::string dsLeftDoorIsOpen01 = "CAN_Input_L1.Door01LeftIsOpen"; ///< bool RX Vehicle.Body.Door.Axle._01.Left
static std::string dsRightDoorIsOpen01 = "CAN_Input_R1.Door01RightIsOpen"; ///< bool RX Vehicle.Body.Door.Axle._01.Right
static std::string dsLeftDoorIsOpen02 = "CAN_Input_L2.Door02LeftIsOpen"; ///< bool RX Vehicle.Body.Door.Axle._02.Left
static std::string dsRightDoorIsOpen02 = "CAN_Input_R2.Door02RightIsOpen"; ///< bool RX Vehicle.Body.Door.Axle._02.Right
static std::string dsLeftLatch01 = "CAN_Output.LockDoor01Left"; ///< bool TX Vehicle.Body.Door.Axle._01.Left
static std::string dsRightLatch01 = "CAN_Output.LockDoor01Right"; ///< bool TX Vehicle.Body.Door.Axle._01.Right
static std::string dsLeftLatch02 = "CAN_Output.LockDoor02Left"; ///< bool TX Vehicle.Body.Door.Axle._02.Left
static std::string dsRightLatch02 = "CAN_Output.LockDoor02Right"; ///< bool TX Vehicle.Body.Door.Axle._02.Right
} // doors
#endif // SIGNAL_NAMES_H

View File

@@ -30,7 +30,7 @@ include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
# services are generated during the configuration phase of CMake. This is necessary, since CMakeFiles.txt files are generated and
# they have to be available during the configuration phase of CMake to be taken into the build process. Requisite for the code
# generation during the configuration time of CMake is the availability of the tools to do the generation. Hence the tools cannot be
# created during the build process, which is executed after the configuraiton process.
# created during the build process, which is executed after the configuration process.
# Execute sdv_vss_util to create IDL files for devices and basic services.
message("Create interface code for devices and basic services of open trunk example.")
@@ -46,7 +46,7 @@ execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/v
# We need proxies and stubs for basic services to give access to the interfaces for complex services ans applications: --ps_lib_namedemo_proxystub
# We need proxies and stubs for basic services to give access to the interfaces for complex services and applications: --ps_lib_namedemo_proxystub
message("Compiling vss_vehiclebodytrunk_bs_tx.idl")
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodytrunk_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_nametrunk_proxystub)
message("Compiling vss_vehiclespeed_bs_rx.idl")
@@ -78,7 +78,7 @@ add_subdirectory(generated/can_dl)
# REMARK: Proxy/stub and vehicle device and basic service code was generated during the configuration phase of CMake. Following
# below are the build steps to build the components that were generated.
message("Include: trunk proxy/stub for vehicle devices and basic services")
message("Include: trunk proxy/stub for basic services")
include_directories(${CMAKE_CURRENT_LIST_DIR}/generated/vss_files)
add_subdirectory(generated/vss_files/ps)
@@ -116,7 +116,6 @@ add_executable(open_trunk_example
open_trunk_app/trunk_application.h
open_trunk_app/console.cpp
open_trunk_app/console.h
open_trunk_app/signal_names.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

View File

@@ -34,8 +34,8 @@ const CConsole::SConsolePos g_sComment3{ 24, 1 };
const CConsole::SConsolePos g_sComment4{ 25, 1 };
const CConsole::SConsolePos g_sComment5{ 26, 1 };
const CConsole::SConsolePos g_sSeparator5{ 28, 1 };
const CConsole::SConsolePos g_sComplexServcie1{ 30, 1 };
const CConsole::SConsolePos g_sComplexServcie2{ 31, 1 };
const CConsole::SConsolePos g_sComplexService1{ 30, 1 };
const CConsole::SConsolePos g_sComplexService2{ 31, 1 };
const CConsole::SConsolePos g_sSeparator6{ 33, 1 };
const CConsole::SConsolePos g_sControlDescription{ 35, 1 };
const CConsole::SConsolePos g_sCursor{ 36, 1 };
@@ -111,12 +111,12 @@ void CConsole::PrintHeader(uint32_t uiInstance)
PrintText(g_sSeparator4, "============================================================================");
PrintText(g_sComment1, "The complex service which checks the speed of the vehicle can be seen");
PrintText(g_sComment2, "as an ASIL A/B component and will block the call from QM.");
PrintText(g_sComment3, "The extern apllication can be seen as a QM function.");
PrintText(g_sComment3, "The extern application can be seen as a QM function.");
PrintText(g_sComment4, "If this example would run in a mixed critical environment the connection");
PrintText(g_sComment5, "from QM to basic service interface would be forbidden.");
PrintText(g_sSeparator5, "============================================================================");
PrintText(g_sComplexServcie1, "Basic Service Interface not available.");
PrintText(g_sComplexServcie2, "Complex Service Interface not available.");
PrintText(g_sComplexService1, "Basic Service Interface not available.");
PrintText(g_sComplexService2, "Complex Service Interface not available.");
PrintText(g_sSeparator6, "----------------------------------------------------------------------------");
PrintText(g_sControlDescription, "Press 'X' to quit; 'C' to clear screen, '1' or '2' to open trunk ");
}
@@ -130,7 +130,7 @@ bool CConsole::PrepareDataConsumers()
PrintValue(g_sDataLinkSpeed, "Vehicle Speed RX", m_SpeedDL, "m/s");
// Registrate for the vehicle device & basic service of the speed.
auto vehicleDevice = sdv::core::GetObject("Vehicle.Speed_Device").GetInterface<vss::Vehicle::SpeedDevice::IVSS_Speed>();
auto vehicleDevice = sdv::core::GetObject("Vehicle.Speed_Device").GetInterface<vss::Vehicle::SpeedDevice::IVSS_ReadSpeed>();
if (vehicleDevice)
{
PrintValue(g_sVehicleDeviceSpeed, "Vehicle Speed RX", m_SpeedVD, "m/s");
@@ -147,15 +147,15 @@ bool CConsole::PrepareDataConsumers()
// Request the basic service for opening the trunk.
m_pTrunkSvc = sdv::core::GetObject("Vehicle.Body.Trunk_Service").GetInterface<vss::Vehicle::Body::TrunkService::IVSS_SetOpen>();
if (m_pTrunkSvc)
PrintText(g_sComplexServcie1, "Basic Service available");
PrintText(g_sComplexService1, "Basic Service available");
else
PrintText(g_sComplexServcie1, "Basic Service NOT available");
PrintText(g_sComplexService1, "Basic Service NOT available");
m_pTrunkComplexService = sdv::core::GetObject("Open Trunk Service").GetInterface<ITrunkKitService>();
if (m_pTrunkComplexService)
PrintText(g_sComplexServcie2, "Complex Service available");
PrintText(g_sComplexService2, "Complex Service available");
else
PrintText(g_sComplexServcie2, "Complex Service NOT available");
PrintText(g_sComplexService2, "Complex Service NOT available");
return true;
}
@@ -165,7 +165,7 @@ void CConsole::ResetSignals()
// Set the cursor position at the end
SetCursorPos(g_sCursor);
auto vehicleDevice = sdv::core::GetObject("Vehicle.Speed_Device").GetInterface<vss::Vehicle::SpeedDevice::IVSS_Speed>();
auto vehicleDevice = sdv::core::GetObject("Vehicle.Speed_Device").GetInterface<vss::Vehicle::SpeedDevice::IVSS_ReadSpeed>();
if (vehicleDevice)
vehicleDevice->UnregisterSpeedEvent(dynamic_cast<vss::Vehicle::SpeedDevice::IVSS_WriteSpeed_Event*> (this));
@@ -173,7 +173,7 @@ void CConsole::ResetSignals()
if (basicService)
basicService->UnregisterOnSignalChangeOfVehicleSpeed(dynamic_cast<vss::Vehicle::SpeedService::IVSS_SetSpeed_Event*> (this));
// Unregister the data link signalss
// Unregister the data link signals
if (m_SignalSpeed)
m_SignalSpeed.Reset();
}
@@ -291,25 +291,25 @@ void CConsole::RunUntilBreak()
{
case 'c':
case 'C':
PrintText(g_sComplexServcie1, " ");
PrintText(g_sComplexServcie2, " ");
PrintText(g_sComplexService1, " ");
PrintText(g_sComplexService2, " ");
break;
case '1':
if (m_pTrunkSvc)
{
if (m_pTrunkSvc->SetOpen(true))
PrintText(g_sComplexServcie1, "Open trunk via basic service - will not be available in Mixed-Critical mode!");
PrintText(g_sComplexService1, "Open trunk via basic service - will not be available in Mixed-Critical mode!");
else
PrintText(g_sComplexServcie1, "Open trunk via basic service failed.");
PrintText(g_sComplexService1, "Open trunk via basic service failed.");
}
break;
case '2':
if (m_pTrunkComplexService)
{
if (m_pTrunkComplexService->PopTrunk())
PrintText(g_sComplexServcie2, "Safety open trunk via complex service.");
PrintText(g_sComplexService2, "Safety open trunk via complex service.");
else
PrintText(g_sComplexServcie2, "Safety open trunk via complex service failed, car is moving");
PrintText(g_sComplexService2, "Safety open trunk via complex service failed, car is moving");
}
break;
case 'x':

View File

@@ -18,7 +18,8 @@
#include <support/app_control.h>
#include <support/component_impl.h>
#include <support/timer.h>
#include "signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
#include <fcntl.h>
#include "../generated/vss_files/vss_vehiclebodytrunk_bs_tx.h"
#include "../generated/vss_files/vss_vehiclespeed_bs_rx.h"
@@ -139,7 +140,7 @@ private:
* @param[in] sPos The location to print the value at.
* @param[in] rssName Reference to the value.
* @param[in] tValue The value.
* @param[in] rssStatus Status, becuse we have signals of type bool
* @param[in] rssStatus Status, because we have signals of type bool
*/
template <typename TValue>
void PrintValue(SConsolePos sPos, const std::string& rssName, TValue tValue, const std::string& rssStatus);
@@ -154,7 +155,6 @@ private:
mutable std::mutex m_mtxPrintToConsole; ///< Mutex to print complete message
bool m_bRunning = false; ///< When set, the application is running.
mutable std::mutex m_mPrintToConsole; ///< Mutex to print complete message
sdv::core::CSignal m_SignalSpeed; ///< Speed
float m_SpeedDL = 0.0; ///< Speed Data Link
@@ -186,7 +186,7 @@ inline void CConsole::PrintValue(SConsolePos sPos, const std::string& rssName, T
std::string(nValueNameLen - std::min(rssName.size(), static_cast<size_t>(nValueNameLen - 1)) - 1, '.') <<
" " << std::fixed << std::setprecision(2) << tValue << " " << rssUnits << " ";
std::lock_guard<std::mutex> lock(m_mPrintToConsole);
std::lock_guard<std::mutex> lock(m_mtxPrintToConsole);
SetCursorPos(sPos);
std::cout << sstreamValueText.str();
}

View File

@@ -1,35 +0,0 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
/**
* namespace for the signal names
* in case /interfaces/signal_identifier.h
* exists, use the file, otherwise define the namespace
*/
#ifndef SIGNAL_NAMES_H
#define SIGNAL_NAMES_H
#ifdef __has_include
#if __has_include("../interfaces/signal_identifier.h")
#include "../interfaces/signal_identifier.h"
#else
namespace trunk
{
// Data Dispatch Service signal names to dbc variable names C-type RX/TX vss name space
static std::string dsVehicleSpeed = "CAN_Input.Speed"; ///< bool RX Vehicle.Speed
static std::string dsTrunk = "CAN_Output.OpenTrunk"; ///< bool TX Vehicle.Body.Trunk
} // trunk
#endif
#endif
#endif // SIGNAL_NAMES_H

View File

@@ -9,7 +9,7 @@
********************************************************************************/
#include "trunk_application.h"
#include "signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
#ifdef _WIN32
#include <conio.h> // Needed for _kbhit

View File

@@ -11,7 +11,6 @@
#include <string>
#include <support/app_control.h>
#include <support/signal_support.h>
#include "vss_vehiclespeed_bs_rx.h"
/**
@@ -47,7 +46,7 @@ private:
bool IsSDVFrameworkEnvironmentSet();
/**
* @brief Loac config file and register vehicle device and basic service.
* @brief Load config file and register vehicle device and basic service.
* @param[in] inputMsg message string to be printed on console in case of success and failure
* @param[in] configFileName config toml file name
* @return Return true on success otherwise false

View File

@@ -30,7 +30,7 @@ include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
# services are generated during the configuration phase of CMake. This is necessary, since CMakeFiles.txt files are generated and
# they have to be available during the configuration phase of CMake to be taken into the build process. Requisite for the code
# generation during the configuration time of CMake is the availability of the tools to do the generation. Hence the tools cannot be
# created during the build process, which is executed after the configuraiton process.
# created during the build process, which is executed after the configuration process.
# Execute sdv_vss_util to create IDL files for devices and basic services.
message("Create interface code for devices and basic services of demo example.")
@@ -46,7 +46,7 @@ execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/v
message("Compiling vss_vehiclespeed_vd_rx.idl")
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclespeed_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
# We need proxies and stubs for basic services to give access to the interfaces for complex services ans applications: --ps_lib_namedemo_proxystub
# We need proxies and stubs for basic services to give access to the interfaces for complex services and applications: --ps_lib_namedemo_proxystub
message("Compiling vss_vehiclechassisrearaxlerowwheel_bs_tx.idl")
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclechassisrearaxlerowwheel_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedemo_proxystub)
message("Compiling vss_vehiclechassissteeringwheelangle_bs_rx.idl")
@@ -81,7 +81,7 @@ add_subdirectory(generated/can_dl)
# REMARK: Proxy/stub and vehicle device and basic service code was generated during the configuration phase of CMake. Following
# below are the build steps to build the components that were generated.
message("Include: demo proxy/stub for vehicle devices and basic services")
message("Include: demo proxy/stub for basic services")
include_directories(${CMAKE_CURRENT_LIST_DIR}/generated/vss_files)
add_subdirectory(generated/vss_files/ps)
@@ -120,7 +120,6 @@ set_target_properties(demo_complex_service PROPERTIES SUFFIX ".sdv")
# Define the executable
add_executable(system_extern_example
example_app/system_extern_example.cpp
example_app/signal_names.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@@ -145,7 +144,6 @@ add_executable(system_demo_example
example_app/control.cpp
example_app/console.h
example_app/console.cpp
example_app/signal_names.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

View File

@@ -253,7 +253,7 @@ void CConsole::RunUntilBreak()
// Set the cursor position at the end
SetCursorPos(g_sCursor);
// Unregister the data link signalss
// Unregister the data link signals
if (m_signalSteeringWheel) m_signalSteeringWheel.Reset();
if (m_signalSpeed) m_signalSpeed.Reset();
if (m_signalRearAxleAngle) m_signalRearAxleAngle.Reset();

View File

@@ -18,7 +18,7 @@
#include <support/app_control.h>
#include <support/component_impl.h>
#include <support/timer.h>
#include "signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
#ifdef __unix__
#include <termios.h> // Needed for tcgetattr and fcntl

View File

@@ -29,7 +29,7 @@
#endif
#endif
#include "signal_names.h"
#include "../generated/vss_files/signal_identifier.h"
/**
* @brief Utility handler for example demos

View File

@@ -1,35 +0,0 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
/**
* namespace for the signal names
* in case /generated/vss_files/signal_identifier.h
* exists, use the file, otherwise define the namespace
*/
#ifndef SIGNAL_NAMES_H
#define SIGNAL_NAMES_H
#ifdef __has_include
#if __has_include("../generated/vss_files/signal_identifier.h")
#include "../generated/vss_files/signal_identifier.h"
#else
namespace demo
{
static std::string dsWheelAngle = "CAN_Input.SteeringWheel"; ///< float RX Vehicle.Chassis.SteeringWheel.Angle
static std::string dsVehicleSpeed = "CAN_Input.Speed"; ///< float RX Vehicle.Speed
static std::string dsAxleAngle = "CAN_Output.RearAngle"; ///< float TX Vehicle.Chassis.RearAxle.Row.Wheel
static std::string dsLiveCounter = "CAN_Output.IsActiveCounter"; ///< uint8_t TX Vehicle.Software.Application.IsActiveCounter
} // demo
#endif
#endif
#endif // ! defined SIGNAL_NAMES_H

View File

@@ -0,0 +1,123 @@
#*******************************************************************************
# Copyright (c) 2025-2026 ZF Friedrichshafen AG
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
#*******************************************************************************
project(SystemDemoExample)
# Use new policy for project version settings and default warning level
cmake_policy(SET CMP0048 NEW) # requires CMake 3.14
cmake_policy(SET CMP0092 NEW) # requires CMake 3.15
set(CMAKE_CXX_STANDARD 17)
# Libary symbols are hidden by default
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
# Include directory to the core framework
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
######################################################################################################################################################################
# preparation
######################################################################################################################################################################
# REMARK: The code generation for the proxy/stub, interface definitions and serialization, the vehicle devices and the basic
# services are generated during the configuration phase of CMake. This is necessary, since CMakeFiles.txt files are generated and
# they have to be available during the configuration phase of CMake to be taken into the build process. Requisite for the code
# generation during the configuration time of CMake is the availability of the tools to do the generation. Hence the tools cannot be
# created during the build process, which is executed after the configuration process.
# Execute sdv_vss_util to create IDL files for devices and basic services.
# REMARK: We need 2 cvs definition files because we want to create 2 identical components.
# Both need to have the same input signal as well as the same output interface. Output must be vehicle speed in km/h.
# One of the component has to convert the value from m/s to km/h, the other one can pass the value directly.
message("Create interface code for devices and basic services of vehicle abstraction example.")
execute_process(COMMAND "${SDV_VSS_UTIL}" "${PROJECT_SOURCE_DIR}/vehicle_abstraction_example.csv" "-O${PROJECT_SOURCE_DIR}/generated/" --prefixabstraction --version1.0.0.1 --enable_components)
execute_process(COMMAND "${SDV_VSS_UTIL}" "${PROJECT_SOURCE_DIR}/vehicle_abstraction_example_ms.csv" "-O${PROJECT_SOURCE_DIR}/generated2/" --prefixabstraction --version1.0.0.1 --enable_components)
# Execute the IDL compiler for the VSS interfaces to digest interface code. Compile with --no_ps as we do not need proxies and stubs as we do not like to expose these interfaces for complex services or applications
message("Compiling vss_vehiclespeed_vd_rx.idl")
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclespeed_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
message("Compiling vss_vehiclespeed_vd_rx.idl")
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated2/vss_files/vss_vehiclespeed_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated2/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated2/vss_files/ --no_ps)
# We need proxies and stubs for basic services to give access to the interfaces for complex services and applications: --ps_lib_namedemo_proxystub
message("Compiling vss_vehiclespeed_bs_rx.idl")
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclespeed_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_nameabstraction_proxystub)
# Execute sdv_dbc_util to create data link code & FMU code.
message("Create data link for vehicle abstraction example")
execute_process(COMMAND ${SDV_DBC_UTIL} "${PROJECT_SOURCE_DIR}/vehicle_abstraction_example.dbc" "-O${PROJECT_SOURCE_DIR}/generated/" --nodesabstraction --version1.0.0.1 --dl_lib_namecan_dl_abstraction)
######################################################################################################################################################################
# data link component
######################################################################################################################################################################
# REMARK: CAN data link code was generated during the configuration phase of CMake. Following below is the build step to build the
# component that was generated.
message("Include: example component can_dl_abstraction")
add_subdirectory(generated/can_dl)
#######################################################################################################################################################################
## vehicle devices and basic services
#######################################################################################################################################################################
# REMARK: Proxy/stub and vehicle device and basic service code was generated during the configuration phase of CMake. Following
# below are the build steps to build the components that were generated.
message("Include: vehicle abstraction proxy/stub for basic services")
include_directories(${CMAKE_CURRENT_LIST_DIR}/generated/vss_files)
add_subdirectory(generated/vss_files/ps)
# REMARK: We create 2 'vd_*' components with identical input and output interface. Therefore we needed 2 csv definition files for their creation.
# The difference is: one passes the input value to output, the other one needs to convert the value from m/s to km/h to match the unit.
add_subdirectory(generated/vss_files/vd_vehiclespeedkmh)
add_subdirectory(generated2/vss_files/vd_vehiclespeedms)
# REMARK: Because the output interface of the 'vd_*' components is identical (km/h), we need only one bs* component which expects to get a value in km/h.
add_subdirectory(generated/vss_files/bs_vehiclespeed)
######################################################################################################################################################################
# vehicle abstraction application
######################################################################################################################################################################
# Define the executable
add_executable(vehicle_abstraction_example
vehicle_abstraction_app/vehicle_abstraction_example.cpp
vehicle_abstraction_app/vehicle_abstraction_application.cpp
vehicle_abstraction_app/vehicle_abstraction_application.h
vehicle_abstraction_app/console.cpp
vehicle_abstraction_app/console.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (WIN32)
target_link_libraries(vehicle_abstraction_example Ws2_32 Winmm Rpcrt4.lib)
else()
target_link_libraries(vehicle_abstraction_example ${CMAKE_DL_LIBS} rt ${CMAKE_THREAD_LIBS_INIT})
endif()
else()
target_link_libraries(vehicle_abstraction_example Rpcrt4.lib)
endif()
# Copy the config files
file (COPY ${PROJECT_SOURCE_DIR}/config/can_com_simulation_vehicle_abstraction_ms.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
file (COPY ${PROJECT_SOURCE_DIR}/config/can_com_simulation_vehicle_abstraction_kmh.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
file (COPY ${PROJECT_SOURCE_DIR}/config/data_dispatch_vehicle_abstraction.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
file (COPY ${PROJECT_SOURCE_DIR}/config/data_link_vehicle_abstraction.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
file (COPY ${PROJECT_SOURCE_DIR}/config/task_timer_vehicle.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
file (COPY ${PROJECT_SOURCE_DIR}/config/vehicle_abstraction_device_kmh.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
file (COPY ${PROJECT_SOURCE_DIR}/config/vehicle_abstraction_device_ms.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
file (COPY ${PROJECT_SOURCE_DIR}/config/vehicle_abstraction_basic_service.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
# Copy the ASC files used by can_com_sim.sdv which includes the CAN messages. One file includes vehicle speed in m/s, the other file in km/h.
file (COPY ${PROJECT_SOURCE_DIR}/vehicle_abstraction_example_receiver_ms.asc DESTINATION ${CMAKE_BINARY_DIR}/bin)
file (COPY ${PROJECT_SOURCE_DIR}/vehicle_abstraction_example_receiver_kmh.asc DESTINATION ${CMAKE_BINARY_DIR}/bin)

View File

@@ -0,0 +1,9 @@
[Configuration]
Version = 100
[[Component]]
Path = "can_com_sim.sdv"
Class = "CAN_Com_Sim"
[Component.Parameters]
Source="vehicle_abstraction_example_receiver_kmh.asc"
Target="vehicle_abstraction_example_writer_kmh.asc"

View File

@@ -0,0 +1,9 @@
[Configuration]
Version = 100
[[Component]]
Path = "can_com_sim.sdv"
Class = "CAN_Com_Sim"
[Component.Parameters]
Source="vehicle_abstraction_example_receiver_ms.asc"
Target="vehicle_abstraction_example_writer_ms.asc"

View File

@@ -0,0 +1,8 @@
[Configuration]
Version = 100
[[Component]]
Path = "data_dispatch_service.sdv"
Class = "DataDispatchService"

View File

@@ -0,0 +1,6 @@
[Configuration]
Version = 100
[[Component]]
Path = "can_dl_abstraction.sdv"
Class = "CAN_data_link"

View File

@@ -0,0 +1,6 @@
[Configuration]
Version = 100
[[Component]]
Path = "task_timer.sdv"
Class = "TaskTimerService"

View File

@@ -0,0 +1,12 @@
[Configuration]
Version = 100
[[Component]]
Path = "abstraction_bs_vehiclespeed_rx.sdv"
Class = "Vehicle.Speed_Service"

View File

@@ -0,0 +1,6 @@
[Configuration]
Version = 100
[[Component]]
Path = "abstraction_vd_vehiclespeedkmh_rx.sdv"
Class = "Vehicle.Speed_Device"

View File

@@ -0,0 +1,8 @@
[Configuration]
Version = 100
[[Component]]
Path = "abstraction_vd_vehiclespeedms_rx.sdv"
Class = "Vehicle.Speed_Device"

View File

@@ -0,0 +1,316 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include "console.h"
#ifdef _WIN32
#include <conio.h> // Needed for _kbhit
#else
#include <fcntl.h>
#endif
const CConsole::SConsolePos g_sTitle{ 1, 1 };
const CConsole::SConsolePos g_sSubTitle1{ 2, 1 };
const CConsole::SConsolePos g_sSubTitle2{3, 1};
const CConsole::SConsolePos g_sSeparator1{ 5, 1 };
const CConsole::SConsolePos g_sDataUnit{ 7, 1 };
const CConsole::SConsolePos g_sDataLinkSpeed{ 8, 1 };
const CConsole::SConsolePos g_sSeparator2{ 10, 1 };
const CConsole::SConsolePos g_sDeviceServiceSpeed{ 12, 1 };
const CConsole::SConsolePos g_sSeparator3{ 14, 1 };
const CConsole::SConsolePos g_sBasicServiceSpeed{ 16, 1 };
const CConsole::SConsolePos g_sSeparator4{ 18, 1 };
const CConsole::SConsolePos g_sComment1{ 20, 1 };
const CConsole::SConsolePos g_sComment2{ 21, 1 };
const CConsole::SConsolePos g_sComment3{ 23, 1 };
const CConsole::SConsolePos g_sComment4{ 24, 1 };
const CConsole::SConsolePos g_sComment5{ 25, 1 };
const CConsole::SConsolePos g_sComment6{ 27, 1 };
const CConsole::SConsolePos g_sComment7{ 28, 1 };
const CConsole::SConsolePos g_sSeparator5{ 30, 1 };
const CConsole::SConsolePos g_sControlDescription{ 32, 1 };
const CConsole::SConsolePos g_sCursor{ 33, 1 };
CConsole::CConsole()
{
#ifdef _WIN32
// Enable ANSI escape codes
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hStdOut != INVALID_HANDLE_VALUE && GetConsoleMode(hStdOut, &m_dwConsoleOutMode))
SetConsoleMode(hStdOut, m_dwConsoleOutMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
if (hStdIn != INVALID_HANDLE_VALUE && GetConsoleMode(hStdIn, &m_dwConsoleInMode))
SetConsoleMode(hStdIn, m_dwConsoleInMode & ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT));
#elif defined __unix__
// Disable echo
tcgetattr(STDIN_FILENO, &m_sTermAttr);
struct termios sTermAttrTemp = m_sTermAttr;
sTermAttrTemp.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &sTermAttrTemp);
m_iFileStatus = fcntl(STDIN_FILENO, F_GETFL, 0);
fcntl(STDIN_FILENO, F_SETFL, m_iFileStatus | O_NONBLOCK);
#else
#error The OS is not supported!
#endif
}
CConsole::~CConsole()
{
SetCursorPos(g_sCursor);
#ifdef _WIN32
// Return to the stored console mode
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hStdOut != INVALID_HANDLE_VALUE)
SetConsoleMode(hStdOut, m_dwConsoleOutMode);
HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
if (hStdIn != INVALID_HANDLE_VALUE)
SetConsoleMode(hStdIn, m_dwConsoleInMode);
#elif defined __unix__
// Return the previous file status flags.
fcntl(STDIN_FILENO, F_SETFL, m_iFileStatus);
// Return to previous terminal state
tcsetattr(STDIN_FILENO, TCSANOW, &m_sTermAttr);
#endif
}
void CConsole::PrintHeader()
{
// Clear the screen...
std::cout << "\x1b[2J";
// Print the titles
PrintText(g_sTitle, "Vehicle Abstraction: ");
PrintText(g_sSubTitle1, "This example demonstrates that the vehicle function implementation is independent of the vehicle itself.");
PrintText(g_sSubTitle2, "CAN bus vehicle 1 => km/h, CAN bus vehicle 2 => m/s.");
PrintText(g_sSeparator1, "====================================================================================================================");
PrintText(g_sDataUnit, m_DataUnit);
PrintText(g_sDataLinkSpeed, "Data Link not available.");
PrintText(g_sSeparator2, "--------------------------------------------------------------------------------------------------------------------");
PrintText(g_sDeviceServiceSpeed, "Platform Abstraction Interface not available.");
PrintText(g_sSeparator3, "--------------------------------------------------------------------------------------------------------------------");
PrintText(g_sBasicServiceSpeed, "Basic Service Interface not available.");
PrintText(g_sSeparator4, "====================================================================================================================");
PrintText(g_sComment1, "The dispatch service displays the value that is written by the CAN message read from the ASC file.");
PrintText(g_sComment2, "The speed should be increased by steps of 10 km/h.");
PrintText(g_sComment3, "The 'Platform Abstraction' component is responsible for the vehicle abstraction and converts the value if necessary.");
PrintText(g_sComment4, "The example contains 2 components for 'Platform Abstraction' with identical output interfaces.");
PrintText(g_sComment5, "Depending on the input (m/s or km/h) the correct 'Platform Abstraction' component must be loaded.");
PrintText(g_sComment6, "Therefore, only one speed sensor component is required, which always receives the speed in km/h.");
PrintText(g_sComment7, "The vehicle function does not require any logic that depends on the specific vehicle.");
PrintText(g_sSeparator5, "====================================================================================================================");
PrintText(g_sControlDescription, "Press 'X' to quit;");
}
bool CConsole::PrepareDataConsumers()
{
sdv::core::CDispatchService dispatch;
m_SignalSpeed = dispatch.Subscribe(abstraction::dsVehicleSpeed, [&](sdv::any_t value) { CallbackSpeed(value); });
if (m_SignalSpeed)
{
auto unit = m_Unit;
unit.append(" [ data dispatch service - input from CAN bus ] ");
PrintValue(g_sDataLinkSpeed, "Vehicle Speed RX", m_SpeedDataLink, unit);
}
auto deviceServiceSpeed = sdv::core::GetObject("Vehicle.Speed_Device").GetInterface<vss::Vehicle::SpeedDevice::IVSS_ReadSpeed>();
if (deviceServiceSpeed)
{
PrintValue(g_sDeviceServiceSpeed, "Vehicle Speed RX", m_PlatformSpeed, "km/h [ Output of Platform Abstraction, not accessible by application ] ");
deviceServiceSpeed->RegisterSpeedEvent(dynamic_cast<vss::Vehicle::SpeedDevice::IVSS_WriteSpeed_Event*> (this));
}
auto basicServiceSpeed = sdv::core::GetObject("Vehicle.Speed_Service").GetInterface<vss::Vehicle::SpeedService::IVSS_GetSpeed>();
if (basicServiceSpeed)
{
PrintValue(g_sBasicServiceSpeed, "Vehicle Speed RX", m_BasicSpeed, "km/h [ Output of Speed Sensor Service, accessible by application ] ");
basicServiceSpeed->RegisterOnSignalChangeOfVehicleSpeed(dynamic_cast<vss::Vehicle::SpeedService::IVSS_SetSpeed_Event*> (this));
}
return true;
}
void CConsole::WriteSpeed( float value)
{
if (m_PlatformSpeed != value)
{
m_PlatformSpeed = value;
PrintValue(g_sDeviceServiceSpeed, "Vehicle Speed RX", m_PlatformSpeed, "km/h [ Output of Platform Abstraction, not accessible by application ] ");
}
}
void CConsole::SetSpeed( float value)
{
if (m_BasicSpeed != value)
{
m_BasicSpeed= value;
PrintValue(g_sBasicServiceSpeed, "Vehicle Speed RX", m_BasicSpeed, "km/h [ Output of Speed Sensor Service, accessible by application ] ");
}
}
void CConsole::ResetSignals()
{
// Set the cursor position at the end
SetCursorPos(g_sCursor);
auto deviceServiceSpeed = sdv::core::GetObject("Vehicle.Speed_Devicee").GetInterface<vss::Vehicle::SpeedDevice::IVSS_ReadSpeed>();
if (deviceServiceSpeed)
{
deviceServiceSpeed->UnregisterSpeedEvent(dynamic_cast<vss::Vehicle::SpeedDevice::IVSS_WriteSpeed_Event*> (this));
}
auto basicServiceSpeed = sdv::core::GetObject("Vehicle.Speed_Service").GetInterface<vss::Vehicle::SpeedService::IVSS_GetSpeed>();
if (basicServiceSpeed)
{
basicServiceSpeed->UnregisterOnSignalChangeOfVehicleSpeed(dynamic_cast<vss::Vehicle::SpeedService::IVSS_SetSpeed_Event*> (this));
}
if (m_SignalSpeed)
m_SignalSpeed.Reset();
}
void CConsole::CallbackSpeed(sdv::any_t value)
{
if (m_SpeedDataLink != value.get<float>())
{
m_SpeedDataLink = value.get<float>();
auto unit = m_Unit;
unit.append(" [ data dispatch service - input from CAN bus ] ");
PrintValue(g_sDataLinkSpeed, "Vehicle Speed RX", m_SpeedDataLink, unit);
}
}
CConsole::SConsolePos CConsole::GetCursorPos() const
{
SConsolePos sPos{};
std::cout << "\033[6n";
char buff[128];
int indx = 0;
for(;;) {
int cc = std::cin.get();
buff[indx] = (char)cc;
indx++;
if(cc == 'R') {
buff[indx + 1] = '\0';
break;
}
}
int iRow = 0, iCol = 0;
sscanf(buff, "\x1b[%d;%dR", &iRow, &iCol);
sPos.uiRow = static_cast<uint32_t>(iRow);
sPos.uiCol = static_cast<uint32_t>(iCol);
fseek(stdin, 0, SEEK_END);
return sPos;
}
void CConsole::SetCursorPos(SConsolePos sPos)
{
std::cout << "\033[" << sPos.uiRow << ";" << sPos.uiCol << "H";
}
void CConsole::PrintText(SConsolePos sPos, const std::string& rssText)
{
auto text = rssText;
while (text.length() < 76)
text.append(" ");
std::lock_guard<std::mutex> lock(m_mtxPrintToConsole);
SetCursorPos(sPos);
std::cout << text;
}
bool CConsole::KeyHit()
{
#ifdef _WIN32
return _kbhit();
#elif __unix__
int ch = getchar();
if (ch != EOF) {
ungetc(ch, stdin);
return true;
}
return false;
#endif
}
char CConsole::GetChar()
{
#ifdef _WIN32
return static_cast<char>(_getch());
#else
return getchar();
#endif
}
void CConsole::RunUntilBreak()
{
bool bRunning = true;
while (bRunning)
{
// Check for a key
if (!KeyHit())
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
continue;
}
// Get a keyboard value (if there is any).
char c = GetChar();
switch (c)
{
case 'x':
case 'X':
bRunning = false;
break;
default:
break;
}
}
}
bool CConsole::SelectInputDataUnits()
{
// Clear the screen and goto top...
std::cout << "\x1b[2J\033[0;0H";
std::cout << "Click '1' to select km/h or '2' to select m/s";
bool bIsKmh = false;
char c = '0';
while(c != '1' && c != '2')
{
c = GetChar();
switch (c)
{
case '1':
m_DataUnit = "[ --- Input data in km/h --- ]";
m_Unit = "km/h";
bIsKmh = true;
break;
case '2':
m_DataUnit = "[ --- Input data in m/s --- ]";
m_Unit = "m/s";
bIsKmh = false;
break;
default:
break;
}
}
return bIsKmh;
}

View File

@@ -0,0 +1,200 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#ifndef CONSOLE_OUTPUT_H
#define CONSOLE_OUTPUT_H
#include <iostream>
#include <string>
#include <functional>
#include <support/signal_support.h>
#include <support/app_control.h>
#include <support/component_impl.h>
#include <support/timer.h>
#include "../generated/vss_files/signal_identifier.h"
#include <fcntl.h>
#include "../generated/vss_files/vss_vehiclespeed_vd_rx.h"
#include "../generated/vss_files/vss_vehiclespeed_bs_rx.h"
#ifdef __unix__
#include <termios.h> // Needed for tcgetattr and fcntl
#include <unistd.h>
#endif
/**
* @brief Console operation class.
* @details This class retrieves RX data from the data dispatch service, platform abstraction & basic service of speed on event change.
* Furthermore, it shows TX value by polling the RX signals.
*/
class CConsole : public vss::Vehicle::SpeedDevice::IVSS_WriteSpeed_Event
, public vss::Vehicle::SpeedService::IVSS_SetSpeed_Event
{
public:
/**
* @brief Screen position structure
*/
struct SConsolePos
{
uint32_t uiRow; ///< Row position (starts at 1)
uint32_t uiCol; ///< Column position (starts at 1)
};
/**
* @brief Constructor
*/
CConsole();
/**
* @brief Destructor
*/
~CConsole();
/**
* @brief Print the header.
*/
void PrintHeader();
/**
* @brief Prepare the data consumers..
* @return Returns whether the preparation of the data consumers was successful or not.
*/
bool PrepareDataConsumers();
/**
* @brief Run loop as long as user input does not exit
*/
void RunUntilBreak();
/**
* @brief Let the user decide which unit the input data should have
* @return Return true if inout data should be km/h, otherwise false
*/
bool SelectInputDataUnits();
/**
* @brief Write vehicleSpeed signal
* @param[in] value vehicleSpeed
*/
void WriteSpeed( float value) override;
/**
* @brief Set vehicleSpeed signal
* @param[in] value vehicleSpeed
*/
void SetSpeed( float value) override;
/**
* @brief For gracefully shutdown all signals need to be reset.
*/
void ResetSignals();
private:
/**
* @brief Callback function for speed.
* @param[in] value The value of the signal to update.
*/
void CallbackSpeed(sdv::any_t value);
/**
* @brief Key hit check. Windows uses the _kbhit function; POSIX emulates this.
* @return Returns whether a key has been pressed.
*/
bool KeyHit();
/**
* @brief Get the character from the keyboard buffer if pressed.
* @return Returns the character from the keyboard buffer.
*/
char GetChar();
/**
* @brief Get the cursor position of the console.
* @return The cursor position.
*/
SConsolePos GetCursorPos() const;
/**
* @brief Set the current cursor position for the console.
* @param[in] sPos Console position to place the current cursor at.
*/
void SetCursorPos(SConsolePos sPos);
/**
* @brief Print text at a specific location.
* @param[in] sPos The location to print text at.
* @param[in] rssText Reference to the text to print.
*/
void PrintText(SConsolePos sPos, const std::string& rssText);
/**
* @brief Print a value string at a specific location.
* @tparam TValue Type of value.
* @param[in] sPos The location to print the value at.
* @param[in] rssName Reference to the value.
* @param[in] tValue The value.
* @param[in] rssStatus Status, because we have signals of type bool
*/
template <typename TValue>
void PrintValue(SConsolePos sPos, const std::string& rssName, TValue tValue, const std::string& rssStatus);
/**
* @brief Align string between name and value.
* @param[in] message Reference to the message to align.
* @param[in] desiredLength The desired length or 0 when no length is specified.
* @return The aligned string.
*/
std::string AlignString(const std::string& message, uint32_t desiredLength = 0);
mutable std::mutex m_mtxPrintToConsole; ///< Mutex to print complete message
bool m_bRunning = false; ///< When set, the application is running.
std::string m_DataUnit = "[ --- Input data in m/s --- ]";
std::string m_Unit = "m/s";
sdv::core::CSignal m_SignalSpeed; ///< Signal to subscribe to the speed signal in dispatch service
float m_SpeedDataLink = 0.0; ///< Data Link value, either km/h or m/s
float m_PlatformSpeed = 0.0; ///< Generalized Speed
float m_BasicSpeed = 0.0; ///< Generalized Speed
#ifdef _WIN32
DWORD m_dwConsoleOutMode = 0u; ///< The console mode before switching on ANSI support.
DWORD m_dwConsoleInMode = 0u; ///< The console mode before switching on ANSI support.
#elif defined __unix__
struct termios m_sTermAttr{}; ///< The terminal attributes before disabling echo.
int m_iFileStatus = 0; ///< The file status flags for STDIN.
#else
#error The OS is not supported!
#endif
};
template <typename TValue>
inline void CConsole::PrintValue(SConsolePos sPos, const std::string& rssName, TValue tValue, const std::string& rssUnits)
{
const size_t nValueNameLen = 26;
std::stringstream sstreamValueText;
sstreamValueText << rssName <<
std::string(nValueNameLen - std::min(rssName.size(), static_cast<size_t>(nValueNameLen - 1)) - 1, '.') <<
" " << std::fixed << std::setprecision(2) << tValue << " " << rssUnits << " ";
std::lock_guard<std::mutex> lock(m_mtxPrintToConsole);
SetCursorPos(sPos);
std::cout << sstreamValueText.str();
}
template <>
inline void CConsole::PrintValue<bool>(SConsolePos sPos, const std::string& rssName, bool bValue, const std::string& rssStatus)
{;
PrintValue(sPos, rssName, bValue ? "" : "", rssStatus);
}
#endif // !define CONSOLE_OUTPUT_H

View File

@@ -0,0 +1,103 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include "vehicle_abstraction_application.h"
#include "../generated/vss_files/signal_identifier.h"
#ifdef _WIN32
#include <conio.h> // Needed for _kbhit
#else
#include <fcntl.h>
#endif
bool CAbstractionControl::LoadConfigFile(const std::string& inputMsg, const std::string& configFileName)
{
std::string msg = inputMsg;
if (m_appcontrol.LoadConfig(configFileName) == sdv::core::EConfigProcessResult::successful)
{
msg.append("ok\n");
std::cout << msg.c_str();
return true;
}
msg.append("FAILED.\n");
std::cout << msg.c_str();
return false;
}
bool CAbstractionControl::IsSDVFrameworkEnvironmentSet()
{
const char* envVariable = std::getenv("SDV_FRAMEWORK_RUNTIME");
if (envVariable)
{
return true;
}
return false;
}
bool CAbstractionControl::Initialize(bool bSimulate)
{
if (m_bInitialized)
return true;
m_bSimulate = bSimulate;
if (!IsSDVFrameworkEnvironmentSet())
{
// if SDV_FRAMEWORK_RUNTIME environment variable is not set we need to set the Framework Runtime directory
m_appcontrol.SetFrameworkRuntimeDirectory("../../bin");
}
if (!m_appcontrol.Startup(""))
return false;
m_appcontrol.SetConfigMode();
bool bResult = LoadConfigFile("Load dispatch service: ", "data_dispatch_vehicle_abstraction.toml");
bResult &= LoadConfigFile("Load task_timer_vehicle: ", "task_timer_vehicle.toml");
if (bSimulate)
{
bResult &= LoadConfigFile("Load can_com_simulation_vehicle_abstraction_kmh: ", "can_com_simulation_vehicle_abstraction_kmh.toml");
bResult &= LoadConfigFile("Load data_link_vehicle_abstraction: ", "data_link_vehicle_abstraction.toml");
bResult &= LoadConfigFile("Load vehicle_abstraction_kmh: ", "vehicle_abstraction_device_kmh.toml");
}
else
{
bResult &= LoadConfigFile("Load can_com_simulation_vehicle_abstraction_ms: ", "can_com_simulation_vehicle_abstraction_ms.toml");
bResult &= LoadConfigFile("Load data_link_vehicle_abstraction: ", "data_link_vehicle_abstraction.toml");
bResult &= LoadConfigFile("Load vehicle_abstraction_ms: ", "vehicle_abstraction_device_ms.toml");
}
bResult &= LoadConfigFile("Load vehicle_abstraction_basic_service: ", "vehicle_abstraction_basic_service.toml");
if (!bResult)
{
SDV_LOG_ERROR("One or more configurations could not be loaded. Cannot continue.");
return false;
}
m_bInitialized = true;
return true;
}
void CAbstractionControl::Shutdown()
{
if (!m_bInitialized)
m_appcontrol.Shutdown();
m_bInitialized = false;
}
void CAbstractionControl::SetRunningMode()
{
m_appcontrol.SetRunningMode();
}

View File

@@ -0,0 +1,60 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include <string>
#include <support/app_control.h>
#include <support/signal_support.h>
/**
* @brief Application Class of the vehicle abstraction example
*/
class CAbstractionControl
{
public:
/**
* @brief Start and initialize the application control and load
* platform abstraction components and basic services
* @param[in] bSimulate If signals should be simulated or CAN input signals should be used
* @return Return true on success otherwise false
*/
bool Initialize(bool bSimulate);
/**
* @brief After initialization/configuration the system mode needs to be set to running mode
*/
void SetRunningMode();
/**
* @brief Shutdown the system.
*/
void Shutdown();
private:
/**
* @brief check if SDV_FRAMEWORK_RUNTIME environment variable exists
* @return Return true if environment variable is found otherwise false
*/
bool IsSDVFrameworkEnvironmentSet();
/**
* @brief Load config file and register vehicle device and basic service.
* @param[in] inputMsg message string to be printed on console in case of success and failure
* @param[in] configFileName config toml file name
* @return Return true on success otherwise false
*/
bool LoadConfigFile(const std::string& inputMsg, const std::string& configFileName);
sdv::app::CAppControl m_appcontrol; ///< App-control of SDV V-API.
bool m_bInitialized = false; ///< Set when initialized.
bool m_bSimulate = false;
};

View File

@@ -0,0 +1,47 @@
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include <iostream>
#include <cstdlib> // for std::strtol
#include <fstream>
#include <filesystem>
#include <sstream>
#include <ostream>
#include "vehicle_abstraction_application.h"
#include "console.h"
#if defined(_WIN32) && defined(_UNICODE)
extern "C" int wmain([[maybe_unused]] int argc, [[maybe_unused]] wchar_t* argv[])
{
#else
extern "C" int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
{
#endif
CConsole visual_obj;
CAbstractionControl appobj;
if (!appobj.Initialize(visual_obj.SelectInputDataUnits()))
{
std::cout << "ERROR: Failed to initialize application control." << std::endl;
return 0;
}
visual_obj.PrintHeader();
visual_obj.PrepareDataConsumers();
appobj.SetRunningMode();
visual_obj.RunUntilBreak();
visual_obj.ResetSignals();
appobj.Shutdown();
return 0;
}

View File

@@ -0,0 +1,4 @@
;Class name;Function name;Signal name;vss;Signal direction;type;DBC CAN name includes CAN message name
;;;;;;;
VD;VehicleSpeedKmh;Speed;vehicleSpeed;Vehicle.Speed;RX;float;CAN_Input.Speed_General
BS;VehicleSpeed;Speed;vehicleSpeed;Vehicle.Speed;RX;float;Vehicle.Speed
1 Class name Function name Signal name vss Signal direction type DBC CAN name includes CAN message name
2
3 VD VehicleSpeedKmh Speed vehicleSpeed Vehicle.Speed RX float CAN_Input.Speed_General
4 BS VehicleSpeed Speed vehicleSpeed Vehicle.Speed RX float Vehicle.Speed

View File

@@ -0,0 +1,115 @@
VERSION "PrivateCAN"
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_
BS_:
BU_: abstraction
VAL_TABLE_ Fault_Codes 27 "UKWN" 26 "VEHSPDMAX_EXDD" 25 "STS_ALIVE" 24 "STEER_NOT_E2E_MODE" 23 "OTA_SPD" 22 "OTA_TIMER_DOWNLOAD_FAILED" 21 "OTA_MAX_TIME" 20 "CUBIXAD_STEERSTREQ_NOTACTV" 19 "CUBIXAD_DRVSTREQ_NOTACTV" 18 "SFTYDRV_INTV" 17 "LSDC_ALIVE" 16 "CUBIXAD_ALIVE" 15 "IBC_MAB_NO_PRIO" 14 "IBC_NOT_RDY" 13 "IBC_ALIVE" 12 "LSDC_GEAR" 11 "LSDC_SPD" 10 "LSDC_ACCL" 9 "IBC_NOT_MAB_MOD" 8 "GOLDBOX_ALIVE" 7 "CUBIXAD_GEAR" 6 "CUBIXAD_SPD_TESTTRACK" 5 "DRVREQCHG" 4 "RDY_TIMER" 3 "SFTY_CDN_FAILED" 2 "ACTVNCHK_SPD" 1 "ACTVNCHK_TIMR" 0 "NONE" ;
VAL_TABLE_ TestMapID 6 "E_TESTMAPID_UNDEFINED" 5 "E_TESTMAPID_TEST_DRIVE" 4 "E_TESTMAPID_AD_AREA" 3 "E_TESTMAPID_STUTT_ARENA" 2 "E_TESTMAPID_ZF_LASTMILE" 1 "E_TESTMAPID_ZF_TESTTRACK_2" 0 "E_TESTMAPID_NONE" ;
VAL_TABLE_ CtrlReqStates 7 "CtrlSts3b_RESERVED_4" 6 "CtrlSts3b_RESERVED_3" 5 "CtrlSts3b_RESERVED_2" 4 "CtrlSts3b_RESERVED_1" 3 "CtrlSts3b_ERROR" 2 "CtrlSts3b_CONTROL_REQUESTED" 1 "CtrlSts3b_CONTROL_NOT_REQUESTED" 0 "CtrlSts3b_INIT" ;
VAL_TABLE_ SteerActrReSts 7 "Diag" 6 "Inactive" 5 "Ramping" 4 "Yellow" 3 "Red" 2 "Normal" 1 "Pending" 0 "Initialisation" ;
VAL_TABLE_ SwtPark1 1 "SwtParkActv" 0 "SwtParkNotActv" ;
VAL_TABLE_ PE_State 2 "ERROR" 1 "INIT" 0 "NO_ERROR" ;
VAL_TABLE_ SSM_Req 7 "HMS_TAKEOVER" 6 "RESERVED" 5 "RELESE_VIA_RAMP" 4 "DRIVEOFF" 3 "HOLD_STANDBY" 2 "PARK" 1 "HOLD" 0 "NO_REQUEST" ;
VAL_TABLE_ IBC_StandStillMode 12 "SSM_ERROR" 11 "SSM_INIT" 10 "SSM_DRIVEOFF_STANDBY_ACTIVE" 9 "SSM_HOLD_STANDBY_ACTIVE" 8 "SSM_HILL_SLIPPOFF_DETECTED" 7 "SSM_RELEASE_REQ_FROM_DRIVER" 6 "SSM_RELEASE_REQ_ACTIVE" 5 "SSM_DRIVEOFF_ACTIVE" 4 "SSM_PARK_RETAINED_ACTIVE" 3 "SSM_PARK_ACTIVE" 2 "SSM_PARK_REQUESTED" 1 "SSM_HOLD_ACTIVE" 0 "SSM_NO_ACTIVE_FUNCTION" ;
VAL_TABLE_ AppTgtStDrv 3 "ACTIVE" 2 "READY" 1 "RESERVED" 0 "NOT_ACTIVE" ;
VAL_TABLE_ IBC_Status 4 "IBC_MAB_ERR_COMM" 3 "IBC_MAB_NO_PRIO" 2 "IBC_IN_MAB_MODE" 1 "IBC_READY" 0 "IBC_NOT_READY_FAILED" ;
VAL_TABLE_ GearLvrIndcn 7 "GearLvrIndcn2_Undefd" 6 "GearLvrIndcn2_Resd2" 5 "GearLvrIndcn2_Resd1" 4 "GearLvrIndcn2_ManModeIndcn" 3 "GearLvrIndcn2_DrvIndcn" 2 "GearLvrIndcn2_NeutIndcn" 1 "GearLvrIndcn2_RvsIndcn" 0 "GearLvrIndcn2_ParkIndcn" ;
VAL_TABLE_ LvlgAdjReq 7 "LvlgAdjReq_Resd2" 6 "LvlgAdjReq_Resd1" 5 "LvlgAdjReq_Ll2" 4 "LvlgAdjReq_Ll1" 3 "LvlgAdjReq_Nrh" 2 "LvlgAdjReq_Hl1" 1 "LvlgAdjReq_Hl2" 0 "LvlgAdjReq_Ukwn" ;
VAL_TABLE_ DrvModReq 15 "Err" 14 "Rock" 13 "Mud" 12 "Sand" 11 "Snow" 10 "Power" 9 "Hybrid" 8 "Pure_EV" 7 "Race" 6 "Adaptive" 5 "Offroad_CrossTerrain" 4 "Individual" 3 "Dynamic_Sport" 2 "Comfort_Normal" 1 "ECO" 0 "Undefd" ;
VAL_TABLE_ MAB_Info_Message 4 "DRV_GEARLVR_TO_P" 3 "DRV_P_TO_D" 2 "LSDC_DI_NOT_PSBL" 1 "LSDC_ENA_NOT_POSSIBLE" 0 "NONE" ;
VAL_TABLE_ MAB_OvrdTool_Sts 11 "HACKATHON" 10 "OTA" 9 "INIT" 8 "FINSHD" 7 "FLT" 6 "CUBIX_AD" 5 "SAVE_THE_SPOILER" 4 "LSDC" 3 "RDY" 2 "ACTVN_CHK" 1 "NO_MANIPULATION" 0 "NONE" ;
VAL_TABLE_ HMI_Drvr_Req 9 "FCT_DEACTVN_REQ" 8 "FCT_ACTVN_OTA_CFMD" 7 "FCT_ACTVN_OTA_REQ" 6 "FCT_ACTVN_SAVETHESPOILER_CFMD" 5 "FCT_ACTVN_SAVETHESPOILER_REQ" 4 "FCT_ACTVN_LSDC_CFMD" 3 "FCT_ACTVN_LSDC_REQ" 2 "FCT_ACTVN_CUBIXAD_CFMD" 1 "FCT_ACTVN_CUBIXAD_REQ" 0 "FCT_ACTVN_NONE" ;
VAL_TABLE_ Info_Message 4 "DRV_GEARLVR_TO_P" 3 "DRV_P_TO_D" 2 "LSDC_DI_NOT_PSBL" 1 "LSDC_ENA_NOT_POSSIBLE" 0 "NONE" ;
VAL_TABLE_ HMI_Fct_Req 8 "FCT_DEACTVN_REQ" 7 "FCT_ACTVN_OTA_REQ" 6 "FCT_ACTVN_SAVETHESPOILER_CFMD" 5 "FCT_ACTVN_SAVETHESPOILER_REQ" 4 "FCT_ACTVN_LSDC_CFMD" 3 "FCT_ACTVN_LSDC_REQ" 2 "FCT_ACTVN_AI4MTN_CFMD" 1 "FCT_ACTVN_AI4MTN_REQ" 0 "FCT_ACTVN_NONE" ;
VAL_TABLE_ SOVD_states 2 "SOVD_SHOWCASE_ACTIVE" 1 "SOVD_SHOWCASE_DEACTIVE" 0 "SOVD_NONE" ;
VAL_TABLE_ OTA_states 7 "OTA_DOWNLOAD_FAILED" 6 "OTA_INSTALL_FAILED" 5 "OTA_INSTALL_FINISHED" 4 "OTA_INSTALL_START" 3 "OTA_DOWNLOAD_START" 2 "OTA_SCHEDULED" 1 "OTA_STANDBY" 0 "OTA_NONE" ;
BO_ 1 CAN_Input: 8 Vector__XXX
SG_ Speed_General : 7|15@0+ (0.00391,0) [0|128.11897] "km/h" abstraction
CM_ SG_ 1 Speed_General "Vehicle speed used in a example to demonstrate vehicel abstraction. One data is in m/s, the otherdata is km/h";
BA_DEF_ "Baudrate" INT 1000 1000000;
BA_DEF_ "BusType" STRING ;
BA_DEF_ "DBName" STRING ;
BA_DEF_ "ProtocolType" STRING ;
BA_DEF_ BU_ "NmAsrNode" ENUM "No","Yes";
BA_DEF_ BU_ "NmAsrNodeIdentifier" INT 0 255;
BA_DEF_ BO_ "GenMsgCycleTime" INT 0 65536;
BA_DEF_ BO_ "GenMsgCycleTimeFast" FLOAT 0 300000;
BA_DEF_ BO_ "GenMsgDelayTime" INT 0 65536;
BA_DEF_ BO_ "GenMsgNrOfRepetition" INT 0 100000;
BA_DEF_ BO_ "GenMsgSendType" ENUM "cyclic","spontaneous","not-used","not-used","not-used","cyclicAndSpontaneous","not-used","cyclicIfActive","NoMsgSendType";
BA_DEF_ BO_ "GenMsgStartDelayTime" INT 0 65536;
BA_DEF_ SG_ "GenSigSendType" ENUM "Cyclic","OnWrite","OnWriteWithRepetition","OnChange","OnChangeWithRepetition","IfActive","IfActiveWithRepetition","NoSigSendType";
BA_DEF_ SG_ "GenSigStartValue" HEX 0 80000000;
BA_DEF_ BO_ "GenMsgILSupport" ENUM "No","Yes";
BA_DEF_ BO_ "NmAsrMessage" ENUM "No","Yes";
BA_DEF_ "NmAsrBaseAddress" HEX 0 536870911;
BA_DEF_ "NmAsrMessageCount" INT 0 255;
BA_DEF_ BU_ "NodeLayerModules" STRING ;
BA_DEF_ BU_ "ILused" ENUM "No","Yes";
BA_DEF_ SG_ "GenSigFuncType" ENUM "NoFunction","n/a","n/a","n/a","n/a","n/a","n/a","n/a","n/a","n/a","n/a","n/a","n/a","n/a","n/a","CHK","CNTR","n/a","n/a","n/a","CNTR_AR_01","CRC_AR_01_BOTH","CRC_AR_01_ALT","CRC_AR_01_LOW","CRC_AR_01_NIBBLE","CNTR_AR_04","CRC_AR_04A","CNTR_AR_05","CRC_AR_05";
BA_DEF_ SG_ "GenSigDataID" STRING ;
BA_DEF_ SG_ "SigGroup" STRING ;
BA_DEF_DEF_ "Baudrate" 1000;
BA_DEF_DEF_ "BusType" "";
BA_DEF_DEF_ "DBName" "";
BA_DEF_DEF_ "ProtocolType" "";
BA_DEF_DEF_ "NmAsrNode" "No";
BA_DEF_DEF_ "NmAsrNodeIdentifier" 0;
BA_DEF_DEF_ "GenMsgCycleTime" 0;
BA_DEF_DEF_ "GenMsgCycleTimeFast" 0;
BA_DEF_DEF_ "GenMsgDelayTime" 0;
BA_DEF_DEF_ "GenMsgNrOfRepetition" 0;
BA_DEF_DEF_ "GenMsgSendType" "NoMsgSendType";
BA_DEF_DEF_ "GenMsgStartDelayTime" 0;
BA_DEF_DEF_ "GenSigSendType" "NoSigSendType";
BA_DEF_DEF_ "GenSigStartValue" 0;
BA_DEF_DEF_ "GenMsgILSupport" "Yes";
BA_DEF_DEF_ "NmAsrMessage" "No";
BA_DEF_DEF_ "NmAsrBaseAddress" 1280;
BA_DEF_DEF_ "NmAsrMessageCount" 64;
BA_DEF_DEF_ "NodeLayerModules" "CANoeILNLSPA.dll";
BA_DEF_DEF_ "ILused" "Yes";
BA_DEF_DEF_ "GenSigFuncType" "NoFunction";
BA_DEF_DEF_ "GenSigDataID" "";
BA_DEF_DEF_ "SigGroup" "";
BA_ "ProtocolType" "CAN";
BA_ "BusType" "CAN";
BA_ "Baudrate" 500000;
BA_ "DBName" "PrivateCAN";

View File

@@ -0,0 +1,3 @@
;Class name;Function name;Signal name;vss;Signal direction;type;DBC CAN name includes CAN message name;
;;;;;;;;
VD;VehicleSpeedMs;Speed;vehicleSpeed;Vehicle.Speed;RX;float;CAN_Input.Speed_General;"float vehicleSpeed = value.get<float>() * 3.6f;"
1 Class name Function name Signal name vss Signal direction type DBC CAN name includes CAN message name
2
3 VD VehicleSpeedMs Speed vehicleSpeed Vehicle.Speed RX float CAN_Input.Speed_General float vehicleSpeed = value.get<float>() * 3.6f;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff