mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-18 10:38:16 +00:00
tunnel component & update vehicle abstraction example (#8)
This commit is contained in:
@@ -32,17 +32,17 @@ struct SConnectEventCallbackWrapper : sdv::IInterfaceAccess, sdv::ipc::IConnectE
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
/**
|
||||
* @brief Set the current status. Overload of sdv::ipc::IConnectEventCallback::SetStatus.
|
||||
* @param[in] eConnectStatus The connection status.
|
||||
* @brief Set the current connect state. Overload of sdv::ipc::IConnectEventCallback::SetConnectState.
|
||||
* @param[in] eConnectState The connection state.
|
||||
*/
|
||||
virtual void SetStatus(/*in*/ sdv::ipc::EConnectStatus eConnectStatus) override
|
||||
virtual void SetConnectState(/*in*/ sdv::ipc::EConnectState eConnectState) override
|
||||
{
|
||||
switch (eConnectStatus)
|
||||
switch (eConnectState)
|
||||
{
|
||||
case sdv::ipc::EConnectStatus::disconnected:
|
||||
case sdv::ipc::EConnectStatus::disconnected_forced:
|
||||
case sdv::ipc::EConnectStatus::connection_error:
|
||||
case sdv::ipc::EConnectStatus::communication_error:
|
||||
case sdv::ipc::EConnectState::disconnected:
|
||||
case sdv::ipc::EConnectState::disconnected_forced:
|
||||
case sdv::ipc::EConnectState::connection_error:
|
||||
case sdv::ipc::EConnectState::communication_error:
|
||||
{
|
||||
auto pRequestShutdown = sdv::core::GetObject<sdv::app::IAppShutdownRequest>("AppControlService");
|
||||
if (!pRequestShutdown) break;
|
||||
@@ -237,13 +237,13 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
|
||||
return APP_CONTROL_INVALID_ISOLATION_CONFIG;
|
||||
}
|
||||
SConnectEventCallbackWrapper sConnectEventWrapper;
|
||||
uint64_t uiCookie = pConnect->RegisterStatusEventCallback(&sConnectEventWrapper);
|
||||
uint64_t uiCookie = pConnect->RegisterStateEventCallback(&sConnectEventWrapper);
|
||||
|
||||
// Connect to the core repository
|
||||
sdv::com::IConnectionControl* pConnectionControl = sdv::core::GetObject<sdv::com::IConnectionControl>("CommunicationControl");
|
||||
if (!pConnectionControl)
|
||||
{
|
||||
pConnect->UnregisterStatusEventCallback(uiCookie);
|
||||
pConnect->UnregisterStateEventCallback(uiCookie);
|
||||
if (!bSilent)
|
||||
std::cerr << "ERROR: " << COMMUNICATION_CONTROL_SERVICE_ACCESS_ERROR_MSG << std::endl;
|
||||
return COMMUNICATION_CONTROL_SERVICE_ACCESS_ERROR;
|
||||
@@ -252,7 +252,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
|
||||
sdv::com::TConnectionID tConnection = pConnectionControl->AssignClientEndpoint(ptrChannelEndpoint, 3000, pCoreRepo);
|
||||
if (!tConnection.uiControl || !pCoreRepo)
|
||||
{
|
||||
pConnect->UnregisterStatusEventCallback(uiCookie);
|
||||
pConnect->UnregisterStateEventCallback(uiCookie);
|
||||
if (!bSilent)
|
||||
std::cerr << "ERROR: " << CONNECT_SDV_SERVER_ERROR_MSG << std::endl;
|
||||
return CONNECT_SDV_SERVER_ERROR;
|
||||
@@ -262,7 +262,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
|
||||
sdv::core::ILinkCoreRepository* pLinkCoreRepo = sdv::core::GetObject<sdv::core::ILinkCoreRepository>("RepositoryService");
|
||||
if (!pLinkCoreRepo)
|
||||
{
|
||||
pConnect->UnregisterStatusEventCallback(uiCookie);
|
||||
pConnect->UnregisterStateEventCallback(uiCookie);
|
||||
if (!bSilent)
|
||||
std::cerr << "ERROR: " << LINK_REPO_SERVICE_ERROR_MSG << std::endl;
|
||||
return LINK_REPO_SERVICE_ERROR;
|
||||
@@ -281,7 +281,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
|
||||
sdv::core::IRepositoryUtilityCreate* pCreateUtility = sdv::core::GetObject<sdv::core::IRepositoryUtilityCreate>("RepositoryService");
|
||||
if (!pRepositoryInfo || !pRepositoryControl || !pObjectAccess || !pCreateUtility)
|
||||
{
|
||||
pConnect->UnregisterStatusEventCallback(uiCookie);
|
||||
pConnect->UnregisterStateEventCallback(uiCookie);
|
||||
if (!bSilent)
|
||||
std::cerr << "ERROR: " << REPOSITORY_SERVICE_ACCESS_ERROR_MSG << std::endl;
|
||||
return REPOSITORY_SERVICE_ACCESS_ERROR;
|
||||
@@ -356,7 +356,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
|
||||
}
|
||||
|
||||
// Shutdwown
|
||||
pConnect->UnregisterStatusEventCallback(uiCookie);
|
||||
pConnect->UnregisterStateEventCallback(uiCookie);
|
||||
parser.Clear();
|
||||
pLinkCoreRepo->UnlinkCoreRepository();
|
||||
appcontrol.Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user