mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-15 17:48:16 +00:00
tunnel component & update vehicle abstraction example (#8)
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user