mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-20 03:08:17 +00:00
Update sdv_packager (#6)
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user