mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-06-30 21:05:10 +00:00
update open trunk example (#12)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user