mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-10 23:50:23 +00:00
remove unused files (#7)
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_bs_frontdoorleft VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_bs_frontdoorleft)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
bs_front_door_left.h
|
||||
bs_front_door_left.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* @file bs_front_door_left.cpp
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "bs_front_door_left.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceFrontDoorLeft::CBasicServiceFrontDoorLeft()
|
||||
{
|
||||
auto leftDoorIsOpen01Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_IsOpen>();
|
||||
if (!leftDoorIsOpen01Device)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_IsOpen': [CBasicServiceFrontDoorLeft]");
|
||||
throw std::runtime_error("Vehicle.Chassis.Door.Axle01.Left mode device not found");
|
||||
}
|
||||
leftDoorIsOpen01Device->RegisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
|
||||
m_ptrLock = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteLock>();
|
||||
if (!m_ptrLock)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_WriteLock': [CBasicServiceFrontDoorLeft]");
|
||||
throw std::runtime_error("Lock device not found");
|
||||
}
|
||||
|
||||
SDV_LOG_TRACE("CBasicServiceFrontDoorLeft created: [Vehicle.Chassis.Door.Axle01.Left_Device]");
|
||||
m_leftDoorIsOpen01 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
CBasicServiceFrontDoorLeft::~CBasicServiceFrontDoorLeft()
|
||||
{
|
||||
auto leftDoorIsOpen01Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_IsOpen>();
|
||||
if (leftDoorIsOpen01Device)
|
||||
{
|
||||
leftDoorIsOpen01Device->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
}
|
||||
leftDoorIsOpen01Device = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set leftDoorIsOpen
|
||||
* @param[in] value leftDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceFrontDoorLeft::SetIsOpenL1(bool value)
|
||||
{
|
||||
m_leftDoorIsOpen01 = value;
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen01MutexCallbacks);
|
||||
for (auto callback : m_leftDoorIsOpen01Callbacks)
|
||||
{
|
||||
callback->SetIsOpenL1(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write leftDoorIsOpen
|
||||
* @param[in] value leftDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceFrontDoorLeft::WriteIsOpen(bool value)
|
||||
{
|
||||
SetIsOpenL1(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get leftDoorIsOpen
|
||||
* @return Returns the leftDoorIsOpen
|
||||
*/
|
||||
bool CBasicServiceFrontDoorLeft::GetIsOpen() const
|
||||
{
|
||||
return m_leftDoorIsOpen01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceFrontDoorLeft::RegisterOnSignalChangeOfLeftDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event* leftDoorIsOpen01Callback)
|
||||
{
|
||||
if ( leftDoorIsOpen01Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen01MutexCallbacks);
|
||||
m_leftDoorIsOpen01Callbacks.insert(leftDoorIsOpen01Callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceFrontDoorLeft::UnregisterOnSignalChangeOfLeftDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event* leftDoorIsOpen01Callback)
|
||||
{
|
||||
if (leftDoorIsOpen01Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen01MutexCallbacks);
|
||||
m_leftDoorIsOpen01Callbacks.erase(leftDoorIsOpen01Callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CBasicServiceFrontDoorLeft::SetLock(bool value)
|
||||
{
|
||||
return m_ptrLock->WriteLock(value);
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* @file bs_front_door_left.h
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__BS_FRONTDOORLEFT_H_20250711_125718_601__
|
||||
#define __VSS_GENERATED__BS_FRONTDOORLEFT_H_20250711_125718_601__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle01left_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle01left_vd_tx.h"
|
||||
#include "vss_vehiclechassisdooraxle01left_bs_tx.h"
|
||||
|
||||
/**
|
||||
* @brief Basic Service Vehicle.Chassis.Door.Axle01.Left
|
||||
*/
|
||||
class CBasicServiceFrontDoorLeft
|
||||
: public sdv::CSdvObject
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_GetIsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_GetIsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::BasicService)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle01.Left_Service")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceFrontDoorLeft();
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
~CBasicServiceFrontDoorLeft();
|
||||
|
||||
/**
|
||||
* @brief Set leftDoorIsOpen signal
|
||||
* @param[in] value leftDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenL1(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Get leftDoorIsOpen
|
||||
* @return Returns the leftDoorIsOpen
|
||||
*/
|
||||
bool GetIsOpen() const override;
|
||||
|
||||
/**
|
||||
* @brief Write leftDoorIsOpen signal
|
||||
* @param[in] value leftDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Set leftLatch signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool SetLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfLeftDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfLeftDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
private:
|
||||
|
||||
bool m_leftDoorIsOpen01 { 0 }; ///< open&close state of the door
|
||||
mutable std::mutex m_leftDoorIsOpen01MutexCallbacks; ///< Mutex protecting m_leftDoorIsOpen01Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event*> m_leftDoorIsOpen01Callbacks; ///< collection of events to be called
|
||||
vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteLock* m_ptrLock = nullptr; ///< Interface pointer to lock/unlock the door
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CBasicServiceFrontDoorLeft)
|
||||
|
||||
#endif // !define __VSS_GENERATED__BS_FRONTDOORLEFT_H_20250711_125718_601__
|
||||
@@ -1,49 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_bs_frontdoorright VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_bs_frontdoorright)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
bs_front_door_right.h
|
||||
bs_front_door_right.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* @file bs_front_door_right.cpp
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "bs_front_door_right.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceFrontDoorRight::CBasicServiceFrontDoorRight()
|
||||
{
|
||||
auto rightDoorIsOpen01Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_IsOpen>();
|
||||
if (!rightDoorIsOpen01Device)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_IsOpen': [CBasicServiceFrontDoorRight]");
|
||||
throw std::runtime_error("Vehicle.Chassis.Door.Axle01.Right mode device not found");
|
||||
}
|
||||
rightDoorIsOpen01Device->RegisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
|
||||
m_ptrLock = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteLock>();
|
||||
if (!m_ptrLock)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_WriteLock': [CBasicServiceFrontDoorRight]");
|
||||
throw std::runtime_error("Lock device not found");
|
||||
}
|
||||
|
||||
SDV_LOG_TRACE("CBasicServiceFrontDoorRight created: [Vehicle.Chassis.Door.Axle01.Right_Device]");
|
||||
m_rightDoorIsOpen01 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
CBasicServiceFrontDoorRight::~CBasicServiceFrontDoorRight()
|
||||
{
|
||||
auto rightDoorIsOpen01Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle01.Right_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_IsOpen>();
|
||||
if (rightDoorIsOpen01Device)
|
||||
{
|
||||
rightDoorIsOpen01Device->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
}
|
||||
rightDoorIsOpen01Device = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceFrontDoorRight::SetIsOpenR1(bool value)
|
||||
{
|
||||
m_rightDoorIsOpen01 = value;
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen01MutexCallbacks);
|
||||
for (auto callback : m_rightDoorIsOpen01Callbacks)
|
||||
{
|
||||
callback->SetIsOpenR1(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceFrontDoorRight::WriteIsOpen(bool value)
|
||||
{
|
||||
SetIsOpenR1(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
bool CBasicServiceFrontDoorRight::GetIsOpen() const
|
||||
{
|
||||
return m_rightDoorIsOpen01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceFrontDoorRight::RegisterOnSignalChangeOfRightDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event* rightDoorIsOpen01Callback)
|
||||
{
|
||||
if ( rightDoorIsOpen01Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen01MutexCallbacks);
|
||||
m_rightDoorIsOpen01Callbacks.insert(rightDoorIsOpen01Callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceFrontDoorRight::UnregisterOnSignalChangeOfRightDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event* rightDoorIsOpen01Callback)
|
||||
{
|
||||
if (rightDoorIsOpen01Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen01MutexCallbacks);
|
||||
m_rightDoorIsOpen01Callbacks.erase(rightDoorIsOpen01Callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CBasicServiceFrontDoorRight::SetLock(bool value)
|
||||
{
|
||||
return m_ptrLock->WriteLock(value);
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* @file bs_front_door_right.h
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__BS_FRONTDOORRIGHT_H_20250711_125718_606__
|
||||
#define __VSS_GENERATED__BS_FRONTDOORRIGHT_H_20250711_125718_606__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle01right_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle01right_vd_tx.h"
|
||||
#include "vss_vehiclechassisdooraxle01right_bs_tx.h"
|
||||
|
||||
/**
|
||||
* @brief Basic Service Vehicle.Chassis.Door.Axle01.Right
|
||||
*/
|
||||
class CBasicServiceFrontDoorRight
|
||||
: public sdv::CSdvObject
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_GetIsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_GetIsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::BasicService)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle01.Right_Service")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceFrontDoorRight();
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
~CBasicServiceFrontDoorRight();
|
||||
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenR1(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Set signal
|
||||
* @param[in] value rightLatche
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool SetLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
bool GetIsOpen() const override;
|
||||
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfRightDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfRightDoorIsOpen01(vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
private:
|
||||
|
||||
bool m_rightDoorIsOpen01 { 0 }; ///< open&close state of the door
|
||||
mutable std::mutex m_rightDoorIsOpen01MutexCallbacks; ///< Mutex protecting m_rightDoorIsOpen01Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event*> m_rightDoorIsOpen01Callbacks; ///< collection of events to be called
|
||||
vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteLock* m_ptrLock = nullptr; ///< Interface pointer to lock/unlock the door
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CBasicServiceFrontDoorRight)
|
||||
|
||||
#endif // !define __VSS_GENERATED__BS_FRONTDOORRIGHT_H_20250711_125718_606__
|
||||
@@ -1,49 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_bs_reardoorleft VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_bs_reardoorleft)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
bs_rear_door_left.h
|
||||
bs_rear_door_left.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* @file bs_rear_door_left.cpp
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "bs_rear_door_left.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceRearDoorLeft::CBasicServiceRearDoorLeft()
|
||||
{
|
||||
auto leftDoorIsOpen02Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_IsOpen>();
|
||||
if (!leftDoorIsOpen02Device)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_IsOpen': [CBasicServiceRearDoorLeft]");
|
||||
throw std::runtime_error("Vehicle.Chassis.Door.Axle02.Left mode device not found");
|
||||
}
|
||||
leftDoorIsOpen02Device->RegisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
|
||||
m_ptrLock = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteLock>();
|
||||
if (!m_ptrLock)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_WriteLock': [CBasicServiceRearDoorLeft]");
|
||||
throw std::runtime_error("Lock device not found");
|
||||
}
|
||||
|
||||
SDV_LOG_TRACE("CBasicServiceRearDoorLeft created: [Vehicle.Chassis.Door.Axle02.Left_Device]");
|
||||
m_leftDoorIsOpen02 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
CBasicServiceRearDoorLeft::~CBasicServiceRearDoorLeft()
|
||||
{
|
||||
auto leftDoorIsOpen02Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Left_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_IsOpen>();
|
||||
if (leftDoorIsOpen02Device)
|
||||
{
|
||||
leftDoorIsOpen02Device->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
}
|
||||
leftDoorIsOpen02Device = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceRearDoorLeft::SetIsOpenL2(bool value)
|
||||
{
|
||||
m_leftDoorIsOpen02 = value;
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen02MutexCallbacks);
|
||||
for (auto callback : m_leftDoorIsOpen02Callbacks)
|
||||
{
|
||||
callback->SetIsOpenL2(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceRearDoorLeft::WriteIsOpen(bool value)
|
||||
{
|
||||
SetIsOpenL2(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
bool CBasicServiceRearDoorLeft::GetIsOpen() const
|
||||
{
|
||||
return m_leftDoorIsOpen02;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceRearDoorLeft::RegisterOnSignalChangeOfLeftDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event* leftDoorIsOpen02Callback)
|
||||
{
|
||||
if ( leftDoorIsOpen02Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen02MutexCallbacks);
|
||||
m_leftDoorIsOpen02Callbacks.insert(leftDoorIsOpen02Callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceRearDoorLeft::UnregisterOnSignalChangeOfLeftDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event* leftDoorIsOpen02Callback)
|
||||
{
|
||||
if (leftDoorIsOpen02Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen02MutexCallbacks);
|
||||
m_leftDoorIsOpen02Callbacks.erase(leftDoorIsOpen02Callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CBasicServiceRearDoorLeft::SetLock(bool value)
|
||||
{
|
||||
return m_ptrLock->WriteLock(value);
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* @file bs_rear_door_left.h
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__BS_REARDOORLEFT_H_20250711_125718_611__
|
||||
#define __VSS_GENERATED__BS_REARDOORLEFT_H_20250711_125718_611__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle02left_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle02left_vd_tx.h"
|
||||
#include "vss_vehiclechassisdooraxle02left_bs_tx.h"
|
||||
|
||||
/**
|
||||
* @brief Basic Service Vehicle.Chassis.Door.Axle02.Left
|
||||
*/
|
||||
class CBasicServiceRearDoorLeft
|
||||
: public sdv::CSdvObject
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_GetIsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_GetIsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::BasicService)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle02.Left_Service")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceRearDoorLeft();
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
~CBasicServiceRearDoorLeft();
|
||||
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenL2(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Set leftLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool SetLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
bool GetIsOpen() const override;
|
||||
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfLeftDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfLeftDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
private:
|
||||
|
||||
bool m_leftDoorIsOpen02 { 0 }; ///< open&close state of the door
|
||||
mutable std::mutex m_leftDoorIsOpen02MutexCallbacks; ///< Mutex protecting m_leftDoorIsOpen02Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event*> m_leftDoorIsOpen02Callbacks; ///< collection of events to be called
|
||||
vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteLock* m_ptrLock = nullptr; ///< Interface pointer to lock/unlock the door
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CBasicServiceRearDoorLeft)
|
||||
|
||||
#endif // !define __VSS_GENERATED__BS_REARDOORLEFT_H_20250711_125718_611__
|
||||
@@ -1,49 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_bs_reardoorright VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_bs_reardoorright)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
bs_rear_door_right.h
|
||||
bs_rear_door_right.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* @file bs_rear_door_right.cpp
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "bs_rear_door_right.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceRearDoorRight::CBasicServiceRearDoorRight()
|
||||
{
|
||||
auto rightDoorIsOpen02Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_IsOpen>();
|
||||
if (!rightDoorIsOpen02Device)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_IsOpen': [CBasicServiceRearDoorRight]");
|
||||
throw std::runtime_error("Vehicle.Chassis.Door.Axle02.Right mode device not found");
|
||||
}
|
||||
rightDoorIsOpen02Device->RegisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
|
||||
m_ptrLock = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteLock>();
|
||||
if (!m_ptrLock)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get interface 'IVSS_WriteLock': [CBasicServiceRearDoorRight]");
|
||||
throw std::runtime_error("Lock device not found");
|
||||
}
|
||||
|
||||
SDV_LOG_TRACE("CBasicServiceRearDoorRight created: [Vehicle.Chassis.Door.Axle02.Right_Device]");
|
||||
m_rightDoorIsOpen02 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
CBasicServiceRearDoorRight::~CBasicServiceRearDoorRight()
|
||||
{
|
||||
auto rightDoorIsOpen02Device = sdv::core::GetObject("Vehicle.Chassis.Door.Axle02.Right_Device").GetInterface<vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_IsOpen>();
|
||||
if (rightDoorIsOpen02Device)
|
||||
{
|
||||
rightDoorIsOpen02Device->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
}
|
||||
rightDoorIsOpen02Device = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceRearDoorRight::SetIsOpenR2(bool value)
|
||||
{
|
||||
m_rightDoorIsOpen02 = value;
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen02MutexCallbacks);
|
||||
for (auto callback : m_rightDoorIsOpen02Callbacks)
|
||||
{
|
||||
callback->SetIsOpenR2(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void CBasicServiceRearDoorRight::WriteIsOpen(bool value)
|
||||
{
|
||||
SetIsOpenR2(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
bool CBasicServiceRearDoorRight::GetIsOpen() const
|
||||
{
|
||||
return m_rightDoorIsOpen02;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceRearDoorRight::RegisterOnSignalChangeOfRightDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event* rightDoorIsOpen02Callback)
|
||||
{
|
||||
if ( rightDoorIsOpen02Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen02MutexCallbacks);
|
||||
m_rightDoorIsOpen02Callbacks.insert(rightDoorIsOpen02Callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void CBasicServiceRearDoorRight::UnregisterOnSignalChangeOfRightDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event* rightDoorIsOpen02Callback)
|
||||
{
|
||||
if (rightDoorIsOpen02Callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen02MutexCallbacks);
|
||||
m_rightDoorIsOpen02Callbacks.erase(rightDoorIsOpen02Callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CBasicServiceRearDoorRight::SetLock(bool value)
|
||||
{
|
||||
return m_ptrLock->WriteLock(value);
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* @file bs_rear_door_right.h
|
||||
* @date 2025-07-11 12:57:18
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__BS_REARDOORRIGHT_H_20250711_125718_616__
|
||||
#define __VSS_GENERATED__BS_REARDOORRIGHT_H_20250711_125718_616__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle02right_bs_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle02right_vd_tx.h"
|
||||
#include "vss_vehiclechassisdooraxle02right_bs_tx.h"
|
||||
|
||||
/**
|
||||
* @brief Basic Service Vehicle.Chassis.Door.Axle02.Right
|
||||
*/
|
||||
class CBasicServiceRearDoorRight
|
||||
: public sdv::CSdvObject
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_GetIsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_GetIsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::BasicService)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle02.Right_Service")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CBasicServiceRearDoorRight();
|
||||
|
||||
/**
|
||||
* @brief User-Defined Destructor
|
||||
*/
|
||||
~CBasicServiceRearDoorRight();
|
||||
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenR2(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Set rightLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool SetLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
bool GetIsOpen() const override;
|
||||
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfRightDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister CallBack function on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfRightDoorIsOpen02(vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event* callback) override;
|
||||
|
||||
private:
|
||||
|
||||
bool m_rightDoorIsOpen02 { 0 }; ///< open&close state of the door
|
||||
mutable std::mutex m_rightDoorIsOpen02MutexCallbacks; ///< Mutex protecting m_rightDoorIsOpen02Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event*> m_rightDoorIsOpen02Callbacks; ///< collection of events to be called
|
||||
vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteLock* m_ptrLock = nullptr; ///< Interface pointer to lock/unlock the door
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CBasicServiceRearDoorRight)
|
||||
|
||||
#endif // !define __VSS_GENERATED__BS_REARDOORRIGHT_H_20250711_125718_616__
|
||||
@@ -1,42 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(can_dl_door VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Library symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(can_dl_door SHARED
|
||||
datalink.cpp
|
||||
datalink.h)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(can_dl_door PROPERTIES PREFIX "")
|
||||
set_target_properties(can_dl_door PROPERTIES SUFFIX ".sdv")
|
||||
@@ -1,412 +0,0 @@
|
||||
/**
|
||||
* @file datalink.cpp
|
||||
* @date 2025-09-06 08:00:37
|
||||
* This file implements the data link object between CAN and the V-API devices.
|
||||
* This file was generated by the DBC utility from:
|
||||
* "", "datalink_4doors_example.dbc"
|
||||
* DBC file version: 1.0.0.1
|
||||
*/
|
||||
#include "datalink.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CDataLink::CDataLink() :
|
||||
m_sRxMsgCAN_Input_L1(m_dispatch),
|
||||
m_sRxMsgCAN_Input_R1(m_dispatch),
|
||||
m_sRxMsgCAN_Input_L2(m_dispatch),
|
||||
m_sRxMsgCAN_Input_R2(m_dispatch),
|
||||
m_sTxMsgCAN_Output(m_dispatch)
|
||||
{}
|
||||
|
||||
CDataLink::~CDataLink()
|
||||
{
|
||||
Shutdown(); // Just in case
|
||||
}
|
||||
|
||||
void CDataLink::Initialize(const sdv::u8string& /*ssObjectConfig*/)
|
||||
{
|
||||
if (m_eStatus != sdv::EObjectStatus::initialization_pending) return;
|
||||
|
||||
// Get the CAN communication object.
|
||||
sdv::TInterfaceAccessPtr ptrCANObject = sdv::core::GetObject("CAN_Communication_Object");
|
||||
if (!ptrCANObject)
|
||||
{
|
||||
SDV_LOG_ERROR("CDataLink::Initialize() failure, 'CAN_Communication_Object' not found");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the CAN receiver registration interface.
|
||||
m_pRegister = ptrCANObject.GetInterface<sdv::can::IRegisterReceiver>();
|
||||
if (!m_pRegister)
|
||||
{
|
||||
SDV_LOG_ERROR("CDataLink::Initialize() failure, 'sdv::can::IRegisterReceiver' interface not found");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
m_pRegister->RegisterReceiver(static_cast<sdv::can::IReceive*>(this));
|
||||
|
||||
// Get the CAN transmit interface
|
||||
m_pSend = ptrCANObject.GetInterface<sdv::can::ISend>();
|
||||
if (!m_pSend)
|
||||
{
|
||||
SDV_LOG_ERROR("CDataLink::Initialize() failure, 'sdv::can::ISend' interface not found");
|
||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize messages
|
||||
bool bSuccess = true;
|
||||
bSuccess &= m_sRxMsgCAN_Input_L1.Init();
|
||||
bSuccess &= m_sRxMsgCAN_Input_R1.Init();
|
||||
bSuccess &= m_sRxMsgCAN_Input_L2.Init();
|
||||
bSuccess &= m_sRxMsgCAN_Input_R2.Init();
|
||||
bSuccess &= m_sTxMsgCAN_Output.Init(m_pSend);
|
||||
|
||||
m_eStatus = bSuccess ? sdv::EObjectStatus::initialized : sdv::EObjectStatus::initialization_failure;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CDataLink::GetStatus() const
|
||||
{
|
||||
return m_eStatus;
|
||||
}
|
||||
|
||||
void CDataLink::SetOperationMode(sdv::EOperationMode eMode)
|
||||
{
|
||||
switch (eMode)
|
||||
{
|
||||
case sdv::EOperationMode::configuring:
|
||||
if (m_eStatus == sdv::EObjectStatus::running || m_eStatus == sdv::EObjectStatus::initialized)
|
||||
m_eStatus = sdv::EObjectStatus::configuring;
|
||||
break;
|
||||
case sdv::EOperationMode::running:
|
||||
if (m_eStatus == sdv::EObjectStatus::configuring || m_eStatus == sdv::EObjectStatus::initialized)
|
||||
m_eStatus = sdv::EObjectStatus::running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CDataLink::Shutdown()
|
||||
{
|
||||
m_eStatus = sdv::EObjectStatus::shutdown_in_progress;
|
||||
|
||||
// Unregister receiver interface.
|
||||
if (m_pRegister) m_pRegister->UnregisterReceiver(static_cast<sdv::can::IReceive*>(this));
|
||||
m_pRegister = nullptr;
|
||||
|
||||
m_pSend = nullptr;
|
||||
|
||||
// Terminate messages
|
||||
m_sRxMsgCAN_Input_L1.Term();
|
||||
m_sRxMsgCAN_Input_R1.Term();
|
||||
m_sRxMsgCAN_Input_L2.Term();
|
||||
m_sRxMsgCAN_Input_R2.Term();
|
||||
m_sTxMsgCAN_Output.Term();
|
||||
|
||||
// Update the status
|
||||
m_eStatus = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
void CDataLink::Receive(/*in*/ [[maybe_unused]] const sdv::can::SMessage& sMsg, /*in*/ uint32_t uiIfcIndex)
|
||||
{
|
||||
if (static_cast<size_t>(uiIfcIndex) != m_nIfcIndex) return;
|
||||
|
||||
switch (sMsg.uiID)
|
||||
{
|
||||
case 1: // CAN_Input_L1
|
||||
m_sRxMsgCAN_Input_L1.Process(sMsg.seqData);
|
||||
break;
|
||||
case 2: // CAN_Input_R1
|
||||
m_sRxMsgCAN_Input_R1.Process(sMsg.seqData);
|
||||
break;
|
||||
case 3: // CAN_Input_L2
|
||||
m_sRxMsgCAN_Input_L2.Process(sMsg.seqData);
|
||||
break;
|
||||
case 4: // CAN_Input_R2
|
||||
m_sRxMsgCAN_Input_R2.Process(sMsg.seqData);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CDataLink::Error(/*in*/ [[maybe_unused]] const sdv::can::SErrorFrame& sError, /*in*/ uint32_t uiIfcIndex)
|
||||
{
|
||||
if (static_cast<size_t>(uiIfcIndex) != m_nIfcIndex) return;
|
||||
|
||||
// TODO: Currently no error frame handling...
|
||||
}
|
||||
|
||||
|
||||
CDataLink::SRxMsg_CAN_Input_L1::SRxMsg_CAN_Input_L1(sdv::core::CDispatchService& rdispatch) :
|
||||
m_rdispatch(rdispatch)
|
||||
{}
|
||||
|
||||
bool CDataLink::SRxMsg_CAN_Input_L1::Init()
|
||||
{
|
||||
// Register signals
|
||||
[[maybe_unused]] bool bSuccess = true;
|
||||
m_sigDoor01LeftIsOpen = m_rdispatch.RegisterRxSignal("CAN_Input_L1.Door01LeftIsOpen");
|
||||
bSuccess &= m_sigDoor01LeftIsOpen ? true : false;
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_L1::Term()
|
||||
{
|
||||
// Unregister signals
|
||||
m_sigDoor01LeftIsOpen.Reset();
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_L1::Process(const sdv::sequence<uint8_t>& rseqData)
|
||||
{
|
||||
// Check for the correct size.
|
||||
if (rseqData.size() != 1)
|
||||
{
|
||||
// TODO: Error. Delivered data has different size as compared to the specification.
|
||||
return;
|
||||
}
|
||||
|
||||
// Helper variable
|
||||
[[maybe_unused]] UValueHelper uValueHelper;
|
||||
|
||||
// Start a transaction
|
||||
sdv::core::CTransaction transaction = m_rdispatch.CreateTransaction();
|
||||
|
||||
// Process CAN_Input_L1.Door01LeftIsOpen
|
||||
uValueHelper.uiUint64Value = rseqData[0] & 3;
|
||||
uValueHelper.uiUint64Value >>= 1;
|
||||
m_sigDoor01LeftIsOpen.Write(std::min(std::max(uValueHelper.s32.u32.uiValue, 0u), 1u), transaction);
|
||||
|
||||
// Finalize the transaction
|
||||
transaction.Finish();
|
||||
}
|
||||
|
||||
CDataLink::SRxMsg_CAN_Input_R1::SRxMsg_CAN_Input_R1(sdv::core::CDispatchService& rdispatch) :
|
||||
m_rdispatch(rdispatch)
|
||||
{}
|
||||
|
||||
bool CDataLink::SRxMsg_CAN_Input_R1::Init()
|
||||
{
|
||||
// Register signals
|
||||
[[maybe_unused]] bool bSuccess = true;
|
||||
m_sigDoor01RightIsOpen = m_rdispatch.RegisterRxSignal("CAN_Input_R1.Door01RightIsOpen");
|
||||
bSuccess &= m_sigDoor01RightIsOpen ? true : false;
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_R1::Term()
|
||||
{
|
||||
// Unregister signals
|
||||
m_sigDoor01RightIsOpen.Reset();
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_R1::Process(const sdv::sequence<uint8_t>& rseqData)
|
||||
{
|
||||
// Check for the correct size.
|
||||
if (rseqData.size() != 1)
|
||||
{
|
||||
// TODO: Error. Delivered data has different size as compared to the specification.
|
||||
return;
|
||||
}
|
||||
|
||||
// Helper variable
|
||||
[[maybe_unused]] UValueHelper uValueHelper;
|
||||
|
||||
// Start a transaction
|
||||
sdv::core::CTransaction transaction = m_rdispatch.CreateTransaction();
|
||||
|
||||
// Process CAN_Input_R1.Door01RightIsOpen
|
||||
uValueHelper.uiUint64Value = rseqData[0] & 15;
|
||||
uValueHelper.uiUint64Value >>= 3;
|
||||
m_sigDoor01RightIsOpen.Write(std::min(std::max(uValueHelper.s32.u32.uiValue, 0u), 1u), transaction);
|
||||
|
||||
// Finalize the transaction
|
||||
transaction.Finish();
|
||||
}
|
||||
|
||||
CDataLink::SRxMsg_CAN_Input_L2::SRxMsg_CAN_Input_L2(sdv::core::CDispatchService& rdispatch) :
|
||||
m_rdispatch(rdispatch)
|
||||
{}
|
||||
|
||||
bool CDataLink::SRxMsg_CAN_Input_L2::Init()
|
||||
{
|
||||
// Register signals
|
||||
[[maybe_unused]] bool bSuccess = true;
|
||||
m_sigDoor02LeftIsOpen = m_rdispatch.RegisterRxSignal("CAN_Input_L2.Door02LeftIsOpen");
|
||||
bSuccess &= m_sigDoor02LeftIsOpen ? true : false;
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_L2::Term()
|
||||
{
|
||||
// Unregister signals
|
||||
m_sigDoor02LeftIsOpen.Reset();
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_L2::Process(const sdv::sequence<uint8_t>& rseqData)
|
||||
{
|
||||
// Check for the correct size.
|
||||
if (rseqData.size() != 1)
|
||||
{
|
||||
// TODO: Error. Delivered data has different size as compared to the specification.
|
||||
return;
|
||||
}
|
||||
|
||||
// Helper variable
|
||||
[[maybe_unused]] UValueHelper uValueHelper;
|
||||
|
||||
// Start a transaction
|
||||
sdv::core::CTransaction transaction = m_rdispatch.CreateTransaction();
|
||||
|
||||
// Process CAN_Input_L2.Door02LeftIsOpen
|
||||
uValueHelper.uiUint64Value = rseqData[0] & 63;
|
||||
uValueHelper.uiUint64Value >>= 5;
|
||||
m_sigDoor02LeftIsOpen.Write(std::min(std::max(uValueHelper.s32.u32.uiValue, 0u), 1u), transaction);
|
||||
|
||||
// Finalize the transaction
|
||||
transaction.Finish();
|
||||
}
|
||||
|
||||
CDataLink::SRxMsg_CAN_Input_R2::SRxMsg_CAN_Input_R2(sdv::core::CDispatchService& rdispatch) :
|
||||
m_rdispatch(rdispatch)
|
||||
{}
|
||||
|
||||
bool CDataLink::SRxMsg_CAN_Input_R2::Init()
|
||||
{
|
||||
// Register signals
|
||||
[[maybe_unused]] bool bSuccess = true;
|
||||
m_sigDoor02RightIsOpen = m_rdispatch.RegisterRxSignal("CAN_Input_R2.Door02RightIsOpen");
|
||||
bSuccess &= m_sigDoor02RightIsOpen ? true : false;
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_R2::Term()
|
||||
{
|
||||
// Unregister signals
|
||||
m_sigDoor02RightIsOpen.Reset();
|
||||
}
|
||||
|
||||
void CDataLink::SRxMsg_CAN_Input_R2::Process(const sdv::sequence<uint8_t>& rseqData)
|
||||
{
|
||||
// Check for the correct size.
|
||||
if (rseqData.size() != 1)
|
||||
{
|
||||
// TODO: Error. Delivered data has different size as compared to the specification.
|
||||
return;
|
||||
}
|
||||
|
||||
// Helper variable
|
||||
[[maybe_unused]] UValueHelper uValueHelper;
|
||||
|
||||
// Start a transaction
|
||||
sdv::core::CTransaction transaction = m_rdispatch.CreateTransaction();
|
||||
|
||||
// Process CAN_Input_R2.Door02RightIsOpen
|
||||
uValueHelper.uiUint64Value = rseqData[0];
|
||||
uValueHelper.uiUint64Value >>= 7;
|
||||
m_sigDoor02RightIsOpen.Write(std::min(std::max(uValueHelper.s32.u32.uiValue, 0u), 1u), transaction);
|
||||
|
||||
// Finalize the transaction
|
||||
transaction.Finish();
|
||||
}
|
||||
|
||||
CDataLink::STxMsg_CAN_Output::STxMsg_CAN_Output(sdv::core::CDispatchService& rdispatch) :
|
||||
m_rdispatch(rdispatch)
|
||||
{}
|
||||
|
||||
bool CDataLink::STxMsg_CAN_Output::Init(sdv::can::ISend* pSend)
|
||||
{
|
||||
if (!pSend) return false;
|
||||
m_pSend = pSend;
|
||||
|
||||
// Register signals
|
||||
bool bSuccess = true;
|
||||
m_sigLockDoor02Right = m_rdispatch.RegisterTxSignal("CAN_Output.LockDoor02Right", sdv::any_t());
|
||||
bSuccess &= m_sigLockDoor02Right ? true : false;
|
||||
m_sigLockDoor02Left = m_rdispatch.RegisterTxSignal("CAN_Output.LockDoor02Left", sdv::any_t());
|
||||
bSuccess &= m_sigLockDoor02Left ? true : false;
|
||||
m_sigLockDoor01Right = m_rdispatch.RegisterTxSignal("CAN_Output.LockDoor01Right", sdv::any_t());
|
||||
bSuccess &= m_sigLockDoor01Right ? true : false;
|
||||
m_sigLockDoor01Left = m_rdispatch.RegisterTxSignal("CAN_Output.LockDoor01Left", sdv::any_t());
|
||||
bSuccess &= m_sigLockDoor01Left ? true : false;
|
||||
|
||||
// Initialize the trigger
|
||||
m_trigger = m_rdispatch.CreateTxTrigger([&] { Transmit(); }, false, 0, 10, false);
|
||||
m_trigger.AddSignal(m_sigLockDoor02Right);
|
||||
m_trigger.AddSignal(m_sigLockDoor02Left);
|
||||
m_trigger.AddSignal(m_sigLockDoor01Right);
|
||||
m_trigger.AddSignal(m_sigLockDoor01Left);
|
||||
bSuccess &= m_trigger;
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
void CDataLink::STxMsg_CAN_Output::Term()
|
||||
{
|
||||
// Reset the trigger
|
||||
m_trigger.Reset();
|
||||
|
||||
// Unregister signals
|
||||
m_sigLockDoor02Right.Reset();
|
||||
m_sigLockDoor02Left.Reset();
|
||||
m_sigLockDoor01Right.Reset();
|
||||
m_sigLockDoor01Left.Reset();
|
||||
}
|
||||
|
||||
void CDataLink::STxMsg_CAN_Output::Transmit()
|
||||
{
|
||||
if (!m_pSend) return;
|
||||
|
||||
// Compose CAN message
|
||||
sdv::can::SMessage msg;
|
||||
msg.uiID = 5;
|
||||
msg.bExtended = false;
|
||||
msg.bCanFd = false; // TODO: Currently not supported
|
||||
msg.seqData.resize(1);
|
||||
std::fill(msg.seqData.begin(), msg.seqData.end(), static_cast<uint8_t>(0));
|
||||
|
||||
// Helper variable
|
||||
[[maybe_unused]] UValueHelper uValueHelper;
|
||||
|
||||
// Start a transaction
|
||||
sdv::core::CTransaction transaction = m_rdispatch.CreateTransaction();
|
||||
|
||||
// Compose CAN_Output.LockDoor02Right
|
||||
uValueHelper.s32.u32.uiValue = static_cast<uint32_t>(std::min(std::max(static_cast<long long int>(m_sigLockDoor02Right.Read(transaction)), 0ll), 1ll));
|
||||
uValueHelper.uiUint64Value <<= 7;
|
||||
msg.seqData[0] |= uValueHelper.uiUint64Value & 0xff;
|
||||
|
||||
// Compose CAN_Output.LockDoor02Left
|
||||
uValueHelper.s32.u32.uiValue = static_cast<uint32_t>(std::min(std::max(static_cast<long long int>(m_sigLockDoor02Left.Read(transaction)), 0ll), 1ll));
|
||||
uValueHelper.uiUint64Value <<= 5;
|
||||
msg.seqData[0] |= uValueHelper.uiUint64Value & 63;
|
||||
|
||||
// Compose CAN_Output.LockDoor01Right
|
||||
uValueHelper.s32.u32.uiValue = static_cast<uint32_t>(std::min(std::max(static_cast<long long int>(m_sigLockDoor01Right.Read(transaction)), 0ll), 1ll));
|
||||
uValueHelper.uiUint64Value <<= 3;
|
||||
msg.seqData[0] |= uValueHelper.uiUint64Value & 15;
|
||||
|
||||
// Compose CAN_Output.LockDoor01Left
|
||||
uValueHelper.s32.u32.uiValue = static_cast<uint32_t>(std::min(std::max(static_cast<long long int>(m_sigLockDoor01Left.Read(transaction)), 0ll), 1ll));
|
||||
uValueHelper.uiUint64Value <<= 1;
|
||||
msg.seqData[0] |= uValueHelper.uiUint64Value & 3;
|
||||
|
||||
// Finalize the transaction
|
||||
transaction.Finish();
|
||||
|
||||
// Transmit the message
|
||||
// TODO: Determine CAN interface index...
|
||||
m_pSend->Send(msg, 0);
|
||||
}
|
||||
|
||||
@@ -1,300 +0,0 @@
|
||||
/**
|
||||
* @file datalink.h
|
||||
* @date 2025-09-06 08:00:37
|
||||
* This file defines the data link object between CAN and the V-API devices.
|
||||
* This file was generated by the DBC utility from:
|
||||
* "", "datalink_4doors_example.dbc"
|
||||
* DBC file version: 1.0.0.1
|
||||
*/
|
||||
#ifndef __DBC_GENERATED__DATALINK_H__20250906_080037_856__
|
||||
#define __DBC_GENERATED__DATALINK_H__20250906_080037_856__
|
||||
|
||||
#include <support/component_impl.h>
|
||||
#include <interfaces/can.h>
|
||||
#include <support/interface_ptr.h>
|
||||
#include <support/signal_support.h>
|
||||
|
||||
/**
|
||||
* @brief Data link class.
|
||||
*/
|
||||
class CDataLink : public sdv::CSdvObject, public sdv::IObjectControl, public sdv::can::IReceive
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CDataLink();
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~CDataLink();
|
||||
|
||||
// Interface map
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(sdv::can::IReceive)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
// Declarations
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_NAME("CAN_data_link")
|
||||
DECLARE_DEFAULT_OBJECT_NAME("DataLink")
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
|
||||
* @return Return the current status of the object.
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief Process a receive a CAN message. Overload of sdv::can::IReceive::Receive.
|
||||
* @param[in] sMsg Message that was received.
|
||||
* @param[in] uiIfcIndex Interface index of the received message.
|
||||
*/
|
||||
virtual void Receive(/*in*/ const sdv::can::SMessage& sMsg, /*in*/ uint32_t uiIfcIndex) override;
|
||||
|
||||
/**
|
||||
* @brief Process an error frame. Overload of sdv::can::IReceive::Error.
|
||||
* @param[in] sError Error frame that was received.
|
||||
* @param[in] uiIfcIndex Interface index of the received message.
|
||||
*/
|
||||
virtual void Error(/*in*/ const sdv::can::SErrorFrame& sError, /*in*/ uint32_t uiIfcIndex) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Union containing all the compound values needed to convert between the DBC defined types.
|
||||
*/
|
||||
union UValueHelper
|
||||
{
|
||||
uint64_t uiUint64Value; ///< The 64-bit unsingned value.
|
||||
int64_t iInt64Value; ///< The 64-bit signed value.
|
||||
|
||||
/**
|
||||
* @brief The structure mapping the 32-bit value types into the 64-bit.
|
||||
*/
|
||||
struct S32
|
||||
{
|
||||
#if (!defined(_MSC_VER) || defined(__clang__)) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
uint32_t uiPadding; ///< Padding for big endian byte ordering (MSB)
|
||||
#endif
|
||||
/**
|
||||
* @brief The 32-bit union containing the possible 32-bit values.
|
||||
*/
|
||||
union U32Value
|
||||
{
|
||||
int32_t iValue; ///< 32-bit signed integer.
|
||||
uint32_t uiValue; ///< 32-bit unsigned integer.
|
||||
float fValue; ///< 32-bit floating point number.
|
||||
} u32; ///< 32-bit union instance.
|
||||
|
||||
#if (defined(_MSC_VER) && !defined(__clang__)) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
uint32_t uiPadding; ///< Padding for little endian byte ordering (MSB)
|
||||
#endif
|
||||
} s32;
|
||||
|
||||
double dValue; ///< 64-bit double precision floating point number.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief RX CAN message definition of: CAN_Input_L1 [id=1]
|
||||
*/
|
||||
struct SRxMsg_CAN_Input_L1
|
||||
{
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] rdispatch Reference to the dispatch service.
|
||||
*/
|
||||
SRxMsg_CAN_Input_L1(sdv::core::CDispatchService& rdispatch);
|
||||
|
||||
/**
|
||||
* @brief Initialize the message by registering all signals.
|
||||
*/
|
||||
bool Init();
|
||||
|
||||
/**
|
||||
* @brief Terminate the message by unregistering all signals.
|
||||
*/
|
||||
void Term();
|
||||
|
||||
/**
|
||||
* @brief Process received data.
|
||||
* @param[in] rseqData Reference to the message data to process.
|
||||
*/
|
||||
void Process(const sdv::sequence<uint8_t>& rseqData);
|
||||
|
||||
sdv::core::CDispatchService& m_rdispatch; ///< Reference to the dispatch service.
|
||||
|
||||
/// Signal Door01LeftIsOpen with unit
|
||||
sdv::core::CSignal m_sigDoor01LeftIsOpen;
|
||||
} m_sRxMsgCAN_Input_L1;
|
||||
|
||||
/**
|
||||
* @brief RX CAN message definition of: CAN_Input_R1 [id=2]
|
||||
*/
|
||||
struct SRxMsg_CAN_Input_R1
|
||||
{
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] rdispatch Reference to the dispatch service.
|
||||
*/
|
||||
SRxMsg_CAN_Input_R1(sdv::core::CDispatchService& rdispatch);
|
||||
|
||||
/**
|
||||
* @brief Initialize the message by registering all signals.
|
||||
*/
|
||||
bool Init();
|
||||
|
||||
/**
|
||||
* @brief Terminate the message by unregistering all signals.
|
||||
*/
|
||||
void Term();
|
||||
|
||||
/**
|
||||
* @brief Process received data.
|
||||
* @param[in] rseqData Reference to the message data to process.
|
||||
*/
|
||||
void Process(const sdv::sequence<uint8_t>& rseqData);
|
||||
|
||||
sdv::core::CDispatchService& m_rdispatch; ///< Reference to the dispatch service.
|
||||
|
||||
/// Signal Door01RightIsOpen with unit
|
||||
sdv::core::CSignal m_sigDoor01RightIsOpen;
|
||||
} m_sRxMsgCAN_Input_R1;
|
||||
|
||||
/**
|
||||
* @brief RX CAN message definition of: CAN_Input_L2 [id=3]
|
||||
*/
|
||||
struct SRxMsg_CAN_Input_L2
|
||||
{
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] rdispatch Reference to the dispatch service.
|
||||
*/
|
||||
SRxMsg_CAN_Input_L2(sdv::core::CDispatchService& rdispatch);
|
||||
|
||||
/**
|
||||
* @brief Initialize the message by registering all signals.
|
||||
*/
|
||||
bool Init();
|
||||
|
||||
/**
|
||||
* @brief Terminate the message by unregistering all signals.
|
||||
*/
|
||||
void Term();
|
||||
|
||||
/**
|
||||
* @brief Process received data.
|
||||
* @param[in] rseqData Reference to the message data to process.
|
||||
*/
|
||||
void Process(const sdv::sequence<uint8_t>& rseqData);
|
||||
|
||||
sdv::core::CDispatchService& m_rdispatch; ///< Reference to the dispatch service.
|
||||
|
||||
/// Signal Door02LeftIsOpen with unit
|
||||
sdv::core::CSignal m_sigDoor02LeftIsOpen;
|
||||
} m_sRxMsgCAN_Input_L2;
|
||||
|
||||
/**
|
||||
* @brief RX CAN message definition of: CAN_Input_R2 [id=4]
|
||||
*/
|
||||
struct SRxMsg_CAN_Input_R2
|
||||
{
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] rdispatch Reference to the dispatch service.
|
||||
*/
|
||||
SRxMsg_CAN_Input_R2(sdv::core::CDispatchService& rdispatch);
|
||||
|
||||
/**
|
||||
* @brief Initialize the message by registering all signals.
|
||||
*/
|
||||
bool Init();
|
||||
|
||||
/**
|
||||
* @brief Terminate the message by unregistering all signals.
|
||||
*/
|
||||
void Term();
|
||||
|
||||
/**
|
||||
* @brief Process received data.
|
||||
* @param[in] rseqData Reference to the message data to process.
|
||||
*/
|
||||
void Process(const sdv::sequence<uint8_t>& rseqData);
|
||||
|
||||
sdv::core::CDispatchService& m_rdispatch; ///< Reference to the dispatch service.
|
||||
|
||||
/// Signal Door02RightIsOpen with unit
|
||||
sdv::core::CSignal m_sigDoor02RightIsOpen;
|
||||
} m_sRxMsgCAN_Input_R2;
|
||||
|
||||
/**
|
||||
* @brief TX CAN message definition of: CAN_Output [id=5]
|
||||
*/
|
||||
struct STxMsg_CAN_Output
|
||||
{
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] rdispatch Reference to the dispatch service.
|
||||
*/
|
||||
STxMsg_CAN_Output(sdv::core::CDispatchService& rdispatch);
|
||||
|
||||
/**
|
||||
* @brief Initialize the message by registering all signals.
|
||||
* @param[in] pSend The send-interface of the CAN.
|
||||
*/
|
||||
bool Init(sdv::can::ISend* pSend);
|
||||
|
||||
/**
|
||||
* @brief Terminate the message by unregistering all signals.
|
||||
*/
|
||||
void Term();
|
||||
|
||||
/**
|
||||
* @brief Transmit data.
|
||||
* @param[in] pCanSend Pointer to the CAN send interface.
|
||||
*/
|
||||
void Transmit();
|
||||
|
||||
sdv::core::CDispatchService& m_rdispatch; ///< Reference to the dispatch service.
|
||||
sdv::core::CTrigger m_trigger; ///< Message trigger being called by the dispatch service.
|
||||
sdv::can::ISend* m_pSend = nullptr; ///< Message sending interface.
|
||||
|
||||
/// Signal LockDoor02Right with unit
|
||||
sdv::core::CSignal m_sigLockDoor02Right;
|
||||
/// Signal LockDoor02Left with unit
|
||||
sdv::core::CSignal m_sigLockDoor02Left;
|
||||
/// Signal LockDoor01Right with unit
|
||||
sdv::core::CSignal m_sigLockDoor01Right;
|
||||
/// Signal LockDoor01Left with unit
|
||||
sdv::core::CSignal m_sigLockDoor01Left;
|
||||
} m_sTxMsgCAN_Output;
|
||||
|
||||
sdv::EObjectStatus m_eStatus = sdv::EObjectStatus::initialization_pending; ///< Keep track of the object status.
|
||||
size_t m_nIfcIndex = 0; ///< CAN Interface index.
|
||||
sdv::can::IRegisterReceiver* m_pRegister = nullptr; ///< CAN receiver registration interface.
|
||||
sdv::can::ISend* m_pSend = nullptr; ///< CAN sender interface.
|
||||
sdv::core::CDispatchService m_dispatch; ///< Dispatch service
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CDataLink)
|
||||
|
||||
#endif // !defined __DBC_GENERATED__DATALINK_H__20250906_080037_856__
|
||||
@@ -1,10 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "door_complex_service.sdv"
|
||||
Class = "Doors Example Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "door_complex_service.sdv"
|
||||
Class = "Doors Example Service"
|
||||
Name = "Doors Example Service"
|
||||
|
||||
[[Module]]
|
||||
Path = "doors_service_proxystub.sdv"
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# Settings file
|
||||
[Settings]
|
||||
Version = 100
|
||||
|
||||
# The system config array can contain zero or more configurations that are loaded at the time
|
||||
# the system ist started. It is advisable to split the configurations in:
|
||||
# platform config - containing all the components needed to interact with the OS,
|
||||
# middleware, vehicle bus, Ethernet.
|
||||
# vehicle interface - containing the vehicle bus interpretation components like data link
|
||||
# based on DBC and devices for their abstraction.
|
||||
# vehicle abstraction - containing the basic services
|
||||
# Load the system configurations by providing the "SystemConfig" keyword as an array of strings.
|
||||
# A relative path is relative to the installation directory (being "exe_location/instance_id").
|
||||
#
|
||||
# Example:
|
||||
# SystemConfig = [ "platform.toml", "vehicle_ifc.toml", "vehicle_abstract.toml" ]
|
||||
|
||||
SystemConfig = [ "platform.toml", "vehicle_ifc.toml", "vehicle_abstract.toml"]
|
||||
|
||||
# The application config contains the configuration file that can be updated when services and
|
||||
# apps are being added to the system (or being removed from the system). Load the application
|
||||
# config by providing the "AppConfig" keyword as a string value. A relative path is relative to
|
||||
# the installation directory (being "exe_location/instance_id").
|
||||
#
|
||||
# Example
|
||||
# AppConfig = "app_config.toml"
|
||||
#
|
||||
AppConfig = "door_demo.toml"
|
||||
@@ -1,26 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Service"
|
||||
Name = "Vehicle.Chassis.Door.Axle01.Left_Service"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Service"
|
||||
Name = "Vehicle.Chassis.Door.Axle01.Right_Service"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Left_Service"
|
||||
Name = "Vehicle.Chassis.Door.Axle02.Left_Service"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Right_Service"
|
||||
Name = "Vehicle.Chassis.Door.Axle02.Right_Service"
|
||||
|
||||
[[Module]]
|
||||
Path = "doors_proxystub.sdv"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "can_dl_door.sdv"
|
||||
Class = "CAN_data_link"
|
||||
Name = "DataLink"
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Left_Device"
|
||||
Name = "Vehicle.Chassis.Door.Axle01.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle01.Right_Device"
|
||||
Name = "Vehicle.Chassis.Door.Axle01.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorleft.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Left_Device"
|
||||
Name = "Vehicle.Chassis.Door.Axle02.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorright.sdv"
|
||||
Class = "Vehicle.Chassis.Door.Axle02.Right_Device"
|
||||
Name = "Vehicle.Chassis.Door.Axle02.Right_Device"
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "door_complex_service.sdv"
|
||||
Class = "Doors Example Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "door_complex_service.sdv"
|
||||
Class = "Doors Example Service"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* @file signal_identifier.h
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__SIGNALIDENTIFIER_H_20250711_110355_840__
|
||||
#define __VSS_GENERATED__SIGNALIDENTIFIER_H_20250711_110355_840__
|
||||
|
||||
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.Right
|
||||
} // doors
|
||||
|
||||
#endif // __VSS_GENERATED__SIGNALIDENTIFIER_H_20250711_110355_840__
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01left_bs_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
#include "vss_vehiclechassisdooraxle01left_vd_rx.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module LeftService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetIsOpen event interface
|
||||
*/
|
||||
interface IVSS_SetIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Set leftDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenL1(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_GetIsOpen Service interface
|
||||
*/
|
||||
interface IVSS_GetIsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen signal
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
boolean GetIsOpen() const;
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfLeftDoorIsOpen01(in vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event callback);
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfLeftDoorIsOpen01(in vss::Vehicle::Chassis::Door::Axle01::LeftService::IVSS_SetIsOpen_Event callback);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01left_bs_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module LeftService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetLock Service interface
|
||||
*/
|
||||
interface IVSS_SetLock
|
||||
{
|
||||
/**
|
||||
* @brief Set leftLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean SetLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01left_vd_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module LeftDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteIsOpen event interface
|
||||
*/
|
||||
interface IVSS_WriteIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Write leftDoorIsOpen signal
|
||||
* @param[in] value leftDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_IsOpen abstract Device interface
|
||||
*/
|
||||
interface IVSS_IsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Register WriteIsOpen event on signal change
|
||||
* Register all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01left_vd_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module LeftDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteLock Device interface
|
||||
*/
|
||||
interface IVSS_WriteLock
|
||||
{
|
||||
/**
|
||||
* @brief Write leftLatch01 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean WriteLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01right_bs_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
#include "vss_vehiclechassisdooraxle01right_vd_rx.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module RightService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetIsOpen event interface
|
||||
*/
|
||||
interface IVSS_SetIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenR1(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_GetIsOpen Service interface
|
||||
*/
|
||||
interface IVSS_GetIsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen signal
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
boolean GetIsOpen() const;
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfRightDoorIsOpen01(in vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event callback);
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfRightDoorIsOpen01(in vss::Vehicle::Chassis::Door::Axle01::RightService::IVSS_SetIsOpen_Event callback);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01right_bs_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module RightService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetLock Service interface
|
||||
*/
|
||||
interface IVSS_SetLock
|
||||
{
|
||||
/**
|
||||
* @brief Set rightLatch signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean SetLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01right_vd_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module RightDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteIsOpen event interface
|
||||
*/
|
||||
interface IVSS_WriteIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_IsOpen abstract Device interface
|
||||
*/
|
||||
interface IVSS_IsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Register WriteIsOpen event on signal change
|
||||
* Register all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle01right_vd_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle01
|
||||
{
|
||||
module RightDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteLock Device interface
|
||||
*/
|
||||
interface IVSS_WriteLock
|
||||
{
|
||||
/**
|
||||
* @brief Write rightLatch signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean WriteLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02left_bs_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
#include "vss_vehiclechassisdooraxle02left_vd_rx.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module LeftService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetIsOpen event interface
|
||||
*/
|
||||
interface IVSS_SetIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Set leftDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenL2(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_GetIsOpen Service interface
|
||||
*/
|
||||
interface IVSS_GetIsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen signal
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
boolean GetIsOpen() const;
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfLeftDoorIsOpen02(in vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event callback);
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfLeftDoorIsOpen02(in vss::Vehicle::Chassis::Door::Axle02::LeftService::IVSS_SetIsOpen_Event callback);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02left_bs_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module LeftService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetLock Service interface
|
||||
*/
|
||||
interface IVSS_SetLock
|
||||
{
|
||||
/**
|
||||
* @brief Set leftLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean SetLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02left_vd_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module LeftDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteIsOpen event interface
|
||||
*/
|
||||
interface IVSS_WriteIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Write leftDoorIsOpen signal
|
||||
* @param[in] value leftDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_IsOpen abstract Device interface
|
||||
*/
|
||||
interface IVSS_IsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Register WriteIsOpen event on signal change
|
||||
* Register all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02left_vd_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module LeftDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteLock Device interface
|
||||
*/
|
||||
interface IVSS_WriteLock
|
||||
{
|
||||
/**
|
||||
* @brief Write leftLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean WriteLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02right_bs_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
#include "vss_vehiclechassisdooraxle02right_vd_rx.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module RightService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetIsOpen event interface
|
||||
*/
|
||||
interface IVSS_SetIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Set rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void SetIsOpenR2(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_GetIsOpen Service interface
|
||||
*/
|
||||
interface IVSS_GetIsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Get rightDoorIsOpen signal
|
||||
* @return Returns the rightDoorIsOpen
|
||||
*/
|
||||
boolean GetIsOpen() const;
|
||||
|
||||
/**
|
||||
* @brief Register Callback on signal change
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void RegisterOnSignalChangeOfRightDoorIsOpen02(in vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event callback);
|
||||
|
||||
/**
|
||||
* @brief Unregister Callback
|
||||
* @param[in] callback function
|
||||
*/
|
||||
void UnregisterOnSignalChangeOfRightDoorIsOpen02(in vss::Vehicle::Chassis::Door::Axle02::RightService::IVSS_SetIsOpen_Event callback);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02right_bs_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module RightService
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_SetLock Service interface
|
||||
*/
|
||||
interface IVSS_SetLock
|
||||
{
|
||||
/**
|
||||
* @brief Set rightLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean SetLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02right_vd_rx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include "interfaces/core.idl"
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module RightDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteIsOpen event interface
|
||||
*/
|
||||
interface IVSS_WriteIsOpen_Event
|
||||
{
|
||||
/**
|
||||
* @brief Write rightDoorIsOpen signal
|
||||
* @param[in] value rightDoorIsOpen
|
||||
*/
|
||||
void WriteIsOpen(in boolean value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IVSS_IsOpen abstract Device interface
|
||||
*/
|
||||
interface IVSS_IsOpen
|
||||
{
|
||||
/**
|
||||
* @brief Register WriteIsOpen event on signal change
|
||||
* Register all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(in IVSS_WriteIsOpen_Event event);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file vss_vehiclechassisdooraxle02right_vd_tx.idl
|
||||
* @date 2025-07-11 11:03:55
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <interfaces/core.idl>
|
||||
|
||||
module vss
|
||||
{
|
||||
module Vehicle
|
||||
{
|
||||
module Chassis
|
||||
{
|
||||
module Door
|
||||
{
|
||||
module Axle02
|
||||
{
|
||||
module RightDevice
|
||||
{
|
||||
/**
|
||||
* @brief IVSS_WriteLock Device interface
|
||||
*/
|
||||
interface IVSS_WriteLock
|
||||
{
|
||||
/**
|
||||
* @brief Write rightLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
boolean WriteLock(in boolean value);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_vd_frontdoorleft VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_vd_frontdoorleft)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
vd_front_door_left.h
|
||||
vd_front_door_left.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,151 +0,0 @@
|
||||
/**
|
||||
* @file vd_front_door_left.cpp
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "vd_front_door_left.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceFrontDoorLeft::CVehicleDeviceFrontDoorLeft()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorLeft::Initialize(const sdv::u8string&)
|
||||
{
|
||||
if (m_status != sdv::EObjectStatus::initialization_pending)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sdv::core::CDispatchService dispatch;
|
||||
m_leftDoorIsOpen01Signal = dispatch.Subscribe(doors::dsLeftDoorIsOpen01, [&](sdv::any_t value) { ExecuteAllCallBacksForLeftDoorIsOpen01( value ); });
|
||||
if (!m_leftDoorIsOpen01Signal)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsLeftDoorIsOpen01, " [CVehicleDeviceFrontDoorLeft]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_leftLatch01 = dispatch.AddPublisher(doors::dsLeftLatch01);
|
||||
if (!m_leftLatch01)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsLeftLatch01, " [CVehicleDevice]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_status = sdv::EObjectStatus::initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus CVehicleDeviceFrontDoorLeft::GetStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorLeft::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 request thread
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorLeft::Shutdown()
|
||||
{
|
||||
m_leftDoorIsOpen01Signal.Reset();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen01MutexCallbacks);
|
||||
for (auto callback : m_leftDoorIsOpen01Callbacks)
|
||||
{
|
||||
UnregisterIsOpenEvent(callback);
|
||||
}
|
||||
m_leftDoorIsOpen01Callbacks.clear();
|
||||
|
||||
m_status = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register IsOpen event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorLeft::RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen01MutexCallbacks);
|
||||
m_leftDoorIsOpen01Callbacks.insert(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorLeft::UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen01MutexCallbacks);
|
||||
m_leftDoorIsOpen01Callbacks.erase(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorLeft::ExecuteAllCallBacksForLeftDoorIsOpen01(sdv::any_t value)
|
||||
{
|
||||
bool leftDoorIsOpen = value.get<bool>();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen01MutexCallbacks);
|
||||
for (auto callback : m_leftDoorIsOpen01Callbacks)
|
||||
{
|
||||
callback->WriteIsOpen(leftDoorIsOpen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CVehicleDeviceFrontDoorLeft::WriteLock(bool value)
|
||||
{
|
||||
if (m_leftLatch01)
|
||||
{
|
||||
m_leftLatch01.Write(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/**
|
||||
* @file vd_front_door_left.h
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__VD_FRONTDOORLEFT_H_20250711_124352_681__
|
||||
#define __VSS_GENERATED__VD_FRONTDOORLEFT_H_20250711_124352_681__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle01left_vd_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle01left_vd_tx.h"
|
||||
#include "signal_identifier.h"
|
||||
|
||||
/**
|
||||
* @brief Vehicle device Vehicle.Chassis.Door.Axle01.Left
|
||||
*/
|
||||
class CVehicleDeviceFrontDoorLeft
|
||||
: public sdv::CSdvObject
|
||||
, public sdv::IObjectControl
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_IsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_IsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle01.Left_Device")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceFrontDoorLeft();
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void Initialize(const sdv::u8string& objectConfig) override;
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(/*in*/ sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown function is to shutdown the execution of request thread
|
||||
*/
|
||||
void Shutdown() override;
|
||||
|
||||
/**
|
||||
* @brief Set leftLatch signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool WriteLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register IVSS_WriteIsOpen_Event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister IVSS_IsOpen_Event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void ExecuteAllCallBacksForLeftDoorIsOpen01(sdv::any_t value);
|
||||
|
||||
sdv::core::CSignal m_leftLatch01; ///< Signal to lock/unlock the door
|
||||
sdv::core::CSignal m_leftDoorIsOpen01Signal; ///< Open/close signal of the vehicle device
|
||||
mutable std::mutex m_leftDoorIsOpen01MutexCallbacks; ///< Mutex protecting m_leftDoorIsOpen01Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle01::LeftDevice::IVSS_WriteIsOpen_Event*> m_leftDoorIsOpen01Callbacks; ///< collection of events to be called
|
||||
|
||||
std::atomic<sdv::EObjectStatus> m_status = { sdv::EObjectStatus::initialization_pending }; ///< To update the object status when it changes.
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CVehicleDeviceFrontDoorLeft)
|
||||
|
||||
#endif // !define __VSS_GENERATED__VD_FRONTDOORLEFT_H_20250711_124352_681__
|
||||
@@ -1,49 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_vd_frontdoorright VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_vd_frontdoorright)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
vd_front_door_right.h
|
||||
vd_front_door_right.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,151 +0,0 @@
|
||||
/**
|
||||
* @file vd_front_door_right.cpp
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "vd_front_door_right.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceFrontDoorRight::CVehicleDeviceFrontDoorRight()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorRight::Initialize(const sdv::u8string&)
|
||||
{
|
||||
if (m_status != sdv::EObjectStatus::initialization_pending)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sdv::core::CDispatchService dispatch;
|
||||
|
||||
m_rightDoorIsOpen01Signal = dispatch.Subscribe(doors::dsRightDoorIsOpen01, [&](sdv::any_t value) { ExecuteAllCallBacksForRightDoorIsOpen01( value ); });
|
||||
if (!m_rightDoorIsOpen01Signal)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsRightDoorIsOpen01, " [CVehicleDeviceFrontDoorRight]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_rightLatch01 = dispatch.AddPublisher(doors::dsRightLatch01);
|
||||
if (!m_rightLatch01)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsRightLatch01, " [CVehicleDevice]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_status = sdv::EObjectStatus::initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus CVehicleDeviceFrontDoorRight::GetStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorRight::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 request thread
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorRight::Shutdown()
|
||||
{
|
||||
m_rightDoorIsOpen01Signal.Reset();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen01MutexCallbacks);
|
||||
for (auto callback : m_rightDoorIsOpen01Callbacks)
|
||||
{
|
||||
UnregisterIsOpenEvent(callback);
|
||||
}
|
||||
m_rightDoorIsOpen01Callbacks.clear();
|
||||
|
||||
m_status = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register IsOpen event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorRight::RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen01MutexCallbacks);
|
||||
m_rightDoorIsOpen01Callbacks.insert(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorRight::UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen01MutexCallbacks);
|
||||
m_rightDoorIsOpen01Callbacks.erase(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void CVehicleDeviceFrontDoorRight::ExecuteAllCallBacksForRightDoorIsOpen01(sdv::any_t value)
|
||||
{
|
||||
bool rightDoorIsOpen = value.get<bool>();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen01MutexCallbacks);
|
||||
for (auto callback : m_rightDoorIsOpen01Callbacks)
|
||||
{
|
||||
callback->WriteIsOpen(rightDoorIsOpen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CVehicleDeviceFrontDoorRight::WriteLock(bool value)
|
||||
{
|
||||
if (m_rightLatch01)
|
||||
{
|
||||
m_rightLatch01.Write(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/**
|
||||
* @file vd_front_door_right.h
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__VD_FRONTDOORRIGHT_H_20250711_124352_693__
|
||||
#define __VSS_GENERATED__VD_FRONTDOORRIGHT_H_20250711_124352_693__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle01right_vd_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle01right_vd_tx.h"
|
||||
#include "signal_identifier.h"
|
||||
|
||||
/**
|
||||
* @brief Vehicle device Vehicle.Chassis.Door.Axle01.Right
|
||||
*/
|
||||
class CVehicleDeviceFrontDoorRight
|
||||
: public sdv::CSdvObject
|
||||
, public sdv::IObjectControl
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_IsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_IsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle01.Right_Device")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceFrontDoorRight();
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void Initialize(const sdv::u8string& objectConfig) override;
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(/*in*/ sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown function is to shutdown the execution of request thread
|
||||
*/
|
||||
void Shutdown() override;
|
||||
|
||||
/**
|
||||
* @brief Set rightLatch signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool WriteLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register IVSS_WriteIsOpen_Event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister IVSS_IsOpen_Event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void ExecuteAllCallBacksForRightDoorIsOpen01(sdv::any_t value);
|
||||
|
||||
sdv::core::CSignal m_rightLatch01; ///< Signal to lock/unlock the door
|
||||
sdv::core::CSignal m_rightDoorIsOpen01Signal; ///< Open/close signal of the vehicle device
|
||||
mutable std::mutex m_rightDoorIsOpen01MutexCallbacks; ///< Mutex protecting m_rightDoorIsOpen01Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle01::RightDevice::IVSS_WriteIsOpen_Event*> m_rightDoorIsOpen01Callbacks; ///< collection of events to be called
|
||||
|
||||
std::atomic<sdv::EObjectStatus> m_status = { sdv::EObjectStatus::initialization_pending }; ///< To update the object status when it changes.
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CVehicleDeviceFrontDoorRight)
|
||||
|
||||
#endif // !define __VSS_GENERATED__VD_FRONTDOORRIGHT_H_20250711_124352_693__
|
||||
@@ -1,49 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_vd_reardoorleft VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_vd_reardoorleft)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
vd_rear_door_left.h
|
||||
vd_rear_door_left.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* @file vd_rear_door_left.cpp
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "vd_rear_door_left.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceRearDoorLeft::CVehicleDeviceRearDoorLeft()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void CVehicleDeviceRearDoorLeft::Initialize(const sdv::u8string&)
|
||||
{
|
||||
if (m_status != sdv::EObjectStatus::initialization_pending)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sdv::core::CDispatchService dispatch;
|
||||
m_leftDoorIsOpen02Signal = dispatch.Subscribe(doors::dsLeftDoorIsOpen02, [&](sdv::any_t value) { ExecuteAllCallBacksForLeftDoorIsOpen02( value ); });
|
||||
if (!m_leftDoorIsOpen02Signal)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsLeftDoorIsOpen02, " [CVehicleDeviceRearDoorLeft]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_leftLatch02 = dispatch.AddPublisher(doors::dsLeftLatch02);
|
||||
if (!m_leftLatch02)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsLeftLatch02, " [CVehicleDevice]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_status = sdv::EObjectStatus::initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus CVehicleDeviceRearDoorLeft::GetStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void CVehicleDeviceRearDoorLeft::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 request thread
|
||||
*/
|
||||
void CVehicleDeviceRearDoorLeft::Shutdown()
|
||||
{
|
||||
m_leftDoorIsOpen02Signal.Reset();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen02MutexCallbacks);
|
||||
for (auto callback : m_leftDoorIsOpen02Callbacks)
|
||||
{
|
||||
UnregisterIsOpenEvent(callback);
|
||||
}
|
||||
m_leftDoorIsOpen02Callbacks.clear();
|
||||
|
||||
m_status = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register IsOpen event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceRearDoorLeft::RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen02MutexCallbacks);
|
||||
m_leftDoorIsOpen02Callbacks.insert(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceRearDoorLeft::UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen02MutexCallbacks);
|
||||
m_leftDoorIsOpen02Callbacks.erase(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void CVehicleDeviceRearDoorLeft::ExecuteAllCallBacksForLeftDoorIsOpen02(sdv::any_t value)
|
||||
{
|
||||
bool rightDoorIsOpen = value.get<bool>();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_leftDoorIsOpen02MutexCallbacks);
|
||||
for (auto callback : m_leftDoorIsOpen02Callbacks)
|
||||
{
|
||||
callback->WriteIsOpen(rightDoorIsOpen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CVehicleDeviceRearDoorLeft::WriteLock(bool value)
|
||||
{
|
||||
if (m_leftLatch02)
|
||||
{
|
||||
m_leftLatch02.Write(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
/**
|
||||
* @file vd_rear_door_left.h
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__VD_REARDOORLEFT_H_20250711_124352_704__
|
||||
#define __VSS_GENERATED__VD_REARDOORLEFT_H_20250711_124352_704__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle02left_vd_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle02left_vd_tx.h"
|
||||
#include "signal_identifier.h"
|
||||
|
||||
/**
|
||||
* @brief Vehicle device Vehicle.Chassis.Door.Axle02.Left
|
||||
*/
|
||||
class CVehicleDeviceRearDoorLeft
|
||||
: public sdv::CSdvObject
|
||||
, public sdv::IObjectControl
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_IsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_IsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle02.Left_Device")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceRearDoorLeft();
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void Initialize(const sdv::u8string& objectConfig) override;
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(/*in*/ sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown function is to shutdown the execution of request thread
|
||||
*/
|
||||
void Shutdown() override;
|
||||
|
||||
/**
|
||||
* @brief Set leftLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool WriteLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register IVSS_WriteIsOpen_Event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister IVSS_IsOpen_Event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void ExecuteAllCallBacksForLeftDoorIsOpen02(sdv::any_t value);
|
||||
|
||||
sdv::core::CSignal m_leftLatch02; ///< Signal to lock/unlock the door
|
||||
sdv::core::CSignal m_leftDoorIsOpen02Signal; ///< Open/close signal of the vehicle device
|
||||
mutable std::mutex m_leftDoorIsOpen02MutexCallbacks; ///< Mutex protecting m_leftDoorIsOpen02Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle02::LeftDevice::IVSS_WriteIsOpen_Event*> m_leftDoorIsOpen02Callbacks; ///< collection of events to be called
|
||||
|
||||
std::atomic<sdv::EObjectStatus> m_status = { sdv::EObjectStatus::initialization_pending }; ///< To update the object status when it changes.
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CVehicleDeviceRearDoorLeft)
|
||||
|
||||
#endif // !define __VSS_GENERATED__VD_REARDOORLEFT_H_20250711_124352_704__
|
||||
@@ -1,49 +0,0 @@
|
||||
# Enforce CMake version 3.20 or newer needed for path function
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# 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
|
||||
|
||||
# Define project
|
||||
project(doors_vd_reardoorright VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Use C++17 support
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Libary symbols are hidden by default
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Set target name.
|
||||
set(TARGET_NAME doors_vd_reardoorright)
|
||||
|
||||
# Set the SDV_FRAMEWORK_DEV_INCLUDE if not defined yet
|
||||
if (NOT DEFINED SDV_FRAMEWORK_DEV_INCLUDE)
|
||||
if (NOT DEFINED ENV{SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
message( FATAL_ERROR "The environment variable SDV_FRAMEWORK_DEV_INCLUDE needs to be pointing to the SDV V-API development include files location!")
|
||||
endif()
|
||||
set (SDV_FRAMEWORK_DEV_INCLUDE "$ENV{SDV_FRAMEWORK_DEV_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# Include link to export directory of SDV V-API development include files location
|
||||
include_directories(${SDV_FRAMEWORK_DEV_INCLUDE})
|
||||
include_directories(../../interfaces)
|
||||
|
||||
# Set platform specific compile flags
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /WX /wd4996 /wd4100 /permissive- /Zc:rvalueCast)
|
||||
else()
|
||||
add_compile_options(-Werror -Wall -Wextra -Wshadow -Wpedantic -Wunreachable-code -fno-common)
|
||||
endif()
|
||||
|
||||
# Add the dynamic library
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
vd_rear_door_right.h
|
||||
vd_rear_door_right.cpp)
|
||||
|
||||
# Set extension to .sdv
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# TODO: set target name.
|
||||
#add_dependencies(${TARGET_NAME} <add_cmake_target_this_depends_on>)
|
||||
@@ -1,153 +0,0 @@
|
||||
/**
|
||||
* @file vd_rear_door_right.cpp
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "vd_rear_door_right.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceRearDoorRight::CVehicleDeviceRearDoorRight()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void CVehicleDeviceRearDoorRight::Initialize(const sdv::u8string&)
|
||||
{
|
||||
if (m_status != sdv::EObjectStatus::initialization_pending)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sdv::core::CDispatchService dispatch;
|
||||
|
||||
m_rightDoorIsOpen02Signal = dispatch.Subscribe(doors::dsRightDoorIsOpen02, [&](sdv::any_t value) { ExecuteAllCallBacksForRightDoorIsOpen02( value ); });
|
||||
if (!m_rightDoorIsOpen02Signal)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsRightDoorIsOpen02, " [CVehicleDeviceRearDoorRight]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_rightLatch02 = dispatch.AddPublisher(doors::dsRightLatch02);
|
||||
if (!m_rightLatch02)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not get signal: ", doors::dsRightLatch02, " [CVehicleDevice]");
|
||||
m_status = sdv::EObjectStatus::initialization_failure;
|
||||
return;
|
||||
}
|
||||
|
||||
m_status = sdv::EObjectStatus::initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus CVehicleDeviceRearDoorRight::GetStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void CVehicleDeviceRearDoorRight::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 request thread
|
||||
*/
|
||||
void CVehicleDeviceRearDoorRight::Shutdown()
|
||||
{
|
||||
m_rightDoorIsOpen02Signal.Reset();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen02MutexCallbacks);
|
||||
for (auto callback : m_rightDoorIsOpen02Callbacks)
|
||||
{
|
||||
UnregisterIsOpenEvent(callback);
|
||||
}
|
||||
m_rightDoorIsOpen02Callbacks.clear();
|
||||
|
||||
m_status = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register IsOpen event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceRearDoorRight::RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen02MutexCallbacks);
|
||||
m_rightDoorIsOpen02Callbacks.insert(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unregister IsOpen event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void CVehicleDeviceRearDoorRight::UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event* event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen02MutexCallbacks);
|
||||
m_rightDoorIsOpen02Callbacks.erase(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void CVehicleDeviceRearDoorRight::ExecuteAllCallBacksForRightDoorIsOpen02(sdv::any_t value)
|
||||
{
|
||||
bool rightDoorIsOpen = value.get<bool>();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_rightDoorIsOpen02MutexCallbacks);
|
||||
for (auto callback : m_rightDoorIsOpen02Callbacks)
|
||||
{
|
||||
callback->WriteIsOpen(rightDoorIsOpen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Lock
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool CVehicleDeviceRearDoorRight::WriteLock(bool value)
|
||||
{
|
||||
if (m_rightLatch02)
|
||||
{
|
||||
m_rightLatch02.Write(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
/**
|
||||
* @file vd_rear_door_right.h
|
||||
* @date 2025-07-11 12:43:52
|
||||
* File is auto generated from VSS utility.
|
||||
* VSS Version:1.0.0.1
|
||||
*/
|
||||
#ifndef __VSS_GENERATED__VD_REARDOORRIGHT_H_20250711_124352_715__
|
||||
#define __VSS_GENERATED__VD_REARDOORRIGHT_H_20250711_124352_715__
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/signal_support.h>
|
||||
#include "vss_vehiclechassisdooraxle02right_vd_rx.h"
|
||||
#include "vss_vehiclechassisdooraxle02right_vd_tx.h"
|
||||
#include "signal_identifier.h"
|
||||
|
||||
/**
|
||||
* @brief Vehicle device Vehicle.Chassis.Door.Axle02.Right
|
||||
*/
|
||||
class CVehicleDeviceRearDoorRight
|
||||
: public sdv::CSdvObject
|
||||
, public sdv::IObjectControl
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_IsOpen
|
||||
, public vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteLock
|
||||
{
|
||||
public:
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_IsOpen)
|
||||
SDV_INTERFACE_ENTRY(vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteLock)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Device)
|
||||
DECLARE_OBJECT_CLASS_NAME("Vehicle.Chassis.Door.Axle02.Right_Device")
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CVehicleDeviceRearDoorRight();
|
||||
|
||||
/**
|
||||
* @brief initialize device to get the object name or use the default.
|
||||
* @param[in] objectConfig Configuration containing the object name
|
||||
*/
|
||||
void Initialize(const sdv::u8string& objectConfig) override;
|
||||
|
||||
/**
|
||||
* @brief Gets the current status of the object
|
||||
* @return EObjectStatus The current status of the object
|
||||
*/
|
||||
sdv::EObjectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Set the component operation mode. Overlovd of sdv::IObjectControl::SetOperationMode.
|
||||
* @param[in] eMode The operation mode, the component should run in.
|
||||
*/
|
||||
void SetOperationMode(/*in*/ sdv::EOperationMode eMode) override;
|
||||
|
||||
/**
|
||||
* @brief Shutdown function is to shutdown the execution of request thread
|
||||
*/
|
||||
void Shutdown() override;
|
||||
|
||||
/**
|
||||
* @brief Set rightLatch02 signal
|
||||
* @param[in] value
|
||||
* @return true on success otherwise false
|
||||
*/
|
||||
bool WriteLock(bool value) override;
|
||||
|
||||
/**
|
||||
* @brief Register IVSS_WriteIsOpen_Event on signal change
|
||||
* Collect all events and call them on signal change
|
||||
* @param[in] event function
|
||||
*/
|
||||
void RegisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister IVSS_IsOpen_Event
|
||||
* @param[in] event function
|
||||
*/
|
||||
void UnregisterIsOpenEvent(vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event* event) override;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Execute all callbacks
|
||||
*/
|
||||
void ExecuteAllCallBacksForRightDoorIsOpen02(sdv::any_t value);
|
||||
|
||||
sdv::core::CSignal m_rightLatch02; ///< Signal to lock/unlock the door
|
||||
sdv::core::CSignal m_rightDoorIsOpen02Signal; ///< Open/close signal of the vehicle device
|
||||
mutable std::mutex m_rightDoorIsOpen02MutexCallbacks; ///< Mutex protecting m_rightDoorIsOpen02Callbacks
|
||||
std::set<vss::Vehicle::Chassis::Door::Axle02::RightDevice::IVSS_WriteIsOpen_Event*> m_rightDoorIsOpen02Callbacks; ///< collection of events to be called
|
||||
|
||||
std::atomic<sdv::EObjectStatus> m_status = { sdv::EObjectStatus::initialization_pending }; ///< To update the object status when it changes.
|
||||
};
|
||||
|
||||
DEFINE_SDV_OBJECT(CVehicleDeviceRearDoorRight)
|
||||
|
||||
#endif // !define __VSS_GENERATED__VD_REARDOORRIGHT_H_20250711_124352_715__
|
||||
@@ -1,28 +0,0 @@
|
||||
# Settings file
|
||||
[Settings]
|
||||
Version = 100
|
||||
|
||||
# The system config array can contain zero or more configurations that are loaded at the time
|
||||
# the system ist started. It is advisable to split the configurations in:
|
||||
# platform config - containing all the components needed to interact with the OS,
|
||||
# middleware, vehicle bus, Ethernet.
|
||||
# vehicle interface - containing the vehicle bus interpretation components like data link
|
||||
# based on DBC and devices for their abstraction.
|
||||
# vehicle abstraction - containing the basic services
|
||||
# Load the system configurations by providing the "SystemConfig" keyword as an array of strings.
|
||||
# A relative path is relative to the installation directory (being "exe_location/instance_id").
|
||||
#
|
||||
# Example:
|
||||
# SystemConfig = [ "platform.toml", "vehicle_ifc.toml", "vehicle_abstract.toml" ]
|
||||
#
|
||||
SystemConfig = [ "platform.toml", "vehicle_ifc.toml", "vehicle_abstract.toml" ]
|
||||
|
||||
# The application config contains the configuration file that can be updated when services and
|
||||
# apps are being added to the system (or being removed from the system). Load the application
|
||||
# config by providing the "AppConfig" keyword as a string value. A relative path is relative to
|
||||
# the installation directory (being "exe_location/instance_id").
|
||||
#
|
||||
# Example
|
||||
# AppConfig = "app_config.toml"
|
||||
#
|
||||
AppConfig = "trunk.toml"
|
||||
@@ -1,20 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "trunk_complex_service.sdv"
|
||||
Class = "Open Trunk Service"
|
||||
Name = "Open Trunk Service"
|
||||
|
||||
[[Module]]
|
||||
Path = "trunk_service_proxystub.sdv"
|
||||
|
||||
[[Module.Component]]
|
||||
Class = "Proxy_13181601229896482092"
|
||||
Aliases = ["Proxy_ITrunkKitService"]
|
||||
Type = "Proxy"
|
||||
|
||||
[[Module.Component]]
|
||||
Class = "Stub_13181601229896482092"
|
||||
Aliases = ["Stub_ITrunkKitService"]
|
||||
Type = "Stub"
|
||||
@@ -1,19 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "trunk_bs_vehiclespeed_rx.sdv"
|
||||
Class = "Vehicle.Speed_Service"
|
||||
Name = "Vehicle.Speed_Service"
|
||||
|
||||
[[Component]]
|
||||
Path = "trunk_bs_vehicletrunk_tx.sdv"
|
||||
Class = "Vehicle.Body.Trunk_Service"
|
||||
Name = "Vehicle.Body.Trunk_Service"
|
||||
|
||||
|
||||
[[Module]]
|
||||
Path = "trunk_proxystub.sdv"
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "can_dl_trunk.sdv"
|
||||
Class = "CAN_data_link"
|
||||
Name = "DataLink"
|
||||
|
||||
[[Component]]
|
||||
Path = "trunk_vd_vehiclespeed_rx.sdv"
|
||||
Class = "Vehicle.Speed_Device"
|
||||
Name = "Vehicle.Speed_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "trunk_vd_vehicletrunk_tx.sdv"
|
||||
Class = "Vehicle.Body.Trunk_Device"
|
||||
Name = "Vehicle.Body.Trunk_Device"
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_complex_service.sdv"
|
||||
Class = "Counter Steering Example Service"
|
||||
Name = "Counter Steering Example Service"
|
||||
|
||||
[[Module]]
|
||||
Path = "example_service_proxystub.sdv"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# Settings file
|
||||
[Settings]
|
||||
Version = 100
|
||||
|
||||
# The system config array can contain zero or more configurations that are loaded at the time
|
||||
# the system ist started. It is advisable to split the configurations in:
|
||||
# platform config - containing all the components needed to interact with the OS,
|
||||
# middleware, vehicle bus, Ethernet.
|
||||
# vehicle interface - containing the vehicle bus interpretation components like data link
|
||||
# based on DBC and devices for their abstraction.
|
||||
# vehicle abstraction - containing the basic services
|
||||
# Load the system configurations by providing the "SystemConfig" keyword as an array of strings.
|
||||
# A relative path is relative to the installation directory (being "exe_location/instance_id").
|
||||
#
|
||||
# Example:
|
||||
# SystemConfig = [ "platform.toml", "vehicle_ifc.toml", "vehicle_abstract.toml" ]
|
||||
#
|
||||
SystemConfig = [ "platform.toml", "vehicle_ifc.toml", "vehicle_abstract.toml" ]
|
||||
|
||||
# The application config contains the configuration file that can be updated when services and
|
||||
# apps are being added to the system (or being removed from the system). Load the application
|
||||
# config by providing the "AppConfig" keyword as a string value. A relative path is relative to
|
||||
# the installation directory (being "exe_location/instance_id").
|
||||
#
|
||||
# Example
|
||||
# AppConfig = "app_config.toml"
|
||||
#
|
||||
AppConfig = "Demo.toml"
|
||||
@@ -1,26 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_bs_isactivecounter_tx.sdv"
|
||||
Class = "Vehicle.Software.Application.IsActiveCounter_Service"
|
||||
Name = "Vehicle.Software.Application.IsActiveCounter_Service"
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_bs_steeringwheel_rx.sdv"
|
||||
Class = "Vehicle.Chassis.SteeringWheel.Angle_Service"
|
||||
Name = "Vehicle.Chassis.SteeringWheel.Angle_Service"
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_bs_vehiclechassisaxle_tx.sdv"
|
||||
Class = "Vehicle.Chassis.RearAxle.Row.Wheel_Service"
|
||||
Name = "Vehicle.Chassis.RearAxle.Row.Wheel_Service"
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_bs_vehiclespeed_rx.sdv"
|
||||
Class = "Vehicle.Speed_Service"
|
||||
Name = "Vehicle.Speed_Service"
|
||||
|
||||
[[Module]]
|
||||
Path = "demo_proxystub.sdv"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
[Configuration]
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "can_dl_example.sdv"
|
||||
Class = "CAN_data_link"
|
||||
Name = "DataLink"
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_vd_isactivecounter_tx.sdv"
|
||||
Class = "Vehicle.Software.Application.IsActiveCounter_Device"
|
||||
Name = "Vehicle.Software.Application.IsActiveCounter_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_vd_steeringwheel_rx.sdv"
|
||||
Class = "Vehicle.Chassis.SteeringWheel.Angle_Device"
|
||||
Name = "Vehicle.Chassis.SteeringWheel.Angle_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_vd_vehiclechassisaxle_tx.sdv"
|
||||
Class = "Vehicle.Chassis.RearAxle.Row.Wheel_Device"
|
||||
Name = "Vehicle.Chassis.RearAxle.Row.Wheel_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "demo_vd_vehiclespeed_rx.sdv"
|
||||
Class = "Vehicle.Speed_Device"
|
||||
Name = "Vehicle.Speed_Device"
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
#ifndef SDV_TEST_MACRO_H
|
||||
#define SDV_TEST_MACRO_H
|
||||
|
||||
/**
|
||||
* @brief Software Defined Vehicle framework.
|
||||
*/
|
||||
namespace sdv
|
||||
{
|
||||
/**
|
||||
* @brief Namespace TEST
|
||||
*/
|
||||
namespace TEST
|
||||
{
|
||||
/**
|
||||
* @brief Enum for warning levels.
|
||||
*/
|
||||
enum WarningLevel
|
||||
{
|
||||
WARNING_ENABLED, //<! With this level Failed tests are reported as error as it is in GTEST normally.
|
||||
WARNING_REDUCED, //<! With this level Failed tests are reported as warning.
|
||||
WARNING_DISABLED //<! With this level no action is implemented at this moment.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Function to report a warning when the expected condition is not met.
|
||||
* @param[in] condition The condition that is being checked (should be true if valid).
|
||||
* @param[in] warningLevel The level of warning to display.
|
||||
* @param[in] message The warning message to display.
|
||||
* @param[in] file The name of the file where the warning occurred.
|
||||
* @param[in] line The line number where the warning occurred.
|
||||
*/
|
||||
inline void ReportWarning(bool condition, WarningLevel warningLevel, const std::string& message, const char* file, int line)
|
||||
{
|
||||
if (!condition)
|
||||
{
|
||||
switch (warningLevel)
|
||||
{
|
||||
case WARNING_ENABLED:
|
||||
FAIL() << "[ FAILED ]: " << message << " in file " << file << " on line " << line << std::endl;
|
||||
break;
|
||||
case WARNING_DISABLED:
|
||||
// No action
|
||||
break;
|
||||
case WARNING_REDUCED:
|
||||
std::clog << "[[ WARNING ]] TEST FAILURE NOT EVALUATED: " << message << " in file " << file << " on line " << line << std::endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to detect whether tests are running with CMAKE build or locally manually.
|
||||
* @return Returns true if it is running with CMAKE build, otherwise false.
|
||||
*/
|
||||
inline bool IsRunningTestsWithCmakeBuild()
|
||||
{
|
||||
auto envVar = std::getenv("TEST_EXECUTION_MODE");
|
||||
|
||||
if (envVar && std::string(envVar) == "CMake") return true;
|
||||
else return false;
|
||||
}
|
||||
} // namespace TEST
|
||||
} // namespace sdv
|
||||
|
||||
/**
|
||||
* @brief Macro for checking whether tests are running with CMAKE build or locally manually.
|
||||
* Returns true if it is running with CMAKE build, otherwise false.
|
||||
*/
|
||||
#define SDV_IS_RUNNING_TESTS_WITH_CMAKE_BUILD sdv::TEST::IsRunningTestsWithCmakeBuild()
|
||||
|
||||
/**
|
||||
* @brief Helper macro to handle warning levels.
|
||||
* @param[in] level The warning level.
|
||||
* @param[in] statement The statement to execute.
|
||||
* @param[in] val1 The first value for comparison.
|
||||
* @param[in] val2 The second value for comparison.
|
||||
* @param[in] condition The condition to check.
|
||||
*/
|
||||
#define HANDLE_WARNING_LEVEL(level, statement, val1, val2, condition) \
|
||||
do \
|
||||
{ \
|
||||
switch (level) \
|
||||
{ \
|
||||
case sdv::TEST::WarningLevel::WARNING_ENABLED: \
|
||||
statement; \
|
||||
break; \
|
||||
case sdv::TEST::WarningLevel::WARNING_REDUCED: \
|
||||
if (val1 condition val2) statement; \
|
||||
else \
|
||||
{ \
|
||||
std::ostringstream oss; \
|
||||
oss << "[[ WARNING ]] TEST FAILURE NOT EVALUATED: Condition did not match for [" \
|
||||
<< #val1 "] and [" #val2 << "] in file " << __FILE__ << " on line " << __LINE__; \
|
||||
std::clog << oss.str() << std::endl; \
|
||||
} \
|
||||
break; \
|
||||
case sdv::TEST::WarningLevel::WARNING_DISABLED: /* No action */ \
|
||||
break; \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* @brief Redefine GTEST macros with warning level.
|
||||
* @param[in] val1 The first value.
|
||||
* @param[in] val2 The second value.
|
||||
* @param[in] level The warning level.
|
||||
*/
|
||||
#define SDV_EXPECT_EQ(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_EQ(val1, val2), val1, val2, ==)
|
||||
|
||||
#define SDV_ASSERT_EQ(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_EQ(val1, val2), val1, val2, ==)
|
||||
|
||||
#define SDV_EXPECT_NE(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_NE(val1, val2), val1, val2, !=)
|
||||
|
||||
#define SDV_ASSERT_NE(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_NE(val1, val2), val1, val2, !=)
|
||||
|
||||
#define SDV_EXPECT_TRUE(condition, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_TRUE(condition), condition, true, ==)
|
||||
|
||||
#define SDV_ASSERT_TRUE(condition, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_TRUE(condition), condition, true, ==)
|
||||
|
||||
#define SDV_EXPECT_FALSE(condition, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_FALSE(condition), condition, false, ==)
|
||||
|
||||
#define SDV_ASSERT_FALSE(condition, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_FALSE(condition), condition, false, ==)
|
||||
|
||||
#define SDV_EXPECT_LT(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_LT(val1, val2), val1, val2, <)
|
||||
|
||||
#define SDV_ASSERT_LT(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_LT(val1, val2), val1, val2, <)
|
||||
|
||||
#define SDV_EXPECT_LE(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_LE(val1, val2), val1, val2, <=)
|
||||
|
||||
#define SDV_ASSERT_LE(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_LE(val1, val2), val1, val2, <=)
|
||||
|
||||
#define SDV_EXPECT_GT(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_GT(val1, val2), val1, val2, >)
|
||||
|
||||
#define SDV_ASSERT_GT(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_GT(val1, val2), val1, val2, >)
|
||||
|
||||
#define SDV_EXPECT_GE(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_GE(val1, val2), val1, val2, >=)
|
||||
|
||||
#define SDV_ASSERT_GE(val1, val2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_GE(val1, val2), val1, val2, >=)
|
||||
|
||||
#define SDV_EXPECT_STREQ(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_STREQ((str1).c_str(), (str2).c_str()), str1, str2, ==)
|
||||
|
||||
#define SDV_ASSERT_STREQ(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_STREQ((str1).c_str(), (str2).c_str()), str1, str2, ==)
|
||||
|
||||
#define SDV_EXPECT_STRNE(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_STRNE(str1.c_str(), str2.c_str()), str1, str2, !=)
|
||||
|
||||
#define SDV_ASSERT_STRNE(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_STRNE(str1.c_str(), str2.c_str()), str1, str2, !=)
|
||||
|
||||
#define SDV_EXPECT_STRCASEEQ(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_STRCASEEQ((str1).c_str(), (str2).c_str()), str1, str2, ==)
|
||||
|
||||
#define SDV_ASSERT_STRCASEEQ(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_STRCASEEQ((str1).c_str(), (str2).c_str()), str1, str2, ==)
|
||||
|
||||
#define SDV_EXPECT_STRCASENE(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, EXPECT_STRCASENE((str1).c_str(), (str2).c_str()), str1, str2, !=)
|
||||
|
||||
#define SDV_ASSERT_STRCASENE(str1, str2, level) \
|
||||
HANDLE_WARNING_LEVEL(level, ASSERT_STRCASENE((str1).c_str(), (str2).c_str()), str1, str2, !=)
|
||||
|
||||
/**
|
||||
* @brief Macro for equality check (==) with warning reporting for time critical tests.
|
||||
* @param[in] val1 The first value.
|
||||
* @param[in] val2 The second value.
|
||||
* @param[in] warningLevel The level of warning to display.
|
||||
*/
|
||||
#define SDV_TIMING_EXPECT_EQ(val1, val2, warningLevel) \
|
||||
sdv::TEST::ReportWarning((val1) == (val2), warningLevel, \
|
||||
"Expected " #val1 " == " #val2 " (" #val1 "=" + std::to_string(val1) + ", " #val2 "=" + std::to_string(val2) + ")", \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @brief Macro for inequality check (!=) with warning reporting for time critical tests.
|
||||
* @param[in] val1 The first value.
|
||||
* @param[in] val2 The second value.
|
||||
* @param[in] warningLevel The level of warning to display.
|
||||
*/
|
||||
#define SDV_TIMING_EXPECT_NE(val1, val2, warningLevel) \
|
||||
sdv::TEST::ReportWarning((val1) != (val2), warningLevel, \
|
||||
"Expected " #val1 " != " #val2 " (" #val1 "=" + std::to_string(val1) + ", " #val2 "=" + std::to_string(val2) + ")", \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @brief Macro for greater-than check (>) with warning reporting for time critical tests.
|
||||
* @param[in] val1 The first value.
|
||||
* @param[in] val2 The second value.
|
||||
* @param[in] warningLevel The level of warning to display.
|
||||
*/
|
||||
#define SDV_TIMING_EXPECT_GT(val1, val2, warningLevel) \
|
||||
sdv::TEST::ReportWarning((val1) > (val2), warningLevel, \
|
||||
"Expected " #val1 " > " #val2 " (" #val1 "=" + std::to_string(val1) + ", " #val2 "=" + std::to_string(val2) + ")", \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @brief Macro for less-than check (<) with warning reporting for time critical tests.
|
||||
* @param[in] val1 The first value.
|
||||
* @param[in] val2 The second value.
|
||||
* @param[in] warningLevel The level of warning to display.
|
||||
*/
|
||||
#define SDV_TIMING_EXPECT_LT(val1, val2, warningLevel) \
|
||||
sdv::TEST::ReportWarning((val1) < (val2), warningLevel, \
|
||||
"Expected " #val1 " < " #val2 " (" #val1 "=" + std::to_string(val1) + ", " #val2 "=" + std::to_string(val2) + ")", \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @brief Macro for greater-than-or-equal-to check (>=) with warning reporting for time critical tests.
|
||||
* @param[in] val1 The first value.
|
||||
* @param[in] val2 The second value.
|
||||
* @param[in] warningLevel The level of warning to display.
|
||||
*/
|
||||
#define SDV_TIMING_EXPECT_GE(val1, val2, warningLevel) \
|
||||
sdv::TEST::ReportWarning((val1) >= (val2), warningLevel, \
|
||||
"Expected " #val1 " >= " #val2 " (" #val1 "=" + std::to_string(val1) + ", " #val2 "=" + std::to_string(val2) + ")", \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @brief Macro for less-than-or-equal-to check (<=) with warning reporting for time critical tests.
|
||||
* @param[in] val1 The first value.
|
||||
* @param[in] val2 The second value.
|
||||
* @param[in] warningLevel The level of warning to display.
|
||||
*/
|
||||
#define SDV_TIMING_EXPECT_LE(val1, val2, warningLevel) \
|
||||
sdv::TEST::ReportWarning((val1) <= (val2), warningLevel, \
|
||||
"Expected " #val1 " <= " #val2 " (" #val1 "=" + std::to_string(val1) + ", " #val2 "=" + std::to_string(val2) + ")", \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
#endif // SDV_TEST_MACRO_H
|
||||
@@ -1,24 +0,0 @@
|
||||
if(WIN32)
|
||||
# Define project
|
||||
project(ipc_sockets VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Define target
|
||||
add_library(ipc_sockets SHARED
|
||||
"channel_mgnt.h"
|
||||
"channel_mgnt.cpp"
|
||||
"connection.h"
|
||||
"connection.cpp")
|
||||
target_link_libraries(ipc_sockets ${CMAKE_THREAD_LIBS_INIT} Ws2_32.lib)
|
||||
target_link_options(ipc_sockets PRIVATE)
|
||||
target_include_directories(ipc_sockets PRIVATE ./include/)
|
||||
|
||||
set_target_properties(ipc_sockets PROPERTIES PREFIX "")
|
||||
set_target_properties(ipc_sockets PROPERTIES SUFFIX ".sdv")
|
||||
|
||||
# Build dependencies
|
||||
add_dependencies(ipc_sockets CompileCoreIDL)
|
||||
|
||||
# Appending the service in the service list
|
||||
set(SDV_Service_List ${SDV_Service_List} ipc_sockets PARENT_SCOPE)
|
||||
|
||||
endif()
|
||||
@@ -1,356 +0,0 @@
|
||||
#include "channel_mgnt.h"
|
||||
#include "connection.h"
|
||||
#include "../../global/base64.h"
|
||||
#include <support/toml.h>
|
||||
#include <interfaces/process.h>
|
||||
#include <future>
|
||||
|
||||
#pragma push_macro("interface")
|
||||
#undef interface
|
||||
#pragma push_macro("GetObject")
|
||||
#undef GetObject
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <array>
|
||||
|
||||
// Resolve conflict
|
||||
#pragma pop_macro("GetObject")
|
||||
#pragma pop_macro("interface")
|
||||
#ifdef GetClassInfo
|
||||
#undef GetClassInfo
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Define for the connection string
|
||||
*/
|
||||
#define SHARED_SOCKET "SHARED_SOCKET"
|
||||
|
||||
void CSocketsChannelMgnt::Initialize(const sdv::u8string& /*ssObjectConfig*/)
|
||||
{
|
||||
if (m_eObjectStatus != sdv::EObjectStatus::initialization_pending)
|
||||
m_eObjectStatus = sdv::EObjectStatus::initialization_failure;
|
||||
else
|
||||
m_eObjectStatus = sdv::EObjectStatus::initialized;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CSocketsChannelMgnt::GetStatus() const
|
||||
{
|
||||
return m_eObjectStatus;
|
||||
}
|
||||
|
||||
void CSocketsChannelMgnt::SetOperationMode(sdv::EOperationMode eMode)
|
||||
{
|
||||
switch (eMode)
|
||||
{
|
||||
case sdv::EOperationMode::configuring:
|
||||
if (m_eObjectStatus == sdv::EObjectStatus::running || m_eObjectStatus == sdv::EObjectStatus::initialized)
|
||||
m_eObjectStatus = sdv::EObjectStatus::configuring;
|
||||
break;
|
||||
case sdv::EOperationMode::running:
|
||||
if (m_eObjectStatus == sdv::EObjectStatus::configuring || m_eObjectStatus == sdv::EObjectStatus::initialized)
|
||||
m_eObjectStatus = sdv::EObjectStatus::running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CSocketsChannelMgnt::Shutdown()
|
||||
{
|
||||
//m_eObjectStatus = sdv::EObjectStatus::shutdown_in_progress;
|
||||
//...
|
||||
m_eObjectStatus = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
sdv::ipc::SChannelEndpoint CSocketsChannelMgnt::CreateEndpoint(const sdv::u8string& /*ssChannelConfig*/)
|
||||
{
|
||||
StartUpWinSock();
|
||||
addrinfo hints;
|
||||
ZeroMemory(&hints, sizeof(hints));
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
||||
SOCKET listenSocket = CreateSocket(hints);
|
||||
|
||||
if (listenSocket == INVALID_SOCKET)
|
||||
{
|
||||
SDV_LOG_ERROR("CreateSocket failed (could not create endpoint)");
|
||||
sdv::ipc::SChannelEndpoint connectionEndpoint{};
|
||||
return connectionEndpoint;
|
||||
}
|
||||
|
||||
CConnection* pRemoteIPCConnection = new CConnection(listenSocket, true);
|
||||
|
||||
uint16_t port = GetPort(listenSocket);
|
||||
std::string ipcCompleteConfig = "localhost";
|
||||
ipcCompleteConfig.append(";");
|
||||
ipcCompleteConfig.append(std::to_string(port));
|
||||
SDV_LOG_INFO("IPC command param: '", ipcCompleteConfig, "'");
|
||||
|
||||
sdv::ipc::SChannelEndpoint connectionEndpoint{};
|
||||
connectionEndpoint.pConnection = static_cast<IInterfaceAccess*>(pRemoteIPCConnection);
|
||||
connectionEndpoint.ssConnectString = ipcCompleteConfig;
|
||||
|
||||
return connectionEndpoint;
|
||||
}
|
||||
|
||||
|
||||
sdv::IInterfaceAccess* CSocketsChannelMgnt::Access(const sdv::u8string& ssConnectString)
|
||||
{
|
||||
bool sharedSocketRequired = ssConnectString.find(SHARED_SOCKET) != std::string::npos ? true : false;
|
||||
|
||||
if (sharedSocketRequired)
|
||||
{
|
||||
std::string base64Data(ssConnectString);
|
||||
const std::string ext(SHARED_SOCKET);
|
||||
base64Data = base64Data.substr(0, base64Data.size() - ext.size());
|
||||
|
||||
WSAPROTOCOL_INFO socketInfo = DecodeBase64<WSAPROTOCOL_INFO>(base64Data);
|
||||
|
||||
SOCKET sharedSocket = WSASocket(0, 0, 0, &socketInfo, 0, 0);
|
||||
std::string success = "Socket sharing success";
|
||||
if (sharedSocket == INVALID_SOCKET)
|
||||
{
|
||||
success = "Socket sharing did not work!";
|
||||
}
|
||||
|
||||
return static_cast<IInterfaceAccess*>(new CConnection(sharedSocket, false));
|
||||
}
|
||||
|
||||
StartUpWinSock();
|
||||
addrinfo hints;
|
||||
ZeroMemory(&hints, sizeof(hints));
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
||||
std::string host{"localhost"};
|
||||
std::string param{ssConnectString};
|
||||
auto it = param.find(";");
|
||||
if (it != std::string::npos)
|
||||
{
|
||||
host = param.substr(0, it);
|
||||
param = param.substr(it + 1, param.size() - it - 1);
|
||||
}
|
||||
|
||||
SOCKET socket = CreateAndConnectToExistingSocket(hints, host.c_str(), param.c_str());
|
||||
if (socket == INVALID_SOCKET)
|
||||
{
|
||||
SDV_LOG_ERROR("Could not create my socket and connect to the existing socket.");
|
||||
}
|
||||
|
||||
return static_cast<IInterfaceAccess*>(new CConnection(socket, false));
|
||||
}
|
||||
|
||||
uint16_t CSocketsChannelMgnt::GetPort(SOCKET socket) const
|
||||
{
|
||||
sockaddr_in sockAddr;
|
||||
sockAddr.sin_port = 0;
|
||||
int nameLength = sizeof(sockAddr);
|
||||
getsockname(socket, reinterpret_cast<sockaddr*>(&sockAddr), &nameLength);
|
||||
return ntohs(sockAddr.sin_port);
|
||||
}
|
||||
|
||||
SOCKET CSocketsChannelMgnt::CreateAndConnectToExistingSocket(const addrinfo& hints,
|
||||
const char* hostName,
|
||||
const char* portName)
|
||||
{
|
||||
SOCKET invalidSocket{INVALID_SOCKET};
|
||||
|
||||
// Resolve the server address and port
|
||||
CAddrInfo result;
|
||||
int error = getaddrinfo(hostName, portName, &hints, &result.AddressInfo);
|
||||
if (error != 0)
|
||||
{
|
||||
|
||||
SDV_LOG_ERROR("getaddrinfo failed with error: ",
|
||||
std::to_string(error),
|
||||
" host: ",
|
||||
hostName,
|
||||
" port: ",
|
||||
portName);
|
||||
return invalidSocket;
|
||||
}
|
||||
|
||||
SOCKET connectSocket{INVALID_SOCKET};
|
||||
// Attempt to connect to an address until one succeeds
|
||||
for (addrinfo* ptr = result.AddressInfo; ptr != NULL; ptr = ptr->ai_next)
|
||||
{
|
||||
// Create a SOCKET for connecting to server
|
||||
connectSocket = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
|
||||
if (connectSocket == INVALID_SOCKET)
|
||||
{
|
||||
SDV_LOG_ERROR("socket failed with error: ", std::to_string(error));
|
||||
return invalidSocket;
|
||||
}
|
||||
|
||||
// Connect to server.
|
||||
error = connect(connectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
|
||||
if (error == SOCKET_ERROR)
|
||||
{
|
||||
SDV_LOG_ERROR("connect failed with error: ", std::to_string(error));
|
||||
closesocket(connectSocket);
|
||||
connectSocket = INVALID_SOCKET;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return connectSocket;
|
||||
}
|
||||
|
||||
SOCKET CSocketsChannelMgnt::CreateSocket(const addrinfo& hints)
|
||||
{
|
||||
static constexpr const char* defaultPort_0{"0"}; // In case a defined port is required
|
||||
SOCKET invalidSocket{INVALID_SOCKET};
|
||||
CAddrInfo result;
|
||||
int error = getaddrinfo(NULL, defaultPort_0, &hints, &result.AddressInfo);
|
||||
if (error != 0)
|
||||
{
|
||||
SDV_LOG_ERROR("getaddrinfo failed with error: ", std::to_string(error));
|
||||
return invalidSocket;
|
||||
}
|
||||
|
||||
SOCKET connectSocket{INVALID_SOCKET};
|
||||
connectSocket =
|
||||
socket(result.AddressInfo->ai_family, result.AddressInfo->ai_socktype, result.AddressInfo->ai_protocol);
|
||||
if (connectSocket == INVALID_SOCKET)
|
||||
{
|
||||
SDV_LOG_ERROR("error at socket(): ", std::to_string(error));
|
||||
return invalidSocket;
|
||||
}
|
||||
|
||||
error = bind(connectSocket, result.AddressInfo->ai_addr, (int)result.AddressInfo->ai_addrlen);
|
||||
if (error == SOCKET_ERROR)
|
||||
{
|
||||
closesocket(connectSocket);
|
||||
SDV_LOG_ERROR("bind failed with error: ", std::to_string(error));
|
||||
return invalidSocket;
|
||||
}
|
||||
|
||||
if (listen(connectSocket, SOMAXCONN) == SOCKET_ERROR)
|
||||
{
|
||||
closesocket(connectSocket);
|
||||
SDV_LOG_ERROR("listen failed with error: ", std::to_string(WSAGetLastError()));
|
||||
return invalidSocket;
|
||||
}
|
||||
|
||||
// Change the socket mode on the listening socket from blocking to
|
||||
// non-block so the application will not block waiting for requests
|
||||
u_long NonBlock = 1;
|
||||
if (ioctlsocket(connectSocket, FIONBIO, &NonBlock) == SOCKET_ERROR)
|
||||
{
|
||||
closesocket(connectSocket);
|
||||
SDV_LOG_ERROR("ioctlsocket failed with error: ", std::to_string(WSAGetLastError()));
|
||||
return invalidSocket;
|
||||
}
|
||||
|
||||
return connectSocket;
|
||||
}
|
||||
|
||||
|
||||
SOCKET CSocketsChannelMgnt::CreateAndConnectToSocket(const addrinfo& hints, const char* defaultHost, const char* defaultPort)
|
||||
{
|
||||
SOCKET ConnectSocket{ INVALID_SOCKET };
|
||||
|
||||
// Resolve the server address and port
|
||||
CAddrInfo result;
|
||||
if (getaddrinfo(defaultHost, defaultPort, &hints, &result.AddressInfo) != 0)
|
||||
{
|
||||
SDV_LOG_ERROR("getaddrinfo() failed: ", std::to_string(WSAGetLastError()));
|
||||
return ConnectSocket;
|
||||
}
|
||||
|
||||
// Attempt to connect to an address until one succeeds
|
||||
for (addrinfo* ptr = result.AddressInfo; ptr != NULL; ptr = ptr->ai_next)
|
||||
{
|
||||
// Create a SOCKET for connecting to server
|
||||
ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
|
||||
if (ConnectSocket == INVALID_SOCKET)
|
||||
{
|
||||
SDV_LOG_ERROR("creating SOCKET for connecting failed: ", std::to_string(WSAGetLastError()));
|
||||
break;
|
||||
}
|
||||
|
||||
// Connect to server.
|
||||
if (connect(ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen) == SOCKET_ERROR)
|
||||
{
|
||||
SDV_LOG_ERROR("connect to servcer failed: ", std::to_string(WSAGetLastError()));
|
||||
closesocket(ConnectSocket);
|
||||
ConnectSocket = INVALID_SOCKET;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (ConnectSocket == INVALID_SOCKET)
|
||||
{
|
||||
SDV_LOG_ERROR("Failed to create valid sockaet in CreateAndConnectToSocket()");
|
||||
}
|
||||
|
||||
return ConnectSocket;
|
||||
}
|
||||
|
||||
SOCKET CSocketsChannelMgnt::Listen(const addrinfo& hints, uint32_t port)
|
||||
{
|
||||
SOCKET listenSocket = INVALID_SOCKET;
|
||||
CAddrInfo result;
|
||||
int error = getaddrinfo(NULL, std::to_string(port).c_str(), &hints, &result.AddressInfo);
|
||||
if (error != 0)
|
||||
{
|
||||
SDV_LOG_ERROR("getaddrinfo() failed: ", std::to_string(WSAGetLastError()));
|
||||
return listenSocket;
|
||||
}
|
||||
|
||||
listenSocket = socket(result.AddressInfo->ai_family, result.AddressInfo->ai_socktype, result.AddressInfo->ai_protocol);
|
||||
if (listenSocket == INVALID_SOCKET)
|
||||
{
|
||||
SDV_LOG_ERROR("2creating SOCKET for connecting failed: failed: ", std::to_string(WSAGetLastError()));
|
||||
return listenSocket;
|
||||
}
|
||||
|
||||
error = bind(listenSocket, result.AddressInfo->ai_addr, (int)result.AddressInfo->ai_addrlen);
|
||||
if (error == SOCKET_ERROR)
|
||||
{
|
||||
SDV_LOG_ERROR("bind failed with error: ", std::to_string(WSAGetLastError()));
|
||||
closesocket(listenSocket);
|
||||
listenSocket = INVALID_SOCKET;
|
||||
return listenSocket;
|
||||
}
|
||||
|
||||
if (listen(listenSocket, SOMAXCONN) == SOCKET_ERROR)
|
||||
{
|
||||
SDV_LOG_ERROR("listen to SOCKET failed: ", std::to_string(WSAGetLastError()));
|
||||
closesocket(listenSocket);
|
||||
listenSocket = INVALID_SOCKET;
|
||||
return listenSocket;
|
||||
}
|
||||
|
||||
return listenSocket;
|
||||
}
|
||||
|
||||
|
||||
SocketConnection CSocketsChannelMgnt::CreateConnectedSocketPair()
|
||||
{
|
||||
SocketConnection connection;
|
||||
|
||||
uint32_t port = 0;
|
||||
SOCKET listenSocket = Listen(getHints, port);
|
||||
|
||||
uint16_t portOfListenSocket = GetPort(listenSocket);
|
||||
auto future = std::async([listenSocket]() { return accept(listenSocket, NULL, NULL); });
|
||||
|
||||
connection.From = CreateAndConnectToSocket(getHints, "localhost", std::to_string(portOfListenSocket).c_str());
|
||||
|
||||
// Future::Get has to be called after the CreateAndConnect-Function
|
||||
connection.To = future.get();
|
||||
return connection;
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
#ifndef CHANNEL_MGNT_H
|
||||
#define CHANNEL_MGNT_H
|
||||
|
||||
#include <support/component_impl.h>
|
||||
#include <interfaces/ipc.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The CAddrInfo structure is used by the getaddrinfo function to hold host address information.
|
||||
*/
|
||||
struct CAddrInfo
|
||||
{
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CAddrInfo() = default;
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
CAddrInfo(const CAddrInfo&) = delete;
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
*/
|
||||
CAddrInfo& operator=(const CAddrInfo&) = delete;
|
||||
/**
|
||||
* @brief Move constructor
|
||||
* @param[in] other Reference to the structure to move.
|
||||
*/
|
||||
CAddrInfo(CAddrInfo&& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief Move operator.
|
||||
* @param[in] other Reference to the structure to move.
|
||||
* @return Returns reference to CAddrInfo structure
|
||||
*/
|
||||
CAddrInfo& operator=(CAddrInfo&& other) = delete;
|
||||
|
||||
~CAddrInfo()
|
||||
{
|
||||
freeaddrinfo(AddressInfo);
|
||||
}
|
||||
|
||||
addrinfo* AddressInfo{nullptr}; ///< The CAddrInfo structure holding host address information.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initial startup of winSock
|
||||
* @return Returns 0 in case of no error, otherwise the error code
|
||||
*/
|
||||
inline int StartUpWinSock()
|
||||
{
|
||||
static bool isInitialized = false;
|
||||
if (isInitialized)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WSADATA wsaData;
|
||||
int error = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||
if (error != 0)
|
||||
{
|
||||
SDV_LOG_ERROR("WSAStartup failed with error: ", std::to_string(error));
|
||||
}
|
||||
else
|
||||
{
|
||||
SDV_LOG_INFO("WSAStartup initialized");
|
||||
isInitialized = true;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Holds to sockets.
|
||||
* Used by the core process to create a connection between to shild processes
|
||||
*/
|
||||
struct SocketConnection
|
||||
{
|
||||
SOCKET From{ INVALID_SOCKET }; ///< socket from child process
|
||||
SOCKET To{ INVALID_SOCKET }; ///< socket to child process
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief IPC channel management class for the shared memory communication.
|
||||
*/
|
||||
class CSocketsChannelMgnt : public sdv::CSdvObject, public sdv::IObjectControl, public sdv::ipc::ICreateEndpoint,
|
||||
public sdv::ipc::IChannelAccess
|
||||
{
|
||||
public:
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
SDV_INTERFACE_ENTRY(sdv::ipc::IChannelAccess)
|
||||
SDV_INTERFACE_ENTRY(sdv::ipc::ICreateEndpoint)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
// Object declarations
|
||||
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::SystemObject)
|
||||
DECLARE_OBJECT_CLASS_NAME("DefaultSocketsChannelControl")
|
||||
DECLARE_OBJECT_CLASS_ALIAS("RemoteChannelControl")
|
||||
DECLARE_DEFAULT_OBJECT_NAME("RemoteChannelControl")
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
|
||||
* @return Return the current status of the object.
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief Create IPC connection object and return the endpoint information. Overload of
|
||||
* sdv::ipc::ICreateEndpoint::CreateEndpoint.
|
||||
* @details The endpoints are generated using either a size and a name based on the interface and port number provided through
|
||||
* the channel configuration or if no configuration is supplied a randomly generated size and name. The following configuration
|
||||
* can be supplied:
|
||||
* @code
|
||||
* [IpcChannel]
|
||||
* Interface = "127.0.0.1"
|
||||
* Port = 2000
|
||||
* @endcode
|
||||
* @param[in] ssChannelConfig Optional channel type specific endpoint configuration.
|
||||
* @return IPC connection object
|
||||
*/
|
||||
sdv::ipc::SChannelEndpoint CreateEndpoint(/*in*/ const sdv::u8string& ssChannelConfig) override;
|
||||
|
||||
/**
|
||||
* @brief Create a connection object from the channel connection parameters string
|
||||
* @param[in] ssConnectString Reference to the string containing the channel connection parameters.
|
||||
* @return Pointer to IInterfaceAccess interface of the connection object or NULL when the object cannot be created.
|
||||
*/
|
||||
sdv::IInterfaceAccess* Access(const sdv::u8string& ssConnectString) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Creates a listen socket without setting the port and configured the socket to return directly without
|
||||
* blocking. No blocking access when data is received. Therefore any receive function must use polling
|
||||
* @return Returns the listen socket
|
||||
*/
|
||||
SOCKET CreateSocket(const addrinfo& hints);
|
||||
|
||||
/**
|
||||
* @brief get port number of a given socket
|
||||
* @param[in] socket the port number is requested
|
||||
* @return Returns the port number of the socket
|
||||
*/
|
||||
uint16_t GetPort(SOCKET socket) const;
|
||||
|
||||
SocketConnection CreateConnectedSocketPair();
|
||||
SOCKET Listen(const addrinfo& hints, uint32_t port);
|
||||
SOCKET CreateAndConnectToSocket(const addrinfo& hints, const char* defaultHost, const char* defaultPort);
|
||||
|
||||
/**
|
||||
* @brief Creates an own socket and connects to an existing socket
|
||||
* @param[in] hints The CAddrInfo structure to create the socket.
|
||||
* @param[in] hostName host name.
|
||||
* @param[in] portName port name.
|
||||
* @return Returns an socket
|
||||
*/
|
||||
SOCKET CreateAndConnectToExistingSocket(const addrinfo& hints, const char* hostName, const char* portName);
|
||||
|
||||
inline static const addrinfo getHints
|
||||
{
|
||||
[]() constexpr {
|
||||
addrinfo hints{0, 0, 0, 0, 0, nullptr, nullptr, nullptr};
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
hints.ai_next = nullptr;
|
||||
|
||||
return hints;
|
||||
}()
|
||||
};
|
||||
|
||||
sdv::EObjectStatus m_eObjectStatus = sdv::EObjectStatus::initialization_pending; ///< Object status.
|
||||
};
|
||||
DEFINE_SDV_OBJECT(CSocketsChannelMgnt)
|
||||
|
||||
#endif // ! defined CHANNEL_MGNT_H
|
||||
@@ -1,353 +0,0 @@
|
||||
#include "connection.h"
|
||||
|
||||
CConnection::CConnection(SOCKET preconfiguredSocket, bool acceptConnectionRequired)
|
||||
{
|
||||
std::fill(std::begin(m_SendBuffer), std::end(m_SendBuffer), '\0');
|
||||
std::fill(std::begin(m_ReceiveBuffer), std::end(m_ReceiveBuffer), '\0');
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::uninitialized;
|
||||
m_ConnectionSocket = preconfiguredSocket;
|
||||
m_AcceptConnectionRequired = acceptConnectionRequired;
|
||||
}
|
||||
|
||||
int32_t CConnection::Send(const char* data, int32_t dataLength)
|
||||
{
|
||||
int32_t bytesSent = send(m_ConnectionSocket, data, dataLength, 0);
|
||||
if (bytesSent == SOCKET_ERROR)
|
||||
{
|
||||
SDV_LOG_ERROR("send failed with error: ", std::to_string(WSAGetLastError()));
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::communication_error;
|
||||
m_ConnectionSocket = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
return bytesSent;
|
||||
}
|
||||
|
||||
bool CConnection::SendData(/*inout*/ sdv::sequence<sdv::pointer<uint8_t>>& seqData)
|
||||
{
|
||||
static uint32_t msgId = 0;
|
||||
msgId++;
|
||||
size_t requiredSize = 0;
|
||||
std::for_each(seqData.cbegin(),
|
||||
seqData.cend(),
|
||||
[&](const sdv::pointer<uint8_t>& rBuffer) { requiredSize += rBuffer.size(); });
|
||||
|
||||
std::unique_lock<std::recursive_mutex> lock(m_SendMutex);
|
||||
|
||||
uint32_t packageNumber = 1;
|
||||
SMsgHeader msgHeader;
|
||||
msgHeader.msgStart = m_MsgStart;
|
||||
msgHeader.msgEnd = m_MsgEnd;
|
||||
msgHeader.msgId = msgId;
|
||||
msgHeader.msgSize = static_cast<uint32_t>(requiredSize);
|
||||
msgHeader.packetNumber = packageNumber;
|
||||
msgHeader.totalPacketCount = static_cast<uint32_t>((requiredSize + m_SendMessageSize - 1) / m_SendMessageSize);
|
||||
memcpy_s(&m_SendBuffer[0], m_SendBufferSize, &msgHeader, sizeof(msgHeader));
|
||||
uint32_t offsetBuffer = sizeof(SMsgHeader);
|
||||
|
||||
std::for_each(seqData.cbegin(),
|
||||
seqData.cend(),
|
||||
[&](const sdv::pointer<uint8_t>& rBuffer)
|
||||
{
|
||||
uint32_t offsetData = 0;
|
||||
while (rBuffer.size() > offsetData)
|
||||
{
|
||||
if (offsetBuffer == 0)
|
||||
{
|
||||
msgHeader.packetNumber = packageNumber;
|
||||
memcpy_s(&m_SendBuffer[0], m_SendBufferSize, &msgHeader, sizeof(msgHeader));
|
||||
offsetBuffer = sizeof(SMsgHeader);
|
||||
}
|
||||
|
||||
auto availableBufferSize = m_SendBufferSize - offsetBuffer;
|
||||
|
||||
if (availableBufferSize > (rBuffer.size() - offsetData))
|
||||
{
|
||||
// fragments fits in buffer, go to next fragment without sending
|
||||
memcpy_s(&m_SendBuffer[offsetBuffer],
|
||||
availableBufferSize,
|
||||
rBuffer.get() + offsetData,
|
||||
rBuffer.size() - offsetData);
|
||||
|
||||
offsetBuffer += (static_cast<uint32_t>(rBuffer.size()) - offsetData);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// fragments exceeds buffer, fill buffer, send buffer, keep fragment
|
||||
memcpy_s(&m_SendBuffer[offsetBuffer],
|
||||
availableBufferSize,
|
||||
rBuffer.get() + offsetData,
|
||||
availableBufferSize);
|
||||
|
||||
Send(m_SendBuffer, static_cast<int>(m_SendBufferSize));
|
||||
offsetData += (static_cast<uint32_t>(availableBufferSize));
|
||||
offsetBuffer = 0;
|
||||
packageNumber++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (0 != offsetBuffer)
|
||||
{
|
||||
Send(m_SendBuffer, static_cast<int>(offsetBuffer));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SOCKET CConnection::AcceptConnection()
|
||||
{
|
||||
SOCKET clientSocket{INVALID_SOCKET};
|
||||
|
||||
int32_t attempt = 0;
|
||||
while (clientSocket == INVALID_SOCKET)
|
||||
{
|
||||
clientSocket = accept(m_ConnectionSocket, NULL, NULL);
|
||||
if (clientSocket == INVALID_SOCKET)
|
||||
{
|
||||
Sleep(2);
|
||||
}
|
||||
attempt++;
|
||||
if (attempt > 2000)
|
||||
{
|
||||
SDV_LOG_ERROR("Accept socket failed, loop exeeded.");
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::connection_error;
|
||||
m_ConnectionSocket = INVALID_SOCKET;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return clientSocket;
|
||||
}
|
||||
|
||||
bool CConnection::AsyncConnect(sdv::IInterfaceAccess* pReceiver)
|
||||
{
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::initializing;
|
||||
if (m_AcceptConnectionRequired)
|
||||
{
|
||||
m_ConnectionSocket = AcceptConnection();
|
||||
}
|
||||
|
||||
if (m_ConnectionSocket == INVALID_SOCKET)
|
||||
{
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::connection_error;
|
||||
return false;
|
||||
}
|
||||
m_pReceiver = sdv::TInterfaceAccessPtr(pReceiver).GetInterface<sdv::ipc::IDataReceiveCallback>();
|
||||
m_pEvent = sdv::TInterfaceAccessPtr(pReceiver).GetInterface<sdv::ipc::IConnectEventCallback>();
|
||||
m_ReceiveThread = std::thread(std::bind(&CConnection::ReceiveMessages, this));
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::connected;
|
||||
|
||||
// TODO: Connection negotiation didn't take place... implement this!
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConnection::WaitForConnection(/*in*/ uint32_t /*uiWaitMs*/)
|
||||
{
|
||||
if (m_ConnectionStatus == sdv::ipc::EConnectStatus::connected) return true;
|
||||
|
||||
// TODO: Implementation here!
|
||||
|
||||
// TODO: Suppress static code analysis while there is no implementation yet.
|
||||
// cppcheck-suppress identicalConditionAfterEarlyExit
|
||||
return m_ConnectionStatus == sdv::ipc::EConnectStatus::connected;
|
||||
}
|
||||
|
||||
void CConnection::CancelWait()
|
||||
{
|
||||
// TODO: Implementation here!
|
||||
}
|
||||
|
||||
void CConnection::Disconnect()
|
||||
{
|
||||
// TODO: Implementation here!
|
||||
}
|
||||
|
||||
uint64_t CConnection::RegisterStatusEventCallback(/*in*/ sdv::IInterfaceAccess* /*pEventCallback*/)
|
||||
{
|
||||
// TODO: Implementation here!
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CConnection::UnregisterStatusEventCallback(/*in*/ uint64_t /*uiCookie*/)
|
||||
{
|
||||
// TODO: Implementation here!
|
||||
}
|
||||
|
||||
sdv::ipc::EConnectStatus CConnection::GetStatus() const
|
||||
{
|
||||
return m_ConnectionStatus;
|
||||
}
|
||||
|
||||
void CConnection::DestroyObject()
|
||||
{
|
||||
m_StopReceiveThread = true;
|
||||
if (m_ReceiveThread.joinable())
|
||||
{
|
||||
m_ReceiveThread.join();
|
||||
}
|
||||
closesocket(m_ConnectionSocket);
|
||||
m_ConnectionSocket = INVALID_SOCKET;
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::disconnected;
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
bool CConnection::ValidateHeader(const SMsgHeader& msgHeader)
|
||||
{
|
||||
if ((msgHeader.msgStart == m_MsgStart) && (msgHeader.msgEnd == m_MsgEnd))
|
||||
{
|
||||
if (msgHeader.msgSize != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CConnection::ReadNumberOfBytes(char* buffer, uint32_t bufferLength)
|
||||
{
|
||||
uint32_t bytesReceived = 0;
|
||||
while (!m_StopReceiveThread && (bufferLength > bytesReceived))
|
||||
{
|
||||
bytesReceived += recv(m_ConnectionSocket, buffer + bytesReceived, bufferLength - bytesReceived, 0);
|
||||
if (bytesReceived == static_cast<uint32_t>(SOCKET_ERROR))
|
||||
{
|
||||
auto error = WSAGetLastError();
|
||||
if (error != WSAEWOULDBLOCK)
|
||||
{
|
||||
if(error == WSAECONNRESET)
|
||||
{
|
||||
SDV_LOG_INFO("Reset SOCKET, recv() failed with error: ", error, " ", m_StopReceiveThread);
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::disconnected;
|
||||
m_ConnectionSocket = INVALID_SOCKET;
|
||||
break;
|
||||
}
|
||||
else if (!m_StopReceiveThread)
|
||||
{
|
||||
SDV_LOG_ERROR("SOCKET_ERROR, recv() failed with error: ", error);
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::communication_error;
|
||||
m_ConnectionSocket = INVALID_SOCKET;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bytesReceived = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (bufferLength != bytesReceived)
|
||||
{
|
||||
if (!m_StopReceiveThread || (m_ConnectionStatus == sdv::ipc::EConnectStatus::disconnected))
|
||||
{
|
||||
SDV_LOG_INFO("The expected bytes could not be received.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CConnection::ReadMessageHeader(uint32_t& msgSize, uint32_t& msgId, uint32_t& packageNumber, uint32_t& totalPackageCount, bool verifyHeader)
|
||||
{
|
||||
SMsgHeader msgHeader;
|
||||
|
||||
if (ReadNumberOfBytes(reinterpret_cast<char*>(&msgHeader), sizeof(SMsgHeader)))
|
||||
{
|
||||
if (ValidateHeader(msgHeader))
|
||||
{
|
||||
if (!verifyHeader)
|
||||
{
|
||||
if (msgHeader.msgSize == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
msgSize = msgHeader.msgSize;
|
||||
msgId = msgHeader.msgId;
|
||||
packageNumber = msgHeader.packetNumber;
|
||||
totalPackageCount = msgHeader.totalPacketCount;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((msgId == msgHeader.msgId) && (packageNumber == msgHeader.packetNumber))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDV_LOG_WARNING("Received wrong message, Id = ", std::to_string(msgHeader.msgId), " package = ",
|
||||
std::to_string(packageNumber), " (expected id = ", std::to_string(msgId), " package = ", std::to_string(packageNumber), ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_StopReceiveThread)
|
||||
{
|
||||
SDV_LOG_WARNING("Could not read message header");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CConnection::ReceiveMessages()
|
||||
{
|
||||
while (!m_StopReceiveThread && (m_ConnectionSocket != INVALID_SOCKET))
|
||||
{
|
||||
uint32_t messageSize{ 0 };
|
||||
uint32_t msgId{ 0 };
|
||||
uint32_t packageNumber{ 0 };
|
||||
uint32_t totalPackageCount{ 0 };
|
||||
|
||||
if (ReadMessageHeader(messageSize, msgId, packageNumber, totalPackageCount, false))
|
||||
{
|
||||
uint32_t dataOffset{ 0 };
|
||||
sdv::pointer<uint8_t> message;
|
||||
message.resize(messageSize);
|
||||
for (uint32_t package = 1; package <= totalPackageCount; package++)
|
||||
{
|
||||
uint32_t bytesToBeRead = m_SendMessageSize;
|
||||
if (package == totalPackageCount)
|
||||
{
|
||||
bytesToBeRead = messageSize - dataOffset; // last package
|
||||
}
|
||||
|
||||
if (package != 1)
|
||||
{
|
||||
if (!ReadMessageHeader(messageSize, msgId, package, totalPackageCount, true))
|
||||
{
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::communication_error;
|
||||
m_ConnectionSocket = INVALID_SOCKET;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ReadNumberOfBytes(reinterpret_cast<char*>(message.get()) + dataOffset, bytesToBeRead))
|
||||
{
|
||||
m_ConnectionStatus = sdv::ipc::EConnectStatus::communication_error;
|
||||
m_ConnectionSocket = INVALID_SOCKET;
|
||||
break;
|
||||
}
|
||||
|
||||
dataOffset += bytesToBeRead;
|
||||
}
|
||||
|
||||
if (!m_StopReceiveThread && (m_pReceiver != nullptr) && (m_ConnectionSocket != INVALID_SOCKET)) // In case of shutdown the message maybe invalid/incomplete
|
||||
{
|
||||
//m_pReceiver->ReceiveData(message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
/**
|
||||
* @file connection.h
|
||||
* @author Sudipta Babu Durjoy FRD DISS21 (mailto:sudipta.durjoy@zf.com)
|
||||
* @brief
|
||||
* @version 1.0
|
||||
* @date 2023-04-18
|
||||
*
|
||||
* @copyright Copyright ZF Friedrichshafen AG (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CHANNEL_H
|
||||
#define CHANNEL_H
|
||||
|
||||
#include <thread>
|
||||
#include <algorithm>
|
||||
|
||||
#include <interfaces/ipc.h>
|
||||
#include <support/interface_ptr.h>
|
||||
#include <support/local_service_access.h>
|
||||
#include <support/component_impl.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#endif
|
||||
|
||||
constexpr uint32_t m_MsgStart = 0x01020304; ///< value to mark the start of the message header
|
||||
constexpr uint32_t m_MsgEnd = 0x05060708; ///< value to mark the end of the message header
|
||||
|
||||
/**
|
||||
* @brief Message header which will be put before a message.
|
||||
* Can be used for validation and includes complete size of the message. Other values are not used yet
|
||||
*/
|
||||
struct SMsgHeader
|
||||
{
|
||||
uint32_t msgStart = 0; ///< marker for the start of the header
|
||||
uint32_t msgId = 0; ///< message Id, must match for all message packages
|
||||
uint32_t msgSize = 0; ///< size of the message without the header
|
||||
uint32_t packetNumber = 0; ///< number of the package starting with 1
|
||||
uint32_t totalPacketCount = 0; ///< total number of paackes required for the message
|
||||
uint32_t msgEnd = 0; ///< marker for the end of the header
|
||||
};
|
||||
|
||||
/**
|
||||
* Class for remote IPC connection
|
||||
* Created and managed by IPCAccess::AccessRemoveIPCConnection(best use unique_ptr to store, so memory address stays
|
||||
* valid)
|
||||
*/
|
||||
class CConnection : public sdv::IInterfaceAccess, public sdv::ipc::IDataSend, public sdv::ipc::IConnect, public sdv::IObjectDestroy
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief default constructor used by create endpoint - allocates new buffers m_Sender and m_Receiver
|
||||
*/
|
||||
CConnection();
|
||||
|
||||
/**
|
||||
* @brief access existing connection
|
||||
* @param[in] preconfiguredSocket Prepared socket for the connection.
|
||||
* @param[in] acceptConnectionRequired If true connection has to be accepted before receive thread can be started.
|
||||
*/
|
||||
CConnection(SOCKET preconfiguredSocket, bool acceptConnectionRequired);
|
||||
|
||||
/**
|
||||
* @brief Virtual destructor needed for "delete this;".
|
||||
*/
|
||||
virtual ~CConnection() = default;
|
||||
|
||||
BEGIN_SDV_INTERFACE_MAP()
|
||||
SDV_INTERFACE_ENTRY(sdv::ipc::IDataSend)
|
||||
SDV_INTERFACE_ENTRY(sdv::ipc::IConnect)
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectDestroy)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
/**
|
||||
* @brief Sends data consisting of multiple data chunks via the IPC connection.
|
||||
* Overload of sdv::ipc::IDataSend::SendData.
|
||||
* @param[inout] seqData Sequence of data buffers to be sent. The sequence might be changed to optimize the communication
|
||||
* without having to copy the data.
|
||||
* @return Return 'true' if all data could be sent; 'false' otherwise.
|
||||
*/
|
||||
virtual bool SendData(/*inout*/ sdv::sequence<sdv::pointer<uint8_t>>& seqData) override;
|
||||
|
||||
/**
|
||||
* @brief Establish a connection and start sending/receiving messages. Overload of
|
||||
* sdv::ipc::IConnect::AsyncConnect.
|
||||
* @param[in] pReceiver The message has to be forwarded.
|
||||
* @return Returns 'true' when a connection could be established. Use IConnectStatus or IConnectEventCallback to check the
|
||||
* connection state.
|
||||
*/
|
||||
virtual bool AsyncConnect(/*in*/ sdv::IInterfaceAccess* pReceiver) override;
|
||||
|
||||
/**
|
||||
* @brief Wait for a connection to take place. Overload of sdv::ipc::IConnect::WaitForConnection.
|
||||
* @param[in] uiWaitMs Wait for a connection to take place. A value of 0 doesn't wait at all, a value of 0xffffffff
|
||||
* waits for infinite time.
|
||||
* @return Returns 'true' when a connection took place.
|
||||
*/
|
||||
virtual bool WaitForConnection(/*in*/ uint32_t uiWaitMs) override;
|
||||
|
||||
/**
|
||||
* @brief Cancel a wait for connection. Overload of sdv::ipc::IConnect::CancelWait.
|
||||
*/
|
||||
virtual void CancelWait() override;
|
||||
|
||||
/**
|
||||
* @brief Disconnect from a connection. This will set the connect status to disconnected and release the interface
|
||||
* used for the status events.
|
||||
*/
|
||||
virtual void Disconnect() override;
|
||||
|
||||
/**
|
||||
* @brief Register event callback interface. Overload of sdv::ipc::IConnect::RegisterStatusEventCallback.
|
||||
* @details Register a connection status event callback interface. The exposed interface must be of type
|
||||
* IConnectEventCallback. The registration will exist until a call to the unregister function with the returned cookie
|
||||
* or until the connection is terminated.
|
||||
* @param[in] pEventCallback Pointer to the object exposing the IConnectEventCallback interface.
|
||||
* @return The cookie assigned to the registration.
|
||||
*/
|
||||
virtual uint64_t RegisterStatusEventCallback(/*in*/ sdv::IInterfaceAccess* pEventCallback) override;
|
||||
|
||||
/**
|
||||
* @brief Unregister the status event callback with the returned cookie from the registration. Overload of
|
||||
* sdv::ipc::IConnect::UnregisterStatusEventCallback.
|
||||
* @param[in] uiCookie The cookie returned by a previous call to the registration function.
|
||||
*/
|
||||
virtual void UnregisterStatusEventCallback(/*in*/ uint64_t uiCookie) override;
|
||||
|
||||
/**
|
||||
* @brief Get status of the connection
|
||||
* @return Returns the ipc::EConnectStatus struct
|
||||
*/
|
||||
virtual sdv::ipc::EConnectStatus GetStatus() const override;
|
||||
|
||||
/**
|
||||
* @brief Destroy the object. Overload of IObjectDestroy::DestroyObject.
|
||||
* @attention After a call of this function, all exposed interfaces render invalid and should not be used any more.
|
||||
*/
|
||||
virtual void DestroyObject() override;
|
||||
|
||||
private:
|
||||
std::thread m_ReceiveThread; ///< Thread which receives data from the socket
|
||||
std::atomic<bool> m_StopReceiveThread = false; ///< bool variable to stop thread
|
||||
std::atomic<sdv::ipc::EConnectStatus> m_ConnectionStatus; ///< the status of the connection
|
||||
SOCKET m_ConnectionSocket; ///< The socket to send and receive data
|
||||
sdv::ipc::IDataReceiveCallback* m_pReceiver = nullptr; ///< Receiver to pass the messages if available
|
||||
sdv::ipc::IConnectEventCallback* m_pEvent = nullptr; ///< Event receiver.
|
||||
bool m_AcceptConnectionRequired; ///< if true connection has to be accepted before receive thread can be started
|
||||
mutable std::recursive_mutex m_SendMutex; ///< Synchronize all packages to be send.
|
||||
|
||||
static constexpr uint32_t m_SendMessageSize{ 1024 }; ///< size for the message to be send.
|
||||
static constexpr uint32_t m_SendBufferSize = sizeof(SMsgHeader) + m_SendMessageSize; ///< Initial size of the send buffer.
|
||||
char m_SendBuffer[m_SendBufferSize]; ///< send buffer length
|
||||
char m_ReceiveBuffer[sizeof(SMsgHeader)]; ///< receive buffer, just for reading the message header
|
||||
uint32_t m_ReceiveBufferLength = sizeof(SMsgHeader); ///< receive buffer length
|
||||
|
||||
/**
|
||||
* @brief Function to accept the connection to the client.
|
||||
* @return Returns the socket to receive data
|
||||
*/
|
||||
SOCKET AcceptConnection();
|
||||
|
||||
/**
|
||||
* @brief Send data function via socket.
|
||||
* @param[in] data to be send
|
||||
* @param[in] dataLength size of the data to be sent
|
||||
* @return Returns number of bytes which has been sent
|
||||
*/
|
||||
int32_t Send(const char* data, int32_t dataLength);
|
||||
|
||||
/**
|
||||
* @brief Function to receive data, runs in a thread
|
||||
*/
|
||||
void ReceiveMessages();
|
||||
|
||||
/**
|
||||
* @brief Validates the header of the message to determine if message is valid
|
||||
* @param[in] msgHeader filled message header structure
|
||||
* @return true if valid header was found, otherwise false
|
||||
*/
|
||||
bool ValidateHeader(const SMsgHeader& msgHeader);
|
||||
|
||||
/**
|
||||
* @brief read header and get the values from the header. In case verify == true validate the input values
|
||||
* @param[in] msgSize size of the message without headers
|
||||
* @param[in] msgId message id of the message
|
||||
* @param[in] packageNumber package number of the message
|
||||
* @param[in] totalPackageCount number of packages the message requires
|
||||
* @param[in] verifyHeader If true verify that the input of msgId and packageNumber match the header values
|
||||
* @return if verify == false, return true if a valid header can be read.
|
||||
* if verify == true input values of msdId and package number must match with the header values.
|
||||
*/
|
||||
bool ReadMessageHeader(uint32_t &msgSize, uint32_t &msgId, uint32_t &packageNumber, uint32_t &totalPackageCount, bool verifyHeader);
|
||||
|
||||
/**
|
||||
* @brief read number of bytes and write them to the given buffer
|
||||
* @param[in] buffer Buffer the data is stored
|
||||
* @param[in] length of the buffer to be filled
|
||||
* @return return true if the number of bytes can be read, otherwise false
|
||||
*/
|
||||
bool ReadNumberOfBytes(char* buffer, uint32_t length);
|
||||
};
|
||||
|
||||
#endif // !define CHANNEL_H
|
||||
@@ -1,31 +0,0 @@
|
||||
# Define project
|
||||
project (ComponentTest_CoreLibrary VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Data maneger executable
|
||||
add_executable(ComponentTest_CoreLibrary
|
||||
"main.cpp"
|
||||
"app_control_test.cpp"
|
||||
"app_control_test_no_event_handler.cpp"
|
||||
"app_control_test_event_handler.cpp"
|
||||
"app_control_test_mgnt_class.cpp"
|
||||
"app_config.cpp")
|
||||
|
||||
target_link_libraries(ComponentTest_CoreLibrary ${CMAKE_DL_LIBS} GTest::GTest)
|
||||
|
||||
# Add the Data Dispatch Service unittest
|
||||
add_test(NAME ComponentTest_CoreLibrary COMMAND ComponentTest_CoreLibrary WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
|
||||
# Execute the test
|
||||
# Currently disabled due to issues with MINGW causing the application to sporadically crash. A bug ticket has been filed:
|
||||
# https://dev.azure.com/SW4ZF/AZP-074_DivDI_SofDCarResearch/_workitems/edit/608132
|
||||
#add_custom_command(TARGET ComponentTest_CoreLibrary POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND} -E env TEST_EXECUTION_MODE=CMake "$<TARGET_FILE:ComponentTest_CoreLibrary>" --gtest_output=xml:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ComponentTest_CoreLibrary.xml
|
||||
# VERBATIM
|
||||
#)
|
||||
|
||||
|
||||
# Build dependencies
|
||||
add_dependencies(ComponentTest_CoreLibrary install_manifest)
|
||||
add_dependencies(ComponentTest_CoreLibrary dependency_sdv_components)
|
||||
add_dependencies(ComponentTest_CoreLibrary data_dispatch_service)
|
||||
add_dependencies(ComponentTest_CoreLibrary ComponentTest_Repository) # Use the repository components for this test
|
||||
@@ -1,29 +0,0 @@
|
||||
// Application config tests
|
||||
// Load config file - Save config file - identical?
|
||||
// Load config file - add module - save config file - module added?
|
||||
// Load config file - add and delete module - identical?
|
||||
// Load config file - add component - save config file - module added?
|
||||
// Load config file - add and delete component - identical?
|
||||
// Load config file - load another config file - Save config file - identical to last config file?
|
||||
// Load config file - reset baseline - add module - save config file - only module in config?
|
||||
// Load config file - reset baseline - add component - save config file - only component in config?
|
||||
// Add module - save config - only module in config?
|
||||
// Add component - save config - only component in config?
|
||||
// Add config file in Startup - config loaded?
|
||||
// For main app: add system config file in settings - config loaded?
|
||||
// For main app: add multiple system config file in settings - config loaded?
|
||||
// For main app: add application config file in settings - config loaded?
|
||||
// For main app: add multiple system config files and an application config in settings - configs loaded?
|
||||
// For main app: add application config file in settings - config loaded? - add component - auto save config - config updated with additional compoment?
|
||||
// For main app: add multiple system config files and an application config file in settings - config loaded? - add component - auto save config - config updated with additional compoment?
|
||||
// For main app: add system config file in settings - add config in application startup - configs loaded?
|
||||
// For main app: add multiple system config file in settings - add config in application startup - configs loaded?
|
||||
// For main app: add application config file in settings - add config in application startup - startup config loaded (and otherone not)?
|
||||
// For main app: add application config file in settings - add config in application startup - add service - startup config not updated? Settings config also not?
|
||||
// Test search algorithm with multiple modules with similar name in different location for standalone and essential
|
||||
// Test search algorithm with multiple modules with similar name in different location for main and isolated
|
||||
// Test configuration saving of module path shoudl not change when module is found somewhere else.
|
||||
// Test not existing config
|
||||
// Test partially existing config (some modules/components do not exist)
|
||||
// Test multiple manifest for loading components
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <support/sdv_core.h>
|
||||
#include <interfaces/app.h>
|
||||
#include <support/mem_access.h>
|
||||
#include <support/app_control.h>
|
||||
#include "../../../global/exec_dir_helper.h"
|
||||
|
||||
TEST(CoreLibrary_AppControl, SetModuleSearchPath)
|
||||
{
|
||||
sdv::core::IModuleControlConfig* pModuleConfig = sdv::core::GetCore<sdv::core::IModuleControlConfig>();
|
||||
ASSERT_NE(pModuleConfig, nullptr);
|
||||
bool bResult = pModuleConfig->AddModuleSearchDir("../../bin");
|
||||
EXPECT_TRUE(bResult);
|
||||
sdv::sequence<sdv::u8string> seqSearchDirs = pModuleConfig->GetModuleSearchDirs();
|
||||
std::filesystem::path pathModuleDir = (GetExecDirectory() / "../../bin").lexically_normal();
|
||||
auto itDir = std::find_if(seqSearchDirs.begin(), seqSearchDirs.end(),
|
||||
[&](const sdv::u8string& rssDir)
|
||||
{
|
||||
std::filesystem::path pathDir = static_cast<std::string>(rssDir);
|
||||
if (pathDir.is_relative())
|
||||
pathDir = (GetExecDirectory() / pathDir).lexically_normal();
|
||||
return pathDir == pathModuleDir;
|
||||
});
|
||||
EXPECT_NE(itDir, seqSearchDirs.end());
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl, SetModuleSearchPathMgntClass)
|
||||
{
|
||||
sdv::app::CAppControl appcontrol;
|
||||
bool bResult = appcontrol.AddModuleSearchDir("../../bin");
|
||||
EXPECT_TRUE(bResult);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,510 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <support/sdv_core.h>
|
||||
#include <interfaces/app.h>
|
||||
#include <support/mem_access.h>
|
||||
#include <support/app_control.h>
|
||||
#include "../../../sdv_services/core/local_shutdown_request.h"
|
||||
#include "../../../global/base64.h"
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Invalid_ApplicationMode)
|
||||
{
|
||||
// Prevent error reporting on std::cerr - they will influence test outcome.
|
||||
auto* pCErr = std::cerr.rdbuf();
|
||||
std::ostringstream sstreamCErr;
|
||||
std::cerr.rdbuf(sstreamCErr.rdbuf());
|
||||
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Invalid\"");
|
||||
EXPECT_FALSE(bResult);
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
std::cerr.rdbuf(pCErr);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Default_NoConfig)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(control.GetInstanceID(), 1000u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Standalone_NoConfig)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Standalone\"");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(control.GetInstanceID(), 1000u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_External_NoConfig)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"External\"");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::external);
|
||||
EXPECT_EQ(control.GetInstanceID(), 1000u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Isolated_NoConfig)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup(R"code(
|
||||
[Application]
|
||||
Mode = "Isolated"
|
||||
|
||||
[Console]
|
||||
Report = "Silent"
|
||||
)code");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::isolated);
|
||||
EXPECT_EQ(control.GetInstanceID(), 1000u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Main_NoConfig)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Main\"");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::main);
|
||||
EXPECT_EQ(control.GetInstanceID(), 1000u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Essential_NoConfig)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Essential\"");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::essential);
|
||||
EXPECT_EQ(control.GetInstanceID(), 1000u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Maintenance_NoConfig)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Maintenance\"");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::maintenance);
|
||||
EXPECT_EQ(control.GetInstanceID(), 1000u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Default_DefineInstance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nInstance=2005");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2005u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Standalone_DefineInstance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Standalone\"\nInstance=2005");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2005u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_External_DefineInstance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"External\"\nInstance=2005");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::external);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2005u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Isolated_DefineInstance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
std::string ssConfig = R"code([Application]
|
||||
Mode = "Isolated"
|
||||
Instance = 2005
|
||||
Connection = ")code";
|
||||
ssConfig += Base64EncodePlainText("test") + "\"";
|
||||
bool bResult = control.Startup(ssConfig);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::isolated);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2005u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Main_DefineInstance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Main\"\nInstance=2005");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::main);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2005u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Essential_DefineInstance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Essential\"\nInstance=2005");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::essential);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2005u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, Startup_Maintenance_DefineInstance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Maintenance\"\nInstance=2005");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::maintenance);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2005u);
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, RunLoop_Default)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nInstance=2007");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
EXPECT_TRUE(control.RunLoop());
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, RunLoop_Standalone)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Standalone\"\nInstance=2007");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
EXPECT_TRUE(control.RunLoop());
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, RunLoop_External)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"External\"\nInstance=2007");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::external);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
EXPECT_TRUE(control.RunLoop());
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, RunLoop_Isolated)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
std::string ssConfig = R"code([Application]
|
||||
Mode = "Isolated"
|
||||
Instance = 2007
|
||||
Connection = ")code";
|
||||
ssConfig += Base64EncodePlainText("test") + "\"";
|
||||
bool bResult = control.Startup(ssConfig);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::isolated);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
sdv::app::IAppShutdownRequest* pShutdownRequest = sdv::core::GetObject<sdv::app::IAppShutdownRequest>("AppControlService");
|
||||
ASSERT_NE(pShutdownRequest, nullptr);
|
||||
pShutdownRequest->RequestShutdown();
|
||||
});
|
||||
EXPECT_TRUE(control.RunLoop());
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, RunLoop_Main)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Main\"\nInstance=2007");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::main);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
sdv::app::IAppShutdownRequest* pShutdownRequest = sdv::core::GetObject<sdv::app::IAppShutdownRequest>("AppControlService");
|
||||
ASSERT_NE(pShutdownRequest, nullptr);
|
||||
pShutdownRequest->RequestShutdown();
|
||||
});
|
||||
EXPECT_TRUE(control.RunLoop());
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, RunLoop_Essential)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Essential\"\nInstance=2007");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::essential);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
EXPECT_TRUE(control.RunLoop());
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_MgntClass, RunLoop_Maintenance)
|
||||
{
|
||||
sdv::app::CAppControl control;
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = control.Startup("[Application]\nMode=\"Maintenance\"\nInstance=2007");
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_TRUE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::maintenance);
|
||||
EXPECT_EQ(control.GetInstanceID(), 2007u);
|
||||
|
||||
// Loop not allowed...
|
||||
EXPECT_FALSE(control.RunLoop());
|
||||
|
||||
control.Shutdown();
|
||||
EXPECT_FALSE(control.IsRunning());
|
||||
EXPECT_EQ(control.GetAppContext(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(control.GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
@@ -1,643 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <support/sdv_core.h>
|
||||
#include <interfaces/app.h>
|
||||
#include <support/mem_access.h>
|
||||
#include <support/app_control.h>
|
||||
#include "../../../sdv_services/core/local_shutdown_request.h"
|
||||
#include "../../../global/base64.h"
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Invalid_ApplicationMode)
|
||||
{
|
||||
// Prevent error reporting on std::cerr - they will influence test outcome.
|
||||
auto* pCErr = std::cerr.rdbuf();
|
||||
std::ostringstream sstreamCErr;
|
||||
std::cerr.rdbuf(sstreamCErr.rdbuf());
|
||||
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Invalid\"", nullptr);
|
||||
EXPECT_FALSE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
std::cerr.rdbuf(pCErr);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Default_NoConfig)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 1000u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Standalone_NoConfig)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Standalone\"", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 1000u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_External_NoConfig)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"External\"", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::external);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 1000u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Isolated_NoConfig)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup(R"code(
|
||||
[Application]
|
||||
Mode = "Isolated"
|
||||
|
||||
[Console]
|
||||
Report = "Silent"
|
||||
)code", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::isolated);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 1000u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Main_NoConfig)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Main\"", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::main);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 1000u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Essential_NoConfig)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Essential\"", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::essential);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 1000u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Maintenance_NoConfig)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Maintenance\"", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::maintenance);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 1000u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Default_DefineInstance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nInstance=2005", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2005u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Standalone_DefineInstance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Standalone\"\nInstance=2005", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2005u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_External_DefineInstance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"External\"\nInstance=2005", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::external);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2005u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Isolated_DefineInstance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
std::string ssConfig = R"code([Application]
|
||||
Mode = "Isolated"
|
||||
Instance = 2005
|
||||
Connection = ")code";
|
||||
ssConfig += Base64EncodePlainText("test") + "\"";
|
||||
bool bResult = pControl->Startup(ssConfig, nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::isolated);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2005u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Main_DefineInstance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Main\"\nInstance=2005", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::main);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2005u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Essential_DefineInstance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Essential\"\nInstance=2005", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::essential);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2005u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, Startup_Maintenance_DefineInstance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Maintenance\"\nInstance=2005", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::maintenance);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2005u);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, RunLoop_Default)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nInstance=2007", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
pControl->RunLoop();
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, RunLoop_Standalone)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Standalone\"\nInstance=2007", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::standalone);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
pControl->RunLoop();
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, RunLoop_External)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"External\"\nInstance=2007", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::external);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
pControl->RunLoop();
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, RunLoop_Isolated)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
std::string ssConfig = R"code([Application]
|
||||
Mode = "Isolated"
|
||||
Instance = 2007
|
||||
Connection = ")code";
|
||||
ssConfig += Base64EncodePlainText("test") + "\"";
|
||||
bool bResult = pControl->Startup(ssConfig, nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::isolated);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
sdv::app::IAppShutdownRequest* pShutdownRequest = sdv::core::GetObject<sdv::app::IAppShutdownRequest>("AppControlService");
|
||||
ASSERT_NE(pShutdownRequest, nullptr);
|
||||
pShutdownRequest->RequestShutdown();
|
||||
});
|
||||
pControl->RunLoop();
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, RunLoop_Main)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Main\"\nInstance=2007", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::main);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
sdv::app::IAppShutdownRequest* pShutdownRequest = sdv::core::GetObject<sdv::app::IAppShutdownRequest>("AppControlService");
|
||||
ASSERT_NE(pShutdownRequest, nullptr);
|
||||
pShutdownRequest->RequestShutdown();
|
||||
});
|
||||
pControl->RunLoop();
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, RunLoop_Essential)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Essential\"\nInstance=2007", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::essential);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2007u);
|
||||
|
||||
auto tpStart = std::chrono::high_resolution_clock::now();
|
||||
std::thread threadShutdownRequest([]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
RequestShutdown(2007u);
|
||||
});
|
||||
pControl->RunLoop();
|
||||
EXPECT_GT(std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - tpStart).count(), 0.100);
|
||||
threadShutdownRequest.join();
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
TEST(CoreLibrary_AppControl_NoEventHandler, RunLoop_Maintenance)
|
||||
{
|
||||
sdv::app::IAppControl* pControl = sdv::core::GetCore<sdv::app::IAppControl>();
|
||||
ASSERT_NE(pControl, nullptr);
|
||||
sdv::app::IAppContext* pContext = sdv::core::GetCore<sdv::app::IAppContext>();
|
||||
ASSERT_NE(pContext, nullptr);
|
||||
sdv::app::IAppOperation* pOperation = sdv::core::GetCore<sdv::app::IAppOperation>();
|
||||
ASSERT_NE(pOperation, nullptr);
|
||||
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
|
||||
bool bResult = pControl->Startup("[Application]\nMode=\"Maintenance\"\nInstance=2007", nullptr);
|
||||
EXPECT_TRUE(bResult);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::running);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::maintenance);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 2007u);
|
||||
|
||||
// Loop not allowed...
|
||||
EXPECT_THROW(pControl->RunLoop(), sdv::XAccessDenied);
|
||||
|
||||
pControl->Shutdown(true);
|
||||
EXPECT_EQ(pOperation->GetOperationState(), sdv::app::EAppOperationState::not_started);
|
||||
EXPECT_EQ(pContext->GetContextType(), sdv::app::EAppContext::no_context);
|
||||
EXPECT_EQ(pContext->GetInstanceID(), 0u);
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "../../../global/process_watchdog.h"
|
||||
|
||||
#if defined(_WIN32) && defined(_UNICODE)
|
||||
extern "C" int wmain(int argc, wchar_t* argv[])
|
||||
#else
|
||||
extern "C" int main(int argc, char* argv[])
|
||||
#endif
|
||||
{
|
||||
CProcessWatchdog watchdog;
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
@@ -1,400 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "../../../global/localmemmgr.h"
|
||||
#include "../../../sdv_services/core/trace_fifo.h"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <atomic>
|
||||
|
||||
TEST(TraceFifoTest, Connect_Disconnect)
|
||||
{
|
||||
CTraceFifoWriter fifo;
|
||||
EXPECT_FALSE(fifo.IsOpened());
|
||||
EXPECT_TRUE(fifo.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifo.IsOpened());
|
||||
fifo.Close();
|
||||
EXPECT_FALSE(fifo.IsOpened());
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Connect_Channel)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter;
|
||||
CTraceFifoReader fifoReader;
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
|
||||
EXPECT_TRUE(fifoWriter.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
|
||||
fifoWriter.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
fifoReader.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Connect_Channel_Reverse)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter;
|
||||
CTraceFifoReader fifoReader;
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
|
||||
EXPECT_TRUE(fifoReader.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
EXPECT_TRUE(fifoWriter.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
|
||||
fifoReader.Close();
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
fifoWriter.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Connect_MultiWriter)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter1;
|
||||
CTraceFifoWriter fifoWriter2;
|
||||
CTraceFifoReader fifoReader;
|
||||
EXPECT_FALSE(fifoWriter1.IsOpened());
|
||||
EXPECT_FALSE(fifoWriter2.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
|
||||
EXPECT_TRUE(fifoWriter1.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoWriter1.IsOpened());
|
||||
EXPECT_FALSE(fifoWriter2.Open());
|
||||
EXPECT_TRUE(fifoWriter1.IsOpened());
|
||||
EXPECT_FALSE(fifoWriter2.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.Open());
|
||||
EXPECT_TRUE(fifoWriter1.IsOpened());
|
||||
EXPECT_FALSE(fifoWriter2.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
|
||||
fifoWriter1.Close();
|
||||
EXPECT_FALSE(fifoWriter1.IsOpened());
|
||||
EXPECT_FALSE(fifoWriter2.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
fifoWriter2.Close();
|
||||
EXPECT_FALSE(fifoWriter1.IsOpened());
|
||||
EXPECT_FALSE(fifoWriter2.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
fifoReader.Close();
|
||||
EXPECT_FALSE(fifoWriter1.IsOpened());
|
||||
EXPECT_FALSE(fifoWriter2.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Connect_MultiReader)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter;
|
||||
CTraceFifoReader fifoReader1;
|
||||
CTraceFifoReader fifoReader2;
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader1.IsOpened());
|
||||
EXPECT_FALSE(fifoReader2.IsOpened());
|
||||
|
||||
EXPECT_TRUE(fifoWriter.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader1.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader1.IsOpened());
|
||||
EXPECT_TRUE(fifoReader2.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader1.IsOpened());
|
||||
EXPECT_TRUE(fifoReader2.IsOpened());
|
||||
|
||||
fifoWriter.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader1.IsOpened());
|
||||
EXPECT_TRUE(fifoReader2.IsOpened());
|
||||
fifoReader1.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader1.IsOpened());
|
||||
EXPECT_TRUE(fifoReader2.IsOpened());
|
||||
fifoReader2.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader1.IsOpened());
|
||||
EXPECT_FALSE(fifoReader2.IsOpened());
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Takeover_Size)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter(1000, 6000);
|
||||
CTraceFifoReader fifoReader(1000, 2048);
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
|
||||
EXPECT_TRUE(fifoWriter.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_NE(fifoWriter.GetViewSize(), 0);
|
||||
EXPECT_EQ(fifoReader.GetViewSize(), 0);
|
||||
EXPECT_TRUE(fifoReader.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
EXPECT_EQ(fifoReader.GetViewSize(), fifoWriter.GetViewSize());
|
||||
|
||||
fifoWriter.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
fifoReader.Close();
|
||||
EXPECT_FALSE(fifoWriter.IsOpened());
|
||||
EXPECT_FALSE(fifoReader.IsOpened());
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Open_100)
|
||||
{
|
||||
CTraceFifoWriter rgfifoWriter[100];
|
||||
CTraceFifoReader rgfifoReader[100];
|
||||
size_t n = 100;
|
||||
size_t nCreated = 0;
|
||||
for (CTraceFifoWriter& rfifoWriter : rgfifoWriter)
|
||||
{
|
||||
rfifoWriter = CTraceFifoWriter(static_cast<uint32_t>(n++), 6000);
|
||||
nCreated += rfifoWriter.Open(0, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)) ? 1 : 0;
|
||||
}
|
||||
n = 100;
|
||||
size_t nOpened = 0;
|
||||
size_t nCorrectSize = 0;
|
||||
for (size_t nIndex = 0; nIndex < 100; nIndex++)
|
||||
{
|
||||
CTraceFifoReader& rfifoReader = rgfifoReader[nIndex];
|
||||
rfifoReader = CTraceFifoReader(static_cast<uint32_t>(n++), 2048);
|
||||
nOpened += rfifoReader.Open(0, true) ? 1 : 0;
|
||||
nCorrectSize += rfifoReader.GetViewSize() == rgfifoWriter[nIndex].GetViewSize() ? 1 : 0;
|
||||
}
|
||||
|
||||
EXPECT_EQ(n, 200);
|
||||
EXPECT_EQ(nCreated, 100);
|
||||
EXPECT_EQ(nOpened, 100);
|
||||
EXPECT_EQ(nCorrectSize, 100);
|
||||
|
||||
for (CTraceFifoWriter& rfifoWriter : rgfifoWriter)
|
||||
rfifoWriter.Close();
|
||||
for (CTraceFifoReader& rfifoReader : rgfifoReader)
|
||||
rfifoReader.Close();
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Simple_Publish_Monitor)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter;
|
||||
CTraceFifoReader fifoReader;
|
||||
EXPECT_TRUE(fifoWriter.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoReader.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
|
||||
std::vector<std::string> vecSent, vecReceived;
|
||||
std::atomic_bool bShutdown = false;
|
||||
|
||||
// Start receiving thread until shutdown flag is set.
|
||||
std::thread thread([&]()
|
||||
{
|
||||
while (!bShutdown)
|
||||
{
|
||||
std::string ss = fifoReader.WaitForMessage();
|
||||
if (!ss.empty())
|
||||
vecReceived.push_back(ss);
|
||||
}
|
||||
});
|
||||
|
||||
// Send 10 messages
|
||||
for (size_t n = 0; n < 10; n++)
|
||||
{
|
||||
std::stringstream sstream;
|
||||
sstream << "This is message #" << n;
|
||||
vecSent.push_back(sstream.str());
|
||||
fifoWriter.Publish(sstream.str());
|
||||
}
|
||||
|
||||
// Shutdown receiving thread
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
bShutdown = true;
|
||||
thread.join();
|
||||
|
||||
// Close both fifos
|
||||
fifoWriter.Close();
|
||||
fifoReader.Close();
|
||||
|
||||
// Compare the messages
|
||||
EXPECT_EQ(vecSent, vecReceived);
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Simple_Publish_Monitor_Multi)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter;
|
||||
CTraceFifoReader fifoReader1;
|
||||
CTraceFifoReader fifoReader2;
|
||||
EXPECT_TRUE(fifoWriter.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoReader1.Open());
|
||||
EXPECT_TRUE(fifoReader2.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader1.IsOpened());
|
||||
EXPECT_TRUE(fifoReader2.IsOpened());
|
||||
|
||||
std::vector<std::string> vecSent, vecReceived1, vecReceived2;
|
||||
std::atomic_bool bShutdown = false;
|
||||
|
||||
// Start receiving thread until shutdown flag is set.
|
||||
std::thread thread1([&]()
|
||||
{
|
||||
while (!bShutdown)
|
||||
{
|
||||
std::string ss = fifoReader1.WaitForMessage();
|
||||
if (!ss.empty())
|
||||
vecReceived1.push_back(ss);
|
||||
}
|
||||
});
|
||||
|
||||
// Start receiving thread until shutdown flag is set.
|
||||
std::thread thread2([&]()
|
||||
{
|
||||
while (!bShutdown)
|
||||
{
|
||||
std::string ss = fifoReader2.WaitForMessage();
|
||||
if (!ss.empty())
|
||||
vecReceived2.push_back(ss);
|
||||
}
|
||||
});
|
||||
|
||||
// Send 10 messages
|
||||
for (size_t n = 0; n < 10; n++)
|
||||
{
|
||||
std::stringstream sstream;
|
||||
sstream << "This is message #" << n;
|
||||
vecSent.push_back(sstream.str());
|
||||
fifoWriter.Publish(sstream.str());
|
||||
}
|
||||
|
||||
// Shutdown receiving thread
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
bShutdown = true;
|
||||
thread1.join();
|
||||
thread2.join();
|
||||
|
||||
// Close both fifos
|
||||
fifoWriter.Close();
|
||||
fifoReader1.Close();
|
||||
fifoReader2.Close();
|
||||
|
||||
// Compare the messages
|
||||
EXPECT_EQ(vecSent, vecReceived1);
|
||||
EXPECT_EQ(vecSent, vecReceived2);
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Simple_Publish_Beyond_Buffer_With_Reading)
|
||||
{
|
||||
CTraceFifoWriter fifoWriter;
|
||||
CTraceFifoReader fifoReader;
|
||||
EXPECT_TRUE(fifoWriter.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoReader.Open());
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
|
||||
std::vector<std::string> vecSent, vecReceived;
|
||||
std::atomic_bool bShutdown = false;
|
||||
|
||||
// Start receiving thread until shutdown flag is set.
|
||||
std::thread thread([&]()
|
||||
{
|
||||
while (!bShutdown)
|
||||
{
|
||||
std::string ss = fifoReader.WaitForMessage();
|
||||
if (!ss.empty())
|
||||
vecReceived.push_back(ss);
|
||||
}
|
||||
});
|
||||
|
||||
// Send until 110% has been reached
|
||||
size_t nTotal = 0;
|
||||
size_t n = 0;
|
||||
while (nTotal < (fifoWriter.GetDataBufferSize() * 11 / 10))
|
||||
{
|
||||
std::stringstream sstream;
|
||||
sstream << "This is message #" << n++;
|
||||
vecSent.push_back(sstream.str());
|
||||
nTotal += sstream.str().size() + 1;
|
||||
fifoWriter.Publish(sstream.str());
|
||||
}
|
||||
|
||||
// Shutdown receiving thread
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
bShutdown = true;
|
||||
thread.join();
|
||||
|
||||
// Close both fifos
|
||||
fifoWriter.Close();
|
||||
fifoReader.Close();
|
||||
|
||||
// Compare the messages
|
||||
EXPECT_EQ(vecSent, vecReceived);
|
||||
}
|
||||
|
||||
TEST(TraceFifoTest, Simple_Publish_Beyond_Buffer_With_Delayed_Reading)
|
||||
{
|
||||
// Open writer
|
||||
CTraceFifoWriter fifoWriter(1000, 1024);
|
||||
EXPECT_TRUE(fifoWriter.Open(1000, static_cast<uint32_t>(ETraceFifoOpenFlags::force_create)));
|
||||
EXPECT_TRUE(fifoWriter.IsOpened());
|
||||
|
||||
std::deque<std::string> dequeSent, dequeReceived;
|
||||
|
||||
// Send until 250% has been reached
|
||||
size_t nTotal = 0;
|
||||
size_t n = 0;
|
||||
while (nTotal < (fifoWriter.GetDataBufferSize() * 25 / 10))
|
||||
{
|
||||
std::stringstream sstream;
|
||||
sstream << "This is message #" << n++;
|
||||
nTotal += sstream.str().size() + 1;
|
||||
fifoWriter.Publish(sstream.str());
|
||||
}
|
||||
|
||||
// Open reader
|
||||
CTraceFifoReader fifoReader(1000);
|
||||
EXPECT_TRUE(fifoReader.Open());
|
||||
EXPECT_TRUE(fifoReader.IsOpened());
|
||||
|
||||
// Read all messages (should be none)
|
||||
while (true)
|
||||
{
|
||||
std::string ss = fifoReader.WaitForMessage();
|
||||
if (ss.empty()) break;
|
||||
dequeReceived.push_back(ss);
|
||||
}
|
||||
|
||||
// Send until 90% has been reached (this is the part where the reader should also receive)
|
||||
nTotal = 0;
|
||||
n = 0;
|
||||
while (nTotal < (fifoWriter.GetDataBufferSize() * 9 / 10))
|
||||
{
|
||||
std::stringstream sstream;
|
||||
sstream << "This is message #" << n++;
|
||||
dequeSent.push_back(sstream.str());
|
||||
nTotal += sstream.str().size() + 1;
|
||||
fifoWriter.Publish(sstream.str());
|
||||
}
|
||||
|
||||
// Close writer
|
||||
fifoWriter.Close();
|
||||
|
||||
// Read all messages (should be the 90%)
|
||||
while (true)
|
||||
{
|
||||
std::string ss = fifoReader.WaitForMessage();
|
||||
if (ss.empty()) break;
|
||||
dequeReceived.push_back(ss);
|
||||
}
|
||||
|
||||
// Close reader
|
||||
fifoReader.Close();
|
||||
|
||||
// Compare the messages
|
||||
EXPECT_EQ(dequeSent.size(), dequeReceived.size());
|
||||
}
|
||||
@@ -1,449 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../../../sdv_services/core/toml_parser/parser_node_toml.h"
|
||||
#include "../../../sdv_services/core/toml_parser/parser_toml.h"
|
||||
|
||||
// Delete nodes (for all types of nodes, between all types of nodes)
|
||||
// - beginning
|
||||
// - middle
|
||||
// - end
|
||||
// - Using deleted node info -- error
|
||||
// - Last node (empty after that)
|
||||
// - Smart delete (comments/whitespace around)
|
||||
|
||||
// Insert nodes (for all types of nodes, between all types of nodes)
|
||||
// Before and after:
|
||||
// - beginning
|
||||
// - middle
|
||||
// - end
|
||||
// - Being the first item in a TOML file
|
||||
// - Inserted and straight away deleted
|
||||
// - Inserted with false/deleted reference --error
|
||||
// - Inserted values before (okay) and behind (error) tables
|
||||
// - Inserted duplicate value -- error
|
||||
// - Smart insert (comments/whitespace around)
|
||||
|
||||
// Shift nodes (for all types of nodes, between root, tables and arrays)
|
||||
|
||||
/*
|
||||
* @brief Delete a key from the TOML string.
|
||||
* @param[in] rssTOMLInput Reference to the TOML string.
|
||||
* @param[in] rssKey Reference to the key to delete.
|
||||
* @param[in] rssOuput Reference to the expected ouput.
|
||||
* @return Returns 'true' on success.
|
||||
*/
|
||||
bool TestDelete(const std::string& rssTOMLInput, const std::string& rssKey, const std::string& rssOutput)
|
||||
{
|
||||
toml_parser::CParser parser;
|
||||
bool bRes = true;
|
||||
EXPECT_NO_THROW(bRes = parser.Process(rssTOMLInput));
|
||||
EXPECT_TRUE(bRes);
|
||||
if (!bRes) return bRes;
|
||||
auto ptrNode = parser.Root().Direct(rssKey);
|
||||
EXPECT_TRUE(ptrNode);
|
||||
if (!ptrNode) return false;
|
||||
EXPECT_TRUE(bRes = ptrNode->DeleteNode());
|
||||
if (!bRes) return bRes;
|
||||
std::string ssTOML = parser.GenerateTOML();
|
||||
EXPECT_EQ(ssTOML, rssOutput);
|
||||
if (ssTOML != rssOutput) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
TEST(TOMLContentModifications, DISABLED_DeleteValues)
|
||||
{
|
||||
// Delete a key from the begin
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10 # value key
|
||||
bare_key = "value" # value bare_key
|
||||
bare-key = false # value bare-key
|
||||
)toml",
|
||||
"key",
|
||||
R"toml(
|
||||
bare_key = "value" # value bare_key
|
||||
bare-key = false # value bare-key
|
||||
)toml"));
|
||||
|
||||
// Delete a key from the middle
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10 # value key
|
||||
bare_key = "value" # value bare_key
|
||||
bare-key = false # value bare-key
|
||||
)toml",
|
||||
"bare_key",
|
||||
R"toml(
|
||||
key = 10 # value key
|
||||
bare-key = false # value bare-key
|
||||
)toml"));
|
||||
|
||||
// Delete a key from the end
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10 # value key
|
||||
bare_key = "value" # value bare_key
|
||||
bare-key = false # value bare-key
|
||||
)toml",
|
||||
"bare-key",
|
||||
R"toml(
|
||||
key = 10 # value key
|
||||
bare_key = "value" # value bare_key
|
||||
)toml"));
|
||||
}
|
||||
|
||||
TEST(TOMLContentModifications, DISABLED_DeleteInlineTableValues)
|
||||
{
|
||||
// Delete key from the inline table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml",
|
||||
"1234.y",
|
||||
R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, z = 2, str = "abc"}
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml",
|
||||
"1234.x",
|
||||
R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {y = 1, z = 2, str = "abc"}
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml",
|
||||
"1234.str",
|
||||
R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2}
|
||||
)toml"));
|
||||
|
||||
// Delete key from the inline sub-table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, b=2, c=3}}
|
||||
)toml",
|
||||
"1234.tbl.b",
|
||||
R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, c=3}}
|
||||
)toml"));
|
||||
|
||||
// Delete table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, b=2, c=3}}
|
||||
)toml",
|
||||
"1234.tbl",
|
||||
R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, b=2, c=3}}
|
||||
)toml",
|
||||
"1234",
|
||||
R"toml(
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
)toml"));
|
||||
}
|
||||
|
||||
TEST(TOMLContentModifications, DISABLED_DeleteTableValues)
|
||||
{
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
)toml",
|
||||
"my_table.key",
|
||||
R"toml(
|
||||
[my_table]
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
)toml"));
|
||||
|
||||
// Delete a key from the middle
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
)toml",
|
||||
"my_table.bare_key",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare-key = false
|
||||
)toml"));
|
||||
|
||||
// Delete a key from the end
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
)toml",
|
||||
"my_table.bare-key",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
)toml"));
|
||||
|
||||
// Delete key from the inline table in a table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml",
|
||||
"my_table.1234.y",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, z = 2, str = "abc"}
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml",
|
||||
"my_table.1234.x",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {y = 1, z = 2, str = "abc"}
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml",
|
||||
"my_table.1234.str",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2}
|
||||
)toml"));
|
||||
|
||||
// Delete key from the inline sub-table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, b=2, c=3}}
|
||||
)toml",
|
||||
"my_table.1234.tbl.b",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, c=3}}
|
||||
)toml"));
|
||||
|
||||
// Delete table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, b=2, c=3}}
|
||||
)toml",
|
||||
"my_table.1234.tbl",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc"}
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
1234 = {x = 0, y = 1, z = 2, str = "abc", tbl={a =1, b=2, c=3}}
|
||||
)toml",
|
||||
"my_table.1234",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
)toml"));
|
||||
|
||||
// Delete key from the child-table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
y = 1
|
||||
z = 2
|
||||
str = "abc"
|
||||
)toml",
|
||||
"my_table.1234.y",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
z = 2
|
||||
str = "abc"
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
y = 1
|
||||
z = 2
|
||||
str = "abc"
|
||||
)toml",
|
||||
"my_table.1234.x",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
y = 1
|
||||
z = 2
|
||||
str = "abc"
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
y = 1
|
||||
z = 2
|
||||
str = "abc"
|
||||
)toml",
|
||||
"my_table.1234.str",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
y = 1
|
||||
z = 2
|
||||
)toml"));
|
||||
|
||||
// Delete table
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
y = 1
|
||||
z = 2
|
||||
str = "abc"
|
||||
[my_table.1234.tbl]
|
||||
a =1
|
||||
b=2
|
||||
c=3
|
||||
)toml",
|
||||
"my_table.1234.tbl",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
y = 1
|
||||
z = 2
|
||||
str = "abc"
|
||||
)toml"));
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
[my_table.1234]
|
||||
x = 0
|
||||
y = 1
|
||||
z = 2
|
||||
str = "abc"
|
||||
[my_table.1234.tbl]
|
||||
a =1
|
||||
b=2
|
||||
c=3
|
||||
)toml",
|
||||
"my_table.1234",
|
||||
R"toml(
|
||||
[my_table]
|
||||
key = 10
|
||||
bare_key = "value"
|
||||
bare-key = false
|
||||
)toml"));
|
||||
}
|
||||
|
||||
TEST(TOMLContentModifications, DISABLED_DeleteArrayValues)
|
||||
{
|
||||
EXPECT_TRUE(TestDelete(R"toml(
|
||||
key = [10, 20, 30]
|
||||
bare_key = ["value1", "value2", 3030]
|
||||
bare-key = [{a = false, b = true}, 2020]
|
||||
)toml",
|
||||
"key[1]",
|
||||
R"toml(
|
||||
key = [10, 30]
|
||||
bare_key = ["value1", "value2", 3030]
|
||||
bare-key = [{a = false, b = true}, 2020]
|
||||
)toml"));
|
||||
}
|
||||
Reference in New Issue
Block a user