Update sdv_packager (#6)

This commit is contained in:
tompzf
2026-03-27 14:12:49 +01:00
committed by GitHub
parent 234be8917f
commit aefefd52f7
717 changed files with 42252 additions and 11334 deletions

View File

@@ -12,6 +12,7 @@ Class = "DataDispatchService"
[[Component]]
Path = "can_com_silkit.sdv"
Class = "CAN_Com_SilKit"
[Component.Parameters]
DebugInfo = true
SyncMode = true
SilKitParticipantName = "CAN1"

View File

@@ -1,5 +1,15 @@
#*******************************************************************************
# 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
#*******************************************************************************
# Only build on MSVC/Windows or 64-bit Linux (not ARM)
if((WIN32 AND NOT MSVC) OR (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"))
if((WIN32 AND MSVC) OR (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"))
project(ManualTestCanComSilKit)

View File

@@ -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 TEST_CAN_SILKIT_HELPER_H
#define TEST_CAN_SILKIT_HELPER_H
@@ -22,9 +32,9 @@ class CTestCanSilKit : public CCANSilKit
return CCANSilKit::Initialize(ssObjectConfig);
}
virtual sdv::EObjectStatus GetStatus() const override
virtual sdv::EObjectState GetObjectState() const override
{
return CCANSilKit::GetStatus();
return CCANSilKit::GetObjectState();
}
virtual void Shutdown() override

View File

@@ -1,3 +1,15 @@
REM /********************************************************************************
REM * Copyright (c) 2025-2026 ZF Friedrichshafen AG
REM *
REM * This program and the accompanying materials are made available under the
REM * terms of the Apache License Version 2.0 which is available at
REM * https://www.apache.org/licenses/LICENSE-2.0
REM *
REM * SPDX-License-Identifier: Apache-2.0
REM ********************************************************************************/
REM
REM
REM
@echo off
REM Run sil-kit-registry in a new Command Prompt window
start cmd /k "..\..\_deps\silkit-src\SilKit\bin\sil-kit-registry.exe"

View File

@@ -1,3 +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
# ********************************************************************************/
#
#
#!/bin/bash
# Run sil-kit-registry in a new terminal window

View File

@@ -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 "../../../../global/process_watchdog.h"
#include "../include/can_com_test_helper.h"
@@ -52,9 +62,9 @@ class CTestCANSilkit : public CCANSilKit
return CCANSilKit::GetInterfaces();
}
sdv::EObjectStatus GetTestStatus() const
sdv::EObjectState GetTestStatus() const
{
return CCANSilKit::GetStatus();
return CCANSilKit::GetObjectState();
}
uint64_t GetMessagesSent() const
@@ -104,7 +114,7 @@ bool InitializeAppControl(sdv::app::CAppControl* appcontrol, const std::string&
void InitializeCanComObject(CTestCANSilkit& canComObj, const std::string config, MockCANReceiver& mockRcv)
{
ASSERT_NO_THROW(canComObj.Initialize(config.c_str()));
EXPECT_EQ(canComObj.GetStatus(), sdv::EObjectStatus::initialized);
EXPECT_EQ(canComObj.GetObjectState(), sdv::EObjectState::initialized);
ASSERT_NO_THROW(canComObj.SetOperationMode(sdv::EOperationMode::configuring));
ASSERT_NO_THROW(canComObj.RegisterReceiver(&mockRcv));
EXPECT_NO_THROW(canComObj.SetOperationMode(sdv::EOperationMode::running));
@@ -147,12 +157,12 @@ TEST_F(CANSilkitTest, ValidConfigString)
)";
CTestCANSilkit canComObj;
ASSERT_NO_THROW(canComObj.Initialize(ssObjectConfig.c_str()));
ASSERT_EQ(canComObj.GetStatus(), sdv::EObjectStatus::initialized);
ASSERT_EQ(canComObj.GetObjectState(), sdv::EObjectState::initialized);
ASSERT_NO_THROW(canComObj.Send(testMsg, 0));
ASSERT_NO_THROW(canComObj.Shutdown());
ASSERT_EQ(canComObj.GetStatus(), sdv::EObjectStatus::shutdown_in_progress);
ASSERT_EQ(canComObj.GetObjectState(), sdv::EObjectState::shutdown_in_progress);
}
TEST_F(CANSilkitTest, InvalidConfigIdentifier)
@@ -176,10 +186,10 @@ TEST_F(CANSilkitTest, InvalidConfigIdentifier)
CTestCANSilkit canComObj;
ASSERT_NO_THROW(canComObj.Initialize(ssObjectConfig.c_str()));
EXPECT_EQ(canComObj.GetStatus(), sdv::EObjectStatus::initialization_failure);
EXPECT_EQ(canComObj.GetObjectState(), sdv::EObjectState::initialization_failure);
ASSERT_NO_THROW(canComObj.Shutdown());
EXPECT_EQ(canComObj.GetStatus(), sdv::EObjectStatus::shutdown_in_progress);
EXPECT_EQ(canComObj.GetObjectState(), sdv::EObjectState::shutdown_in_progress);
}
TEST_F(CANSilkitTest, SendReceiveTest)
@@ -219,9 +229,9 @@ TEST_F(CANSilkitTest, SendReceiveTest)
MockCANReceiver mockRcv;
canComObj1.Initialize(ssConfig1.c_str());
ASSERT_EQ(canComObj1.GetStatus(), sdv::EObjectStatus::initialized);
ASSERT_EQ(canComObj1.GetObjectState(), sdv::EObjectState::initialized);
canComObj2.Initialize(ssConfig2.c_str());
ASSERT_EQ(canComObj2.GetStatus(), sdv::EObjectStatus::initialized);
ASSERT_EQ(canComObj2.GetObjectState(), sdv::EObjectState::initialized);
ASSERT_NO_THROW(canComObj1.SetOperationMode(sdv::EOperationMode::running));
ASSERT_NO_THROW(canComObj2.SetOperationMode(sdv::EOperationMode::configuring));

View File

@@ -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 <set>
#include <mutex>
@@ -20,7 +30,6 @@
*/
class CDummyCANSilKit
: public sdv::CSdvObject
, public sdv::IObjectControl
, public sdv::can::IRegisterReceiver
, public sdv::can::ISend
{
@@ -28,46 +37,30 @@ public:
// Interface map
BEGIN_SDV_INTERFACE_MAP()
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
SDV_INTERFACE_ENTRY(sdv::can::IRegisterReceiver)
SDV_INTERFACE_ENTRY(sdv::can::ISend)
END_SDV_INTERFACE_MAP()
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::vehicle_bus)
DECLARE_OBJECT_CLASS_NAME("Dummy_CAN_Sockets")
DECLARE_DEFAULT_OBJECT_NAME("CAN_Communication_Object")
DECLARE_OBJECT_SINGLETON()
virtual void Initialize(const sdv::u8string& ) 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
{
m_StopThread = false;
//m_thSend2DatalinkThread = std::thread(&CDummyCANSockets::Send2DatalinkThread, this);
m_status = sdv::EObjectStatus::initialized;
return true;
}
virtual sdv::EObjectStatus GetStatus() const override
{
return m_status;
}
void SetOperationMode(sdv::EOperationMode eMode) 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;
}
}
virtual void Shutdown() override
/**
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
*/
virtual void OnShutdown() override
{
m_StopThread = true;
if (m_thSend2DatalinkThread.joinable())
@@ -126,7 +119,6 @@ private:
std::thread m_thSend2DatalinkThread;
mutable std::mutex m_mtxReceivers;
std::set<sdv::can::IReceive*> m_setReceivers;
std::atomic<sdv::EObjectStatus> m_status = { sdv::EObjectStatus::initialization_pending };
};
class MockCANReceiver : public sdv::can::IReceive
@@ -245,37 +237,37 @@ TEST_F(CANCommunicationTest, BasicSendAndReceiveMessageTest)
testMsg.seqData = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x77, 0x88};
// Configuration content as a string
std::string testConfigFileContent = R"(
[Configuration]
Version = 100
const std::string testConfigFileContent = R"toml(
[Configuration]
Version = )toml" + std::to_string(SDVFrameworkInterfaceVersion) + R"toml(
[[Component]]
Path = "task_timer.sdv"
Class = "TaskTimerService"
[[Component]]
Path = "task_timer.sdv"
Class = "TaskTimerService"
[[Component]]
Path = "data_dispatch_service.sdv"
Class = "DataDispatchService"
[[Component]]
Path = "data_dispatch_service.sdv"
Class = "DataDispatchService"
[[Component]]
Path = "can_com_silkit.sdv"
Class = "CAN_Com_SilKit"
DebugInfo = true
SyncMode = true
CanSilKitChannel = "CAN1"
CanSilKitNetwork = "PrivateCAN"
RegistryURI = "silkit://localhost:8500"
SilKitConfig = """{
"Logging": {
"Sinks": [ { "Type": "Stdout", "Level": "Info" } ]
},
}"""
[[Component]]
Path = "can_com_silkit.sdv"
Class = "CAN_Com_SilKit"
DebugInfo = true
SyncMode = true
CanSilKitChannel = "CAN1"
CanSilKitNetwork = "PrivateCAN"
RegistryURI = "silkit://localhost:8500"
SilKitConfig = """{
"Logging": {
"Sinks": [ { "Type": "Stdout", "Level": "Info" } ]
},
}"""
[[Component]]
Path = "can_datalink.sdv"
Class = "CAN_data_link"
"""
)";
[[Component]]
Path = "can_datalink.sdv"
Class = "CAN_data_link"
"""
)toml";
sdv::app::CAppControl appControl;
auto bResult = InitializeAppControl(&appControl, "test_manual_can_com_silkit.toml");

View File

@@ -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/can_com_test_helper.h"
void ReceiveData()

View File

@@ -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/can_com_test_helper.h"
int main()