update open trunk example (#12)

This commit is contained in:
tompzf
2026-04-17 20:05:48 +02:00
committed by GitHub
parent 79c06f6efd
commit 56d0d186c1
14 changed files with 213 additions and 264 deletions

View File

@@ -211,6 +211,11 @@ add_custom_target(platform_doors_config
)
# used for a sdv_packager example in the documentation
file (COPY ${PROJECT_SOURCE_DIR}/coreconfig/platform.toml DESTINATION ${CMAKE_BINARY_DIR}/bin/new_instance)
######################################################################################################################################################################
# the FMU files have been created via the dbc file
# ..\\..\\build\\<configurePreset>\\bin\\sdv_dbc_util datalink_2doors_example.dbc -Ogenerated\\ --nodesdoors --version1.0.0.1 --moduleDoors2ExampleFMU --dl_lib_namecan_dl_door

View File

@@ -17,7 +17,7 @@
#include <fcntl.h>
#endif
bool CDoorExternControl::Initialize()
bool CDoorExternControl::Initialize(uint32_t uiInstance)
{
if (m_bInitialized)
return true;
@@ -31,7 +31,7 @@ bool CDoorExternControl::Initialize()
std::stringstream sstreamAppConfig;
sstreamAppConfig << "[Application]" << std::endl;
sstreamAppConfig << "Mode=\"External\"" << std::endl;
sstreamAppConfig << "Instance=\"3002\"" << std::endl;
sstreamAppConfig << "Instance=" << uiInstance << std::endl;
sstreamAppConfig << "Retries=" << 6 << std::endl;
sstreamAppConfig << "[Console]" << std::endl;
sstreamAppConfig << "Report=\"Silent\"" << std::endl;

View File

@@ -12,10 +12,39 @@
#include "../door_app/include/door_extern_application.h"
#include "../door_app/include/console.h"
int main()
#if defined(_WIN32) && defined(_UNICODE)
extern "C" int wmain(int argc, wchar_t* argv[])
{
uint32_t uiInstance = 3002;
if (argc >= 2)
{
try
{
uiInstance = std::stoi(argv[1]);
}
catch (const std::exception& )
{
}
}
#else
extern "C" int main(int argc, char* argv[])
{
uint32_t uiInstance = 3002;
if (argc < 2)
{
try
{
uiInstance = std::stoi(argv[1]);
}
catch (const std::exception& )
{
}
}
#endif
CDoorExternControl appobj;
if (!appobj.Initialize())
if (!appobj.Initialize(uiInstance))
{
std::cout << "ERROR: Failed to initialize application control." << std::endl;
return 0;

View File

@@ -20,11 +20,11 @@ class CDoorExternControl
public:
/**
* @brief Start and initialize the application control and load vehicle devices and
* basic services depending on the number of doors
* @brief Start and initialize the application control and load vehicle devices and basic services depending on the number of doors
* @param[in] uiInstance Instance number the application will connect to. 3002 is default
* @return Return true on success otherwise false
*/
bool Initialize();
bool Initialize(uint32_t uiInstance);
/**
* @brief Run loop as long as user input does not exit