mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-10 07:40:22 +00:00
Update sdv_packager (#6)
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
#
|
||||
# Contributors:
|
||||
# Erik Verhoeven - initial API and implementation
|
||||
#*******************************************************************************
|
||||
|
||||
# Enforce CMake version 3.20
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
cmake_policy (VERSION 3.20)
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
#*******************************************************************************
|
||||
|
||||
# Enforce CMake version 3.20
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
cmake_policy (VERSION 3.20)
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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(HowToExamples)
|
||||
|
||||
# Use new policy for project version settings and default warning level
|
||||
|
||||
@@ -6,7 +6,6 @@ class DemoConfigurationComponent : public sdv::CSdvObject, public sdv::IObjectCo
|
||||
{
|
||||
public:
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
|
||||
@@ -8,5 +8,6 @@ Class = "Hello_Component"
|
||||
[[Component]]
|
||||
Path = "example_general_component.sdv"
|
||||
Class = "Hello_Component"
|
||||
[Component.Parameters]
|
||||
number = 42
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Class = "Hello_Component"
|
||||
[[Component]]
|
||||
Path = "example_general_component_with_initialization.sdv"
|
||||
Class = "Hello_Component_With_Initialization"
|
||||
[Component.Parameters]
|
||||
number = 42
|
||||
|
||||
[[Component]]
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_NAME("Access_Component")
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::BasicService);
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::basic_service);
|
||||
|
||||
/**
|
||||
* @brief Show messages, implements the function of IShowExample
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_NAME("BasicService_Component")
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::BasicService);
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::basic_service);
|
||||
|
||||
/**
|
||||
* @brief Set brake force
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_NAME("ComplexService_Component")
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::ComplexService);
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::complex_service);
|
||||
|
||||
/**
|
||||
* @brief Set speed
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
SDV_INTERFACE_ENTRY(ISayGoodbye)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Hello_Component")
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
class CTestComponentWithInitialization
|
||||
: public sdv::CSdvObject
|
||||
, public sdv::IObjectControl
|
||||
, public ISayHello
|
||||
, public ISayGoodbye
|
||||
{
|
||||
@@ -22,63 +21,30 @@ public:
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(ISayHello)
|
||||
SDV_INTERFACE_ENTRY(ISayGoodbye)
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Hello_Component_With_Initialization")
|
||||
|
||||
/**
|
||||
* @brief Initialize the object. Overload of sdv::IObjectControl::Initialize.
|
||||
* @param[in] ssObjectConfig Optional configuration string.
|
||||
*/
|
||||
inline virtual void Initialize(const sdv::u8string& ssObjectConfig) override
|
||||
{
|
||||
if (!ParseConfigurationString(ssObjectConfig))
|
||||
{
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
m_status = sdv::EObjectStatus::initialized;
|
||||
};
|
||||
// Parameter map
|
||||
BEGIN_SDV_PARAM_MAP()
|
||||
SDV_PARAM_ENTRY(m_Number, "number", -1, "", "A number")
|
||||
END_SDV_PARAM_MAP()
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(/*in*/ sdv::EOperationMode eMode) override
|
||||
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
|
||||
* @return Returns 'true' when the initialization was successful, 'false' when not.
|
||||
*/
|
||||
virtual bool OnInitialize() override
|
||||
{
|
||||
switch (eMode)
|
||||
{
|
||||
case sdv::EOperationMode::configuring:
|
||||
if (m_status == sdv::EObjectStatus::running || m_status == sdv::EObjectStatus::initialized)
|
||||
m_status = sdv::EObjectStatus::configuring;
|
||||
break;
|
||||
case sdv::EOperationMode::running:
|
||||
if (m_status == sdv::EObjectStatus::configuring || m_status == sdv::EObjectStatus::initialized)
|
||||
m_status = sdv::EObjectStatus::running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
|
||||
* @return Return the current status of the object.
|
||||
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
|
||||
*/
|
||||
inline virtual sdv::EObjectStatus GetStatus() const override
|
||||
{
|
||||
return m_status;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.
|
||||
*/
|
||||
inline virtual void Shutdown() override
|
||||
{
|
||||
m_status = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
virtual void OnShutdown() override
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Show messages, implements the function of IShowExample
|
||||
@@ -97,31 +63,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool ParseConfigurationString(const sdv::u8string& objectConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
sdv::toml::CTOMLParser config(objectConfig.c_str());
|
||||
|
||||
// get any settings from the configuration
|
||||
auto nodeNumber = config.GetDirect("number");
|
||||
if (nodeNumber.GetType() == sdv::toml::ENodeType::node_integer)
|
||||
{
|
||||
m_Number = static_cast<int32_t>(nodeNumber.GetValue());
|
||||
}
|
||||
}
|
||||
catch (const sdv::toml::XTOMLParseException& e)
|
||||
{
|
||||
std::cout << "Configuration could not be read:" << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cout << "Initialization number: " << std::to_string(m_Number) << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t m_Number = -1;
|
||||
std::atomic<sdv::EObjectStatus> m_status = { sdv::EObjectStatus::initialization_pending }; //!< To update the object status when it changes.
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CTestComponentWithInitialization)
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
SDV_INTERFACE_ENTRY(vss::Device::ITransferSignalBrakeForce)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::vehicle_bus)
|
||||
DECLARE_OBJECT_CLASS_NAME("VehicleDevice_Component")
|
||||
|
||||
~CVehicleDevice()
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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(AutoHeadlight)
|
||||
|
||||
# Use new policy for project version settings and default warning level
|
||||
@@ -128,7 +138,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/config/autoheadlight_cs.toml DESTINATION ${CMAK
|
||||
#
|
||||
# What cannot be created automatically is the method OpenAPILoad(const std::string& resources) in file model.cpp
|
||||
# The method must load all required components
|
||||
# Therfore here the file is copied and overwritten the auto generated file
|
||||
# Therefore here the file is copied and overwritten the auto generated file
|
||||
#
|
||||
# The required toml files need to be copied to the folder:
|
||||
# generated/fmu_DemoExampleFMU/DemoExampleFMU/resources
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 <fstream>
|
||||
#include <support/app_control.h>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "autoheadlight_console.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "autoheadlight_simulate.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 <string>
|
||||
#include <functional>
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
/**
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
@@ -1,27 +1,31 @@
|
||||
/********************************************************************************
|
||||
* 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 "autoheadlight_cs.h"
|
||||
|
||||
|
||||
CAutoHeadlightService::CAutoHeadlightService()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
CAutoHeadlightService::~CAutoHeadlightService()
|
||||
{
|
||||
Shutdown();
|
||||
}
|
||||
{}
|
||||
|
||||
void CAutoHeadlightService::Initialize(const sdv::u8string& ssObjectConfig)
|
||||
bool CAutoHeadlightService::OnInitialize()
|
||||
{
|
||||
m_eStatus = sdv::EObjectStatus::initializing;
|
||||
|
||||
// Request the basic service for the headlight.
|
||||
m_pHeadlightSvc = sdv::core::GetObject("Vehicle.Body.Light.Front.LowBeam_Service").GetInterface<vss::Vehicle::Body::Light::Front::LowBeamService::IVSS_SetHeadLightLowBeam>();
|
||||
if (!m_pHeadlightSvc)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_SetHeadlightLowBeam': [CAutoHeadlightService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Request the basic service for the steering wheel.
|
||||
@@ -29,8 +33,7 @@ void CAutoHeadlightService::Initialize(const sdv::u8string& ssObjectConfig)
|
||||
if (!pCurrentLatitudeSvc)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_GetCurrentLatitude': [CAutoHeadlightService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Request the basic service for the vehicle speed.
|
||||
@@ -38,8 +41,7 @@ void CAutoHeadlightService::Initialize(const sdv::u8string& ssObjectConfig)
|
||||
if (!pCurrentLongitudeSvc)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_GetCurrentLongitude': [CAutoHeadlightService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Register Current Latitude change event handler.
|
||||
@@ -49,32 +51,17 @@ void CAutoHeadlightService::Initialize(const sdv::u8string& ssObjectConfig)
|
||||
pCurrentLongitudeSvc->RegisterOnSignalChangeOfFCurrentLongitude(static_cast<vss::Vehicle::Position::CurrentLongitudeService::IVSS_SetCurrentLongitude_Event*> (this));
|
||||
|
||||
|
||||
if(LoadGPSBounds(ssObjectConfig))
|
||||
{
|
||||
SDV_LOG_INFO("AutoHeadlightService: GPS bounds loaded Successfully");
|
||||
m_eStatus = sdv::EObjectStatus::initialized;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDV_LOG_ERROR("AutoHeadlightService: GPS bounds could not be loaded");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
// Swap the bounding box the make certain that min is less than max
|
||||
if (m_SGPSBoundingBox.fTunnelMinLat > m_SGPSBoundingBox.fTunnelMaxLat)
|
||||
std::swap(m_SGPSBoundingBox.fTunnelMinLat, m_SGPSBoundingBox.fTunnelMaxLat);
|
||||
if (m_SGPSBoundingBox.fTunnelMinLon > m_SGPSBoundingBox.fTunnelMaxLon)
|
||||
std::swap(m_SGPSBoundingBox.fTunnelMinLon, m_SGPSBoundingBox.fTunnelMaxLon);
|
||||
|
||||
SDV_LOG_INFO("AutoHeadlightService: Initialized Successfully");
|
||||
return true;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CAutoHeadlightService::GetStatus() const
|
||||
{
|
||||
return m_eStatus;
|
||||
}
|
||||
|
||||
void CAutoHeadlightService::SetOperationMode(sdv::EOperationMode /*eMode*/)
|
||||
{
|
||||
// Not applicable
|
||||
}
|
||||
|
||||
void CAutoHeadlightService::Shutdown()
|
||||
void CAutoHeadlightService::OnShutdown()
|
||||
{
|
||||
// Unregister the Current latitude event handler.
|
||||
auto pCurrentLatitudeSvc = sdv::core::GetObject("Vehicle.Position.CurrentLatitude_Service").GetInterface<vss::Vehicle::Position::CurrentLatitudeService::IVSS_GetCurrentLatitude>();
|
||||
@@ -139,57 +126,6 @@ void CAutoHeadlightService::ProcessHeadlightBasedOnEgoPosition()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CAutoHeadlightService::LoadGPSBounds(const sdv::u8string& rssObjectConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
sdv::toml::CTOMLParser config(rssObjectConfig.c_str());
|
||||
|
||||
sdv::toml::CNode fStartLatNode = config.GetDirect("tunnel_start_lat");
|
||||
float fTunnelStartLat = 0.0; ///< Tunnel Start Latitude
|
||||
if (fStartLatNode.GetType() == sdv::toml::ENodeType::node_floating_point)
|
||||
{
|
||||
fTunnelStartLat = static_cast<float>(fStartLatNode.GetValue());
|
||||
}
|
||||
|
||||
sdv::toml::CNode fStartLonNode = config.GetDirect("tunnel_start_lon");
|
||||
float fTunnelStartLon = 0.0; ///< Tunnel Start Longitude
|
||||
if (fStartLonNode.GetType() == sdv::toml::ENodeType::node_floating_point)
|
||||
{
|
||||
fTunnelStartLon = static_cast<float>(fStartLonNode.GetValue());
|
||||
}
|
||||
|
||||
sdv::toml::CNode fEndLatNode = config.GetDirect("tunnel_end_lat");
|
||||
float fTunnelEndLat = 0.0; ///< Tunnel End Latitude
|
||||
if (fEndLatNode.GetType() == sdv::toml::ENodeType::node_floating_point)
|
||||
{
|
||||
fTunnelEndLat = static_cast<float>(fEndLatNode.GetValue());
|
||||
}
|
||||
|
||||
sdv::toml::CNode fEndLonNode = config.GetDirect("tunnel_end_lon");
|
||||
float fTunnelEndLon = 0.0; ///< Tunnel End Longitude
|
||||
if (fEndLonNode.GetType() == sdv::toml::ENodeType::node_floating_point)
|
||||
{
|
||||
fTunnelEndLon = static_cast<float>(fEndLonNode.GetValue());
|
||||
}
|
||||
|
||||
// Calculate bounding box
|
||||
m_SGPSBoundingBox.fTunnelMinLat = std::min(fTunnelStartLat, fTunnelEndLat);
|
||||
m_SGPSBoundingBox.fTunnelMaxLat = std::max(fTunnelStartLat, fTunnelEndLat);
|
||||
m_SGPSBoundingBox.fTunnelMinLon = std::min(fTunnelStartLon, fTunnelEndLon);
|
||||
m_SGPSBoundingBox.fTunnelMaxLon = std::max(fTunnelStartLon, fTunnelEndLon);
|
||||
}
|
||||
catch (const sdv::toml::XTOMLParseException& e)
|
||||
{
|
||||
SDV_LOG_ERROR("Parsing error: ", e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
IAutoheadlightService::SGPSBoundBox CAutoHeadlightService::GetGPSBoundBox() const
|
||||
{
|
||||
SGPSBoundBox tunnel;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 COMPLEX_SERVICE_EXAMPLE_H
|
||||
#define COMPLEX_SERVICE_EXAMPLE_H
|
||||
|
||||
@@ -35,7 +45,6 @@
|
||||
*/
|
||||
class CAutoHeadlightService :
|
||||
public sdv::CSdvObject,
|
||||
public sdv::IObjectControl,
|
||||
public IAutoheadlightService,
|
||||
public vss::Vehicle::Position::CurrentLatitudeService::IVSS_SetCurrentLatitude_Event,
|
||||
public vss::Vehicle::Position::CurrentLongitudeService::IVSS_SetCurrentLongitude_Event
|
||||
@@ -53,39 +62,35 @@ public:
|
||||
|
||||
// Interface map
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Position::CurrentLatitudeService::IVSS_SetCurrentLatitude_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Position::CurrentLongitudeService::IVSS_SetCurrentLongitude_Event)
|
||||
SDV_INTERFACE_ENTRY(IAutoheadlightService)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
// Object declarations
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::ComplexService)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::vehicle_function)
|
||||
DECLARE_OBJECT_CLASS_NAME("Auto Headlight Service")
|
||||
DECLARE_OBJECT_SINGLETON()
|
||||
|
||||
/**
|
||||
* @brief Initialize the object. Overload of sdv::IObjectControl::Initialize.
|
||||
* @param[in] ssObjectConfig Optional configuration string.
|
||||
*/
|
||||
void Initialize(const sdv::u8string& ssObjectConfig) override;
|
||||
// Parameter map
|
||||
BEGIN_SDV_PARAM_MAP()
|
||||
SDV_PARAM_ENABLE_LOCKING()
|
||||
SDV_PARAM_ENTRY(m_SGPSBoundingBox.fTunnelMinLat, "tunnel_start_lat", 0.0f, u8"<EFBFBD>", "Tunnel Start Latitude")
|
||||
SDV_PARAM_ENTRY(m_SGPSBoundingBox.fTunnelMinLon, "tunnel_start_lon", 0.0f, u8"<EFBFBD>", "Tunnel Start Longitude")
|
||||
SDV_PARAM_ENTRY(m_SGPSBoundingBox.fTunnelMaxLat, "tunnel_end_lat", 0.0f, u8"<EFBFBD>", "Tunnel End Latitude")
|
||||
SDV_PARAM_ENTRY(m_SGPSBoundingBox.fTunnelMaxLon, "tunnel_end_lon", 0.0f, u8"<EFBFBD>", "Tunnel End Longitude")
|
||||
END_SDV_PARAM_MAP()
|
||||
|
||||
/**
|
||||
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
|
||||
* @return Return the current status of the object.
|
||||
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
|
||||
* @return Returns 'true' when the initialization was successful, 'false' when not.
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
virtual bool OnInitialize() override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
|
||||
*/
|
||||
void SetOperationMode(sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.
|
||||
*/
|
||||
void Shutdown() override;
|
||||
virtual void OnShutdown() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -129,13 +134,11 @@ private:
|
||||
*/
|
||||
bool LoadGPSBounds(const sdv::u8string& rssObjectConfig);
|
||||
|
||||
sdv::EObjectStatus m_eStatus = sdv::EObjectStatus::initialization_pending; ///< Current object status
|
||||
volatile float m_fCurrentLatitude = 0.0; ///< Current Latitude
|
||||
volatile float m_fCurrentLongitude = 0.0; ///< Current Longitude
|
||||
volatile bool m_bHeadlight = false; ///< Headlight status
|
||||
SGPSBoundBox m_SGPSBoundingBox; ///< Tunnel bounding box coordinates
|
||||
|
||||
|
||||
///< Headlight interface.
|
||||
vss::Vehicle::Body::Light::Front::LowBeamService::IVSS_SetHeadLightLowBeam* m_pHeadlightSvc = nullptr;
|
||||
};
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* @file AutoHeadlight.idl
|
||||
* @details Auto Headlight example service interface definition.
|
||||
*/
|
||||
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief AutoHeadlight example service interface. The interface provides functions for the
|
||||
* @details Auto Headlight example service interface definition.
|
||||
* Auto Headlight example complex service.
|
||||
*/
|
||||
interface IAutoheadlightService
|
||||
|
||||
@@ -4,6 +4,7 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "autoheadlight_service.sdv"
|
||||
Class = "Auto Headlight Service"
|
||||
[Component.Parameters]
|
||||
tunnel_start_lat = 47.6500
|
||||
tunnel_start_lon = 9.4700
|
||||
tunnel_end_lat = 47.6506
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file model.cpp
|
||||
* @date 2025-09-12 15:01:57
|
||||
|
||||
@@ -4,6 +4,7 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "autoheadlight_service.sdv"
|
||||
Class = "Auto Headlight Service"
|
||||
[Component.Parameters]
|
||||
tunnel_start_lat = 31.300
|
||||
tunnel_start_lon = 3.756
|
||||
tunnel_end_lat = 21.168
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
#*******************************************************************************
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
/********************************************************************************
|
||||
* 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 <support/component_impl.h>
|
||||
#include <support/toml.h>
|
||||
|
||||
class DemoConfigurationComponent : public sdv::CSdvObject, public sdv::IObjectControl
|
||||
class DemoConfigurationComponent : public sdv::CSdvObject
|
||||
{
|
||||
public:
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
public:
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Configuration_Example")
|
||||
|
||||
/**
|
||||
* @brief initialize function to register, access the task timer interface from platform abstraction.
|
||||
* After initialization 'CreateTimer' function is called to execute the task periodically.
|
||||
* @param[in] rssObjectConfig An object configuration is currently not used by this demo component.
|
||||
*/
|
||||
virtual void Initialize([[maybe_unused]] const sdv::u8string& rssObjectConfig) override
|
||||
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
|
||||
* @return Returns 'true' when the initialization was successful, 'false' when not.
|
||||
*/
|
||||
virtual bool OnInitialize() override
|
||||
{
|
||||
try
|
||||
{
|
||||
sdv::toml::CTOMLParser config(rssObjectConfig.c_str());
|
||||
sdv::toml::CTOMLParser config(GetObjectConfig());
|
||||
|
||||
sdv::toml::CNode messageNode = config.GetDirect("Message");
|
||||
if (messageNode.GetType() == sdv::toml::ENodeType::node_string)
|
||||
@@ -89,53 +94,19 @@ class DemoConfigurationComponent : public sdv::CSdvObject, public sdv::IObjectCo
|
||||
{
|
||||
SDV_LOG_ERROR("Parsing error: ", e.what());
|
||||
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
PrintAllVariables();
|
||||
|
||||
m_status = sdv::EObjectStatus::initialized;
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
virtual sdv::EObjectStatus GetStatus() const override
|
||||
{
|
||||
return m_status;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
|
||||
*/
|
||||
void SetOperationMode(/*in*/ sdv::EOperationMode eMode)
|
||||
{
|
||||
switch (eMode)
|
||||
{
|
||||
case sdv::EOperationMode::configuring:
|
||||
if (m_status == sdv::EObjectStatus::running || m_status == sdv::EObjectStatus::initialized)
|
||||
m_status = sdv::EObjectStatus::configuring;
|
||||
break;
|
||||
case sdv::EOperationMode::running:
|
||||
if (m_status == sdv::EObjectStatus::configuring || m_status == sdv::EObjectStatus::initialized)
|
||||
m_status = sdv::EObjectStatus::running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Shutdown function is to shutdown the execution of periodic task.
|
||||
* Timer ID of the task is used to shutdown the specific task.
|
||||
*/
|
||||
virtual void Shutdown() override
|
||||
{
|
||||
m_status = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
virtual void OnShutdown() override
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Print all global variables to console
|
||||
@@ -160,8 +131,6 @@ class DemoConfigurationComponent : public sdv::CSdvObject, public sdv::IObjectCo
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic<sdv::EObjectStatus> m_status = {sdv::EObjectStatus::initialization_pending}; //!< To update the object status when it changes.
|
||||
|
||||
std::string m_Message { "" };
|
||||
std::string m_JSONConfig { "" };
|
||||
int32_t m_Id { -1 };
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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(ConfigurationTestApp)
|
||||
|
||||
# Use new policy for project version settings and default warning level
|
||||
|
||||
@@ -4,6 +4,7 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "configuration_component_example.sdv"
|
||||
Class = "Configuration_Example"
|
||||
[Component.Parameters]
|
||||
Message = "It's me"
|
||||
### the following is a valid JSON structure in a muliline string
|
||||
JSONConfig = """{
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 <fstream>
|
||||
#include <support/app_control.h>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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(DoorDemoExample)
|
||||
|
||||
# Use new policy for project version settings and default warning level
|
||||
@@ -19,7 +29,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/config/front_left_door_example.toml DESTINATION
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/front_right_door_example.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/rear_left_door_example.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/rear_right_door_example.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/door_comple_service.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/door_complex_service.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/data_link_door.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
|
||||
# Copy the ASC files used by can_com_sim.sdv which includes the CAN messages
|
||||
@@ -32,77 +42,85 @@ file (COPY ${PROJECT_SOURCE_DIR}/door_example_receiver.asc DESTINATION ${CMAKE_B
|
||||
# preparation
|
||||
######################################################################################################################################################################
|
||||
|
||||
# Execute sdv_vss_util to create IDL files for devices and basic services.
|
||||
message("Create interface code for devices and basic services of doors example.")
|
||||
execute_process(COMMAND "${SDV_VSS_UTIL}" "${PROJECT_SOURCE_DIR}/vss_doors_example.csv" "-O${PROJECT_SOURCE_DIR}/generated/" --prefixdoors --version1.0.0.1 --enable_components)
|
||||
|
||||
|
||||
message("Compiling Interface Door01Left RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door01Right RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Left RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Right RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
|
||||
message("Compiling Interface Door01Left TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door01Right TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle01right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Left TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Right TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/interfaces/vss_vehiclechassisdooraxle02right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/interfaces/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
# Execute the IDL compiler for the complex service to digest interface code.
|
||||
message("Compiling door_ifc.idl")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/door_service/door_ifc.idl" "-O${PROJECT_SOURCE_DIR}/generated/door_service/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Iexample_service/ --ps_lib_namedoors_service_proxystub)
|
||||
|
||||
add_subdirectory(interfaces/ps)
|
||||
add_subdirectory(generated/door_service/ps)
|
||||
add_subdirectory(generated/vss_files/ps)
|
||||
|
||||
add_subdirectory(vd/vd_front_door_left)
|
||||
add_subdirectory(vd/vd_front_door_right)
|
||||
add_subdirectory(vd/vd_rear_door_left)
|
||||
add_subdirectory(vd/vd_rear_door_right)
|
||||
add_subdirectory(generated/vss_files/vd_frontdoorleft)
|
||||
add_subdirectory(generated/vss_files/vd_frontdoorright)
|
||||
add_subdirectory(generated/vss_files/vd_reardoorleft)
|
||||
add_subdirectory(generated/vss_files/vd_reardoorright)
|
||||
|
||||
add_subdirectory(bs/bs_front_door_left)
|
||||
add_subdirectory(bs/bs_front_door_right)
|
||||
add_subdirectory(bs/bs_rear_door_left)
|
||||
add_subdirectory(bs/bs_rear_door_right)
|
||||
add_subdirectory(generated/vss_files/bs_frontdoorleft)
|
||||
add_subdirectory(generated/vss_files/bs_frontdoorright)
|
||||
add_subdirectory(generated/vss_files/bs_reardoorleft)
|
||||
add_subdirectory(generated/vss_files/bs_reardoorright)
|
||||
|
||||
add_subdirectory(can_dl_door)
|
||||
# Execute sdv_dbc_util to create data link code & FMU code.
|
||||
message("Create data link for doors example")
|
||||
execute_process(COMMAND ${SDV_DBC_UTIL} "${PROJECT_SOURCE_DIR}/datalink_4doors_example.dbc" "-O${PROJECT_SOURCE_DIR}/generated/" --nodesdoors --version1.0.0.1 --moduleDoorsExampleFMU --dl_lib_namecan_dl_doors)
|
||||
|
||||
add_subdirectory(generated/can_dl)
|
||||
|
||||
|
||||
######################################################################################################################################################################
|
||||
# complex service
|
||||
######################################################################################################################################################################
|
||||
|
||||
include_directories(interfaces)
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/door_app/include)
|
||||
|
||||
message("Include: proxy/stub for complex doors service")
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/generated/door_service)
|
||||
add_subdirectory(generated/door_service/ps)
|
||||
|
||||
add_library(door_complex_service SHARED
|
||||
add_library(doors_complex_service SHARED
|
||||
door_service/complex_service.h
|
||||
door_service/complex_service.cpp
|
||||
door_service/lock_doors_thread.h)
|
||||
|
||||
set_target_properties(door_complex_service PROPERTIES OUTPUT_NAME "door_complex_service")
|
||||
set_target_properties(door_complex_service PROPERTIES PREFIX "")
|
||||
set_target_properties(door_complex_service PROPERTIES SUFFIX ".sdv")
|
||||
set_target_properties(doors_complex_service PROPERTIES OUTPUT_NAME "doors_complex_service")
|
||||
set_target_properties(doors_complex_service PROPERTIES PREFIX "")
|
||||
set_target_properties(doors_complex_service PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
######################################################################################################################################################################
|
||||
# executable
|
||||
@@ -152,19 +170,18 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
######################################################################################################################################################################
|
||||
# create instance 3002 of door demo example
|
||||
######################################################################################################################################################################
|
||||
add_custom_target(vehicle_device_doors_config
|
||||
ALL
|
||||
DEPENDS
|
||||
can_dl_door
|
||||
doors_vd_frontdoorleft
|
||||
doors_vd_frontdoorright
|
||||
doors_vd_reardoorleft
|
||||
doors_vd_reardoorright
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL VehicleDeviceDoors --instance3002 can_dl_door.sdv doors_vd_frontdoorleft.sdv doors_vd_frontdoorright.sdv doors_vd_reardoorleft.sdv doors_vd_reardoorright.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --interface_config --overwrite
|
||||
can_dl_doors
|
||||
doors_vd_frontdoorleft_rx
|
||||
doors_vd_frontdoorright_rx
|
||||
doors_vd_reardoorleft_rx
|
||||
doors_vd_reardoorright_rx
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL VehicleDeviceDoors --instance3002 can_dl_doors.sdv doors_vd_frontdoorleft_rx.sdv doors_vd_frontdoorright_rx.sdv doors_vd_reardoorleft_rx.sdv doors_vd_reardoorright_rx.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --interface_config --overwrite
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
@@ -172,31 +189,29 @@ add_custom_target(basic_service_doors_config
|
||||
ALL
|
||||
DEPENDS
|
||||
doors_proxystub
|
||||
doors_bs_frontdoorleft
|
||||
doors_bs_frontdoorright
|
||||
doors_bs_reardoorleft
|
||||
doors_bs_reardoorright
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL BasicServiceDoors --instance3002 doors_proxystub.sdv doors_bs_frontdoorleft.sdv doors_bs_frontdoorright.sdv doors_bs_reardoorleft.sdv doors_bs_reardoorright.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --abstract_config --overwrite
|
||||
doors_bs_frontdoorleft_rx
|
||||
doors_bs_frontdoorright_rx
|
||||
doors_bs_reardoorleft_rx
|
||||
doors_bs_reardoorright_rx
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL BasicServiceDoors --instance3002 doors_proxystub.sdv doors_bs_frontdoorleft_rx.sdv doors_bs_frontdoorright_rx.sdv doors_bs_reardoorleft_rx.sdv doors_bs_reardoorright_rx.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --abstract_config --overwrite
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(door_complex_service_config
|
||||
ALL
|
||||
DEPENDS
|
||||
door_complex_service
|
||||
doors_complex_service
|
||||
doors_service_proxystub
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL DoorComplexService --instance3002 door_complex_service.sdv doors_service_proxystub.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --user_config --overwrite
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL DoorsComplexService --instance3002 doors_complex_service.sdv doors_service_proxystub.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --user_config --overwrite
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(platform_doors_config
|
||||
ALL
|
||||
COMMAND "${SDV_PACKAGER}" CONFIGURE ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml --instance3002 --platform_config
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
######################################################################################################################################################################
|
||||
# TODO: SDV_PACKAGER does not create the toml files, therefore we need to copy them
|
||||
######################################################################################################################################################################
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/door_demo.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3002)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3002)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/settings.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3002)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_abstract.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3002)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_ifc.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3002)
|
||||
|
||||
######################################################################################################################################################################
|
||||
# the FMU files have been created via the dbc file
|
||||
@@ -211,5 +226,5 @@ file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_ifc.toml DESTINATION ${SDV_F
|
||||
# ...\fmu_Doors2ExampleFMU\Doors2ExampleFMU\model.cpp
|
||||
# ...\fmu_Doors2ExampleFMU\Doors4ExampleFMU\model.cpp
|
||||
######################################################################################################################################################################
|
||||
add_subdirectory(fmu_Doors2ExampleFMU)
|
||||
add_subdirectory(fmu_Doors4ExampleFMU)
|
||||
add_subdirectory(fmu_Doors2ExampleFMU)
|
||||
add_subdirectory(fmu_Doors4ExampleFMU)
|
||||
|
||||
@@ -4,6 +4,7 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "can_com_sim.sdv"
|
||||
Class = "CAN_Com_Sim"
|
||||
[Component.Parameters]
|
||||
Source="door_example_receiver.asc"
|
||||
Target="door_example_writer.asc"
|
||||
|
||||
|
||||
10
examples/door_demo_example/config/door_complex_service.toml
Normal file
10
examples/door_demo_example/config/door_complex_service.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_complex_service.sdv"
|
||||
Class = "Doors Example Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Device"
|
||||
Path = "doors_vd_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Service"
|
||||
|
||||
Path = "doors_bs_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Device"
|
||||
Path = "doors_vd_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Service"
|
||||
Path = "doors_bs_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Left_Device"
|
||||
Path = "doors_vd_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Left_Service"
|
||||
Path = "doors_bs_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Right_Device"
|
||||
Path = "doors_vd_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Right_Service"
|
||||
Path = "doors_bs_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Service"
|
||||
|
||||
@@ -4,6 +4,7 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "can_com_sim.sdv"
|
||||
Class = "CAN_Com_Sim"
|
||||
[Component.Parameters]
|
||||
Source="door_example_receiver.asc"
|
||||
Target="door_example_writer.asc"
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "include/console.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -131,7 +141,7 @@ bool CConsole::PrepareDataConsumers()
|
||||
}
|
||||
}
|
||||
|
||||
auto basicServiceL1 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_GetIsOpen>();
|
||||
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]");
|
||||
@@ -142,29 +152,29 @@ bool CConsole::PrepareDataConsumers()
|
||||
/* Interface exists -> Clean the line for Console window */
|
||||
PrintText(g_sBasicServiceL1, " ");
|
||||
}
|
||||
basicServiceL1->RegisterOnSignalChangeOfLeftDoorIsOpen01(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceL1->RegisterOnSignalChangeOfLeftDoorIsOpen01(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetIsOpenL1_Event*> (this));
|
||||
bool value = false;
|
||||
PrintValue(g_sFrontLeftDoorIsLocked, "Front Left Latch:", value, (value ? "locked" : "unlocked"));
|
||||
|
||||
// all other doors are optional
|
||||
auto basicServiceR1 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_GetIsOpen>();
|
||||
auto basicServiceR1 = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_GetIsOpenR1>();
|
||||
if (basicServiceR1)
|
||||
{
|
||||
basicServiceR1->RegisterOnSignalChangeOfRightDoorIsOpen01(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceR1->RegisterOnSignalChangeOfRightDoorIsOpen01(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetIsOpenR1_Event*> (this));
|
||||
PrintValue(g_sFrontRightDoorIsLocked, "Front Right Latch:", value, (value ? "locked" : "unlocked"));
|
||||
}
|
||||
|
||||
auto basicServiceL2 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_GetIsOpen>();
|
||||
auto basicServiceL2 = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_GetIsOpenL2>();
|
||||
if (basicServiceL2)
|
||||
{
|
||||
basicServiceL2->RegisterOnSignalChangeOfLeftDoorIsOpen02(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceL2->RegisterOnSignalChangeOfLeftDoorIsOpen02(dynamic_cast<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetIsOpenL2_Event*> (this));
|
||||
PrintValue(g_sRearLeftDoorIsLocked, "Rear Left Latch:", value, (value ? "locked" : "unlocked"));
|
||||
}
|
||||
|
||||
auto basicServiceR2 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_GetIsOpen>();
|
||||
auto basicServiceR2 = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_GetIsOpenR2>();
|
||||
if (basicServiceR2)
|
||||
{
|
||||
basicServiceR2->RegisterOnSignalChangeOfRightDoorIsOpen02(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceR2->RegisterOnSignalChangeOfRightDoorIsOpen02(dynamic_cast<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event*> (this));
|
||||
PrintValue(g_sRearRightDoorIsLocked, "Rear Right Latch:", value, (value ? "locked" : "unlocked"));
|
||||
}
|
||||
|
||||
@@ -196,25 +206,26 @@ void CConsole::ResetSignals()
|
||||
SetCursorPos(g_sCursor);
|
||||
|
||||
// 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.Chassis.Door.Axle01.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_IsOpen>();
|
||||
auto vehicleDevice =
|
||||
sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface < vss::Vehicle::Body::Door::Axle::_01 ::LeftDevice::IVSS_IsOpen > ();
|
||||
if (vehicleDevice)
|
||||
vehicleDevice->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
vehicleDevice->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
|
||||
auto basicServiceL1 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_GetIsOpen>();
|
||||
auto basicServiceL1 = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_GetIsOpenL1>();
|
||||
if (basicServiceL1)
|
||||
basicServiceL1->UnregisterOnSignalChangeOfLeftDoorIsOpen01(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceL1->UnregisterOnSignalChangeOfLeftDoorIsOpen01(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetIsOpenL1_Event*> (this));
|
||||
|
||||
auto basicServiceR1 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_GetIsOpen>();
|
||||
auto basicServiceR1 = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_GetIsOpenR1>();
|
||||
if (basicServiceR1)
|
||||
basicServiceR1->UnregisterOnSignalChangeOfRightDoorIsOpen01(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceR1->UnregisterOnSignalChangeOfRightDoorIsOpen01(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetIsOpenR1_Event*> (this));
|
||||
|
||||
auto basicServiceL2 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_GetIsOpen>();
|
||||
auto basicServiceL2 = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_GetIsOpenL2>();
|
||||
if (basicServiceL2)
|
||||
basicServiceL2->UnregisterOnSignalChangeOfLeftDoorIsOpen02(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceL2->UnregisterOnSignalChangeOfLeftDoorIsOpen02(dynamic_cast<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetIsOpenL2_Event*> (this));
|
||||
|
||||
auto basicServiceR2 = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_GetIsOpen>();
|
||||
auto basicServiceR2 = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_GetIsOpenR2>();
|
||||
if (basicServiceR2)
|
||||
basicServiceR2->UnregisterOnSignalChangeOfRightDoorIsOpen02(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
basicServiceR2->UnregisterOnSignalChangeOfRightDoorIsOpen02(dynamic_cast<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event*> (this));
|
||||
|
||||
// Unregister the data link signalss
|
||||
if (m_SignalFrontLeftDoorIsOpen)
|
||||
@@ -327,13 +338,13 @@ 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.Chassis.Door.Axle01.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_IsOpen>();
|
||||
auto vehicleDevice = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_IsOpen>();
|
||||
if (!vehicleDevice)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'LeftDevice::IVSS_IsOpen': [CConsole]");
|
||||
return false;
|
||||
}
|
||||
vehicleDevice->RegisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
vehicleDevice->RegisterIsOpenEvent(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "../door_app/include/door_application.h"
|
||||
#include "../door_app/include/signal_names.h"
|
||||
|
||||
@@ -126,7 +136,7 @@ bool CDoorControl::Initialize(const uint32_t numberOfDoors)
|
||||
}
|
||||
}
|
||||
|
||||
bResult &= LoadConfigFile("Load door service (complex service): ", "door_comple_service.toml");
|
||||
bResult &= LoadConfigFile("Load door service (complex service): ", "door_complex_service.toml");
|
||||
|
||||
if (!bResult)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "../door_app/include/door_application.h"
|
||||
#include "../door_app/include/console.h"
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "../door_app/include/door_extern_application.h"
|
||||
#include "../door_app/include/signal_names.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "../door_app/include/door_extern_application.h"
|
||||
#include "../door_app/include/console.h"
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
@@ -12,29 +22,30 @@
|
||||
#include "signal_names.h"
|
||||
#include <fcntl.h>
|
||||
#include <atomic>
|
||||
#include "../interfaces/vss_vehiclechassisdooraxle01left_vd_rx.h"
|
||||
#include "../interfaces/vss_vehiclechassisdooraxle01left_bs_rx.h"
|
||||
#include "../interfaces/vss_vehiclechassisdooraxle01right_bs_rx.h"
|
||||
#include "../interfaces/vss_vehiclechassisdooraxle02left_bs_rx.h"
|
||||
#include "../interfaces/vss_vehiclechassisdooraxle02right_bs_rx.h"
|
||||
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_01left_vd_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.h"
|
||||
|
||||
#ifdef __unix__
|
||||
#include <termios.h> // Needed for tcgetattr and fcntl
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "../generated/door_service/door_ifc.h"
|
||||
#include "../../generated/door_service/door_ifc.h"
|
||||
|
||||
/**
|
||||
* @brief Console operation class.
|
||||
* @details This class retrieves RX data from the data dispatch service, vehicle device & basic service of front left door on event change.
|
||||
* Furthermore, it shows TX value by polling the RX signals.
|
||||
*/
|
||||
class CConsole : public vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event
|
||||
class CConsole : public vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_WriteIsOpen_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetIsOpenL1_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetIsOpenR1_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetIsOpenL2_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
@@ -9,14 +19,14 @@
|
||||
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.Chassis.Door.Axle01.Left
|
||||
static std::string dsRightDoorIsOpen01 = "CAN_Input_R1.Door01RightIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle01.Right
|
||||
static std::string dsLeftDoorIsOpen02 = "CAN_Input_L2.Door02LeftIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle02.Left
|
||||
static std::string dsRightDoorIsOpen02 = "CAN_Input_R2.Door02RightIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle02.Right
|
||||
static std::string dsLeftLatch01 = "CAN_Output.LockDoor01Left"; ///< bool TX Vehicle.Chassis.TX.Door.Axle01.Left
|
||||
static std::string dsRightLatch01 = "CAN_Output.LockDoor01Right"; ///< bool TX Vehicle.Chassis.TX.Door.Axle01.Right
|
||||
static std::string dsLeftLatch02 = "CAN_Output.LockDoor02Left"; ///< bool TX Vehicle.Chassis.TX.Door.Axle02.Left
|
||||
static std::string dsRightLatch02 = "CAN_Output.LockDoor02Right"; ///< bool TX Vehicle.Chassis.TX.Door.Axle02.Left
|
||||
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
|
||||
|
||||
|
||||
@@ -1,119 +1,113 @@
|
||||
/********************************************************************************
|
||||
* 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 "complex_service.h"
|
||||
|
||||
void CDoorsExampleService::Initialize(const sdv::u8string& /*ssObjectConfig*/)
|
||||
bool CDoorsExampleService::OnInitialize()
|
||||
{
|
||||
m_eStatus = sdv::EObjectStatus::initializing;
|
||||
|
||||
// Request the basic service for front left door.
|
||||
auto pFrontLeftDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_GetIsOpen>();
|
||||
auto pFrontLeftDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_GetIsOpenL1>();
|
||||
if (pFrontLeftDoorSvc)
|
||||
{
|
||||
// Register front left door change event handler.
|
||||
pFrontLeftDoorSvc->RegisterOnSignalChangeOfLeftDoorIsOpen01(static_cast<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
pFrontLeftDoorSvc->RegisterOnSignalChangeOfLeftDoorIsOpen01(static_cast<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetIsOpenL1_Event*> (this));
|
||||
}
|
||||
|
||||
// Request the basic service for front right door.
|
||||
auto pFrontRightDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_GetIsOpen>();
|
||||
auto pFrontRightDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_GetIsOpenR1>();
|
||||
if (pFrontRightDoorSvc)
|
||||
{
|
||||
// Register front right door change event handler.
|
||||
pFrontRightDoorSvc->RegisterOnSignalChangeOfRightDoorIsOpen01(static_cast<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
pFrontRightDoorSvc->RegisterOnSignalChangeOfRightDoorIsOpen01(static_cast<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetIsOpenR1_Event*> (this));
|
||||
}
|
||||
|
||||
// Request the basic service for rear left door.
|
||||
auto pRearLeftDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_GetIsOpen>();
|
||||
auto pRearLeftDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_GetIsOpenL2>();
|
||||
if (pRearLeftDoorSvc)
|
||||
{
|
||||
// Register rear left door change event handler.
|
||||
pRearLeftDoorSvc->RegisterOnSignalChangeOfLeftDoorIsOpen02(static_cast<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
pRearLeftDoorSvc->RegisterOnSignalChangeOfLeftDoorIsOpen02(static_cast<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetIsOpenL2_Event*> (this));
|
||||
}
|
||||
|
||||
// Request the basic service for front right door.
|
||||
auto pRearRightDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_GetIsOpen>();
|
||||
auto pRearRightDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_GetIsOpenR2>();
|
||||
if (pRearRightDoorSvc)
|
||||
{
|
||||
// Register rear right door change event handler.
|
||||
pRearRightDoorSvc->RegisterOnSignalChangeOfRightDoorIsOpen02(static_cast<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
pRearRightDoorSvc->RegisterOnSignalChangeOfRightDoorIsOpen02(static_cast<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event*> (this));
|
||||
}
|
||||
|
||||
// Request the basic service for locking the front left door.
|
||||
m_pFrontLeftDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetLock>();
|
||||
m_pFrontLeftDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetLock>();
|
||||
|
||||
// Request the basic service for locking the front right door.
|
||||
m_pFrontRightDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetLock>();
|
||||
m_pFrontRightDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetLock>();
|
||||
|
||||
// Request the basic service for locking the rear left door.
|
||||
m_pRearLeftDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetLock>();
|
||||
m_pRearLeftDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetLock>();
|
||||
|
||||
// Request the basic service for locking the rear right door.
|
||||
m_pRearRightDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetLock>();
|
||||
m_pRearRightDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetLock>();
|
||||
|
||||
// Validate if we have the Open/Closed signal and the Lock/Unlock door signal, both must exist together or both must not exist
|
||||
// Front left door is an exception, it isalways required
|
||||
// Front left door is an exception, it is always required
|
||||
if ((!pFrontLeftDoorSvc) || (!m_pFrontLeftDoorSvc))
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interfaces for 'Front left door': [CDoorsExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((pFrontRightDoorSvc == nullptr) != (m_pFrontRightDoorSvc == nullptr))
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get both interfaces for 'Front right door': [CDoorsExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((pRearLeftDoorSvc == nullptr) != (m_pRearLeftDoorSvc == nullptr))
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get both interfaces for 'Rear left door': [CDoorsExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((pRearRightDoorSvc == nullptr) != (m_pRearRightDoorSvc == nullptr))
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get both interfaces for 'Rear right door': [CDoorsExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_doorsThread.start(m_Interval);
|
||||
m_eStatus = sdv::EObjectStatus::initialized;
|
||||
return true;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CDoorsExampleService::GetStatus() const
|
||||
{
|
||||
return m_eStatus;
|
||||
}
|
||||
|
||||
void CDoorsExampleService::SetOperationMode(sdv::EOperationMode /*eMode*/)
|
||||
{
|
||||
// Not applicable
|
||||
}
|
||||
|
||||
void CDoorsExampleService::Shutdown()
|
||||
void CDoorsExampleService::OnShutdown()
|
||||
{
|
||||
// Unregister front left door change event handler.
|
||||
auto pFrontLeftDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_GetIsOpen>();
|
||||
auto pFrontLeftDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_GetIsOpenL1>();
|
||||
if (pFrontLeftDoorSvc)
|
||||
pFrontLeftDoorSvc->UnregisterOnSignalChangeOfLeftDoorIsOpen01(static_cast<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
pFrontLeftDoorSvc->UnregisterOnSignalChangeOfLeftDoorIsOpen01(static_cast<vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetIsOpenL1_Event*> (this));
|
||||
|
||||
// Unregister front right door change event handler.
|
||||
auto pFrontRightDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_GetIsOpen>();
|
||||
auto pFrontRightDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_GetIsOpenR1>();
|
||||
if (pFrontRightDoorSvc)
|
||||
pFrontRightDoorSvc->UnregisterOnSignalChangeOfRightDoorIsOpen01(static_cast<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
pFrontRightDoorSvc->UnregisterOnSignalChangeOfRightDoorIsOpen01(static_cast<vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetIsOpenR1_Event*> (this));
|
||||
|
||||
// Unregister rear left door change event handler.
|
||||
auto pRearLeftDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_GetIsOpen>();
|
||||
auto pRearLeftDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Left_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_GetIsOpenL2>();
|
||||
if (pRearLeftDoorSvc)
|
||||
pRearLeftDoorSvc->UnregisterOnSignalChangeOfLeftDoorIsOpen02(static_cast<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event*> (this));
|
||||
pRearLeftDoorSvc->UnregisterOnSignalChangeOfLeftDoorIsOpen02(static_cast<vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetIsOpenL2_Event*> (this));
|
||||
|
||||
// Unregister rear right door change event handler.
|
||||
auto pRearRightDoorSvc = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Service").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_GetIsOpen>();
|
||||
auto pRearRightDoorSvc = sdv::core::GetObject("Vehicle.Body.Door.Axle._02.Right_Service").GetInterface<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_GetIsOpenR2>();
|
||||
if (pRearRightDoorSvc)
|
||||
pRearRightDoorSvc->UnregisterOnSignalChangeOfRightDoorIsOpen02(static_cast<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event*> (this));
|
||||
pRearRightDoorSvc->UnregisterOnSignalChangeOfRightDoorIsOpen02(static_cast<vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event*> (this));
|
||||
|
||||
m_doorsThread.stop();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 DOORS_COMPLEX_SERVICE_EXAMPLE_H
|
||||
#define DOORS_COMPLEX_SERVICE_EXAMPLE_H
|
||||
|
||||
@@ -8,15 +18,15 @@
|
||||
#include <support/signal_support.h>
|
||||
#include <support/timer.h>
|
||||
|
||||
// VSS interfaces - located in ../interfaces
|
||||
#include "vss_vehiclechassisdooraxle01left_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle01left_bs_tx.h"
|
||||
#include "vss_vehiclechassisdooraxle01right_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle01right_bs_tx.h"
|
||||
#include "vss_vehiclechassisdooraxle02left_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle02left_bs_tx.h"
|
||||
#include "vss_vehiclechassisdooraxle02right_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle02right_bs_tx.h"
|
||||
// VSS interfaces - located in ../generated/vss_files/
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01left_bs_tx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01right_bs_tx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02left_bs_tx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02right_bs_tx.h"
|
||||
|
||||
#include "lock_doors_thread.h"
|
||||
|
||||
@@ -26,11 +36,10 @@
|
||||
* @brief Doors example service: locks/unlocks doors after closing/opening doors
|
||||
*/
|
||||
class CDoorsExampleService : public sdv::CSdvObject
|
||||
, public sdv::IObjectControl
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetIsOpenL1_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetIsOpenR1_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetIsOpenL2_Event
|
||||
, public vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event
|
||||
, public IDoorService
|
||||
{
|
||||
public:
|
||||
@@ -43,48 +52,32 @@ public:
|
||||
* @brief Destructor
|
||||
*/
|
||||
~CDoorsExampleService()
|
||||
{
|
||||
// Just in case...
|
||||
Shutdown();
|
||||
}
|
||||
{}
|
||||
|
||||
// Interface map
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetIsOpenL1_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetIsOpenR1_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetIsOpenL2_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetIsOpenR2_Event)
|
||||
SDV_INTERFACE_ENTRY(IDoorService)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
// Object declarations
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::ComplexService)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::vehicle_function)
|
||||
DECLARE_OBJECT_CLASS_NAME("Doors Example Service")
|
||||
DECLARE_OBJECT_SINGLETON()
|
||||
|
||||
/**
|
||||
* @brief Initialize the object. Overload of sdv::IObjectControl::Initialize.
|
||||
* @param[in] ssObjectConfig Optional configuration string.
|
||||
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
|
||||
* @return Returns 'true' when the initialization was successful, 'false' when not.
|
||||
*/
|
||||
void Initialize(const sdv::u8string& ssObjectConfig) override;
|
||||
virtual bool OnInitialize() override;
|
||||
|
||||
/**
|
||||
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
|
||||
* @return Return the current status of the object.
|
||||
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.
|
||||
*/
|
||||
void Shutdown() override;
|
||||
virtual void OnShutdown() override;
|
||||
|
||||
/**
|
||||
* @brief Set leftDoorIsOpen signal (front door)
|
||||
@@ -166,8 +159,6 @@ private:
|
||||
*/
|
||||
void LockDoors(const bool lock) const;
|
||||
|
||||
sdv::EObjectStatus m_eStatus = sdv::EObjectStatus::initialization_pending; ///< Current object status
|
||||
|
||||
bool m_bFrontLeftDoorIsOpen = false; ///< Front Left Door Status
|
||||
bool m_bFrontRightDoorIsOpen = false; ///< Front Right Door Status
|
||||
bool m_bRearLeftDoorIsOpen = false; ///< Rear Left Door Status
|
||||
@@ -176,10 +167,10 @@ private:
|
||||
bool m_bAllDoorsAreLocked = false; ///< state for locked/unlocked of all doors
|
||||
|
||||
///< Door lock interfaces.
|
||||
vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetLock* m_pFrontLeftDoorSvc = nullptr; ///< Front Left Door
|
||||
vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetLock* m_pFrontRightDoorSvc = nullptr; ///< Front Right Door
|
||||
vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetLock* m_pRearLeftDoorSvc = nullptr; ///< Rear Left Door
|
||||
vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetLock* m_pRearRightDoorSvc = nullptr; ///< Rear Right Door
|
||||
vss::Vehicle::Body::Door::Axle::_01::LeftService::IVSS_SetLock* m_pFrontLeftDoorSvc = nullptr; ///< Front Left Door
|
||||
vss::Vehicle::Body::Door::Axle::_01::RightService::IVSS_SetLock* m_pFrontRightDoorSvc = nullptr; ///< Front Right Door
|
||||
vss::Vehicle::Body::Door::Axle::_02::LeftService::IVSS_SetLock* m_pRearLeftDoorSvc = nullptr; ///< Rear Left Door
|
||||
vss::Vehicle::Body::Door::Axle::_02::RightService::IVSS_SetLock* m_pRearRightDoorSvc = nullptr; ///< Rear Right Door
|
||||
|
||||
LockDoorsThread m_doorsThread; ///< timer thread
|
||||
uint32_t m_Interval = 18; ///< interval value * 100 = x milliseconds
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* @file door_ifc.idl
|
||||
* @details Door service interface definition.
|
||||
*/
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @brief DoorService example service interface. The interface provides functions for the
|
||||
* @details Door service interface definition.
|
||||
* Doors example complex service.
|
||||
*/
|
||||
interface IDoorService
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
/********************************************************************************
|
||||
* 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 LOCK_DOORS_THREAD_H
|
||||
#define LOCK_DOORS_THREAD_H
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
|
||||
# @file CMakeLists.txt
|
||||
# This file is cmake project file.
|
||||
# This file was generated by the DBC utility from:
|
||||
# datalink_2doors_example.dbc
|
||||
# DBC file version: 1.0.0.1
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
#*******************************************************************************
|
||||
|
||||
|
||||
# Based on CMakeLists.txt from https://github.com/modelica/Reference-FMUs
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file config.h
|
||||
* @date 2025-09-06 15:15:34
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file model.cpp
|
||||
* @date 2025-09-06 15:15:34
|
||||
@@ -137,7 +147,7 @@ bool OpenAPILoad(const std::string& resources)
|
||||
|
||||
success &= g_appcontrol->LoadConfig("front_left_door_example.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
success &= g_appcontrol->LoadConfig("front_right_door_example.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
success &= g_appcontrol->LoadConfig("door_comple_service.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
success &= g_appcontrol->LoadConfig("door_complex_service.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
|
||||
g_appcontrol->SetRunningMode();
|
||||
return success;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_complex_service.sdv"
|
||||
Class = "Doors Example Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Device"
|
||||
Path = "doors_vd_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Service"
|
||||
Path = "doors_bs_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Device"
|
||||
Path = "doors_vd_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Service"
|
||||
Path = "doors_bs_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Service"
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
@file signal_identifier.h
|
||||
@date 2025-09-06 15:15:34
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
|
||||
# @file CMakeLists.txt
|
||||
# This file is cmake project file.
|
||||
# This file was generated by the DBC utility from:
|
||||
# datalink_4doors_example.dbc
|
||||
# DBC file version: 1.0.0.1
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
#*******************************************************************************
|
||||
|
||||
|
||||
# Based on CMakeLists.txt from https://github.com/modelica/Reference-FMUs
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file config.h
|
||||
* @date 2025-09-06 14:55:42
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file model.cpp
|
||||
* @date 2025-09-06 14:55:42
|
||||
@@ -164,7 +174,7 @@ bool OpenAPILoad(const std::string& resources)
|
||||
success &= g_appcontrol->LoadConfig("front_right_door_example.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
success &= g_appcontrol->LoadConfig("rear_left_door_example.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
success &= g_appcontrol->LoadConfig("rear_right_door_example.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
success &= g_appcontrol->LoadConfig("door_comple_service.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
success &= g_appcontrol->LoadConfig("door_complex_service.toml") == sdv::core::EConfigProcessResult::successful;
|
||||
|
||||
g_appcontrol->SetRunningMode();
|
||||
return success;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_complex_service.sdv"
|
||||
Class = "Doors Example Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Device"
|
||||
Path = "doors_vd_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Service"
|
||||
Path = "doors_bs_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Service"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Device"
|
||||
Path = "doors_vd_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Service"
|
||||
Path = "doors_bs_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Service"
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Left_Device"
|
||||
Path = "doors_vd_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Left_Service"
|
||||
Path = "doors_bs_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Service"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Right_Device"
|
||||
Path = "doors_vd_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Right_Service"
|
||||
Path = "doors_bs_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Service"
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
@file signal_identifier.h
|
||||
@date 2025-09-06 14:55:42
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
@@ -96,7 +106,7 @@ set_target_properties(trunk_complex_service PROPERTIES PREFIX "")
|
||||
set_target_properties(trunk_complex_service PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
######################################################################################################################################################################
|
||||
# basic_system trunk application
|
||||
# open trunk application
|
||||
######################################################################################################################################################################
|
||||
|
||||
# Define the executable
|
||||
@@ -118,32 +128,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
else()
|
||||
target_link_libraries(open_trunk_example Rpcrt4.lib)
|
||||
endif()
|
||||
#[[
|
||||
|
||||
######################################################################################################################################################################
|
||||
# open trunk application
|
||||
######################################################################################################################################################################
|
||||
|
||||
# Define the executable
|
||||
add_executable(system_trunk_example
|
||||
example_app/system_trunk_example.cpp
|
||||
example_app/control.h
|
||||
example_app/control.cpp
|
||||
example_app/console.h
|
||||
example_app/console.cpp
|
||||
example_app/signal_names.h
|
||||
)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if (WIN32)
|
||||
target_link_libraries(system_trunk_example Ws2_32 Winmm Rpcrt4.lib)
|
||||
else()
|
||||
target_link_libraries(system_trunk_example ${CMAKE_DL_LIBS} rt ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(system_trunk_example Rpcrt4.lib)
|
||||
endif()
|
||||
#]]
|
||||
# Copy the config files
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/can_com_simulation_trunk.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/config/complex_service_trunk.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/config)
|
||||
@@ -197,14 +182,11 @@ add_custom_target(trunk_user_config
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
######################################################################################################################################################################
|
||||
# TODO: SDV_PACKAGER does not create the toml files, therefore we need to copy them
|
||||
######################################################################################################################################################################
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/trunk.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3005)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3005)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/settings.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3005)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_abstract.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3005)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_ifc.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3005)
|
||||
add_custom_target(trunk_platform_config
|
||||
ALL
|
||||
COMMAND "${SDV_PACKAGER}" CONFIGURE ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml --instance3005 --platform_config
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "can_com_sim.sdv"
|
||||
Class = "CAN_Com_Sim"
|
||||
[Component.Parameters]
|
||||
Source="open_trunk_receiver.asc"
|
||||
Target="open_trunk_writer.asc"
|
||||
|
||||
@@ -4,5 +4,6 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "can_com_sim.sdv"
|
||||
Class = "CAN_Com_Sim"
|
||||
[Component.Parameters]
|
||||
Source="open_trunk_receiver.asc"
|
||||
Target="open_trunk_writer.asc"
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
@@ -138,10 +148,14 @@ bool CConsole::PrepareDataConsumers()
|
||||
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");
|
||||
else
|
||||
PrintText(g_sComplexServcie1, "Basic Service NOT available");
|
||||
|
||||
m_pITrunkComplexService = sdv::core::GetObject("Open Trunk Service").GetInterface<ITrunkKitService>();
|
||||
if (m_pITrunkComplexService)
|
||||
m_pTrunkComplexService = sdv::core::GetObject("Open Trunk Service").GetInterface<ITrunkKitService>();
|
||||
if (m_pTrunkComplexService)
|
||||
PrintText(g_sComplexServcie2, "Complex Service available");
|
||||
else
|
||||
PrintText(g_sComplexServcie2, "Complex Service NOT available");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -290,9 +304,9 @@ void CConsole::RunUntilBreak()
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (m_pITrunkComplexService)
|
||||
if (m_pTrunkComplexService)
|
||||
{
|
||||
if (m_pITrunkComplexService->PopTrunk())
|
||||
if (m_pTrunkComplexService->PopTrunk())
|
||||
PrintText(g_sComplexServcie2, "Safety open trunk via complex service.");
|
||||
else
|
||||
PrintText(g_sComplexServcie2, "Safety open trunk via complex service failed, car is moving");
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
@@ -152,7 +162,7 @@ private:
|
||||
float m_SpeedBS = 0.0; ///< Speed Data Link
|
||||
|
||||
vss::Vehicle::Body::TrunkService::IVSS_SetOpen* m_pTrunkSvc = nullptr; ///< Front Left Door
|
||||
ITrunkKitService* m_pITrunkComplexService = nullptr; ///< Trunk Service interface pointer.
|
||||
ITrunkKitService* m_pTrunkComplexService = nullptr; ///< Trunk Service interface pointer.
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "trunk_application.h"
|
||||
#include "signal_names.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "trunk_application.h"
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
/********************************************************************************
|
||||
* 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 "complex_service.h"
|
||||
|
||||
|
||||
void CTrunkExampleService::Initialize(const sdv::u8string& /*ssObjectConfig*/)
|
||||
bool CTrunkExampleService::OnInitialize()
|
||||
{
|
||||
m_eStatus = sdv::EObjectStatus::initializing;
|
||||
|
||||
// Request the basic service for speed.
|
||||
auto pSpeedSvc = sdv::core::GetObject("Vehicle.Speed_Service").GetInterface<vss::Vehicle::SpeedService::IVSS_GetSpeed>();
|
||||
if (pSpeedSvc)
|
||||
@@ -20,24 +28,12 @@ void CTrunkExampleService::Initialize(const sdv::u8string& /*ssObjectConfig*/)
|
||||
if ((!pSpeedSvc) || (!m_pTrunkSvc))
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interfaces : [CTrunkExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_eStatus = sdv::EObjectStatus::initialized;
|
||||
return true;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CTrunkExampleService::GetStatus() const
|
||||
{
|
||||
return m_eStatus;
|
||||
}
|
||||
|
||||
void CTrunkExampleService::SetOperationMode(sdv::EOperationMode /*eMode*/)
|
||||
{
|
||||
// Not applicable
|
||||
}
|
||||
|
||||
void CTrunkExampleService::Shutdown()
|
||||
void CTrunkExampleService::OnShutdown()
|
||||
{
|
||||
// Unregister trunk change event handler.
|
||||
auto pSpeedSvc = sdv::core::GetObject("Vehicle.Speed_Service").GetInterface<vss::Vehicle::SpeedService::IVSS_GetSpeed>();
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 TRUNK_COMPLEX_SERVICE_EXAMPLE_H
|
||||
#define TRUNK_COMPLEX_SERVICE_EXAMPLE_H
|
||||
|
||||
@@ -22,7 +32,6 @@
|
||||
* Output call for basic service: opening the trunk
|
||||
*/
|
||||
class CTrunkExampleService : public sdv::CSdvObject
|
||||
, public sdv::IObjectControl
|
||||
, public vss::Vehicle::SpeedService::IVSS_SetSpeed_Event
|
||||
, public ITrunkKitService
|
||||
{
|
||||
@@ -36,45 +45,29 @@ public:
|
||||
* @brief Destructor
|
||||
*/
|
||||
~CTrunkExampleService()
|
||||
{
|
||||
// Just in case...
|
||||
Shutdown();
|
||||
}
|
||||
{}
|
||||
|
||||
// Interface map
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::SpeedService::IVSS_SetSpeed_Event)
|
||||
SDV_INTERFACE_ENTRY(ITrunkKitService)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
// Object declarations
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::ComplexService)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::vehicle_function)
|
||||
DECLARE_OBJECT_CLASS_NAME("Open Trunk Service")
|
||||
DECLARE_OBJECT_SINGLETON()
|
||||
|
||||
/**
|
||||
* @brief Initialize the object. Overload of sdv::IObjectControl::Initialize.
|
||||
* @param[in] ssObjectConfig Optional configuration string.
|
||||
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
|
||||
* @return Returns 'true' when the initialization was successful, 'false' when not.
|
||||
*/
|
||||
void Initialize(const sdv::u8string& ssObjectConfig) override;
|
||||
virtual bool OnInitialize() override;
|
||||
|
||||
/**
|
||||
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
|
||||
* @return Return the current status of the object.
|
||||
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.
|
||||
*/
|
||||
void Shutdown() override;
|
||||
virtual void OnShutdown() override;
|
||||
|
||||
/**
|
||||
* @brief Set vehicleSpeed signal
|
||||
@@ -89,9 +82,6 @@ public:
|
||||
virtual bool PopTrunk() override;
|
||||
|
||||
private:
|
||||
|
||||
sdv::EObjectStatus m_eStatus = sdv::EObjectStatus::initialization_pending; ///< Current object status
|
||||
|
||||
float m_Speed = 0.0; ///< Speed
|
||||
vss::Vehicle::Body::TrunkService::IVSS_SetOpen* m_pTrunkSvc = nullptr; ///< Trunk
|
||||
};
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* @file trunkkit.idl
|
||||
* @details Service interface definition to open the trunk.
|
||||
*/
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief Service to open the trunk
|
||||
* @details Service interface definition to open the trunk.
|
||||
*/
|
||||
interface ITrunkKitService
|
||||
{
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
@@ -205,16 +215,11 @@ add_custom_target(example_user_config
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
######################################################################################################################################################################
|
||||
# TODO: SDV_PACKAGER does not create the toml files, therefore we need to copy them
|
||||
######################################################################################################################################################################
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/demo.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/settings.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_abstract.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_ifc.toml DESTINATION ${SDV_FRAMEWORK_RUNTIME}/3001)
|
||||
|
||||
|
||||
add_custom_target(example_platform_config
|
||||
ALL
|
||||
COMMAND "${SDV_PACKAGER}" CONFIGURE ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml --instance3001 --platform_config
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
######################################################################################################################################################################
|
||||
# system demo fmu for OpenXilEnv
|
||||
@@ -224,7 +229,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/vehicle_ifc.toml DESTINATION ${SDV_F
|
||||
#
|
||||
# What cannot be created automatically is the method OpenAPILoad(const std::string& resources) in file model.cpp
|
||||
# The method must load all required components
|
||||
# Therfore here the file is copied and overwritten the auto generated file
|
||||
# Therefore here the file is copied and overwritten the auto generated file
|
||||
#
|
||||
# The required toml files need to be copied to the folder:
|
||||
# generated/fmu_DemoExampleFMU/DemoExampleFMU/resources
|
||||
|
||||
@@ -4,5 +4,6 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "can_com_sim.sdv"
|
||||
Class = "CAN_Com_Sim"
|
||||
[Component.Parameters]
|
||||
Source="system_demo_receiver.asc"
|
||||
Target="system_demo_writer.asc"
|
||||
|
||||
@@ -4,6 +4,7 @@ Version = 100
|
||||
[[Component]]
|
||||
Path = "can_com_sim.sdv"
|
||||
Class = "CAN_Com_Sim"
|
||||
[Component.Parameters]
|
||||
Source="system_demo_receiver.asc"
|
||||
Target="system_demo_writer.asc"
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "control.h"
|
||||
|
||||
CExampleControl::~CExampleControl()
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 EXMAPLE_UTILITY_H
|
||||
#define EXMAPLE_UTILITY_H
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
#ifdef __unix__
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 <string>
|
||||
#include <filesystem>
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 "complex_service.h"
|
||||
|
||||
@@ -8,22 +18,17 @@ CCounterSteeringExampleService::CCounterSteeringExampleService()
|
||||
}
|
||||
|
||||
CCounterSteeringExampleService::~CCounterSteeringExampleService()
|
||||
{
|
||||
// Just in case...
|
||||
Shutdown();
|
||||
}
|
||||
{}
|
||||
|
||||
void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectConfig*/)
|
||||
bool CCounterSteeringExampleService::OnInitialize()
|
||||
{
|
||||
m_eStatus = sdv::EObjectStatus::initializing;
|
||||
|
||||
// Request the basic service for monitoring the alive counter.
|
||||
m_pAliveCounterSvc = sdv::core::GetObject("Vehicle.Software.Application.IsActiveCounter_Service").GetInterface<vss::Vehicle::Software::Application::IsActiveCounterService::IVSS_SetCounter>();
|
||||
if (!m_pAliveCounterSvc)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_SetCounter': [CCounterSteeringExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
;
|
||||
}
|
||||
|
||||
// Request the basic service for the rear axle.
|
||||
@@ -31,8 +36,7 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
|
||||
if (!m_pRearAxleSvc)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_SetAngle': [CCounterSteeringExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Request the basic service for the steering wheel.
|
||||
@@ -40,8 +44,7 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
|
||||
if (!pSteeringWheelSvc)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_SetSteeringAngle': [CCounterSteeringExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Request the basic service for the vehicle speed.
|
||||
@@ -49,8 +52,7 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
|
||||
if (!pVehSpeedSvc)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_SetSpeed': [CCounterSteeringExampleService]");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Register steering wheel change event handler.
|
||||
@@ -64,26 +66,14 @@ void CCounterSteeringExampleService::Initialize(const sdv::u8string& /*ssObjectC
|
||||
if (!m_Timer)
|
||||
{
|
||||
SDV_LOG_ERROR("CCounterSteeringExampleService: tasktimer with 10 milliseconds could not be created.");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
SDV_LOG_INFO("CCounterSteeringExampleService: tasktimer created with 10 milliseconds");
|
||||
|
||||
m_eStatus = sdv::EObjectStatus::initialized;
|
||||
return true;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CCounterSteeringExampleService::GetStatus() const
|
||||
{
|
||||
return m_eStatus;
|
||||
}
|
||||
|
||||
void CCounterSteeringExampleService::SetOperationMode(sdv::EOperationMode /*eMode*/)
|
||||
{
|
||||
// Not applicable
|
||||
}
|
||||
|
||||
void CCounterSteeringExampleService::Shutdown()
|
||||
void CCounterSteeringExampleService::OnShutdown()
|
||||
{
|
||||
// Terminate the alive counter
|
||||
m_Timer.Reset();
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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 COMPLEX_SERVICE_EXAMPLE_H
|
||||
#define COMPLEX_SERVICE_EXAMPLE_H
|
||||
|
||||
@@ -35,7 +45,6 @@
|
||||
*/
|
||||
class CCounterSteeringExampleService :
|
||||
public sdv::CSdvObject,
|
||||
public sdv::IObjectControl,
|
||||
public vss::Vehicle::Chassis::SteeringWheel::AngleService::IVSS_SetSteeringWheel_Event,
|
||||
public vss::Vehicle::SpeedService::IVSS_SetSpeed_Event,
|
||||
public ICounterSteeringService
|
||||
@@ -53,39 +62,26 @@ public:
|
||||
|
||||
// Interface map
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::SteeringWheel::AngleService::IVSS_SetSteeringWheel_Event)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::SpeedService::IVSS_SetSpeed_Event)
|
||||
SDV_INTERFACE_ENTRY(ICounterSteeringService)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
// Object declarations
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::ComplexService)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::vehicle_function)
|
||||
DECLARE_OBJECT_CLASS_NAME("Counter Steering Example Service")
|
||||
DECLARE_OBJECT_SINGLETON()
|
||||
|
||||
/**
|
||||
* @brief Initialize the object. Overload of sdv::IObjectControl::Initialize.
|
||||
* @param[in] ssObjectConfig Optional configuration string.
|
||||
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
|
||||
* @return Returns 'true' when the initialization was successful, 'false' when not.
|
||||
*/
|
||||
void Initialize(const sdv::u8string& ssObjectConfig) override;
|
||||
virtual bool OnInitialize() override;
|
||||
|
||||
/**
|
||||
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
|
||||
* @return Return the current status of the object.
|
||||
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.
|
||||
*/
|
||||
void Shutdown() override;
|
||||
virtual void OnShutdown() override;
|
||||
|
||||
/**
|
||||
* @brief Set steering angle event. Overload of
|
||||
@@ -136,7 +132,6 @@ private:
|
||||
*/
|
||||
void TimerFunction();
|
||||
|
||||
sdv::EObjectStatus m_eStatus = sdv::EObjectStatus::initialization_pending; ///< Current object status
|
||||
volatile float m_fSteeringWheel = 0.0; ///< Steering wheel angle
|
||||
volatile float m_fVehSpeed = 0.0; ///< Vehicle speed
|
||||
volatile float m_fRearAxleAngle = 0.0; ///< Output rear angle
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* @file countersteering.idl
|
||||
* @details Counter steering example service interface definition.
|
||||
*/
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief Counter steering example service interface. The interface provides functions for the
|
||||
* @details Counter steering example service interface definition.
|
||||
* counter steering example complex service.
|
||||
*/
|
||||
interface ICounterSteeringService
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file model.cpp
|
||||
* @date 2025-04-16 09:03:47
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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
|
||||
#*******************************************************************************
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1,98 +1,61 @@
|
||||
/********************************************************************************
|
||||
* 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 <chrono>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/timer.h>
|
||||
#include <support/toml.h>
|
||||
|
||||
class DemoTimerComponent : public sdv::CSdvObject, public sdv::IObjectControl
|
||||
class DemoTimerComponent : public sdv::CSdvObject
|
||||
{
|
||||
public:
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Timer_Example")
|
||||
|
||||
BEGIN_SDV_PARAM_MAP()
|
||||
SDV_PARAM_ENTRY(m_PeriodicValue, "Timer", 10, "ms", "Periodic timer duration.")
|
||||
END_SDV_PARAM_MAP()
|
||||
|
||||
/**
|
||||
* @brief initialize function to register, access the task timer interface from platform abstraction.
|
||||
* @brief initialize function to register, access the task timer interface from platform abstraction. Overload of
|
||||
* sdv::CSdvObject::OnInitialize.
|
||||
* After initialization 'CreateTimer' function is called to execute the task periodically.
|
||||
* @param[in] ssObjectConfig An object configuration is currently not used by this demo component.
|
||||
* @return Returns 'true' when the initialization was successful, 'false' when not.
|
||||
*/
|
||||
virtual void Initialize([[maybe_unused]] const sdv::u8string& ssObjectConfig) override
|
||||
virtual bool OnInitialize() override
|
||||
{
|
||||
try
|
||||
{
|
||||
sdv::toml::CTOMLParser config(ssObjectConfig.c_str());
|
||||
sdv::toml::CNode timerNode = config.GetDirect("Timer");
|
||||
if (timerNode.GetType() == sdv::toml::ENodeType::node_integer)
|
||||
{
|
||||
m_PeriodicValue = static_cast<uint32_t>(timerNode.GetValue());
|
||||
}
|
||||
}
|
||||
catch (const sdv::toml::XTOMLParseException& e)
|
||||
{
|
||||
SDV_LOG_ERROR("Parser error: ", e.what());
|
||||
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Timer = sdv::core::CTaskTimer(m_PeriodicValue, [&]() {CustomerExecute(); });
|
||||
if (!m_Timer)
|
||||
{
|
||||
SDV_LOG_ERROR("Tasktimer with ", std::to_string(m_PeriodicValue), " milliseconds could not be created.");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDV_LOG_INFO("Tasktimer created with ", std::to_string(m_PeriodicValue), " milliseconds");
|
||||
}
|
||||
m_status = sdv::EObjectStatus::initialized;
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
virtual sdv::EObjectStatus GetStatus() const override
|
||||
{
|
||||
return m_status;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(/*in*/ sdv::EOperationMode eMode)
|
||||
{
|
||||
switch (eMode)
|
||||
{
|
||||
case sdv::EOperationMode::configuring:
|
||||
if (m_status == sdv::EObjectStatus::running || m_status == sdv::EObjectStatus::initialized)
|
||||
m_status = sdv::EObjectStatus::configuring;
|
||||
break;
|
||||
case sdv::EOperationMode::running:
|
||||
if (m_status == sdv::EObjectStatus::configuring || m_status == sdv::EObjectStatus::initialized)
|
||||
m_status = sdv::EObjectStatus::running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Shutdown function is to shutdown the execution of periodic task.
|
||||
* @brief Shutdown function is to shutdown the execution of periodic task. Overload of sdv::CSdvObject::OnShutdown.
|
||||
* Timer ID of the task is used to shutdown the specific task.
|
||||
*/
|
||||
virtual void Shutdown() override
|
||||
virtual void OnShutdown() override
|
||||
{
|
||||
if (m_Timer)
|
||||
{
|
||||
m_Timer.Reset();
|
||||
}
|
||||
m_status = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +68,6 @@ class DemoTimerComponent : public sdv::CSdvObject, public sdv::IObjectControl
|
||||
};
|
||||
|
||||
private:
|
||||
std::atomic<sdv::EObjectStatus> m_status = {sdv::EObjectStatus::initialization_pending}; //!< To update the object status when it changes.
|
||||
sdv::core::CTaskTimer m_Timer; ///< timer
|
||||
uint32_t m_PeriodicValue = 10; ///< periodix in milliseconds
|
||||
};
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#*******************************************************************************
|
||||
# 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(TaskTimerApp)
|
||||
|
||||
# Use new policy for project version settings and default warning level
|
||||
|
||||
@@ -8,6 +8,7 @@ Class = "SimulationTaskTimerService"
|
||||
[[Component]]
|
||||
Path = "tasktimer_component_example.sdv"
|
||||
Class = "Timer_Example"
|
||||
[Component.Parameters]
|
||||
Timer = 175
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Class = "TaskTimerService"
|
||||
[[Component]]
|
||||
Path = "tasktimer_component_example.sdv"
|
||||
Class = "Timer_Example"
|
||||
[Component.Parameters]
|
||||
Timer = 175
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user