Trim mostly-deletion changes (~700 lines) across the modules the Release 2 build compiles: unused telegrams and receiver/handler code in TrainingAreaBase (telegrams, recv_from_dds_aes/fts, ism/main/pdm/position handlers), dead members in SqlBrowser and ProjectDataManagement, unused LtsPluginManager loader paths, LtsSession unit-test, WlsTetra and DdsView cleanups, plus the stale include_directories removal in Lts/CMakeLists.txt. Continues the Release 2 source prune (keep only what the build compiles). Excluded from this commit by design: the machine-specific .envrc (MIGRATE_PIPELINE_ROOT path fix stays uncommitted) and the untracked qt5-before/ reference tree.
68 lines
1.8 KiB
C++
Executable File
68 lines
1.8 KiB
C++
Executable File
#include "exm_handler.h"
|
|
#include "main_handler.h"
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
namespace TrainingAreaBase
|
|
{
|
|
|
|
ExmHandler::ExmHandler(MainHandler *mainHandler)
|
|
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
|
, m_mainHandler(mainHandler)
|
|
{}
|
|
|
|
bool ExmHandler::init()
|
|
{
|
|
m_exmDtc = ExerciseManagement::Interface::Dtc::create(m_mainHandler->ddsHandler()->ddsConnector());
|
|
connect(m_exmDtc.get(), &ExerciseManagement::Interface::Dtc::exerciseChanged,
|
|
this, &ExmHandler::onExerciseChanged);
|
|
connect(m_exmDtc.get(), &ExerciseManagement::Interface::Dtc::exerciseChanged,
|
|
this, &ExmHandler::exerciseChanged);
|
|
if (!m_exmDtc->enableExercise())
|
|
{
|
|
ERROR_LOG(m_logger) << "Can not read equipment/exercise mappings from PPM";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
ExerciseManagement::Exercise ExmHandler::exercise(int exerciseId)
|
|
{
|
|
m_exmDtc->waitForHistoricalDataExercise(10 * 1000);
|
|
return m_exmDtc->exercise(exerciseId);
|
|
}
|
|
|
|
void ExmHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
|
|
{
|
|
if (!data.radioGroupId.has_value() || data.radioGroupId.get() == 0)
|
|
modType = DataModification::eRemoved;
|
|
|
|
bool bExercise2RadioGroupChanged = false;
|
|
switch (modType)
|
|
{
|
|
case DataModification::eAdded:
|
|
case DataModification::eModified:
|
|
{
|
|
auto &val = m_exercise2RadioGroup[data.id];
|
|
if (val != data.radioGroupId.get())
|
|
{
|
|
bExercise2RadioGroupChanged = true;
|
|
val = data.radioGroupId.get();
|
|
}
|
|
break;
|
|
}
|
|
case DataModification::eRemoved:
|
|
{
|
|
auto it = m_exercise2RadioGroup.find(data.id);
|
|
if (it != m_exercise2RadioGroup.end())
|
|
{
|
|
bExercise2RadioGroupChanged = true;
|
|
m_exercise2RadioGroup.erase(it);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (bExercise2RadioGroupChanged)
|
|
emit exercise2RadioGroupChanged();
|
|
}
|
|
}
|