mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-08-30 04:15:10 +00:00
connection between 2 systems and bug fixes (#14)
This commit is contained in:
@@ -353,7 +353,7 @@ void CConsole::StartUpdateDataThread()
|
||||
m_bThreadStarted = true;
|
||||
|
||||
m_bRunning = true;
|
||||
m_threadReadTxSignals = std::thread(&CConsole::UpdateDataThreadFunc, this);
|
||||
m_threadReadTxSignals = sdv::core::secure_thread(&CConsole::UpdateDataThreadFunc, this);
|
||||
}
|
||||
|
||||
void CConsole::StopUpdateDataThread()
|
||||
|
||||
@@ -200,33 +200,33 @@ private:
|
||||
*/
|
||||
std::string AlignString(const std::string& message, uint32_t desiredLength = 0);
|
||||
|
||||
mutable std::mutex m_mtxPrintToConsole; ///< Mutex to print complete message
|
||||
std::thread m_threadReadTxSignals; ///< Simulation datalink thread.
|
||||
bool m_bThreadStarted = false; ///< Set when initialized.
|
||||
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
|
||||
mutable std::mutex m_mtxPrintToConsole; ///< Mutex to print complete message
|
||||
sdv::core::secure_thread m_threadReadTxSignals; ///< Simulation datalink thread.
|
||||
bool m_bThreadStarted = false; ///< Set when initialized.
|
||||
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
|
||||
|
||||
sdv::core::CSignal m_signalCurrentLatitude; ///< Signal Current latitude
|
||||
sdv::core::CSignal m_signalCurrentLongitude; ///< Signal Current longitude
|
||||
sdv::core::CSignal m_signalHeadlight; ///< Signal Headlight status
|
||||
sdv::core::CSignal m_signalCurrentLatitude; ///< Signal Current latitude
|
||||
sdv::core::CSignal m_signalCurrentLongitude; ///< Signal Current longitude
|
||||
sdv::core::CSignal m_signalHeadlight; ///< Signal Headlight status
|
||||
|
||||
float m_fCurrentLongitude = 0.0f; //< Current latitude
|
||||
float m_fCurrentLatitude = 0.0f; //< Current longitude
|
||||
bool m_bHeadLight = true; ///< Head light
|
||||
float m_fCurrentLongitude = 0.0f; //< Current latitude
|
||||
float m_fCurrentLatitude = 0.0f; //< Current longitude
|
||||
bool m_bHeadLight = true; ///< Head light
|
||||
|
||||
float m_fVehicleDeviceCurrentLatitude = 0.0f; ///< Current latitude (Vehicle Device)
|
||||
float m_fVehicleDeviceCurrentLongitude = 0.0; ///< Current longitude (Vehicle Device)
|
||||
float m_fVehicleDeviceCurrentLatitude = 0.0f; ///< Current latitude (Vehicle Device)
|
||||
float m_fVehicleDeviceCurrentLongitude = 0.0; ///< Current longitude (Vehicle Device)
|
||||
|
||||
float m_fBasicServiceCurrentLatitude = 0.0f; ///< Current latitude (basic Service)
|
||||
float m_fBasicServiceCurrentLongitude = 0.0; ///< Current longitude (basic Service)
|
||||
float m_fBasicServiceCurrentLatitude = 0.0f; ///< Current latitude (basic Service)
|
||||
float m_fBasicServiceCurrentLongitude = 0.0; ///< Current longitude (basic Service)
|
||||
|
||||
IAutoheadlightService* m_pIAutoheadlightComplexService = nullptr; ///< Autoheadlight Service interface pointer.
|
||||
IAutoheadlightService* m_pIAutoheadlightComplexService = nullptr; ///< Autoheadlight Service interface pointer.
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD m_dwConsoleOutMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
DWORD m_dwConsoleInMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
DWORD m_dwConsoleOutMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
DWORD m_dwConsoleInMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
#elif defined __unix__
|
||||
struct termios m_sTermAttr {}; ///< The terminal attributes before disabling echo.
|
||||
struct termios m_sTermAttr {}; ///< The terminal attributes before disabling echo.
|
||||
int m_iFileStatus = 0; ///< The file status flags for STDIN.
|
||||
#else
|
||||
#error The OS is not supported!
|
||||
|
||||
@@ -94,7 +94,10 @@ bool CreateCoreServiceTomlFile(const std::string& resources)
|
||||
std::ofstream tomlFile("sdv_core_reloc.toml");
|
||||
if (tomlFile.is_open())
|
||||
{
|
||||
tomlFile << "# Location of the SDV binaries and configuration files\ndirectory = \"";
|
||||
tomlFile << R"toml(# Location of the SDV binaries and configuration files
|
||||
[CoreLocation]
|
||||
Version = 100
|
||||
Framework = ")toml";
|
||||
tomlFile << resources;
|
||||
tomlFile << "\"\n";
|
||||
tomlFile.close();
|
||||
|
||||
@@ -43,59 +43,63 @@ file (COPY ${PROJECT_SOURCE_DIR}/door_example_receiver.asc DESTINATION ${CMAKE_B
|
||||
######################################################################################################################################################################
|
||||
|
||||
# Execute sdv_vss_util to create IDL files for devices and basic services.
|
||||
# In this example we split into into front and rear (frontdoors_proxystub.sdv and frontdoors_proxystub.sdv)
|
||||
# because all interfaces combined in doors_proxystub.sdv would be to large
|
||||
message("Create interface code for devices and basic services of doors example.")
|
||||
execute_process(COMMAND "${SDV_VSS_UTIL}" "${PROJECT_SOURCE_DIR}/vss_doors_example.csv" "-O${PROJECT_SOURCE_DIR}/generated/" --prefixdoors --version1.0.0.1 --enable_components)
|
||||
execute_process(COMMAND "${SDV_VSS_UTIL}" "${PROJECT_SOURCE_DIR}/vss_doors_front_example.csv" "-O${PROJECT_SOURCE_DIR}/generated/front/" --prefixfrontdoors --version1.0.0.1 --enable_components)
|
||||
execute_process(COMMAND "${SDV_VSS_UTIL}" "${PROJECT_SOURCE_DIR}/vss_doors_rear_example.csv" "-O${PROJECT_SOURCE_DIR}/generated/rear/" --prefixreardoors --version1.0.0.1 --enable_components)
|
||||
|
||||
|
||||
message("Compiling Interface Door01Left RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namefrontdoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door01Right RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Left RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Right RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namefrontdoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door01Left TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namefrontdoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door01Right TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_01right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/front/vss_files/vss_vehiclebodydooraxle_01right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/front/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namefrontdoors_proxystub)
|
||||
|
||||
|
||||
message("Compiling Interface Door02Left RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02left_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namereardoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Right RX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02right_vd_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namereardoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Left TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02left_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02left_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namereardoors_proxystub)
|
||||
|
||||
message("Compiling Interface Door02Right TX")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/vss_files/vss_vehiclebodydooraxle_02right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namedoors_proxystub)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02right_vd_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --no_ps)
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/generated/rear/vss_files/vss_vehiclebodydooraxle_02right_bs_tx.idl" "-O${PROJECT_SOURCE_DIR}/generated/rear/vss_files/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Igenerated/vss_files/ --ps_lib_namereardoors_proxystub)
|
||||
|
||||
# Execute the IDL compiler for the complex service to digest interface code.
|
||||
message("Compiling door_ifc.idl")
|
||||
execute_process(COMMAND "${SDV_IDL_COMPILER}" "${PROJECT_SOURCE_DIR}/door_service/door_ifc.idl" "-O${PROJECT_SOURCE_DIR}/generated/door_service/" "-I${SDV_FRAMEWORK_DEV_INCLUDE}" -Iexample_service/ --ps_lib_namedoors_service_proxystub)
|
||||
|
||||
add_subdirectory(generated/door_service/ps)
|
||||
add_subdirectory(generated/vss_files/ps)
|
||||
add_subdirectory(generated/front/vss_files/ps)
|
||||
add_subdirectory(generated/rear/vss_files/ps)
|
||||
|
||||
add_subdirectory(generated/vss_files/vd_frontdoorleft)
|
||||
add_subdirectory(generated/vss_files/vd_frontdoorright)
|
||||
add_subdirectory(generated/vss_files/vd_reardoorleft)
|
||||
add_subdirectory(generated/vss_files/vd_reardoorright)
|
||||
add_subdirectory(generated/front/vss_files/vd_frontdoorleft)
|
||||
add_subdirectory(generated/front/vss_files/vd_frontdoorright)
|
||||
add_subdirectory(generated/front/vss_files/bs_frontdoorleft)
|
||||
add_subdirectory(generated/front/vss_files/bs_frontdoorright)
|
||||
|
||||
add_subdirectory(generated/vss_files/bs_frontdoorleft)
|
||||
add_subdirectory(generated/vss_files/bs_frontdoorright)
|
||||
add_subdirectory(generated/vss_files/bs_reardoorleft)
|
||||
add_subdirectory(generated/vss_files/bs_reardoorright)
|
||||
add_subdirectory(generated/rear/vss_files/vd_reardoorleft)
|
||||
add_subdirectory(generated/rear/vss_files/vd_reardoorright)
|
||||
add_subdirectory(generated/rear/vss_files/bs_reardoorleft)
|
||||
add_subdirectory(generated/rear/vss_files/bs_reardoorright)
|
||||
|
||||
# Execute sdv_dbc_util to create data link code & FMU code.
|
||||
message("Create data link for doors example")
|
||||
@@ -167,7 +171,6 @@ else()
|
||||
target_link_libraries(door_external_app Rpcrt4.lib)
|
||||
endif()
|
||||
|
||||
|
||||
######################################################################################################################################################################
|
||||
# create instance 3002 of door demo example
|
||||
######################################################################################################################################################################
|
||||
@@ -175,23 +178,25 @@ add_custom_target(vehicle_device_doors_config
|
||||
ALL
|
||||
DEPENDS
|
||||
can_dl_doors
|
||||
doors_vd_frontdoorleft_rx
|
||||
doors_vd_frontdoorright_rx
|
||||
doors_vd_reardoorleft_rx
|
||||
doors_vd_reardoorright_rx
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL VehicleDeviceDoors --instance3002 can_dl_doors.sdv doors_vd_frontdoorleft_rx.sdv doors_vd_frontdoorright_rx.sdv doors_vd_reardoorleft_rx.sdv doors_vd_reardoorright_rx.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --interface_config --overwrite
|
||||
frontdoors_vd_frontdoorleft_rx
|
||||
frontdoors_vd_frontdoorright_rx
|
||||
reardoors_vd_reardoorleft_rx
|
||||
reardoors_vd_reardoorright_rx
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL VehicleDeviceDoors --instance3002 can_dl_doors.sdv frontdoors_vd_frontdoorleft_rx.sdv frontdoors_vd_frontdoorright_rx.sdv reardoors_vd_reardoorleft_rx.sdv reardoors_vd_reardoorright_rx.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --interface_config --overwrite
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
|
||||
add_custom_target(basic_service_doors_config
|
||||
ALL
|
||||
DEPENDS
|
||||
doors_proxystub
|
||||
doors_bs_frontdoorleft_rx
|
||||
doors_bs_frontdoorright_rx
|
||||
doors_bs_reardoorleft_rx
|
||||
doors_bs_reardoorright_rx
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL BasicServiceDoors --instance3002 doors_proxystub.sdv doors_bs_frontdoorleft_rx.sdv doors_bs_frontdoorright_rx.sdv doors_bs_reardoorleft_rx.sdv doors_bs_reardoorright_rx.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --abstract_config --overwrite
|
||||
frontdoors_proxystub
|
||||
reardoors_proxystub
|
||||
frontdoors_bs_frontdoorleft_rx
|
||||
frontdoors_bs_frontdoorright_rx
|
||||
reardoors_bs_reardoorleft_rx
|
||||
reardoors_bs_reardoorright_rx
|
||||
COMMAND "${SDV_PACKAGER}" DIRECT_INSTALL BasicServiceDoors --instance3002 frontdoors_proxystub.sdv reardoors_proxystub.sdv frontdoors_bs_frontdoorleft_rx.sdv frontdoors_bs_frontdoorright_rx.sdv reardoors_bs_reardoorleft_rx.sdv reardoors_bs_reardoorright_rx.sdv "-I${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" --abstract_config --overwrite
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorleft_rx.sdv"
|
||||
Path = "frontdoors_vd_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorleft_rx.sdv"
|
||||
Path = "frontdoors_bs_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Service"
|
||||
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorright_rx.sdv"
|
||||
Path = "frontdoors_vd_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorright_rx.sdv"
|
||||
Path = "frontdoors_bs_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Service"
|
||||
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorleft_rx.sdv"
|
||||
Path = "reardoors_vd_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorleft_rx.sdv"
|
||||
Path = "reardoors_bs_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Service"
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorright_rx.sdv"
|
||||
Path = "reardoors_vd_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorright_rx.sdv"
|
||||
Path = "reardoors_bs_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Service"
|
||||
|
||||
@@ -128,7 +128,6 @@ void CConsole::PrintHeader(const uint32_t numberOfDoors)
|
||||
PrintText(g_sTitle, title.c_str());
|
||||
PrintText(g_sControlDescription, "Press 'X' to quit; Doors are toggled automatically");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool CConsole::PrepareDataConsumers()
|
||||
@@ -205,8 +204,7 @@ void CConsole::ResetSignals()
|
||||
// Set the cursor position at the end
|
||||
SetCursorPos(g_sCursor);
|
||||
|
||||
// Registrate for the vehicle device & basic service of the front left door. Front left door mzust exist, the others are optional
|
||||
auto vehicleDevice =
|
||||
auto vehicleDevice =
|
||||
sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface < vss::Vehicle::Body::Door::Axle::_01 ::LeftDevice::IVSS_ReadIsOpen > ();
|
||||
if (vehicleDevice)
|
||||
vehicleDevice->UnregisterIsOpenEvent(dynamic_cast<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_WriteIsOpen_Event*> (this));
|
||||
@@ -254,7 +252,7 @@ void CConsole::StartUpdateDataThread()
|
||||
m_bThreadStarted = true;
|
||||
|
||||
m_bRunning = true;
|
||||
m_threadReadTxSignals = std::thread(&CConsole::UpdateDataThreadFunc, this);
|
||||
m_threadReadTxSignals = sdv::core::secure_thread(&CConsole::UpdateDataThreadFunc, this);
|
||||
}
|
||||
|
||||
void CConsole::StopUpdateDataThread()
|
||||
@@ -299,21 +297,21 @@ bool CConsole::PrepareDataConsumersForStandAlone()
|
||||
{
|
||||
// Subscribe for the door and if available get TX signal. Either both exists or none of them
|
||||
sdv::core::CDispatchService dispatch;
|
||||
m_SignalFrontLeftDoorIsOpen = dispatch.Subscribe(doors::dsLeftDoorIsOpen01, [&](sdv::any_t value) { CallbackFrontLeftDoorIsOpen(value); });
|
||||
m_SignalFrontLeftDoorIsOpen = dispatch.Subscribe(frontdoors::dsLeftDoorIsOpen01, [&](sdv::any_t value) { CallbackFrontLeftDoorIsOpen(value); });
|
||||
if(m_SignalFrontLeftDoorIsOpen)
|
||||
m_SignalFrontLeftDoorIsLocked = dispatch.RegisterTxSignal(doors::dsLeftLatch01, 0);
|
||||
m_SignalFrontLeftDoorIsLocked = dispatch.RegisterTxSignal(frontdoors::dsLeftLatch01, 0);
|
||||
|
||||
m_SignalFrontRightDoorIsOpen = dispatch.Subscribe(doors::dsRightDoorIsOpen01, [&](sdv::any_t value) { CallbackFrontRightDoorIsOpen(value); });
|
||||
m_SignalFrontRightDoorIsOpen = dispatch.Subscribe(frontdoors::dsRightDoorIsOpen01, [&](sdv::any_t value) { CallbackFrontRightDoorIsOpen(value); });
|
||||
if(m_SignalFrontRightDoorIsOpen)
|
||||
m_SignalFrontRightDoorIsLocked = dispatch.RegisterTxSignal(doors::dsRightLatch01, 0);
|
||||
m_SignalFrontRightDoorIsLocked = dispatch.RegisterTxSignal(frontdoors::dsRightLatch01, 0);
|
||||
|
||||
m_SignalRearLeftDoorIsOpen = dispatch.Subscribe(doors::dsLeftDoorIsOpen02, [&](sdv::any_t value) {CallbackRearLeftDoorIsOpen(value); });
|
||||
m_SignalRearLeftDoorIsOpen = dispatch.Subscribe(reardoors::dsLeftDoorIsOpen02, [&](sdv::any_t value) {CallbackRearLeftDoorIsOpen(value); });
|
||||
if(m_SignalRearLeftDoorIsOpen)
|
||||
m_SignalRearLeftDoorIsLocked = dispatch.RegisterTxSignal(doors::dsLeftLatch02, 0);
|
||||
m_SignalRearLeftDoorIsLocked = dispatch.RegisterTxSignal(reardoors::dsLeftLatch02, 0);
|
||||
|
||||
m_SignalRearRightDoorIsOpen = dispatch.Subscribe(doors::dsRightDoorIsOpen02, [&](sdv::any_t value) { CallbackRearRightDoorIsOpen(value); });
|
||||
m_SignalRearRightDoorIsOpen = dispatch.Subscribe(reardoors::dsRightDoorIsOpen02, [&](sdv::any_t value) { CallbackRearRightDoorIsOpen(value); });
|
||||
if(m_SignalRearRightDoorIsOpen)
|
||||
m_SignalRearRightDoorIsLocked = dispatch.RegisterTxSignal(doors::dsRightLatch02, 0);
|
||||
m_SignalRearRightDoorIsLocked = dispatch.RegisterTxSignal(reardoors::dsRightLatch02, 0);
|
||||
|
||||
// Validate: Either both exists or none of them
|
||||
if (m_SignalFrontLeftDoorIsOpen != m_SignalFrontLeftDoorIsLocked)
|
||||
@@ -337,7 +335,7 @@ bool CConsole::PrepareDataConsumersForStandAlone()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Registrate for the vehicle device & basic service of the front left door. Front left door mzust exist, the others are optional
|
||||
// Register for the vehicle device & basic service of the front left door. Front left door must exist, the others are optional
|
||||
auto vehicleDevice = sdv::core::GetObject("Vehicle.Body.Door.Axle._01.Left_Device").GetInterface<vss::Vehicle::Body::Door::Axle::_01::LeftDevice::IVSS_ReadIsOpen>();
|
||||
if (!vehicleDevice)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include "../door_app/include/door_application.h"
|
||||
#include "../generated/vss_files/signal_identifier.h"
|
||||
#include "../generated/front/vss_files/signal_identifier.h"
|
||||
#include "../generated/rear/vss_files/signal_identifier.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <conio.h> // Needed for _kbhit
|
||||
@@ -61,23 +62,23 @@ bool CDoorControl::RegisterSignals()
|
||||
{
|
||||
sdv::core::CDispatchService dispatch;
|
||||
|
||||
m_SignalFrontLeftDoorIsOpen = dispatch.RegisterRxSignal(doors::dsLeftDoorIsOpen01);
|
||||
m_SignalFrontLeftDoorIsLocked = dispatch.RegisterTxSignal(doors::dsLeftLatch01, 0);
|
||||
m_SignalFrontLeftDoorIsOpen = dispatch.RegisterRxSignal(frontdoors::dsLeftDoorIsOpen01);
|
||||
m_SignalFrontLeftDoorIsLocked = dispatch.RegisterTxSignal(frontdoors::dsLeftLatch01, 0);
|
||||
|
||||
if (m_iNumberOfDoors > 1)
|
||||
{
|
||||
m_SignalFrontRightDoorIsOpen = dispatch.RegisterRxSignal(doors::dsRightDoorIsOpen01);
|
||||
m_SignalFrontRightDoorIsLocked = dispatch.RegisterTxSignal(doors::dsRightLatch01, 0);
|
||||
m_SignalFrontRightDoorIsOpen = dispatch.RegisterRxSignal(frontdoors::dsRightDoorIsOpen01);
|
||||
m_SignalFrontRightDoorIsLocked = dispatch.RegisterTxSignal(frontdoors::dsRightLatch01, 0);
|
||||
|
||||
if (m_iNumberOfDoors > 2)
|
||||
{
|
||||
m_SignalRearLeftDoorIsOpen = dispatch.RegisterRxSignal(doors::dsLeftDoorIsOpen02);
|
||||
m_SignalRearLeftDoorIsLocked = dispatch.RegisterTxSignal(doors::dsLeftLatch02, 0);
|
||||
m_SignalRearLeftDoorIsOpen = dispatch.RegisterRxSignal(reardoors::dsLeftDoorIsOpen02);
|
||||
m_SignalRearLeftDoorIsLocked = dispatch.RegisterTxSignal(reardoors::dsLeftLatch02, 0);
|
||||
|
||||
if (m_iNumberOfDoors > 3)
|
||||
{
|
||||
m_SignalRearRightDoorIsOpen = dispatch.RegisterRxSignal(doors::dsRightDoorIsOpen02);
|
||||
m_SignalRearRightDoorIsLocked = dispatch.RegisterTxSignal(doors::dsRightLatch02, 0);
|
||||
m_SignalRearRightDoorIsOpen = dispatch.RegisterRxSignal(reardoors::dsRightDoorIsOpen02);
|
||||
m_SignalRearRightDoorIsLocked = dispatch.RegisterTxSignal(reardoors::dsRightLatch02, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include "../door_app/include/door_extern_application.h"
|
||||
#include "../generated/vss_files/signal_identifier.h"
|
||||
#include "../generated/front/vss_files/signal_identifier.h"
|
||||
#include "../generated/rear/vss_files/signal_identifier.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <conio.h> // Needed for _kbhit
|
||||
|
||||
@@ -19,15 +19,16 @@
|
||||
#include <support/app_control.h>
|
||||
#include <support/component_impl.h>
|
||||
#include <support/timer.h>
|
||||
#include "../../generated/vss_files/signal_identifier.h"
|
||||
#include "../../generated/front/vss_files/signal_identifier.h"
|
||||
#include "../../generated/rear/vss_files/signal_identifier.h"
|
||||
#include <fcntl.h>
|
||||
#include <atomic>
|
||||
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_01left_vd_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.h"
|
||||
#include "../../generated/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.h"
|
||||
#include "../../generated/front/vss_files/vss_vehiclebodydooraxle_01left_vd_rx.h"
|
||||
#include "../../generated/front/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.h"
|
||||
#include "../../generated/front/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.h"
|
||||
#include "../../generated/rear/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.h"
|
||||
#include "../../generated/rear/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.h"
|
||||
|
||||
#ifdef __unix__
|
||||
#include <termios.h> // Needed for tcgetattr and fcntl
|
||||
@@ -215,41 +216,41 @@ private:
|
||||
*/
|
||||
std::string AlignString(const std::string& message, uint32_t desiredLength = 0);
|
||||
|
||||
mutable std::mutex m_mtxPrintToConsole; ///< Mutex to print complete message
|
||||
bool m_bThreadStarted = false; ///< Set when initialized.
|
||||
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
|
||||
bool m_isExternalApp = false; ///< True when we have an external application
|
||||
mutable std::mutex m_mtxPrintToConsole; ///< Mutex to print complete message
|
||||
bool m_bThreadStarted = false; ///< Set when initialized.
|
||||
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
|
||||
bool m_isExternalApp = false; ///< True when we have an external application
|
||||
|
||||
std::thread m_threadReadTxSignals; ///< Simulation datalink thread.
|
||||
sdv::core::secure_thread m_threadReadTxSignals; ///< Simulation datalink thread.
|
||||
|
||||
sdv::core::CSignal m_SignalFrontLeftDoorIsOpen; ///< Front Left Door signal (RX input) - open / closed
|
||||
sdv::core::CSignal m_SignalFrontRightDoorIsOpen; ///< Front Right Door signal (RX input) - open / closed
|
||||
sdv::core::CSignal m_SignalRearLeftDoorIsOpen; ///< Rear Left Door signal (RX input) - open / closed
|
||||
sdv::core::CSignal m_SignalRearRightDoorIsOpen; ///< Rear Right Door signal (RX input) - open / closed
|
||||
sdv::core::CSignal m_SignalFrontLeftDoorIsOpen; ///< Front Left Door signal (RX input) - open / closed
|
||||
sdv::core::CSignal m_SignalFrontRightDoorIsOpen; ///< Front Right Door signal (RX input) - open / closed
|
||||
sdv::core::CSignal m_SignalRearLeftDoorIsOpen; ///< Rear Left Door signal (RX input) - open / closed
|
||||
sdv::core::CSignal m_SignalRearRightDoorIsOpen; ///< Rear Right Door signal (RX input) - open / closed
|
||||
|
||||
bool m_FrontLeftDoorIsOpen = false; ///< Front Left Door value (RX input signal) - open / closed
|
||||
bool m_FrontRightDoorIsOpen = false; ///< Front Right Door value (RX input signal) - open / closed
|
||||
bool m_RearLeftDoorIsOpen = false; ///< Rear Left Door value (RX input signal) - open / closed
|
||||
bool m_RearRightDoorIsOpen = false; ///< Rear Right Door value (RX input signal) - open / closed
|
||||
bool m_FrontLeftDoorIsOpen = false; ///< Front Left Door value (RX input signal) - open / closed
|
||||
bool m_FrontRightDoorIsOpen = false; ///< Front Right Door value (RX input signal) - open / closed
|
||||
bool m_RearLeftDoorIsOpen = false; ///< Rear Left Door value (RX input signal) - open / closed
|
||||
bool m_RearRightDoorIsOpen = false; ///< Rear Right Door value (RX input signal) - open / closed
|
||||
|
||||
sdv::core::CSignal m_SignalFrontLeftDoorIsLocked; ///< Front Left Door signal (TX output) - locked / unlocked
|
||||
sdv::core::CSignal m_SignalFrontRightDoorIsLocked; ///< Front Right Door signal (TX output) - locked / unlocked
|
||||
sdv::core::CSignal m_SignalRearLeftDoorIsLocked; ///< Rear Left Door signal (TX output) - locked / unlocked
|
||||
sdv::core::CSignal m_SignalRearRightDoorIsLocked; ///< Rear Right Door signal (TX output) - locked / unlocked
|
||||
sdv::core::CSignal m_SignalFrontLeftDoorIsLocked; ///< Front Left Door signal (TX output) - locked / unlocked
|
||||
sdv::core::CSignal m_SignalFrontRightDoorIsLocked; ///< Front Right Door signal (TX output) - locked / unlocked
|
||||
sdv::core::CSignal m_SignalRearLeftDoorIsLocked; ///< Rear Left Door signal (TX output) - locked / unlocked
|
||||
sdv::core::CSignal m_SignalRearRightDoorIsLocked; ///< Rear Right Door signal (TX output) - locked / unlocked
|
||||
|
||||
bool m_FrontLeftDoorIsLocked = false; ///< Front Left Door value (TX output) - locked / unlocked
|
||||
bool m_FrontRightDoorIsLocked = false; ///< Front Right Door value (TX output) - locked / unlocked
|
||||
bool m_RearLeftDoorIsLocked = false; ///< Rear Left Door value (TX output) - locked / unlocked
|
||||
bool m_RearRightDoorIsLocked = false; ///< Rear Right Door value (TX output) - locked / unlocked
|
||||
bool m_FrontLeftDoorIsLocked = false; ///< Front Left Door value (TX output) - locked / unlocked
|
||||
bool m_FrontRightDoorIsLocked = false; ///< Front Right Door value (TX output) - locked / unlocked
|
||||
bool m_RearLeftDoorIsLocked = false; ///< Rear Left Door value (TX output) - locked / unlocked
|
||||
bool m_RearRightDoorIsLocked = false; ///< Rear Right Door value (TX output) - locked / unlocked
|
||||
|
||||
IDoorService* m_pDoorService = nullptr; ///< Door service interface pointer.
|
||||
IDoorService* m_pDoorService = nullptr; ///< Door service interface pointer.
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD m_dwConsoleOutMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
DWORD m_dwConsoleInMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
DWORD m_dwConsoleOutMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
DWORD m_dwConsoleInMode = 0u; ///< The console mode before switching on ANSI support.
|
||||
#elif defined __unix__
|
||||
struct termios m_sTermAttr{}; ///< The terminal attributes before disabling echo.
|
||||
int m_iFileStatus = 0; ///< The file status flags for STDIN.
|
||||
struct termios m_sTermAttr{}; ///< The terminal attributes before disabling echo.
|
||||
int m_iFileStatus = 0; ///< The file status flags for STDIN.
|
||||
#else
|
||||
#error The OS is not supported!
|
||||
#endif
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
#include <support/timer.h>
|
||||
|
||||
// VSS interfaces - located in ../generated/vss_files/
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01left_bs_tx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_01right_bs_tx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02left_bs_tx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.h"
|
||||
#include "../generated/vss_files/vss_vehiclebodydooraxle_02right_bs_tx.h"
|
||||
#include "../generated/front/vss_files/vss_vehiclebodydooraxle_01left_bs_rx.h"
|
||||
#include "../generated/front/vss_files/vss_vehiclebodydooraxle_01left_bs_tx.h"
|
||||
#include "../generated/front/vss_files/vss_vehiclebodydooraxle_01right_bs_rx.h"
|
||||
#include "../generated/front/vss_files/vss_vehiclebodydooraxle_01right_bs_tx.h"
|
||||
#include "../generated/rear/vss_files/vss_vehiclebodydooraxle_02left_bs_rx.h"
|
||||
#include "../generated/rear/vss_files/vss_vehiclebodydooraxle_02left_bs_tx.h"
|
||||
#include "../generated/rear/vss_files/vss_vehiclebodydooraxle_02right_bs_rx.h"
|
||||
#include "../generated/rear/vss_files/vss_vehiclebodydooraxle_02right_bs_tx.h"
|
||||
|
||||
#include "lock_doors_thread.h"
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
m_timeIn100MilliSeconds = timeSpan;
|
||||
m_counter = 0;
|
||||
m_running = true;
|
||||
m_thread = std::thread(&LockDoorsThread::run, this);
|
||||
m_thread = sdv::core::secure_thread(&LockDoorsThread::run, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,11 +94,11 @@ public:
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
std::function<void()> m_callback; ///< callback function
|
||||
std::atomic<bool> m_running; ///< status if loop is running
|
||||
std::thread m_thread; ///< timer thread
|
||||
uint32_t m_counter; ///< loop counter
|
||||
uint32_t m_timeIn100MilliSeconds; ///< time before the callback will be executed
|
||||
std::function<void()> m_callback; ///< callback function
|
||||
std::atomic<bool> m_running; ///< status if loop is running
|
||||
sdv::core::secure_thread m_thread; ///< timer thread
|
||||
uint32_t m_counter; ///< loop counter
|
||||
uint32_t m_timeIn100MilliSeconds; ///< time before the callback will be executed
|
||||
};
|
||||
|
||||
#endif // !define LOCK_DOORS_THREAD_H
|
||||
|
||||
@@ -100,7 +100,10 @@ bool CreateCoreServiceTomlFile(const std::string& resources)
|
||||
std::ofstream tomlFile("sdv_core_reloc.toml");
|
||||
if (tomlFile.is_open())
|
||||
{
|
||||
tomlFile << "# Location of the SDV binaries and configuration files\ndirectory = \"";
|
||||
tomlFile << R"toml(# Location of the SDV binaries and configuration files
|
||||
[CoreLocation]
|
||||
Version = 100
|
||||
Framework = ")toml";
|
||||
tomlFile << resources;
|
||||
tomlFile << "\"\n";
|
||||
tomlFile.close();
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorleft_rx.sdv"
|
||||
Path = "frontdoors_vd_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorleft_rx.sdv"
|
||||
Path = "frontdoors_bs_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Service"
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorright_rx.sdv"
|
||||
Path = "frontdoors_vd_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorright_rx.sdv"
|
||||
Path = "frontdoors_bs_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Service"
|
||||
|
||||
|
||||
@@ -125,7 +125,10 @@ bool CreateCoreServiceTomlFile(const std::string& resources)
|
||||
std::ofstream tomlFile("sdv_core_reloc.toml");
|
||||
if (tomlFile.is_open())
|
||||
{
|
||||
tomlFile << "# Location of the SDV binaries and configuration files\ndirectory = \"";
|
||||
tomlFile << R"toml(# Location of the SDV binaries and configuration files
|
||||
[CoreLocation]
|
||||
Version = 100
|
||||
Framework = ")toml";
|
||||
tomlFile << resources;
|
||||
tomlFile << "\"\n";
|
||||
tomlFile.close();
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorleft_rx.sdv"
|
||||
Path = "frontdoors_vd_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorleft_rx.sdv"
|
||||
Path = "frontdoors_bs_frontdoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Left_Service"
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_frontdoorright_rx.sdv"
|
||||
Path = "frontdoors_vd_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_frontdoorright_rx.sdv"
|
||||
Path = "frontdoors_bs_frontdoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._01.Right_Service"
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorleft_rx.sdv"
|
||||
Path = "reardoors_vd_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorleft_rx.sdv"
|
||||
Path = "reardoors_bs_reardoorleft_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Left_Service"
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Version = 100
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_vd_reardoorright_rx.sdv"
|
||||
Path = "reardoors_vd_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Device"
|
||||
|
||||
[[Component]]
|
||||
Path = "doors_bs_reardoorright_rx.sdv"
|
||||
Path = "reardoors_bs_reardoorright_rx.sdv"
|
||||
Class = "Vehicle.Body.Door.Axle._02.Right_Service"
|
||||
|
||||
@@ -2,17 +2,9 @@
|
||||
;;;;;;;
|
||||
VD;FrontDoorLeft;IsOpen;leftDoorIsOpen01;Vehicle.Body.Door.Axle.01.Left;RX;boolean;CAN_Input_L1.Door01LeftIsOpen
|
||||
VD;FrontDoorRight;IsOpen;rightDoorIsOpen01;Vehicle.Body.Door.Axle.01.Right;RX;boolean;CAN_Input_R1.Door01RightIsOpen
|
||||
VD;RearDoorLeft;IsOpen;leftDoorIsOpen02;Vehicle.Body.Door.Axle.02.Left;RX;boolean;CAN_Input_L2.Door02LeftIsOpen
|
||||
VD;RearDoorRight;IsOpen;rightDoorIsOpen02;Vehicle.Body.Door.Axle.02.Right;RX;boolean;CAN_Input_R2.Door02RightIsOpen
|
||||
VD;FrontDoorLeft;Lock;leftLatch01;Vehicle.Body.Door.Axle.01.Left;TX;boolean;CAN_Output.LockDoor01Left
|
||||
VD;FrontDoorRight;Lock;rightLatch01;Vehicle.Body.Door.Axle.01.Right;TX;boolean;CAN_Output.LockDoor01Right
|
||||
VD;RearDoorLeft;Lock;leftLatch02;Vehicle.Body.Door.Axle.02.Left;TX;boolean;CAN_Output.LockDoor02Left
|
||||
VD;RearDoorRight;Lock;rightLatch02;Vehicle.Body.Door.Axle.02.Right;TX;boolean;CAN_Output.LockDoor02Right
|
||||
BS;FrontDoorLeft;IsOpenL1;leftDoorIsOpen01;Vehicle.Body.Door.Axle.01.Left;RX;boolean;Vehicle.Body.Door.Axle.01.Left
|
||||
BS;FrontDoorRight;IsOpenR1;rightDoorIsOpen01;Vehicle.Body.Door.Axle.01.Right;RX;boolean;Vehicle.Body.Door.Axle.01.Right
|
||||
BS;RearDoorLeft;IsOpenL2;leftDoorIsOpen02;Vehicle.Body.Door.Axle.02.Left;RX;boolean;Vehicle.Body.Door.Axle.02.Left
|
||||
BS;RearDoorRight;IsOpenR2;rightDoorIsOpen02;Vehicle.Body.Door.Axle.02.Right;RX;boolean;Vehicle.Body.Door.Axle.02.Right
|
||||
BS;FrontDoorLeft;Lock;leftLatch01;Vehicle.Body.Door.Axle.01.Left;TX;boolean;Vehicle.Body.Door.Axle.01.Left
|
||||
BS;FrontDoorRight;Lock;rightLatch01;Vehicle.Body.Door.Axle.01.Right;TX;boolean;Vehicle.Body.Door.Axle.01.Right
|
||||
BS;RearDoorLeft;Lock;leftLatch02;Vehicle.Body.Door.Axle.02.Left;TX;boolean;Vehicle.Body.Door.Axle.02.Left
|
||||
BS;RearDoorRight;Lock;rightLatch02;Vehicle.Body.Door.Axle.02.Right;TX;boolean;Vehicle.Body.Door.Axle.02.Right
|
||||
|
10
examples/door_demo_example/vss_doors_rear_example.csv
Normal file
10
examples/door_demo_example/vss_doors_rear_example.csv
Normal file
@@ -0,0 +1,10 @@
|
||||
;Class name;Function name;Signal name;vss;Signal direction;type;DBC CAN name includes CAN message name
|
||||
;;;;;;;
|
||||
VD;RearDoorLeft;IsOpen;leftDoorIsOpen02;Vehicle.Body.Door.Axle.02.Left;RX;boolean;CAN_Input_L2.Door02LeftIsOpen
|
||||
VD;RearDoorRight;IsOpen;rightDoorIsOpen02;Vehicle.Body.Door.Axle.02.Right;RX;boolean;CAN_Input_R2.Door02RightIsOpen
|
||||
VD;RearDoorLeft;Lock;leftLatch02;Vehicle.Body.Door.Axle.02.Left;TX;boolean;CAN_Output.LockDoor02Left
|
||||
VD;RearDoorRight;Lock;rightLatch02;Vehicle.Body.Door.Axle.02.Right;TX;boolean;CAN_Output.LockDoor02Right
|
||||
BS;RearDoorLeft;IsOpenL2;leftDoorIsOpen02;Vehicle.Body.Door.Axle.02.Left;RX;boolean;Vehicle.Body.Door.Axle.02.Left
|
||||
BS;RearDoorRight;IsOpenR2;rightDoorIsOpen02;Vehicle.Body.Door.Axle.02.Right;RX;boolean;Vehicle.Body.Door.Axle.02.Right
|
||||
BS;RearDoorLeft;Lock;leftLatch02;Vehicle.Body.Door.Axle.02.Left;TX;boolean;Vehicle.Body.Door.Axle.02.Left
|
||||
BS;RearDoorRight;Lock;rightLatch02;Vehicle.Body.Door.Axle.02.Right;TX;boolean;Vehicle.Body.Door.Axle.02.Right
|
||||
|
@@ -34,9 +34,11 @@ const CConsole::SConsolePos g_sComment3{ 24, 1 };
|
||||
const CConsole::SConsolePos g_sSeparator5{ 26, 1 };
|
||||
const CConsole::SConsolePos g_sOpenViaDevice{ 28, 1 };
|
||||
const CConsole::SConsolePos g_sOpenViaService{ 29, 1 };
|
||||
const CConsole::SConsolePos g_sSeparator6{ 31, 1 };
|
||||
const CConsole::SConsolePos g_sControlDescription{ 33, 1 };
|
||||
const CConsole::SConsolePos g_sCursor{ 34, 1 };
|
||||
const CConsole::SConsolePos g_sAutoCloseTrunk{ 30, 1 };
|
||||
const CConsole::SConsolePos g_sStatusTrunk{ 32, 1 };
|
||||
const CConsole::SConsolePos g_sSeparator6{ 34, 1 };
|
||||
const CConsole::SConsolePos g_sControlDescription{ 36, 1 };
|
||||
const CConsole::SConsolePos g_sCursor{ 37, 1 };
|
||||
|
||||
CConsole::CConsole()
|
||||
{
|
||||
@@ -92,6 +94,7 @@ void CConsole::PrintHeader(uint32_t uiInstance)
|
||||
{
|
||||
subTtitle = "Connected to core instance ";
|
||||
subTtitle.append(std::to_string(uiInstance));
|
||||
subTtitle.append(" (not all interfaces available)");
|
||||
}
|
||||
// Print the titles
|
||||
PrintText(g_sTitle, "Open Trunk example: Open trunk when vehicle is not moving");
|
||||
@@ -108,7 +111,7 @@ void CConsole::PrintHeader(uint32_t uiInstance)
|
||||
PrintText(g_sSeparator4, "============================================================================");
|
||||
PrintText(g_sComment1, "The Open Trunk signal has a safety request.");
|
||||
PrintText(g_sComment2, "Therefore the speed value is required and must be checked.");
|
||||
PrintText(g_sComment3, "If the car is moving, open is blocked and trunk is closed automatically.");
|
||||
PrintText(g_sComment3, "If the vehicle is moving, open is blocked and trunk is closed automatically.");
|
||||
PrintText(g_sSeparator5, "============================================================================");
|
||||
PrintText(g_sOpenViaDevice, "Vehicle Device Interface not available.");
|
||||
PrintText(g_sOpenViaService, "Basic Service Interface not available.");
|
||||
@@ -124,7 +127,7 @@ bool CConsole::PrepareDataConsumers()
|
||||
if (m_SignalSpeed)
|
||||
PrintValue(g_sDataLinkSpeed, "Vehicle Speed RX", m_SpeedDL, "m/s");
|
||||
|
||||
// Registrate for the vehicle device & basic service of the speed.
|
||||
// Register for the vehicle device & basic service of the speed.
|
||||
auto vehicleDevice = sdv::core::GetObject("Vehicle.Speed_Device").GetInterface<vss::Vehicle::SpeedDevice::IVSS_ReadSpeed>();
|
||||
if (vehicleDevice)
|
||||
{
|
||||
@@ -153,6 +156,10 @@ bool CConsole::PrepareDataConsumers()
|
||||
else
|
||||
PrintText(g_sOpenViaDevice, "Trunk Device NOT available");
|
||||
|
||||
m_SignalStatusTrunk = dispatch.RegisterTxSignal(trunk::dsTrunk, 0);
|
||||
if (!m_SignalStatusTrunk)
|
||||
PrintText(g_sStatusTrunk, "Trunk Status not available.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -172,6 +179,9 @@ void CConsole::ResetSignals()
|
||||
// Unregister the data link signals
|
||||
if (m_SignalSpeed)
|
||||
m_SignalSpeed.Reset();
|
||||
|
||||
if (m_SignalStatusTrunk)
|
||||
m_SignalStatusTrunk.Reset();
|
||||
}
|
||||
|
||||
void CConsole::CallbackSpeed(sdv::any_t value)
|
||||
@@ -246,7 +256,13 @@ void CConsole::SetSpeed(float value)
|
||||
|
||||
if (bIsMoving && !m_bWasMovingBS)
|
||||
{
|
||||
PrintText(g_sOpenViaService, "Safety active: speed > 0, trunk close command sent.");
|
||||
if (m_pTrunkService)
|
||||
{
|
||||
if (m_pTrunkService->SetOpen(false))
|
||||
PrintText(g_sAutoCloseTrunk, "Safety feature active: Trunk closed as the vehicle started moving.");
|
||||
else
|
||||
PrintText(g_sOpenViaService, "Close trunk automatically failed.");
|
||||
}
|
||||
}
|
||||
m_bWasMovingBS = bIsMoving;
|
||||
}
|
||||
@@ -278,9 +294,24 @@ char CConsole::GetChar()
|
||||
void CConsole::RunUntilBreak()
|
||||
{
|
||||
bool bRunning = true;
|
||||
bool bTrunkClosed = true;
|
||||
|
||||
while (bRunning)
|
||||
{
|
||||
if(m_SignalStatusTrunk)
|
||||
{
|
||||
auto value =m_SignalStatusTrunk.Read().get<bool>();
|
||||
if (bTrunkClosed != value)
|
||||
{
|
||||
bTrunkClosed = value;
|
||||
if (bTrunkClosed)
|
||||
PrintText(g_sStatusTrunk, "Status: Trunk is open.");
|
||||
else
|
||||
PrintText(g_sStatusTrunk, "Status: Trunk is closed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for a key
|
||||
if (!KeyHit())
|
||||
{
|
||||
@@ -294,17 +325,19 @@ void CConsole::RunUntilBreak()
|
||||
{
|
||||
case 'c':
|
||||
case 'C':
|
||||
PrintText(g_sOpenViaDevice, " ");
|
||||
PrintText(g_sOpenViaService, " ");
|
||||
PrintText(g_sOpenViaDevice, " ");
|
||||
PrintText(g_sOpenViaService, " ");
|
||||
PrintText(g_sAutoCloseTrunk, " ");
|
||||
break;
|
||||
case 'd':
|
||||
case 'D':
|
||||
if (m_pTrunkDevice)
|
||||
{
|
||||
PrintText(g_sAutoCloseTrunk, " ");
|
||||
if (m_pTrunkDevice->WriteOpen(true))
|
||||
{
|
||||
if (m_SpeedVD || m_SpeedBS)
|
||||
PrintText(g_sOpenViaDevice, "Trunk opened directly although car was moving, not safe.");
|
||||
PrintText(g_sOpenViaDevice, "Trunk opened directly although vehicle was moving, not safe.");
|
||||
else
|
||||
PrintText(g_sOpenViaDevice, "Trunk opened directly, not safe.");
|
||||
}
|
||||
@@ -316,10 +349,11 @@ void CConsole::RunUntilBreak()
|
||||
case 'O':
|
||||
if (m_pTrunkService)
|
||||
{
|
||||
PrintText(g_sAutoCloseTrunk, " ");
|
||||
if (m_pTrunkService->SetOpen(true))
|
||||
PrintText(g_sOpenViaService, "Trunk opened safely (auto-close if vehicle starts moving).");
|
||||
else
|
||||
PrintText(g_sOpenViaService, "Open trunk failed, car is moving.");
|
||||
PrintText(g_sOpenViaService, "Open trunk failed, vehicle is moving.");
|
||||
}
|
||||
break;
|
||||
case 'x':
|
||||
|
||||
@@ -157,6 +157,7 @@ private:
|
||||
mutable std::mutex m_mtxPrintToConsole; ///< Mutex to print complete message
|
||||
bool m_bRunning = false; ///< When set, the application is running.
|
||||
|
||||
sdv::core::CSignal m_SignalStatusTrunk; ///< Status of the trunk, only available in the standalone example
|
||||
sdv::core::CSignal m_SignalSpeed; ///< Speed
|
||||
float m_SpeedDL = 0.0; ///< Speed Data Link
|
||||
float m_SpeedVD = 0.0; ///< Speed Vehicle Device
|
||||
|
||||
@@ -209,8 +209,7 @@ bool CConsole::PrepareDataConsumers()
|
||||
m_pCounterSteeringSvc = sdv::core::GetObject("Counter Steering Example Service").GetInterface<ICounterSteeringService>();
|
||||
if (!m_pCounterSteeringSvc)
|
||||
{
|
||||
std::cerr << "Console ERROR: Could not get complex service interface 'ICounterSteeringService'" << std::endl;
|
||||
return false;
|
||||
PrintText(g_sCSActive, "Attention: Complex service 'CounterSteeringService' is not available.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -103,7 +103,7 @@ void CExampleControl::StartTestRun()
|
||||
|
||||
// Start the simulated datalink
|
||||
m_bRunning = true;
|
||||
m_threadSimulateDatalink = std::thread(&CExampleControl::SimulateDatalinkThreadFunc, this);
|
||||
m_threadSimulateDatalink = sdv::core::secure_thread(&CExampleControl::SimulateDatalinkThreadFunc, this);
|
||||
}
|
||||
|
||||
void CExampleControl::StopTestRun()
|
||||
|
||||
@@ -163,20 +163,20 @@ private:
|
||||
verbose, ///< Extensive reporting by application control
|
||||
};
|
||||
|
||||
bool m_bInitialized = false; ///< Set when initialized.
|
||||
bool m_bCmdLnError = false; ///< Command line error occurred.
|
||||
bool m_bCmdLnHelp = false; ///< Command line help provided.
|
||||
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
|
||||
ERunAs m_eRunAs = ERunAs::standalone; ///< Application operation.
|
||||
EAppControlReporting m_eReporting = EAppControlReporting::silent; ///< Application control reporting.
|
||||
uint32_t m_uiInstance = 1000u; ///< Server instance to connect to.
|
||||
std::filesystem::path m_pathFramework; ///< Path to the SDV V-API framework.
|
||||
sdv::app::CAppControl m_appcontrol; ///< App-control of SDV V-API.
|
||||
std::thread m_threadSimulateDatalink; ///< Simulation datalink thread.
|
||||
sdv::core::CSignal m_signalSteeringWheel; ///< Steering wheel angle signal (input) - simulated datalink
|
||||
sdv::core::CSignal m_signalSpeed; ///< Speed signal (input) - simulated datalink
|
||||
sdv::core::CSignal m_signalRearAngle; ///< Rear angle signal (output) - simulated datalink
|
||||
sdv::core::CSignal m_signalCounter; ///< Simple counter signal (output) - simulated datalink
|
||||
bool m_bInitialized = false; ///< Set when initialized.
|
||||
bool m_bCmdLnError = false; ///< Command line error occurred.
|
||||
bool m_bCmdLnHelp = false; ///< Command line help provided.
|
||||
std::atomic_bool m_bRunning = false; ///< When set, the application is running.
|
||||
ERunAs m_eRunAs = ERunAs::standalone; ///< Application operation.
|
||||
EAppControlReporting m_eReporting = EAppControlReporting::silent; ///< Application control reporting.
|
||||
uint32_t m_uiInstance = 1000u; ///< Server instance to connect to.
|
||||
std::filesystem::path m_pathFramework; ///< Path to the SDV V-API framework.
|
||||
sdv::app::CAppControl m_appcontrol; ///< App-control of SDV V-API.
|
||||
sdv::core::secure_thread m_threadSimulateDatalink; ///< Simulation datalink thread.
|
||||
sdv::core::CSignal m_signalSteeringWheel; ///< Steering wheel angle signal (input) - simulated datalink
|
||||
sdv::core::CSignal m_signalSpeed; ///< Speed signal (input) - simulated datalink
|
||||
sdv::core::CSignal m_signalRearAngle; ///< Rear angle signal (output) - simulated datalink
|
||||
sdv::core::CSignal m_signalCounter; ///< Simple counter signal (output) - simulated datalink
|
||||
};
|
||||
|
||||
template <typename TCharType>
|
||||
|
||||
@@ -103,7 +103,10 @@ bool CreateCoreServiceTomlFile(const std::string& resources)
|
||||
std::ofstream tomlFile("sdv_core_reloc.toml");
|
||||
if (tomlFile.is_open())
|
||||
{
|
||||
tomlFile << "# Location of the SDV binaries and configuration files\ndirectory = \"";
|
||||
tomlFile << R"toml(# Location of the SDV binaries and configuration files
|
||||
[CoreLocation]
|
||||
Version = 100
|
||||
Framework = ")toml";
|
||||
tomlFile << resources;
|
||||
tomlFile << "\"\n";
|
||||
tomlFile.close();
|
||||
|
||||
Reference in New Issue
Block a user