103 lines
2.2 KiB
C++
Executable File
103 lines
2.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Custom avm functions
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Baeuerle, SLSE, 2017-07-25
|
|
*/
|
|
|
|
#include "avm_dtc_impl_custom.h"
|
|
#include <DDS/DTC/generic_dtc.h>
|
|
#include <DDS/Generic/generic_data_reader.h>
|
|
|
|
using namespace AudioVideoManagement;
|
|
using namespace Interface;
|
|
|
|
DtcImplCustom::DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
|
|
: DtcImpl(ddsConnector)
|
|
{
|
|
|
|
}
|
|
|
|
bool DtcImplCustom::isFreeVideoTeam(int exerciseId, int videoTeamId)
|
|
{
|
|
if (!m_dtcVideoTeam)
|
|
{
|
|
ERROR_LOG(m_logger) << "Error retrieving data topic VideoTeam";
|
|
return false;
|
|
}
|
|
|
|
for (const auto &sample : m_dtcVideoTeam->readAlive())
|
|
{
|
|
if (sample.data().id() == videoTeamId &&
|
|
(sample.data().exerciseId() == exerciseId ||
|
|
sample.data().exerciseId() != 0) )
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool DtcImplCustom::getActiveFrequencyPlanningIdForExercise(int exerciseId, int &frequencyPlanningId)
|
|
{
|
|
if (!m_dtcActiveFrequencyPlanning)
|
|
{
|
|
ERROR_LOG(m_logger) << "Error retrieving data topic ActiveFrequencyPlanning";
|
|
return false;
|
|
}
|
|
|
|
for (const auto &sample : m_dtcActiveFrequencyPlanning->readAlive())
|
|
{
|
|
if (sample.data().exerciseId() == exerciseId)
|
|
{
|
|
frequencyPlanningId = sample.data().frequencyPlanningId();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
frequencyPlanningId = -1;
|
|
return false;
|
|
}
|
|
|
|
|
|
bool DtcImplCustom::mountingPointForStreamName(const QString &streamName, int &mountingPointId)
|
|
{
|
|
mountingPointId = 0;
|
|
|
|
if (!m_dtcStreamName)
|
|
{
|
|
ERROR_LOG(m_logger) << "Error retrieving data topic StreamName";
|
|
return false;
|
|
}
|
|
|
|
const std::string streamNameStd = streamName.toStdString();
|
|
for (const auto &sample : m_dtcStreamName->readAlive())
|
|
{
|
|
if (sample.data().internalName() == streamNameStd)
|
|
{
|
|
mountingPointId = sample.data().mountingPointId();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
int DtcImplCustom::getActiveVideoReceiver(int teamId)
|
|
{
|
|
if (!m_dtcVideoReceiver)
|
|
{
|
|
ERROR_LOG(m_logger) << "Error retrieving data topic VideoReceiver";
|
|
return false;
|
|
}
|
|
|
|
for (const auto &sample : m_dtcVideoReceiver->readAlive())
|
|
{
|
|
if (sample.data().teamId() == teamId && sample.data().isActive() )
|
|
return sample.data().id();
|
|
}
|
|
|
|
return 0;
|
|
}
|