tunnel component & update vehicle abstraction example (#8)

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

View File

@@ -32,17 +32,17 @@ struct SConnectEventCallbackWrapper : sdv::IInterfaceAccess, sdv::ipc::IConnectE
END_SDV_INTERFACE_MAP()
/**
* @brief Set the current status. Overload of sdv::ipc::IConnectEventCallback::SetStatus.
* @param[in] eConnectStatus The connection status.
* @brief Set the current connect state. Overload of sdv::ipc::IConnectEventCallback::SetConnectState.
* @param[in] eConnectState The connection state.
*/
virtual void SetStatus(/*in*/ sdv::ipc::EConnectStatus eConnectStatus) override
virtual void SetConnectState(/*in*/ sdv::ipc::EConnectState eConnectState) override
{
switch (eConnectStatus)
switch (eConnectState)
{
case sdv::ipc::EConnectStatus::disconnected:
case sdv::ipc::EConnectStatus::disconnected_forced:
case sdv::ipc::EConnectStatus::connection_error:
case sdv::ipc::EConnectStatus::communication_error:
case sdv::ipc::EConnectState::disconnected:
case sdv::ipc::EConnectState::disconnected_forced:
case sdv::ipc::EConnectState::connection_error:
case sdv::ipc::EConnectState::communication_error:
{
auto pRequestShutdown = sdv::core::GetObject<sdv::app::IAppShutdownRequest>("AppControlService");
if (!pRequestShutdown) break;
@@ -237,13 +237,13 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
return APP_CONTROL_INVALID_ISOLATION_CONFIG;
}
SConnectEventCallbackWrapper sConnectEventWrapper;
uint64_t uiCookie = pConnect->RegisterStatusEventCallback(&sConnectEventWrapper);
uint64_t uiCookie = pConnect->RegisterStateEventCallback(&sConnectEventWrapper);
// Connect to the core repository
sdv::com::IConnectionControl* pConnectionControl = sdv::core::GetObject<sdv::com::IConnectionControl>("CommunicationControl");
if (!pConnectionControl)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
pConnect->UnregisterStateEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << COMMUNICATION_CONTROL_SERVICE_ACCESS_ERROR_MSG << std::endl;
return COMMUNICATION_CONTROL_SERVICE_ACCESS_ERROR;
@@ -252,7 +252,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
sdv::com::TConnectionID tConnection = pConnectionControl->AssignClientEndpoint(ptrChannelEndpoint, 3000, pCoreRepo);
if (!tConnection.uiControl || !pCoreRepo)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
pConnect->UnregisterStateEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << CONNECT_SDV_SERVER_ERROR_MSG << std::endl;
return CONNECT_SDV_SERVER_ERROR;
@@ -262,7 +262,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
sdv::core::ILinkCoreRepository* pLinkCoreRepo = sdv::core::GetObject<sdv::core::ILinkCoreRepository>("RepositoryService");
if (!pLinkCoreRepo)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
pConnect->UnregisterStateEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << LINK_REPO_SERVICE_ERROR_MSG << std::endl;
return LINK_REPO_SERVICE_ERROR;
@@ -281,7 +281,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
sdv::core::IRepositoryUtilityCreate* pCreateUtility = sdv::core::GetObject<sdv::core::IRepositoryUtilityCreate>("RepositoryService");
if (!pRepositoryInfo || !pRepositoryControl || !pObjectAccess || !pCreateUtility)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
pConnect->UnregisterStateEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << REPOSITORY_SERVICE_ACCESS_ERROR_MSG << std::endl;
return REPOSITORY_SERVICE_ACCESS_ERROR;
@@ -356,7 +356,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
}
// Shutdwown
pConnect->UnregisterStatusEventCallback(uiCookie);
pConnect->UnregisterStateEventCallback(uiCookie);
parser.Clear();
pLinkCoreRepo->UnlinkCoreRepository();
appcontrol.Shutdown();

View File

@@ -314,10 +314,10 @@ std::string CVSSBSCodingRX::Code_BS_RXConstructor(const SSignalVDDefinition& sig
mapKeywords["signal_name"] = function.signalName;
return ReplaceKeywords(R"code(
auto %signal_name%Device = sdv::core::GetObject("%vd_vss_original%_Device").GetInterface<vss::%vd_vssWithColons%Device::IVSS_%vd_function_name%>();
auto %signal_name%Device = sdv::core::GetObject("%vd_vss_original%_Device").GetInterface<vss::%vd_vssWithColons%Device::IVSS_Read%vd_function_name%>();
if (!%signal_name%Device)
{
SDV_LOG_ERROR("Could not get interface 'IVSS_%vd_function_name%': [CBasicService%vd_class_name%]");
SDV_LOG_ERROR("Could not get interface 'IVSS_Read%vd_function_name%': [CBasicService%vd_class_name%]");
throw std::runtime_error("%vd_vss_original% mode device not found");
}
%signal_name%Device->Register%vd_function_name%Event(dynamic_cast<vss::%vd_vssWithColons%Device::IVSS_Write%vd_function_name%_Event*> (this));
@@ -337,7 +337,7 @@ std::string CVSSBSCodingRX::Code_BS_RXDestructor(const SSignalVDDefinition& sign
mapKeywords["vd_function_name"] = functionVD.functionName;
return ReplaceKeywords(R"code(
auto %vd_signal_name%Device = sdv::core::GetObject("%vd_vss_original%_Device").GetInterface<vss::%vd_vssWithColons%Device::IVSS_%vd_function_name%>();
auto %vd_signal_name%Device = sdv::core::GetObject("%vd_vss_original%_Device").GetInterface<vss::%vd_vssWithColons%Device::IVSS_Read%vd_function_name%>();
if (%vd_signal_name%Device)
{
%vd_signal_name%Device->Unregister%vd_function_name%Event(dynamic_cast<vss::%vd_vssWithColons%Device::IVSS_Write%vd_function_name%_Event*> (this));

View File

@@ -30,7 +30,7 @@ const char szRXVehicleDeviceHeaderTemplate[] = R"code(/**
#include "../signal_identifier.h"
/**
* @brief Vehicle device %vss_original%
* @brief Platform abstraction %vss_original%
*/
class CVehicleDevice%class_name%
: public sdv::CSdvObject
@@ -128,7 +128,7 @@ public:
BEGIN_SDV_INTERFACE_MAP()
%rx_bs_interface_entry_list% END_SDV_INTERFACE_MAP()
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::device)
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::sensor)
DECLARE_OBJECT_CLASS_NAME("%vss_original%_Service")
/**

View File

@@ -30,7 +30,7 @@ const char szTXVehicleDeviceHeaderTemplate[] = R"code(/**
/**
* @brief Vehicle device %vss_shorten_no_dot%
* @brief Platform abstraction %vss_shorten_no_dot%
*/
class CVehicleDevice%class_name%
: public sdv::CSdvObject
@@ -124,7 +124,7 @@ public:
BEGIN_SDV_INTERFACE_MAP()
%tx_bs_interface_entry_list% END_SDV_INTERFACE_MAP()
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::device)
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::actuator)
DECLARE_OBJECT_CLASS_NAME("%vss_original%_Service")
/**

View File

@@ -193,9 +193,9 @@ std::string CVSSVDCodingRX::Code_RXIDLDeviceInterface(const std::string& spaces,
%multiple_spaces%};
%multiple_spaces%/**
%multiple_spaces%* @brief IVSS_%function_name% abstract %prefix% interface
%multiple_spaces%* @brief IVSS_Read%function_name% abstract %prefix% interface
%multiple_spaces%*/
%multiple_spaces%interface IVSS_%function_name%
%multiple_spaces%interface IVSS_Read%function_name%
%multiple_spaces%{
%multiple_spaces% /**
%multiple_spaces% * @brief Register Write%function_name% event on signal change
@@ -276,7 +276,7 @@ std::string CVSSVDCodingRX::Code_VD_RXInterface(const std::string & functionName
mapKeywords["function_name"] = functionName;
mapKeywords["vss_shorten_with_colons"] = vssShortenWithColons;
return ReplaceKeywords(R"code( , public vss::%vss_shorten_with_colons%Device::IVSS_%function_name%
return ReplaceKeywords(R"code( , public vss::%vss_shorten_with_colons%Device::IVSS_Read%function_name%
)code", mapKeywords);
}
@@ -286,7 +286,7 @@ std::string CVSSVDCodingRX::Code_VD_RXInterfaceEntry(const std::string& function
mapKeywords["function_name"] = functionName;
mapKeywords["vssWithColons"] = vssWithColons;
return ReplaceKeywords(R"code( SDV_INTERFACE_ENTRY(vss::%vssWithColons%Device::IVSS_%function_name%)
return ReplaceKeywords(R"code( SDV_INTERFACE_ENTRY(vss::%vssWithColons%Device::IVSS_Read%function_name%)
)code", mapKeywords);
}
@@ -305,7 +305,7 @@ std::string CVSSVDCodingRX::Code_VD_RXReAndUnregisterEvent( const std::string& v
void Register%function_name%Event(vss::%vssWithColons%Device::IVSS_Write%function_name%_Event* event) override;
/**
* @brief Unregister IVSS_%function_name%_Event
* @brief Unregister IVSS_Read%function_name%_Event
* @param[in] event function
*/
void Unregister%function_name%Event(vss::%vssWithColons%Device::IVSS_Write%function_name%_Event* event) override;
@@ -339,7 +339,7 @@ std::string CVSSVDCodingRX::Code_VD_RXPrivateHeaderPart(const SFunctionVDDefinit
*/
void ExecuteAllCallBacksFor%start_with_uppercase%(sdv::any_t value);
sdv::core::CSignal m_%signal_name%Signal; ///< Signal of the vehicle device
sdv::core::CSignal m_%signal_name%Signal; ///< Signal of the platform abstraction
mutable std::mutex m_%signal_name%MutexCallbacks; ///< Mutex protecting m_%signal_name%Callbacks
std::set<vss::%vssWithColons%Device::IVSS_Write%function_name%_Event*> m_%signal_name%Callbacks; ///< collection of events to be called
)code", mapKeywords);