mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-15 09:38:16 +00:00
71 lines
1.7 KiB
C++
71 lines
1.7 KiB
C++
/********************************************************************************
|
|
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
|
*
|
|
* This program and the accompanying materials are made available under the
|
|
* terms of the Apache License Version 2.0 which is available at
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
********************************************************************************/
|
|
|
|
#include <iostream>
|
|
#include <cstdlib> // for std::strtol
|
|
#include "trunk_application.h"
|
|
#include "console.h"
|
|
|
|
#if defined(_WIN32) && defined(_UNICODE)
|
|
extern "C" int wmain(int argc, wchar_t* argv[])
|
|
{
|
|
uint32_t uiInstance = 0;
|
|
if (argc < 2)
|
|
{
|
|
std::cout << "Missing instance number to connect to, '0' will run as standalone application" << std::endl;
|
|
return 1;
|
|
}
|
|
try
|
|
{
|
|
uiInstance = std::stoi(argv[1]);
|
|
}
|
|
catch (const std::exception& )
|
|
{
|
|
uiInstance = 0;
|
|
}
|
|
|
|
#else
|
|
extern "C" int main(int argc, char* argv[])
|
|
{
|
|
uint32_t uiInstance = 0;
|
|
if (argc < 2)
|
|
{
|
|
std::cout << "Missing instance number to connect to, '0' will run as standalone application" << std::endl;
|
|
return 1;
|
|
}
|
|
try
|
|
{
|
|
uiInstance = std::stoi(argv[1]);
|
|
}
|
|
catch (const std::exception& )
|
|
{
|
|
uiInstance = 0;
|
|
}
|
|
#endif
|
|
CTrunkControl appobj;
|
|
if (!appobj.Initialize(uiInstance))
|
|
{
|
|
std::cout << "ERROR: Failed to initialize application control." << std::endl;
|
|
return 0;
|
|
}
|
|
|
|
CConsole visual_obj;
|
|
visual_obj.PrintHeader(uiInstance);
|
|
visual_obj.PrepareDataConsumers();
|
|
|
|
appobj.SetRunningMode();
|
|
visual_obj.RunUntilBreak();
|
|
|
|
visual_obj.ResetSignals();
|
|
|
|
appobj.Shutdown();
|
|
return 0;
|
|
}
|