mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-07-02 05:35:11 +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 "simulationtasktimer.h"
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
@@ -44,7 +57,7 @@ void CSimulationTimer::SimulationStep(uint64_t uiSimulationStep)
|
||||
//#ifdef _WIN32
|
||||
//void CSimulationTimer::ExecuteCallback()
|
||||
//{
|
||||
// if (m_rtimersvc.GetStatus() != sdv::EObjectStatus::running) return;
|
||||
// if (m_rtimersvc.GetObjectState() != sdv::EObjectState::running) return;
|
||||
// if (!m_pExecute) return;
|
||||
// if (!m_bPrioritySet)
|
||||
// SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
@@ -62,52 +75,27 @@ CSimulationTaskTimerService::~CSimulationTaskTimerService()
|
||||
{
|
||||
}
|
||||
|
||||
void CSimulationTaskTimerService::Initialize(/*in*/ const sdv::u8string& /*ssObjectConfig*/)
|
||||
bool CSimulationTaskTimerService::OnInitialize()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
m_eObjectStatus = sdv::EObjectStatus::initializing;
|
||||
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
||||
|
||||
// set up time resolution and maybe some other things
|
||||
timeBeginPeriod(1);
|
||||
#endif
|
||||
m_eObjectStatus = sdv::EObjectStatus::initialized;
|
||||
return true;
|
||||
}
|
||||
|
||||
sdv::EObjectStatus CSimulationTaskTimerService::GetStatus() const
|
||||
{
|
||||
return m_eObjectStatus;
|
||||
}
|
||||
|
||||
void CSimulationTaskTimerService::SetOperationMode(/*in*/ 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 CSimulationTaskTimerService::Shutdown()
|
||||
void CSimulationTaskTimerService::OnShutdown()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
m_eObjectStatus = sdv::EObjectStatus::shutdown_in_progress;
|
||||
timeEndPeriod(1);
|
||||
#endif
|
||||
m_eObjectStatus = sdv::EObjectStatus::destruction_pending;
|
||||
}
|
||||
|
||||
sdv::IInterfaceAccess* CSimulationTaskTimerService::CreateTimer(uint32_t uiPeriod, sdv::IInterfaceAccess* pTask)
|
||||
{
|
||||
if (m_eObjectStatus != sdv::EObjectStatus::configuring) return nullptr;
|
||||
if (GetObjectState() != sdv::EObjectState::configuring) return nullptr;
|
||||
if (!uiPeriod) return nullptr;
|
||||
if (!pTask) return nullptr;
|
||||
sdv::core::ITaskExecute* pExecute = pTask->GetInterface<sdv::core::ITaskExecute>();
|
||||
|
||||
Reference in New Issue
Block a user