mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-21 11:38:16 +00:00
Update sdv_packager (#6)
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Verhoeven - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#include "process_control.h"
|
||||
#include "../../global/base64.h"
|
||||
#include "../../global/exec_dir_helper.h"
|
||||
@@ -43,50 +56,22 @@ CProcessControl::~CProcessControl()
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void CProcessControl::Initialize(const sdv::u8string& /*ssObjectConfig*/)
|
||||
bool CProcessControl::OnInitialize()
|
||||
{
|
||||
if (m_eObjectStatus != sdv::EObjectStatus::initialization_pending) return;
|
||||
|
||||
// Without monitor no trigger...
|
||||
m_threadMonitor = std::thread(&CProcessControl::MonitorThread, this);
|
||||
|
||||
m_eObjectStatus = sdv::EObjectStatus::initialized;
|
||||
return true;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CProcessControl::GetStatus() const
|
||||
{
|
||||
return m_eObjectStatus;
|
||||
}
|
||||
|
||||
void CProcessControl::SetOperationMode(sdv::EOperationMode eMode)
|
||||
{
|
||||
switch (eMode)
|
||||
{
|
||||
case sdv::EOperationMode::configuring:
|
||||
if (m_eObjectStatus == sdv::EObjectStatus::running || m_eObjectStatus == sdv::EObjectStatus::initialized)
|
||||
m_eObjectStatus = sdv::EObjectStatus::configuring;
|
||||
break;
|
||||
case sdv::EOperationMode::running:
|
||||
if (m_eObjectStatus == sdv::EObjectStatus::configuring || m_eObjectStatus == sdv::EObjectStatus::initialized)
|
||||
m_eObjectStatus = sdv::EObjectStatus::running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CProcessControl::Shutdown()
|
||||
void CProcessControl::OnShutdown()
|
||||
{
|
||||
// TODO: Close process handles
|
||||
if (m_eObjectStatus == sdv::EObjectStatus::destruction_pending) return;
|
||||
m_eObjectStatus = sdv::EObjectStatus::shutdown_in_progress;
|
||||
|
||||
// Shutdown the monitor
|
||||
m_bShutdown = true;
|
||||
if (m_threadMonitor.joinable())
|
||||
m_threadMonitor.join();
|
||||
|
||||
m_eObjectStatus = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
bool CProcessControl::AllowProcessControl() const
|
||||
|
||||
Reference in New Issue
Block a user