mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-07-02 05:35:11 +00:00
@@ -0,0 +1,50 @@
|
||||
# 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>)
|
||||
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @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;
|
||||
sdv::core::CSignal m_leftDoorIsOpen01Signal; ///< 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__
|
||||
@@ -0,0 +1,49 @@
|
||||
# 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>)
|
||||
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @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;
|
||||
sdv::core::CSignal m_rightDoorIsOpen01Signal; ///< 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__
|
||||
@@ -0,0 +1,49 @@
|
||||
# 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>)
|
||||
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @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;
|
||||
sdv::core::CSignal m_leftDoorIsOpen02Signal; ///< 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__
|
||||
@@ -0,0 +1,49 @@
|
||||
# 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>)
|
||||
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @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;
|
||||
sdv::core::CSignal m_rightDoorIsOpen02Signal; ///< 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__
|
||||
Reference in New Issue
Block a user