Migrates residual Lts sources to generated rtiddsgen API
Adds NmeaManagement tests, fixes codegen includes and Qt6 SerialPort CMake target.
This commit is contained in:
1 parent
5485a90385
commit
881d44f4dd
512 files changed
+6887
-6426
No files matched your search
+2
-2
@@ -49,7 +49,7 @@ public:
|
||||
const Streams &findStreams(Asset *asset) override
|
||||
{
|
||||
Q_ASSERT(asset);
|
||||
return findStreams(asset->data().id());
|
||||
return findStreams(asset->data().id);
|
||||
}
|
||||
|
||||
void insert(Streams &streams) override
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
void remove(Asset *asset) override
|
||||
{
|
||||
Q_ASSERT(asset);
|
||||
auto found = m_cache.find(asset->data().id());
|
||||
auto found = m_cache.find(asset->data().id);
|
||||
Q_ASSERT(found != m_cache.end());
|
||||
const Streams &streams = found->second;
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace
|
||||
|
||||
bool isRadioStation(const InfrastructureManagement::MainStructureElement &mse)
|
||||
{
|
||||
return mse.structureElementTypeId() == InfrastructureManagement::StructureElementType::RadioStation;
|
||||
return mse.structureElementTypeId == InfrastructureManagement::StructureElementType::RadioStation;
|
||||
}
|
||||
|
||||
QString hostnameForRadioStation(const InfrastructureManagement::MainStructureElement &mse)
|
||||
{
|
||||
LtsUtils::JsonObject properties = LtsUtils::JsonObject::fromJson(mse.properties());
|
||||
LtsUtils::JsonObject properties = LtsUtils::JsonObject::fromJson(mse.properties);
|
||||
return properties.valueOr("hostname", QString());
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ CnrChannel toDds(const Database::AvmCnrChannel &channel)
|
||||
channel.ssrc,
|
||||
channel.addacChannel,
|
||||
channel.pttControl,
|
||||
static_cast<FrequencyBand::inner_enum>(channel.frequencyBand));
|
||||
static_cast<FrequencyBand>(channel.frequencyBand));
|
||||
}
|
||||
|
||||
ModifyCnrConfigRequest toRequest(const Database::AvmCnrConfig &dbData, const boost::optional<int32_t> &requestId = boost::none)
|
||||
@@ -72,28 +72,28 @@ ModifyCnrConfigRequest toRequest(const Database::AvmCnrConfig &dbData, const boo
|
||||
|
||||
ModifyCnrConfigRequest toRequest(const CnrConfig &cnrConfig)
|
||||
{
|
||||
return ModifyCnrConfigRequest(cnrConfig.id(),
|
||||
cnrConfig.cnrChannelId(),
|
||||
cnrConfig.exerciseId(),
|
||||
cnrConfig.radioCircuit(),
|
||||
cnrConfig.recording(),
|
||||
cnrConfig.unitId(),
|
||||
cnrConfig.partyId(),
|
||||
cnrConfig.callSign());
|
||||
return ModifyCnrConfigRequest(cnrConfig.id,
|
||||
cnrConfig.cnrChannelId,
|
||||
cnrConfig.exerciseId,
|
||||
cnrConfig.radioCircuit,
|
||||
cnrConfig.recording,
|
||||
cnrConfig.unitId,
|
||||
cnrConfig.partyId,
|
||||
cnrConfig.callSign);
|
||||
}
|
||||
|
||||
Database::AvmCnrConfig toDb(const ModifyCnrConfigRequest &config)
|
||||
{
|
||||
Database::AvmCnrConfig result;
|
||||
|
||||
result.id = config.id();
|
||||
result.cnrChannelId = config.cnrChannelId();
|
||||
result.radioCircuit = QString::fromStdString(config.radioCircuit());
|
||||
result.callSign = QString::fromStdString(config.callSign());
|
||||
result.partyId = config.partyId();
|
||||
result.id = config.id;
|
||||
result.cnrChannelId = config.cnrChannelId;
|
||||
result.radioCircuit = QString::fromStdString(config.radioCircuit);
|
||||
result.callSign = QString::fromStdString(config.callSign);
|
||||
result.partyId = config.partyId;
|
||||
if (config.unitId.is_set())
|
||||
result.unitId = config.unitId.get();
|
||||
result.recording = config.recording();
|
||||
result.recording = config.recording;
|
||||
if (config.exerciseId.is_set())
|
||||
result.exerciseId = config.exerciseId.get();
|
||||
|
||||
@@ -120,22 +120,22 @@ public:
|
||||
|
||||
void create(const CnrConfig &config)
|
||||
{
|
||||
Q_ASSERT(!m_cache.contains(config.id()));
|
||||
Q_ASSERT(!m_cache.contains(config.id));
|
||||
|
||||
Database::AvmDeviceConfig deviceConfig = m_handler->toDeviceConfig(config);
|
||||
bool status = m_db->insert(deviceConfig);
|
||||
if (!status)
|
||||
ERROR_LOG(m_logger) << "Error while inserting device config";
|
||||
|
||||
m_cache.insert(config.id(), deviceConfig);
|
||||
m_cache.insert(config.id, deviceConfig);
|
||||
emit m_handler->avDbReloadNeeded();
|
||||
}
|
||||
|
||||
void update(const CnrConfig &config)
|
||||
{
|
||||
Q_ASSERT(m_cache.contains(config.id()));
|
||||
Q_ASSERT(m_cache.contains(config.id));
|
||||
|
||||
Database::AvmDeviceConfig oldDeviceConfig = m_cache.value(config.id());
|
||||
Database::AvmDeviceConfig oldDeviceConfig = m_cache.value(config.id);
|
||||
Database::AvmDeviceConfig newDeviceConfig = m_handler->toDeviceConfig(config);
|
||||
|
||||
newDeviceConfig.id = oldDeviceConfig.id;
|
||||
@@ -143,13 +143,13 @@ public:
|
||||
if (!status)
|
||||
ERROR_LOG(m_logger) << "Error while updating device config";
|
||||
|
||||
m_cache[config.id()] = newDeviceConfig;
|
||||
m_cache[config.id] = newDeviceConfig;
|
||||
emit m_handler->avDbReloadNeeded();
|
||||
}
|
||||
|
||||
void createOrUpdate(const CnrConfig &config)
|
||||
{
|
||||
if (m_cache.contains(config.id()))
|
||||
if (m_cache.contains(config.id))
|
||||
update(config);
|
||||
else
|
||||
create(config);
|
||||
@@ -283,7 +283,7 @@ void CnrHandler::onRemoveCnrConfigRequest(const rti::core::SampleIdentity &cooki
|
||||
void CnrHandler::onModifyCnrConfigRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ModifyCnrConfigRequest &request)
|
||||
{
|
||||
auto ret = (request.id() < 1 ? createCnrConfig(request) : modifyCnrConfig(request));
|
||||
auto ret = (request.id < 1 ? createCnrConfig(request) : modifyCnrConfig(request));
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_fts->modifyCnrConfigReply(cookie, ret);
|
||||
@@ -365,10 +365,10 @@ void CnrHandler::onRadioStationChanged(const InfrastructureManagement::MainStruc
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
onRadioStationAdded(data.id(), QString::fromStdString(data.name()), hostnameForRadioStation(data));
|
||||
onRadioStationAdded(data.id, QString::fromStdString(data.name), hostnameForRadioStation(data));
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
onRadioStationRemoved(data.id());
|
||||
onRadioStationRemoved(data.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void CnrHandler::updateDeviceConfig()
|
||||
DBTransaction trans(m_db->database());
|
||||
|
||||
for (const auto &config : qAsConst(m_cache))
|
||||
if (config.isActive())
|
||||
if (config.isActive)
|
||||
m_deviceConfig->update(config);
|
||||
|
||||
trans.commit();
|
||||
@@ -419,7 +419,7 @@ CnrConfig CnrHandler::toDds(const Database::AvmCnrConfig &config) const
|
||||
false);
|
||||
|
||||
if (needDeviceConfig(cnrConfig))
|
||||
cnrConfig.isActive(true);
|
||||
cnrConfig.isActive = true;
|
||||
|
||||
return cnrConfig;
|
||||
}
|
||||
@@ -429,11 +429,11 @@ Database::AvmDeviceConfig CnrHandler::toDeviceConfig(const CnrConfig &cnrConfig)
|
||||
static const QString recordingServer = QStringLiteral("EXCAVS01");
|
||||
|
||||
Database::AvmDeviceConfig deviceConfig;
|
||||
const Database::AvmCnrChannel channel = channelById(cnrConfig.cnrChannelId());
|
||||
const Database::AvmCnrChannel channel = channelById(cnrConfig.cnrChannelId);
|
||||
deviceConfig.id = 0;
|
||||
deviceConfig.context = exerciseList(cnrConfig);
|
||||
deviceConfig.type = channel.addacChannel == 0 ? QStringLiteral("CNR_GUEZ_RT_CHANNEL") : QStringLiteral("ADDAC_RT_CHANNEL");
|
||||
deviceConfig.name = QString::fromStdString(cnrConfig.radioCircuit());
|
||||
deviceConfig.name = QString::fromStdString(cnrConfig.radioCircuit);
|
||||
deviceConfig.controller = stationList(channel.addacChannel);
|
||||
deviceConfig.definition = QStringLiteral("mode=1;ssrc=%1").arg(channel.ssrc);
|
||||
//for UAE we need pttc controll to!
|
||||
@@ -443,7 +443,7 @@ Database::AvmDeviceConfig CnrHandler::toDeviceConfig(const CnrConfig &cnrConfig)
|
||||
#endif
|
||||
if (channel.addacChannel)
|
||||
deviceConfig.definition += QStringLiteral(";channel=%1").arg(normalizedAddacChannel(channel.addacChannel));
|
||||
if (cnrConfig.recording())
|
||||
if (cnrConfig.recording)
|
||||
deviceConfig.definition.append(QStringLiteral(";recording=ECRS@%1").arg(recordingServer));
|
||||
deviceConfig.link = 0;
|
||||
|
||||
@@ -457,17 +457,17 @@ Core::FunctionReplyObject CnrHandler::validateRequest(const ModifyCnrConfigReque
|
||||
{
|
||||
Core::FunctionReplyObject reply;
|
||||
|
||||
if (request.id() > 0)
|
||||
if (request.id > 0)
|
||||
{
|
||||
reply.setId(request.id());
|
||||
if (!m_cache.contains(request.id()))
|
||||
return reply.setStr(tr_lts("dds", "Could not modify CNR config because id %1 is unknown")).arg(request.id());
|
||||
reply.setId(request.id);
|
||||
if (!m_cache.contains(request.id))
|
||||
return reply.setStr(tr_lts("dds", "Could not modify CNR config because id %1 is unknown")).arg(request.id);
|
||||
}
|
||||
|
||||
if (!isValidChannel(request.cnrChannelId()))
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify CNR config because the channel with id %1 is invalid")).arg(request.cnrChannelId());
|
||||
if (!isValidChannel(request.cnrChannelId))
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify CNR config because the channel with id %1 is invalid")).arg(request.cnrChannelId);
|
||||
|
||||
if (!isStreamNameValid(request.radioCircuit()))
|
||||
if (!isStreamNameValid(request.radioCircuit))
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify CNR config because the circuit name is invalid"));
|
||||
|
||||
if (!isNameUnique(request))
|
||||
@@ -483,7 +483,7 @@ bool CnrHandler::checkConstraint(const std::function<bool (const CnrConfig &)> &
|
||||
{
|
||||
for (const CnrConfig &config : qAsConst(m_cache))
|
||||
{
|
||||
if (excludeId == config.id())
|
||||
if (excludeId == config.id)
|
||||
continue;
|
||||
|
||||
// If both configs are local the constraint must hold if they are in the same exercise
|
||||
@@ -526,31 +526,31 @@ bool CnrHandler::isValidChannel(int64_t channelId) const
|
||||
|
||||
bool CnrHandler::isFreeChannel(const ModifyCnrConfigRequest &request) const
|
||||
{
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId());
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId);
|
||||
|
||||
if (request.id() <= 0)
|
||||
return isFreeChannel(request.cnrChannelId(), exerciseId);
|
||||
return isFreeChannel(request.cnrChannelId(), exerciseId, request.id());
|
||||
if (request.id <= 0)
|
||||
return isFreeChannel(request.cnrChannelId, exerciseId);
|
||||
return isFreeChannel(request.cnrChannelId, exerciseId, request.id);
|
||||
}
|
||||
|
||||
bool CnrHandler::isFreeChannel(int32_t channelId, const boost::optional<int> &exerciseId, const boost::optional<int32_t> &excludeId) const
|
||||
{
|
||||
auto constraint = [&channelId] (const CnrConfig &config) { return config.cnrChannelId() != channelId; };
|
||||
auto constraint = [&channelId] (const CnrConfig &config) { return config.cnrChannelId != channelId; };
|
||||
return checkConstraint(constraint, exerciseId, excludeId);
|
||||
}
|
||||
|
||||
bool CnrHandler::isNameUnique(const ModifyCnrConfigRequest &request)
|
||||
{
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId());
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId);
|
||||
|
||||
if (request.id() <= 0)
|
||||
return isNameUnique(request.radioCircuit(), exerciseId);
|
||||
return isNameUnique(request.radioCircuit(), exerciseId, request.id());
|
||||
if (request.id <= 0)
|
||||
return isNameUnique(request.radioCircuit, exerciseId);
|
||||
return isNameUnique(request.radioCircuit, exerciseId, request.id);
|
||||
}
|
||||
|
||||
bool CnrHandler::isNameUnique(const std::string &name, const boost::optional<int> &exerciseId, const boost::optional<int32_t> &excludeId) const
|
||||
{
|
||||
auto constraint = [&name] (const CnrConfig &config) { return config.radioCircuit() != name; };
|
||||
auto constraint = [&name] (const CnrConfig &config) { return config.radioCircuit != name; };
|
||||
return checkConstraint(constraint, exerciseId, excludeId);
|
||||
}
|
||||
|
||||
@@ -576,10 +576,10 @@ Core::FunctionReplyObject CnrHandler::createCnrConfig(const ModifyCnrConfigReque
|
||||
}
|
||||
|
||||
CnrConfig cnrConfig = toDds(dbConfigData);
|
||||
m_cache.insert(cnrConfig.id(), cnrConfig);
|
||||
m_cache.insert(cnrConfig.id, cnrConfig);
|
||||
m_dts->publish(cnrConfig);
|
||||
|
||||
if (cnrConfig.isActive())
|
||||
if (cnrConfig.isActive)
|
||||
m_deviceConfig->create(cnrConfig);
|
||||
|
||||
return Core::FunctionReplyObject(dbConfigData.id);
|
||||
@@ -593,7 +593,7 @@ Core::FunctionReplyObject CnrHandler::modifyCnrConfig(const ModifyCnrConfigReque
|
||||
if (reply.error())
|
||||
return reply;
|
||||
|
||||
auto found = m_cache.find(request.id());
|
||||
auto found = m_cache.find(request.id);
|
||||
Q_ASSERT(found != m_cache.end());
|
||||
|
||||
const CnrConfig &oldCnrConfig = *found;
|
||||
@@ -604,24 +604,24 @@ Core::FunctionReplyObject CnrHandler::modifyCnrConfig(const ModifyCnrConfigReque
|
||||
// But not every entry from the FrequencySet can be assigned, e.g. a CnrConfig of (channel-)type VHF cannot
|
||||
// be assigned to a FrequencySet-entry of type HF.
|
||||
// Thus changing the CnrChannel would possibly invalidate those assignments in the FrequencyPlanning.
|
||||
if (request.cnrChannelId() != oldCnrConfig.cnrChannelId())
|
||||
if (request.cnrChannelId != oldCnrConfig.cnrChannelId)
|
||||
return reply.setStr(tr_lts("dds", "Changing the CNR channel is not allowed"));
|
||||
|
||||
Database::AvmCnrConfig dbConfigData = toDb(request);
|
||||
CnrConfig newCnrConfig = toDds(dbConfigData);
|
||||
|
||||
if (newCnrConfig.isActive())
|
||||
if (newCnrConfig.isActive)
|
||||
m_deviceConfig->createOrUpdate(newCnrConfig);
|
||||
else
|
||||
m_deviceConfig->tryRemove(newCnrConfig.id());
|
||||
m_deviceConfig->tryRemove(newCnrConfig.id);
|
||||
|
||||
if (newCnrConfig == oldCnrConfig)
|
||||
return reply;
|
||||
|
||||
if (!m_db->update(dbConfigData))
|
||||
return reply.setStr(tr_lts("dds", "Error updating CNR config data with id %1 in database")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "Error updating CNR config data with id %1 in database")).arg(request.id);
|
||||
|
||||
m_cache[newCnrConfig.id()] = newCnrConfig;
|
||||
m_cache[newCnrConfig.id] = newCnrConfig;
|
||||
|
||||
m_dts->publish(newCnrConfig);
|
||||
|
||||
@@ -633,7 +633,7 @@ Core::FunctionReplyObject CnrHandler::removeCnrConfig(const Core::RemoveElementR
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "RemoveCnrConfigRequest: " << request;
|
||||
|
||||
int32_t configId = request.id();
|
||||
int32_t configId = request.id;
|
||||
Core::FunctionReplyObject reply(configId);
|
||||
|
||||
auto found = m_cache.find(configId);
|
||||
@@ -647,7 +647,7 @@ Core::FunctionReplyObject CnrHandler::removeCnrConfig(const Core::RemoveElementR
|
||||
m_dts->removeCnrConfigByKey(configId);
|
||||
|
||||
if (!m_db->removeAvmCnrConfig(configId))
|
||||
return reply.setStr(tr_lts("dds", "Could not remove CNR config data with id %1")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "Could not remove CNR config data with id %1")).arg(request.id);
|
||||
|
||||
emit cnrConfigRemoved(configId);
|
||||
|
||||
@@ -675,7 +675,7 @@ bool CnrHandler::needDeviceConfig(const CnrConfig &config) const
|
||||
return false;
|
||||
|
||||
// Config needs to be referenced. (Wonder if its possible to have a non-referenced one...)
|
||||
if (m_frequencyPlanningHandler->isReferencedByActivePlan(exerciseId, config.id()))
|
||||
if (m_frequencyPlanningHandler->isReferencedByActivePlan(exerciseId, config.id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
+50
-50
@@ -48,18 +48,18 @@ CnrTvcProfile toDds(const Database::AvmCnrTvcProfile &circuitContainerDb, T circ
|
||||
std::sort(circuitsDb.begin(), circuitsDb.end(), lessRadioCircuitsContent);
|
||||
|
||||
CnrTvcProfile circuitContainerDds(circuitContainerDb.id, circuitContainerDb.operatorId, circuitContainerDb.exerciseId, {});
|
||||
circuitContainerDds.data().reserve(circuitsDb.size());
|
||||
circuitContainerDds.data.reserve(circuitsDb.size());
|
||||
for (const auto ¤tCircuitDb : qAsConst(circuitsDb))
|
||||
circuitContainerDds.data().push_back(toDds(currentCircuitDb));
|
||||
circuitContainerDds.data.push_back(toDds(currentCircuitDb));
|
||||
return circuitContainerDds;
|
||||
}
|
||||
|
||||
Database::AvmCnrTvcProfile toDb(const CnrTvcProfile &profileDds)
|
||||
{
|
||||
Database::AvmCnrTvcProfile profileDb;
|
||||
profileDb.id = profileDds.id();
|
||||
profileDb.operatorId = profileDds.operatorId();
|
||||
profileDb.exerciseId = profileDds.exerciseId();
|
||||
profileDb.id = profileDds.id;
|
||||
profileDb.operatorId = profileDds.operatorId;
|
||||
profileDb.exerciseId = profileDds.exerciseId;
|
||||
return profileDb;
|
||||
}
|
||||
|
||||
@@ -69,14 +69,14 @@ Database::AvmCnrTvcProfileData toDb(const CnrTvcProfileData &circuitDds, int32_t
|
||||
circuitDb.containerId = containerId;
|
||||
circuitDb.sortIndex = sortIndex;
|
||||
|
||||
switch (circuitDds.radioSystemId().underlying())
|
||||
switch (circuitDds.radioSystemId)
|
||||
{
|
||||
case RadioSystem::Cnr:
|
||||
circuitDb.cnrConfigId = circuitDds.radioCircuitId();
|
||||
circuitDb.cnrConfigId = circuitDds.radioCircuitId;
|
||||
return circuitDb;
|
||||
|
||||
case RadioSystem::Tvc:
|
||||
circuitDb.tvcConfigId = circuitDds.radioCircuitId();
|
||||
circuitDb.tvcConfigId = circuitDds.radioCircuitId;
|
||||
return circuitDb;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
@@ -225,7 +225,7 @@ void CnrTvcProfileHandler::onModifyCnrTvcProfileRequest(const rti::core::SampleI
|
||||
const CnrTvcProfile &request)
|
||||
{
|
||||
Core::FunctionReplyObject rep;
|
||||
if (request.id() <= 0)
|
||||
if (request.id <= 0)
|
||||
rep = createProfile(request);
|
||||
else
|
||||
rep = modifyProfile(request);
|
||||
@@ -249,7 +249,7 @@ void CnrTvcProfileHandler::onRemoveCnrTvcProfileRequest(const rti::core::SampleI
|
||||
|
||||
Core::FunctionReplyObject CnrTvcProfileHandler::createProfile(const CnrTvcProfile &createRequest)
|
||||
{
|
||||
Q_ASSERT(createRequest.id() <= 0);
|
||||
Q_ASSERT(createRequest.id <= 0);
|
||||
|
||||
Core::FunctionReplyObject reply = validateRequest(createRequest);
|
||||
if (reply.error())
|
||||
@@ -263,7 +263,7 @@ Core::FunctionReplyObject CnrTvcProfileHandler::createProfile(const CnrTvcProfil
|
||||
return reply.setStr(tr_lts("dds", "Failed to insert into 'avm.avm_cnr_tvc_profile'"));
|
||||
reply.setId(dbEntry.id);
|
||||
|
||||
const auto circuitDataDb = insert(createRequest.data(), dbEntry.id, status);
|
||||
const auto circuitDataDb = insert(createRequest.data, dbEntry.id, status);
|
||||
if (!status)
|
||||
return reply.setStr(tr_lts("dds", "Failed to insert into 'avm.avm_cnr_tvc_profile_data'"));
|
||||
|
||||
@@ -277,7 +277,7 @@ Core::FunctionReplyObject CnrTvcProfileHandler::createProfile(const CnrTvcProfil
|
||||
|
||||
Core::FunctionReplyObject CnrTvcProfileHandler::modifyProfile(const CnrTvcProfile &modifyRequest)
|
||||
{
|
||||
Q_ASSERT(modifyRequest.id() > 0);
|
||||
Q_ASSERT(modifyRequest.id > 0);
|
||||
|
||||
Core::FunctionReplyObject reply = validateRequest(modifyRequest);
|
||||
if (reply.error())
|
||||
@@ -288,13 +288,13 @@ Core::FunctionReplyObject CnrTvcProfileHandler::modifyProfile(const CnrTvcProfil
|
||||
|
||||
bool status = m_db->update(dbEntry);
|
||||
if (!status)
|
||||
return reply.setStr(tr_lts("dds", "Failed to update 'avm.avm_cnr_tvc_profile' data with id %1")).arg(modifyRequest.id());
|
||||
return reply.setStr(tr_lts("dds", "Failed to update 'avm.avm_cnr_tvc_profile' data with id %1")).arg(modifyRequest.id);
|
||||
|
||||
status = m_db->removeAvmCnrTvcProfileDataByContainerId(modifyRequest.id());
|
||||
status = m_db->removeAvmCnrTvcProfileDataByContainerId(modifyRequest.id);
|
||||
if (!status)
|
||||
return reply.setStr(tr_lts("dds", "Failed to remove from 'avm.avm_cnr_tvc_profile_data' with container_id %1")).arg(modifyRequest.id());
|
||||
return reply.setStr(tr_lts("dds", "Failed to remove from 'avm.avm_cnr_tvc_profile_data' with container_id %1")).arg(modifyRequest.id);
|
||||
|
||||
insert(modifyRequest.data(), modifyRequest.id(), status);
|
||||
insert(modifyRequest.data, modifyRequest.id, status);
|
||||
if (!status)
|
||||
return reply.setStr(tr_lts("dds", "Failed to insert into 'avm.avm_cnr_tvc_profile_data'"));
|
||||
|
||||
@@ -312,16 +312,16 @@ Core::FunctionReplyObject CnrTvcProfileHandler::removeProfile(const Core::Remove
|
||||
|
||||
DBTransaction dbTransaction(m_db->database());
|
||||
|
||||
bool status = m_db->removeAvmCnrTvcProfileDataByContainerId(request.id());
|
||||
bool status = m_db->removeAvmCnrTvcProfileDataByContainerId(request.id);
|
||||
if (!status)
|
||||
return reply.setStr(tr_lts("dds", "Failed to remove from 'avm.avm_cnr_tvc_profile_data' with container_id %1")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "Failed to remove from 'avm.avm_cnr_tvc_profile_data' with container_id %1")).arg(request.id);
|
||||
|
||||
status = m_db->removeAvmCnrTvcProfile(request.id());
|
||||
status = m_db->removeAvmCnrTvcProfile(request.id);
|
||||
if (!status)
|
||||
return reply.setStr(tr_lts("dds", "Failed to remove from 'avm.avm_cnr_tvc_profile' with id %1")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "Failed to remove from 'avm.avm_cnr_tvc_profile' with id %1")).arg(request.id);
|
||||
|
||||
dbTransaction.commit();
|
||||
removeProfile(request.id());
|
||||
removeProfile(request.id);
|
||||
|
||||
return reply;
|
||||
}
|
||||
@@ -350,18 +350,18 @@ std::vector<Database::AvmCnrTvcProfileData> CnrTvcProfileHandler::insert(const s
|
||||
|
||||
void CnrTvcProfileHandler::addProfile(const CnrTvcProfile &profile)
|
||||
{
|
||||
Q_ASSERT(profile.id() > 0);
|
||||
Q_ASSERT(!m_cache.contains(profile.id()));
|
||||
Q_ASSERT(profile.id > 0);
|
||||
Q_ASSERT(!m_cache.contains(profile.id));
|
||||
|
||||
OperatorExerciseKey key(profile);
|
||||
Q_ASSERT(!m_uniqueKeys.contains(key));
|
||||
|
||||
m_cache[profile.id()] = profile;
|
||||
m_cache[profile.id] = profile;
|
||||
m_uniqueKeys.append(key);
|
||||
|
||||
bool status = m_dts->publish(profile);
|
||||
if (!status)
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'CnrTvcProfile' data with id %1 (create)").arg(profile.id());
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'CnrTvcProfile' data with id %1 (create)").arg(profile.id);
|
||||
}
|
||||
|
||||
void CnrTvcProfileHandler::removeProfile(int64_t id)
|
||||
@@ -380,30 +380,30 @@ void CnrTvcProfileHandler::removeProfile(int64_t id)
|
||||
|
||||
void CnrTvcProfileHandler::updateProfile(const CnrTvcProfile &profile)
|
||||
{
|
||||
Q_ASSERT(profile.id() > 0);
|
||||
Q_ASSERT(m_cache.contains(profile.id()));
|
||||
Q_ASSERT(profile.id > 0);
|
||||
Q_ASSERT(m_cache.contains(profile.id));
|
||||
|
||||
OperatorExerciseKey key(profile);
|
||||
Q_ASSERT(m_uniqueKeys.contains(key));
|
||||
|
||||
if (m_cache[profile.id()] == profile)
|
||||
if (m_cache[profile.id] == profile)
|
||||
return;
|
||||
|
||||
m_cache[profile.id()] = profile;
|
||||
m_cache[profile.id] = profile;
|
||||
|
||||
bool status = m_dts->publish(profile);
|
||||
if (!status)
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'CnrTvcProfile' data with id %1 (modify)").arg(profile.id());
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'CnrTvcProfile' data with id %1 (modify)").arg(profile.id);
|
||||
}
|
||||
|
||||
void CnrTvcProfileHandler::onCnrConfigChanged(const CnrConfig &cnrConfig)
|
||||
{
|
||||
onConfigChanged(cnrConfig.id(), RadioSystem::Cnr);
|
||||
onConfigChanged(cnrConfig.id, RadioSystem::Cnr);
|
||||
}
|
||||
|
||||
void CnrTvcProfileHandler::onTvcConfigChanged(const TvcConfig &tvcConfig)
|
||||
{
|
||||
onConfigChanged(tvcConfig.id(), RadioSystem::Tvc);
|
||||
onConfigChanged(tvcConfig.id, RadioSystem::Tvc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,38 +461,38 @@ Core::FunctionReplyObject CnrTvcProfileHandler::validateRequest(const CnrTvcProf
|
||||
{
|
||||
Core::FunctionReplyObject reply;
|
||||
|
||||
if (request.id() > 0)
|
||||
if (request.id > 0)
|
||||
{
|
||||
// modify
|
||||
reply.setId(request.id());
|
||||
reply.setId(request.id);
|
||||
|
||||
if (!m_cache.contains(request.id()))
|
||||
return reply.setStr(tr_lts("dds", "CnrTvcProfile for operator %1 in exercise %2 does not exist")).arg(request.operatorId()).arg(request.exerciseId());
|
||||
if (!m_cache.contains(request.id))
|
||||
return reply.setStr(tr_lts("dds", "CnrTvcProfile for operator %1 in exercise %2 does not exist")).arg(request.operatorId).arg(request.exerciseId);
|
||||
|
||||
if (OperatorExerciseKey(m_cache.value(request.id())) != OperatorExerciseKey(request))
|
||||
if (OperatorExerciseKey(m_cache.value(request.id)) != OperatorExerciseKey(request))
|
||||
return reply.setStr(tr_lts("dds", "operator or exercise may not be changed"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// create
|
||||
if (m_uniqueKeys.contains(OperatorExerciseKey(request)))
|
||||
return reply.setStr(tr_lts("dds", "CnrTvcProfile for operator %1 already exists in exercise %2")).arg(request.operatorId()).arg(request.exerciseId());
|
||||
return reply.setStr(tr_lts("dds", "CnrTvcProfile for operator %1 already exists in exercise %2")).arg(request.operatorId).arg(request.exerciseId);
|
||||
}
|
||||
|
||||
if (request.data().size() == 0)
|
||||
if (request.data.size() == 0)
|
||||
return reply.setStr(tr_lts("dds", "CnrTvcProfile must not be empty"));
|
||||
|
||||
for (const auto &entry : request.data())
|
||||
for (const auto &entry : request.data)
|
||||
{
|
||||
if (entry.radioSystemId() == RadioSystem::Tvc)
|
||||
if (entry.radioSystemId == RadioSystem::Tvc)
|
||||
{
|
||||
auto reply2 = isValidTvc(entry.radioCircuitId(), request.exerciseId(), request.id());
|
||||
auto reply2 = isValidTvc(entry.radioCircuitId, request.exerciseId, request.id);
|
||||
if (reply2.error())
|
||||
return reply2;
|
||||
}
|
||||
else if (entry.radioSystemId() == RadioSystem::Cnr)
|
||||
else if (entry.radioSystemId == RadioSystem::Cnr)
|
||||
{
|
||||
auto reply2 = isValidCnr(entry.radioCircuitId(), request.exerciseId(), request.id());
|
||||
auto reply2 = isValidCnr(entry.radioCircuitId, request.exerciseId, request.id);
|
||||
if (reply2.error())
|
||||
return reply2;
|
||||
}
|
||||
@@ -503,11 +503,11 @@ Core::FunctionReplyObject CnrTvcProfileHandler::validateRequest(const CnrTvcProf
|
||||
|
||||
Core::FunctionReplyObject CnrTvcProfileHandler::validateRequest(const Core::RemoveElementRequest &request) const
|
||||
{
|
||||
Q_ASSERT(request.id() > 0);
|
||||
Core::FunctionReplyObject reply(request.id());
|
||||
Q_ASSERT(request.id > 0);
|
||||
Core::FunctionReplyObject reply(request.id);
|
||||
|
||||
if (!m_cache.contains(request.id()))
|
||||
return reply.setStr(tr_lts("dds", "CnrTvcProfile %1 does not exist")).arg(request.id());
|
||||
if (!m_cache.contains(request.id))
|
||||
return reply.setStr(tr_lts("dds", "CnrTvcProfile %1 does not exist")).arg(request.id);
|
||||
|
||||
return reply;
|
||||
}
|
||||
@@ -571,8 +571,8 @@ void CnrTvcProfileHandler::onConfigChanged(int32_t configId, RadioSystem type)
|
||||
// Find all CnrTvcProfiles where this config is referenced and reload those.
|
||||
// Hint: reloading might modify m_cache. Thus the reloading is done in a separate loop.
|
||||
for (const auto &profile : qAsConst(m_cache))
|
||||
for (const auto &data : profile.data())
|
||||
if (data.radioSystemId() == type && data.radioCircuitId() == configId)
|
||||
for (const auto &data : profile.data)
|
||||
if (data.radioSystemId == type && data.radioCircuitId == configId)
|
||||
{
|
||||
toBeReloaded.append(profile);
|
||||
break;
|
||||
|
||||
+2
-2
@@ -102,8 +102,8 @@ private:
|
||||
{}
|
||||
|
||||
explicit OperatorExerciseKey(const CnrTvcProfile &profile)
|
||||
: operatorId(profile.operatorId())
|
||||
, exerciseId(profile.exerciseId())
|
||||
: operatorId(profile.operatorId)
|
||||
, exerciseId(profile.exerciseId)
|
||||
{}
|
||||
|
||||
qint64 operatorId{0};
|
||||
|
||||
+42
-42
@@ -29,15 +29,15 @@ std::set<int32_t> mountingPointsOfInterest(const InfrastructureManagement::Mai
|
||||
{
|
||||
std::set<int32_t> mountingPoints;
|
||||
|
||||
for (const auto &se : building.elements())
|
||||
for (const auto &se : building.elements)
|
||||
{
|
||||
if (se.structureElementTypeId() != InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
if (se.structureElementTypeId != InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
continue;
|
||||
|
||||
if (se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::AnnouncementUnit ||
|
||||
se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::OutdoorCamera)
|
||||
mountingPoints.insert(se.id());
|
||||
if (se.mountingPointTypeId == InfrastructureManagement::MountingPointType::AnnouncementUnit ||
|
||||
se.mountingPointTypeId == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
se.mountingPointTypeId == InfrastructureManagement::MountingPointType::OutdoorCamera)
|
||||
mountingPoints.insert(se.id);
|
||||
}
|
||||
|
||||
return mountingPoints;
|
||||
@@ -47,7 +47,7 @@ bool isStreamOfInterest(const AudioVideoManagement::Stream &stream, bool isAudio
|
||||
{
|
||||
using AudioVideoManagement::StreamType;
|
||||
|
||||
switch (stream.type().underlying())
|
||||
switch (stream.type)
|
||||
{
|
||||
case StreamType::Video:
|
||||
return !isAudio;
|
||||
@@ -94,7 +94,7 @@ DefaultAvMenus::~DefaultAvMenus() = default;
|
||||
|
||||
void DefaultAvMenus::onStreamChanged(const Stream &stream)
|
||||
{
|
||||
m_streams[stream.id()] = stream;
|
||||
m_streams[stream.id] = stream;
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
@@ -109,20 +109,20 @@ void DefaultAvMenus::onMainStructureElementChanged(const InfrastructureManagemen
|
||||
|
||||
if(modType == DataModification::eRemoved)
|
||||
{
|
||||
m_buildingDisplayNameForId.remove(data.id());
|
||||
m_buildingDisplayNameForId.remove(data.id);
|
||||
m_timer->start();
|
||||
}
|
||||
else if(modType == DataModification::eAdded)
|
||||
{
|
||||
m_buildingDisplayNameForId[data.id()] = buildingDisplayName;
|
||||
m_buildingDisplayNameForId[data.id] = buildingDisplayName;
|
||||
m_timer->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_buildingDisplayNameForId.value(data.id(),buildingDisplayName) == buildingDisplayName)
|
||||
if(m_buildingDisplayNameForId.value(data.id,buildingDisplayName) == buildingDisplayName)
|
||||
return;
|
||||
|
||||
m_buildingDisplayNameForId[data.id()] = buildingDisplayName;
|
||||
m_buildingDisplayNameForId[data.id] = buildingDisplayName;
|
||||
m_timer->start();
|
||||
}
|
||||
}
|
||||
@@ -150,17 +150,17 @@ void DefaultAvMenus::removeMenus()
|
||||
void DefaultAvMenus::updateMenu(bool isAudio)
|
||||
{
|
||||
MenuStruct menu;
|
||||
menu.id(menuStructId(isAudio));
|
||||
menu.isDefault(true);
|
||||
menu.name("Default");
|
||||
menu.isAudio(isAudio);
|
||||
menu.id = menuStructId(isAudio);
|
||||
menu.isDefault = true;
|
||||
menu.name = "Default";
|
||||
menu.isAudio = isAudio;
|
||||
|
||||
std::vector<AvMenuEntry> allEntries;
|
||||
|
||||
const auto &buildings = m_ismDtc->mainStructureElements();
|
||||
for (const auto &building : buildings)
|
||||
{
|
||||
m_buildingDisplayNameForId[building.id()] = getDisplayNameForBuilding(building);
|
||||
m_buildingDisplayNameForId[building.id] = getDisplayNameForBuilding(building);
|
||||
std::vector<AvMenuEntry> subMenu = subMenuForBuilding(building, isAudio);
|
||||
std::move(subMenu.begin(), subMenu.end(), std::back_inserter(allEntries));
|
||||
}
|
||||
@@ -169,24 +169,24 @@ void DefaultAvMenus::updateMenu(bool isAudio)
|
||||
{
|
||||
bool addMenu = false;
|
||||
AvMenuEntry mvsStreams;
|
||||
mvsStreams.id(1000000);
|
||||
mvsStreams.parentId(menuStructId(isAudio));
|
||||
mvsStreams.name().set("MVS");
|
||||
mvsStreams.isGroup(true);
|
||||
mvsStreams.id = 1000000;
|
||||
mvsStreams.parentId = menuStructId(isAudio);
|
||||
mvsStreams.name = "MVS";
|
||||
mvsStreams.isGroup = true;
|
||||
|
||||
const auto &videoTeams = m_videoTeamHandler->videoTeams();
|
||||
for (const auto &videoTeam : videoTeams)
|
||||
{
|
||||
if (videoTeam.exerciseId() != m_context.id())
|
||||
if (videoTeam.exerciseId != m_context.id())
|
||||
continue;
|
||||
addMenu = true;
|
||||
AvMenuEntry streamEntry;
|
||||
streamEntry.id(videoTeam.id());
|
||||
streamEntry.parentId(mvsStreams.id());
|
||||
streamEntry.mountingPointId(-1*videoTeam.id());
|
||||
streamEntry.id = videoTeam.id;
|
||||
streamEntry.parentId = mvsStreams.id;
|
||||
streamEntry.mountingPointId = -1 * videoTeam.id;
|
||||
// Also set the stream name which makes it easier for the clients.
|
||||
streamEntry.name().set(videoTeam.streamName());
|
||||
streamEntry.isGroup(false);
|
||||
streamEntry.name = videoTeam.streamName;
|
||||
streamEntry.isGroup = false;
|
||||
allEntries.push_back(streamEntry);
|
||||
// What about the rowId?
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void DefaultAvMenus::updateMenu(bool isAudio)
|
||||
}
|
||||
}
|
||||
|
||||
menu.menuEntries(allEntries);
|
||||
menu.menuEntries = allEntries;
|
||||
HandlerMenuStruct::sortEntries(menu);
|
||||
|
||||
m_dts->publish(menu);
|
||||
@@ -210,11 +210,11 @@ void DefaultAvMenus::updateMenu(bool isAudio)
|
||||
|
||||
QString DefaultAvMenus::getDisplayNameForBuilding(const InfrastructureManagement::MainStructureElement &data)
|
||||
{
|
||||
for (auto structure : data.elements()) {
|
||||
if(structure.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
|
||||
return QString::fromStdString(structure.displayName());
|
||||
for (auto structure : data.elements) {
|
||||
if(structure.structureElementTypeId == InfrastructureManagement::StructureElementType::Building)
|
||||
return QString::fromStdString(structure.displayName);
|
||||
}
|
||||
return QString::fromStdString(data.name());
|
||||
return QString::fromStdString(data.name);
|
||||
}
|
||||
|
||||
std::vector<AvMenuEntry> DefaultAvMenus::subMenuForBuilding(const InfrastructureManagement::MainStructureElement &building, bool isAudio)
|
||||
@@ -227,10 +227,10 @@ std::vector<AvMenuEntry> DefaultAvMenus::subMenuForBuilding(const Infrastructure
|
||||
entries.reserve(streams.size() + 1);
|
||||
|
||||
AvMenuEntry buildingEntry;
|
||||
buildingEntry.id(building.id());
|
||||
buildingEntry.parentId(menuStructId(isAudio));
|
||||
buildingEntry.name(getDisplayNameForBuilding(building).toStdString());
|
||||
buildingEntry.isGroup(true);
|
||||
buildingEntry.id = building.id;
|
||||
buildingEntry.parentId = menuStructId(isAudio);
|
||||
buildingEntry.name = getDisplayNameForBuilding(building).toStdString();
|
||||
buildingEntry.isGroup = true;
|
||||
// What about the rowId?
|
||||
|
||||
entries.push_back(buildingEntry);
|
||||
@@ -238,12 +238,12 @@ std::vector<AvMenuEntry> DefaultAvMenus::subMenuForBuilding(const Infrastructure
|
||||
for (const auto &stream : streams)
|
||||
{
|
||||
AvMenuEntry streamEntry;
|
||||
streamEntry.id(stream.mountingPointId());
|
||||
streamEntry.parentId(buildingEntry.id());
|
||||
streamEntry.mountingPointId(stream.mountingPointId());
|
||||
streamEntry.id = stream.mountingPointId;
|
||||
streamEntry.parentId = buildingEntry.id;
|
||||
streamEntry.mountingPointId = stream.mountingPointId;
|
||||
// Also set the stream name which makes it easier for the clients.
|
||||
streamEntry.name().set(AudioVideoHandlerImpl::internalStreamName(stream.mountingPointId()).toStdString());
|
||||
streamEntry.isGroup(false);
|
||||
streamEntry.name = AudioVideoHandlerImpl::internalStreamName(stream.mountingPointId).toStdString();
|
||||
streamEntry.isGroup = false;
|
||||
// What about the rowId?
|
||||
|
||||
entries.push_back(streamEntry);
|
||||
@@ -263,7 +263,7 @@ std::vector<Stream> DefaultAvMenus::streamsForBuilding(const InfrastructureManag
|
||||
if (!isStreamOfInterest(stream, isAudio))
|
||||
continue;
|
||||
|
||||
if (!mountingPoints.count(stream.mountingPointId()))
|
||||
if (!mountingPoints.count(stream.mountingPointId))
|
||||
continue;
|
||||
|
||||
streams.push_back(stream);
|
||||
|
||||
+2
-2
@@ -189,7 +189,7 @@ void ExerciseHandler::onLastSeenTimerTimeout()
|
||||
// and remove all device_config entries except the record/replay session
|
||||
// when the cleanup is finished (signal from A/V) we remove also the last two sessions and delete our self
|
||||
auto ex = exmDtc()->exercise(m_exContext.id());
|
||||
if (ex.id() == m_exContext.id())
|
||||
if (ex.id == m_exContext.id())
|
||||
{
|
||||
// found -> update last seen timestamp
|
||||
m_lastSeen.context = m_exContext.toString();
|
||||
@@ -263,7 +263,7 @@ void ExerciseHandler::onContextFilesDeleted(const ExerciseContext &context)
|
||||
|
||||
AVControl::OperatingMode ExerciseHandler::avModeFromExerciseState(ExerciseManagement::ExerciseState state)
|
||||
{
|
||||
switch (state.underlying())
|
||||
switch (state)
|
||||
{
|
||||
case ExerciseManagement::ExerciseState::Unknown:
|
||||
case ExerciseManagement::ExerciseState::Created:
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ void ExercisesHandler::onExerciseChanged(const ExerciseManagement::Exercise &dat
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
exerciseModified(data.id(), data.state());
|
||||
exerciseModified(data.id, data.state);
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
// nothing to do here
|
||||
|
||||
+114
-114
@@ -29,9 +29,9 @@ FrequencyPlanningData toDds(const Database::AvmFrequencyPlanningData &dbEntry)
|
||||
{
|
||||
FrequencyPlanningData ddsEntry;
|
||||
|
||||
ddsEntry.cnrConfigId(dbEntry.cnrConfigId);
|
||||
ddsEntry.frequencyPlanningId(dbEntry.frequencyPlanningId);
|
||||
ddsEntry.properties(dbEntry.properties.toStdString());
|
||||
ddsEntry.cnrConfigId = dbEntry.cnrConfigId;
|
||||
ddsEntry.frequencyPlanningId = dbEntry.frequencyPlanningId;
|
||||
ddsEntry.properties = dbEntry.properties.toStdString();
|
||||
|
||||
return ddsEntry;
|
||||
}
|
||||
@@ -41,14 +41,14 @@ FrequencyPlanning toDds(const Database::AvmFrequencyPlanning &dbPlan,
|
||||
{
|
||||
FrequencyPlanning ddsPlan;
|
||||
|
||||
ddsPlan.id(dbPlan.id);
|
||||
ddsPlan.date(dbPlan.dateOfCreation);
|
||||
ddsPlan.id = dbPlan.id;
|
||||
ddsPlan.date = dbPlan.dateOfCreation;
|
||||
|
||||
if (!dbPlan.exerciseId.isNull())
|
||||
ddsPlan.exerciseId(dbPlan.exerciseId.value<int>());
|
||||
ddsPlan.exerciseId = dbPlan.exerciseId.value<int>();
|
||||
|
||||
ddsPlan.frequencySetId(dbPlan.frequencySetId);
|
||||
ddsPlan.name(dbPlan.name.toStdString());
|
||||
ddsPlan.frequencySetId = dbPlan.frequencySetId;
|
||||
ddsPlan.name = dbPlan.name.toStdString();
|
||||
|
||||
std::vector<FrequencyPlanningData> ddsEntries;
|
||||
ddsEntries.reserve(dbEntries.size());
|
||||
@@ -57,7 +57,7 @@ FrequencyPlanning toDds(const Database::AvmFrequencyPlanning &dbPlan,
|
||||
ddsEntries.push_back(toDds(dbEntry));
|
||||
}
|
||||
|
||||
ddsPlan.data(ddsEntries);
|
||||
ddsPlan.data = ddsEntries;
|
||||
|
||||
return ddsPlan;
|
||||
}
|
||||
@@ -72,12 +72,12 @@ Database::AvmFrequencyPlanning toDb(const ModifyFrequencyPlanningRequest &reques
|
||||
{
|
||||
Database::AvmFrequencyPlanning result;
|
||||
|
||||
result.id = request.id();
|
||||
result.name = QString::fromStdString(request.name());
|
||||
if(request.exerciseId() != 0)
|
||||
result.exerciseId = request.exerciseId();
|
||||
result.dateOfCreation = request.date();
|
||||
result.frequencySetId = request.frequencySetId();
|
||||
result.id = request.id;
|
||||
result.name = QString::fromStdString(request.name);
|
||||
if(request.exerciseId != 0)
|
||||
result.exerciseId = request.exerciseId;
|
||||
result.dateOfCreation = request.date;
|
||||
result.frequencySetId = request.frequencySetId;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -85,11 +85,11 @@ Database::AvmFrequencyPlanning toDb(const ModifyFrequencyPlanningRequest &reques
|
||||
Database::AvmFrequencyPlanning toDb(const FrequencyPlanning &ddsPlan)
|
||||
{
|
||||
Database::AvmFrequencyPlanning dbPlan;
|
||||
dbPlan.id = ddsPlan.id();
|
||||
dbPlan.id = ddsPlan.id;
|
||||
if (ddsPlan.exerciseId.is_set())
|
||||
dbPlan.exerciseId = ddsPlan.exerciseId.get();
|
||||
dbPlan.dateOfCreation = ddsPlan.date();
|
||||
dbPlan.frequencySetId = ddsPlan.frequencySetId();
|
||||
dbPlan.dateOfCreation = ddsPlan.date;
|
||||
dbPlan.frequencySetId = ddsPlan.frequencySetId;
|
||||
|
||||
return dbPlan;
|
||||
}
|
||||
@@ -99,8 +99,8 @@ Database::AvmFrequencyPlanningData toDb(const FrequencyPlanningData &data, int32
|
||||
Database::AvmFrequencyPlanningData result;
|
||||
|
||||
result.frequencyPlanningId = frequencyPlanningId;
|
||||
result.cnrConfigId = data.cnrConfigId();
|
||||
result.properties = QString::fromStdString(data.properties());
|
||||
result.cnrConfigId = data.cnrConfigId;
|
||||
result.properties = QString::fromStdString(data.properties);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ bool FrequencyPlanningHandler::init()
|
||||
void FrequencyPlanningHandler::onModifyFrequencyPlanningRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ModifyFrequencyPlanningRequest &request)
|
||||
{
|
||||
auto ret = request.id() > 0 ? handleModify(request) : handleCreate(request);
|
||||
auto ret = request.id > 0 ? handleModify(request) : handleCreate(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_fts->modifyFrequencyPlanningReply(cookie, ret);
|
||||
@@ -229,9 +229,9 @@ bool FrequencyPlanningHandler::isReferencedByActivePlan(int32_t exerciseId, int3
|
||||
|
||||
Q_ASSERT(m_cache.contains(found->frequencyPlanningId));
|
||||
const FrequencyPlanning &activePlan = m_cache.value(found->frequencyPlanningId);
|
||||
for (const FrequencyPlanningData &entry : activePlan.data())
|
||||
for (const FrequencyPlanningData &entry : activePlan.data)
|
||||
{
|
||||
if (entry.cnrConfigId() == cnrConfigId)
|
||||
if (entry.cnrConfigId == cnrConfigId)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ bool FrequencyPlanningHandler::isReferencedByActivePlan(int32_t exerciseId, int3
|
||||
|
||||
Core::FunctionReplyObject FrequencyPlanningHandler::handleCreate(const ModifyFrequencyPlanningRequest &request)
|
||||
{
|
||||
Q_ASSERT(request.id() <= 0);
|
||||
Q_ASSERT(request.id <= 0);
|
||||
|
||||
Core::FunctionReplyObject reply = validateRequest(request);
|
||||
if (reply.error())
|
||||
@@ -256,7 +256,7 @@ Core::FunctionReplyObject FrequencyPlanningHandler::handleCreate(const ModifyFre
|
||||
|
||||
bool status = false;
|
||||
std::vector<Database::AvmFrequencyPlanningData> dbEntries;
|
||||
for(auto data = request.data().begin(); data != request.data().end(); data++)
|
||||
for(auto data = request.data.begin(); data != request.data.end(); data++)
|
||||
{
|
||||
Database::AvmFrequencyPlanningData dbEntry = toDb((*data), dbPlanning.id);
|
||||
|
||||
@@ -273,9 +273,9 @@ Core::FunctionReplyObject FrequencyPlanningHandler::handleCreate(const ModifyFre
|
||||
trans.commit();
|
||||
|
||||
addPlan(toDds(dbPlanning, dbEntries));
|
||||
if(request.exerciseId() == 0) //set global as active
|
||||
if(request.exerciseId == 0) //set global as active
|
||||
{
|
||||
ModifyActiveFrequencyPlanningRequest modRequest(request.exerciseId() , dbPlanning.id);
|
||||
ModifyActiveFrequencyPlanningRequest modRequest(request.exerciseId , dbPlanning.id);
|
||||
modifyActiveFrequencyPlanningRequest(modRequest);
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ Core::FunctionReplyObject FrequencyPlanningHandler::handleCreate(const ModifyFre
|
||||
|
||||
Core::FunctionReplyObject FrequencyPlanningHandler::handleModify(const ModifyFrequencyPlanningRequest &request)
|
||||
{
|
||||
Q_ASSERT(request.id() > 0);
|
||||
Q_ASSERT(request.id > 0);
|
||||
|
||||
Core::FunctionReplyObject reply = validateRequest(request);
|
||||
if (reply.error())
|
||||
@@ -294,13 +294,13 @@ Q_ASSERT(request.id() > 0);
|
||||
|
||||
DBTransaction trans(m_db->database());
|
||||
|
||||
if (!m_db->removeAvmFrequencyPlanningDataByFrequencyPlanningId(request.id()) ||
|
||||
if (!m_db->removeAvmFrequencyPlanningDataByFrequencyPlanningId(request.id) ||
|
||||
!m_db->update(dbPlanning))
|
||||
return reply.setStr(tr_lts("dds", "Error updating FrequencyPlanning data with id %1")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "Error updating FrequencyPlanning data with id %1")).arg(request.id);
|
||||
|
||||
bool status = false;
|
||||
std::vector<Database::AvmFrequencyPlanningData> dbEntries;
|
||||
for(auto data = request.data().begin(); data != request.data().end(); data++)
|
||||
for(auto data = request.data.begin(); data != request.data.end(); data++)
|
||||
{
|
||||
Database::AvmFrequencyPlanningData dbEntry = toDb((*data), dbPlanning.id);
|
||||
|
||||
@@ -329,13 +329,13 @@ Core::FunctionReplyObject FrequencyPlanningHandler::handleRemove(const Core::Rem
|
||||
|
||||
// first remove the data
|
||||
// removeAvmFrequencyPlanningDataByFrequencyPlanningId not really needed to due FK
|
||||
if (!m_db->removeAvmFrequencyPlanningDataByFrequencyPlanningId(request.id()) ||
|
||||
!m_db->removeAvmFrequencyPlanning(request.id()))
|
||||
return reply.setStr(tr_lts("dds", "Error removing FrequencyPlanningRequest data with id %1 from database")).arg(request.id());
|
||||
if (!m_db->removeAvmFrequencyPlanningDataByFrequencyPlanningId(request.id) ||
|
||||
!m_db->removeAvmFrequencyPlanning(request.id))
|
||||
return reply.setStr(tr_lts("dds", "Error removing FrequencyPlanningRequest data with id %1 from database")).arg(request.id);
|
||||
|
||||
trans.commit();
|
||||
|
||||
removePlan(request.id());
|
||||
removePlan(request.id);
|
||||
|
||||
return reply;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ Core::FunctionReplyObject FrequencyPlanningHandler::validateRequest(const Modify
|
||||
{
|
||||
Core::FunctionReplyObject reply;
|
||||
|
||||
if (request.id() > 0)
|
||||
if (request.id > 0)
|
||||
{
|
||||
reply = validateModifyRequest(request);
|
||||
if (reply.error())
|
||||
@@ -357,13 +357,13 @@ Core::FunctionReplyObject FrequencyPlanningHandler::validateRequest(const Modify
|
||||
|
||||
// Validate that the FrequencySet-entries actually belong to the referenced FrequencySet.
|
||||
|
||||
for (const FrequencyPlanningData &entry : request.data())
|
||||
for (const FrequencyPlanningData &entry : request.data)
|
||||
{
|
||||
QSet<int> frequencySetEntries = AudioVideoManagement::frequencySetDataIds(entry.properties());
|
||||
QSet<int> frequencySetEntries = AudioVideoManagement::frequencySetDataIds(entry.properties);
|
||||
for(const int &setEntry : qAsConst(frequencySetEntries))
|
||||
{
|
||||
if (setEntry != 0 && !m_frequencySetHandler->isValid(request.frequencySetId(), setEntry))
|
||||
return reply.setStr(tr_lts("dds", "FrequencySetData %1 does not belong to FrequencySet %2")).arg(setEntry).arg(request.frequencySetId());
|
||||
if (setEntry != 0 && !m_frequencySetHandler->isValid(request.frequencySetId, setEntry))
|
||||
return reply.setStr(tr_lts("dds", "FrequencySetData %1 does not belong to FrequencySet %2")).arg(setEntry).arg(request.frequencySetId);
|
||||
}
|
||||
}
|
||||
return reply;
|
||||
@@ -374,54 +374,54 @@ Core::FunctionReplyObject FrequencyPlanningHandler::validateRequest(const Modify
|
||||
*/
|
||||
Core::FunctionReplyObject FrequencyPlanningHandler::validateModifyRequest(const ModifyFrequencyPlanningRequest &request) const
|
||||
{
|
||||
Q_ASSERT(request.id() > 0);
|
||||
Q_ASSERT(request.id > 0);
|
||||
|
||||
Core::FunctionReplyObject reply(request.id());
|
||||
Core::FunctionReplyObject reply(request.id);
|
||||
|
||||
auto found = m_cache.constFind(request.id());
|
||||
auto found = m_cache.constFind(request.id);
|
||||
if (found == m_cache.constEnd())
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlan %1 does not exist")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlan %1 does not exist")).arg(request.id);
|
||||
|
||||
const FrequencyPlanning &oldPlan = *found;
|
||||
|
||||
if ((oldPlan.exerciseId.is_set() && oldPlan.exerciseId.get() != request.exerciseId())
|
||||
|| (!oldPlan.exerciseId.is_set() && request.exerciseId() != 0))
|
||||
if ((oldPlan.exerciseId.is_set() && oldPlan.exerciseId.get() != request.exerciseId)
|
||||
|| (!oldPlan.exerciseId.is_set() && request.exerciseId != 0))
|
||||
return reply.setStr(tr_lts("dds", "Exercise may not be changed"));
|
||||
|
||||
if (request.frequencySetId() != oldPlan.frequencySetId())
|
||||
if (request.frequencySetId != oldPlan.frequencySetId)
|
||||
return reply.setStr(tr_lts("dds", "FrequencySet may not be changed"));
|
||||
|
||||
// In case the plan is already active (in an active Exercise), we need to check for conflicts with active FrequencyPlans of other active Exercises.
|
||||
if (!m_activeExercises->isActive(ExerciseContext(request.exerciseId())))
|
||||
if (!m_activeExercises->isActive(ExerciseContext(request.exerciseId)))
|
||||
return reply;
|
||||
|
||||
auto foundActivePlan = m_activePlannings.constFind(request.exerciseId());
|
||||
auto foundActivePlan = m_activePlannings.constFind(request.exerciseId);
|
||||
if (foundActivePlan == m_activePlannings.constEnd())
|
||||
return reply;
|
||||
|
||||
bool currentlyActive = foundActivePlan->frequencyPlanningId == request.id();
|
||||
bool currentlyActive = foundActivePlan->frequencyPlanningId == request.id;
|
||||
if (!currentlyActive)
|
||||
return reply;
|
||||
|
||||
const std::vector<int> activePlans = otherActivePlans(request.exerciseId());
|
||||
return testActivation(request.data(), activePlans, request.id());
|
||||
const std::vector<int> activePlans = otherActivePlans(request.exerciseId);
|
||||
return testActivation(request.data, activePlans, request.id);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject FrequencyPlanningHandler::validateRequest(const Core::RemoveElementRequest &request) const
|
||||
{
|
||||
Q_ASSERT(request.id() > 0);
|
||||
Core::FunctionReplyObject reply(request.id());
|
||||
Q_ASSERT(request.id > 0);
|
||||
Core::FunctionReplyObject reply(request.id);
|
||||
|
||||
auto foundPlan = m_cache.constFind(request.id());
|
||||
auto foundPlan = m_cache.constFind(request.id);
|
||||
if (foundPlan == m_cache.constEnd())
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 does not exist")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 does not exist")).arg(request.id);
|
||||
|
||||
const FrequencyPlanning &plan = *foundPlan;
|
||||
int exerciseId = plan.exerciseId.is_set() ? plan.exerciseId.get() : 0;
|
||||
auto foundActivePlan = m_activePlannings.constFind(exerciseId);
|
||||
bool isActive = foundActivePlan != m_activePlannings.constEnd() && foundActivePlan->frequencyPlanningId == plan.id();
|
||||
bool isActive = foundActivePlan != m_activePlannings.constEnd() && foundActivePlan->frequencyPlanningId == plan.id;
|
||||
if (isActive)
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 cannot be removed because it is active")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 cannot be removed because it is active")).arg(request.id);
|
||||
|
||||
return reply;
|
||||
}
|
||||
@@ -451,27 +451,27 @@ Core::FunctionReplyObject FrequencyPlanningHandler::modifyActiveFrequencyPlannin
|
||||
return reply;
|
||||
|
||||
Database::AvmActiveFrequencyPlanning dbData;
|
||||
dbData.frequencyPlanningId = request.frequencyPlanningId();
|
||||
if(request.exerciseId() != 0)
|
||||
dbData.exerciseId = request.exerciseId();
|
||||
dbData.frequencyPlanningId = request.frequencyPlanningId;
|
||||
if(request.exerciseId != 0)
|
||||
dbData.exerciseId = request.exerciseId;
|
||||
|
||||
if (!m_activePlannings.contains(request.exerciseId())) // create
|
||||
if (!m_activePlannings.contains(request.exerciseId)) // create
|
||||
{
|
||||
if (!m_db->insert(dbData))
|
||||
return reply.setStr(tr_lts("dds", "Error inserting ActiveFrequencyPlanning data with id %1 into DB")).arg(request.exerciseId());
|
||||
return reply.setStr(tr_lts("dds", "Error inserting ActiveFrequencyPlanning data with id %1 into DB")).arg(request.exerciseId);
|
||||
}
|
||||
else // modify
|
||||
{
|
||||
dbData.id = m_activePlannings.value(request.exerciseId()).id;
|
||||
dbData.id = m_activePlannings.value(request.exerciseId).id;
|
||||
if (!m_db->update(dbData))
|
||||
return reply.setStr(tr_lts("dds", "Error updating ActiveFrequencyPlanning data with id %1 in DB")).arg(request.exerciseId());
|
||||
return reply.setStr(tr_lts("dds", "Error updating ActiveFrequencyPlanning data with id %1 in DB")).arg(request.exerciseId);
|
||||
}
|
||||
|
||||
int exerciseId = dbData.exerciseId.isNull() ? 0 : dbData.exerciseId.value<int>();
|
||||
m_activePlannings[exerciseId] = dbData;
|
||||
|
||||
if (!m_dts->publish(toDds(dbData)))
|
||||
return reply.setStr(tr_lts("dds", "Error publishing ActiveFrequencyPlanning data with id %1 to DDS")).arg(request.exerciseId());
|
||||
return reply.setStr(tr_lts("dds", "Error publishing ActiveFrequencyPlanning data with id %1 to DDS")).arg(request.exerciseId);
|
||||
|
||||
emit planningChanged();
|
||||
|
||||
@@ -482,22 +482,22 @@ Core::FunctionReplyObject FrequencyPlanningHandler::removeActiveFrequencyPlannin
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "RemoveActiveFrequencyPlanningRequest: " << request;
|
||||
|
||||
Core::FunctionReplyObject reply(request.exerciseId());
|
||||
Core::FunctionReplyObject reply(request.exerciseId);
|
||||
|
||||
if (!m_activePlannings.contains(request.exerciseId()))
|
||||
return reply.setStr(tr_lts("dds", "No ActiveFrequencyPlanning for exercise %1")).arg(request.exerciseId());
|
||||
if (!m_activePlannings.contains(request.exerciseId))
|
||||
return reply.setStr(tr_lts("dds", "No ActiveFrequencyPlanning for exercise %1")).arg(request.exerciseId);
|
||||
|
||||
Database::AvmActiveFrequencyPlanning activePlanning = m_activePlannings.value(request.exerciseId());
|
||||
if (activePlanning.exerciseId != request.exerciseId())
|
||||
return reply.setStr(tr_lts("dds", "Error removing ActiveFrequencyPlanning data with exercise id %1 - not found")).arg(request.exerciseId());
|
||||
Database::AvmActiveFrequencyPlanning activePlanning = m_activePlannings.value(request.exerciseId);
|
||||
if (activePlanning.exerciseId != request.exerciseId)
|
||||
return reply.setStr(tr_lts("dds", "Error removing ActiveFrequencyPlanning data with exercise id %1 - not found")).arg(request.exerciseId);
|
||||
|
||||
if (!m_dts->removeActiveFrequencyPlanningByKey(request.exerciseId()))
|
||||
return reply.setStr(tr_lts("dds", "Error removing ActiveFrequencyPlanning data with exercise id %1 from DDS")).arg(request.exerciseId());
|
||||
if (!m_dts->removeActiveFrequencyPlanningByKey(request.exerciseId))
|
||||
return reply.setStr(tr_lts("dds", "Error removing ActiveFrequencyPlanning data with exercise id %1 from DDS")).arg(request.exerciseId);
|
||||
|
||||
if (!m_db->removeAvmActiveFrequencyPlanning(activePlanning.id))
|
||||
return reply.setStr(tr_lts("dds", "Error removing ActiveFrequencyPlanning data with exercise id %1 from DB")).arg(request.exerciseId());
|
||||
return reply.setStr(tr_lts("dds", "Error removing ActiveFrequencyPlanning data with exercise id %1 from DB")).arg(request.exerciseId);
|
||||
|
||||
m_activePlannings.remove(request.exerciseId());
|
||||
m_activePlannings.remove(request.exerciseId);
|
||||
|
||||
emit planningChanged();
|
||||
|
||||
@@ -509,25 +509,25 @@ Core::FunctionReplyObject FrequencyPlanningHandler::removeActiveFrequencyPlannin
|
||||
*/
|
||||
Core::FunctionReplyObject FrequencyPlanningHandler::validateRequest(const ModifyActiveFrequencyPlanningRequest &request) const
|
||||
{
|
||||
Core::FunctionReplyObject reply(request.exerciseId());
|
||||
Core::FunctionReplyObject reply(request.exerciseId);
|
||||
|
||||
auto foundPlan = m_cache.constFind(request.frequencyPlanningId());
|
||||
auto foundPlan = m_cache.constFind(request.frequencyPlanningId);
|
||||
if (foundPlan == m_cache.constEnd())
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 does not exist")).arg(request.frequencyPlanningId());
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 does not exist")).arg(request.frequencyPlanningId);
|
||||
|
||||
if (!m_activeExercises->isActive(ExerciseContext(request.exerciseId())))
|
||||
if (!m_activeExercises->isActive(ExerciseContext(request.exerciseId)))
|
||||
return reply;
|
||||
|
||||
const FrequencyPlanning &planToActivate = *foundPlan;
|
||||
|
||||
const std::vector<int> activePlans = otherActivePlans(request.exerciseId());
|
||||
const std::vector<int> activePlans = otherActivePlans(request.exerciseId);
|
||||
if (activePlans.empty())
|
||||
return reply;
|
||||
|
||||
if (!hasSameFrequencySet(planToActivate, *m_cache.constFind(activePlans.front())))
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 cannot be activated because another FrequencyPlanning with a different FrequencySet is active already")).arg(request.frequencyPlanningId());
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning %1 cannot be activated because another FrequencyPlanning with a different FrequencySet is active already")).arg(request.frequencyPlanningId);
|
||||
|
||||
return testActivation(planToActivate.data(), activePlans, request.exerciseId());
|
||||
return testActivation(planToActivate.data, activePlans, request.exerciseId);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject FrequencyPlanningHandler::testActivation(const std::vector<FrequencyPlanningData> &entries, const std::vector<int> &activePlans, int requestId) const
|
||||
@@ -541,27 +541,27 @@ Core::FunctionReplyObject FrequencyPlanningHandler::testActivation(const std::ve
|
||||
const std::vector<int> takenCnrConfigs = takenGlobalCnrConfigs(activePlans);
|
||||
for (const FrequencyPlanningData &entry : entries)
|
||||
{
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(entry.cnrConfigId());
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(entry.cnrConfigId);
|
||||
bool isGlobal = !cnrConfig.exerciseId.is_set();
|
||||
if (!isGlobal)
|
||||
continue;
|
||||
|
||||
auto found = std::find(takenCnrConfigs.begin(), takenCnrConfigs.end(), cnrConfig.id());
|
||||
auto found = std::find(takenCnrConfigs.begin(), takenCnrConfigs.end(), cnrConfig.id);
|
||||
if (found != takenCnrConfigs.end())
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning cannot be activated because CnrConfig \"%1\" is used by some other active FrequencyPlanning")).arg(cnrConfig.radioCircuit());
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning cannot be activated because CnrConfig \"%1\" is used by some other active FrequencyPlanning")).arg(cnrConfig.radioCircuit);
|
||||
}
|
||||
|
||||
// Check that the FrequencyPlanning does not reference an entry from the FrequencySet wich is already referenced by some other active FrequencyPlanning.
|
||||
QSet<int> takenSetEntries = takenFrequencySetEntries(activePlans);
|
||||
for (const FrequencyPlanningData &fpdEntry : entries)
|
||||
{
|
||||
QSet<int> frequencySetEntries = AudioVideoManagement::frequencySetDataIds(fpdEntry.properties());
|
||||
QSet<int> frequencySetEntries = AudioVideoManagement::frequencySetDataIds(fpdEntry.properties);
|
||||
for(const int &setEntry : qAsConst(frequencySetEntries))
|
||||
{
|
||||
if(takenSetEntries.contains(setEntry))
|
||||
{
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(fpdEntry.cnrConfigId());
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning cannot be activated because CnrConfig \"%1\" uses an entry in the FrequencySet which is used by some other active FrequencyPlanning")).arg(cnrConfig.radioCircuit());
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(fpdEntry.cnrConfigId);
|
||||
return reply.setStr(tr_lts("dds", "FrequencyPlanning cannot be activated because CnrConfig \"%1\" uses an entry in the FrequencySet which is used by some other active FrequencyPlanning")).arg(cnrConfig.radioCircuit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -614,14 +614,14 @@ std::vector<int> FrequencyPlanningHandler::takenGlobalCnrConfigs(const std::vect
|
||||
for (auto planId : plans)
|
||||
{
|
||||
const FrequencyPlanning &plan = m_cache.value(planId);
|
||||
Q_ASSERT(plan.id() == planId);
|
||||
Q_ASSERT(plan.id == planId);
|
||||
|
||||
for (const FrequencyPlanningData &entry : plan.data())
|
||||
for (const FrequencyPlanningData &entry : plan.data)
|
||||
{
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(entry.cnrConfigId());
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(entry.cnrConfigId);
|
||||
bool isGlobal = !cnrConfig.exerciseId.is_set();
|
||||
if (isGlobal)
|
||||
result.push_back(cnrConfig.id());
|
||||
result.push_back(cnrConfig.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,11 +638,11 @@ QSet<int> FrequencyPlanningHandler::takenFrequencySetEntries(const std::vector<i
|
||||
for (auto planId : plans)
|
||||
{
|
||||
const FrequencyPlanning &plan = m_cache.value(planId);
|
||||
Q_ASSERT(plan.id() == planId);
|
||||
Q_ASSERT(plan.id == planId);
|
||||
|
||||
for (const FrequencyPlanningData &entry : plan.data())
|
||||
for (const FrequencyPlanningData &entry : plan.data)
|
||||
{
|
||||
result += AudioVideoManagement::frequencySetDataIds(entry.properties());
|
||||
result += AudioVideoManagement::frequencySetDataIds(entry.properties);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ QSet<int> FrequencyPlanningHandler::takenFrequencySetEntries(const std::vector<i
|
||||
|
||||
bool FrequencyPlanningHandler::hasSameFrequencySet(const FrequencyPlanning &plan1, const FrequencyPlanning &plan2) const
|
||||
{
|
||||
return plan1.frequencySetId() == plan2.frequencySetId();
|
||||
return plan1.frequencySetId == plan2.frequencySetId;
|
||||
}
|
||||
|
||||
bool FrequencyPlanningHandler::collectAndPublish(const Database::AvmFrequencyPlanning &planDb, bool isReload)
|
||||
@@ -684,29 +684,29 @@ bool FrequencyPlanningHandler::collectAndPublish(const Database::AvmFrequencyPla
|
||||
|
||||
void FrequencyPlanningHandler::addPlan(const FrequencyPlanning &plan)
|
||||
{
|
||||
Q_ASSERT(plan.id() > 0);
|
||||
Q_ASSERT(!m_cache.contains(plan.id()));
|
||||
Q_ASSERT(plan.id > 0);
|
||||
Q_ASSERT(!m_cache.contains(plan.id));
|
||||
|
||||
m_cache.insert(plan.id(), plan);
|
||||
m_cache.insert(plan.id, plan);
|
||||
|
||||
bool status = m_dts->publish(plan);
|
||||
if (!status)
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'FrequencyPlanning' data with id %1 (create)").arg(plan.id());
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'FrequencyPlanning' data with id %1 (create)").arg(plan.id);
|
||||
|
||||
emit planningChanged();
|
||||
}
|
||||
|
||||
void FrequencyPlanningHandler::updatePlan(const FrequencyPlanning &plan)
|
||||
{
|
||||
Q_ASSERT(plan.id() > 0);
|
||||
auto found = m_cache.find(plan.id());
|
||||
Q_ASSERT(plan.id > 0);
|
||||
auto found = m_cache.find(plan.id);
|
||||
Q_ASSERT(found != m_cache.end());
|
||||
|
||||
*found = plan;
|
||||
|
||||
bool status = m_dts->publish(plan);
|
||||
if (!status)
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'FrequencyPlanning' data with id %1 (modify)").arg(plan.id());
|
||||
ERROR_LOG(m_logger) << QStringLiteral("Failed to publish 'FrequencyPlanning' data with id %1 (modify)").arg(plan.id);
|
||||
|
||||
emit planningChanged();
|
||||
}
|
||||
@@ -762,22 +762,22 @@ void FrequencyPlanningHandler::onCnrConfigRemoved(int cnrConfigId)
|
||||
for (FrequencyPlanning &fp : m_cache)
|
||||
{
|
||||
ModifyFrequencyPlanningRequest req;
|
||||
req.data() = fp.data();
|
||||
auto found = std::find_if(req.data().begin(), req.data().end(), [cnrConfigId](const FrequencyPlanningData &data)
|
||||
req.data = fp.data;
|
||||
auto found = std::find_if(req.data.begin(), req.data.end(), [cnrConfigId](const FrequencyPlanningData &data)
|
||||
{
|
||||
return data.cnrConfigId() == cnrConfigId;
|
||||
return data.cnrConfigId == cnrConfigId;
|
||||
});
|
||||
if (found == req.data().end())
|
||||
if (found == req.data.end())
|
||||
continue;
|
||||
|
||||
// In this Frequency Planning, the (removed) cnrConfig ID is present. Therefore, we need to delete it also:
|
||||
req.data().erase(found);
|
||||
req.data.erase(found);
|
||||
|
||||
req.date() = fp.date();
|
||||
req.exerciseId() = fp.exerciseId.is_set() ? fp.exerciseId.get() : 0;
|
||||
req.frequencySetId() = fp.frequencySetId();
|
||||
req.id() = fp.id();
|
||||
req.name() = fp.name();
|
||||
req.date = fp.date;
|
||||
req.exerciseId = fp.exerciseId.is_set() ? fp.exerciseId.get() : 0;
|
||||
req.frequencySetId = fp.frequencySetId;
|
||||
req.id = fp.id;
|
||||
req.name = fp.name;
|
||||
handleModify(req);
|
||||
}
|
||||
}
|
||||
|
||||
+23
-23
@@ -56,17 +56,17 @@ FrequencySet FrequencySetHandler::toDdsFrequencySet(const Database::AvmFrequency
|
||||
{
|
||||
FrequencySet result;
|
||||
|
||||
result.id(dbData.id);
|
||||
result.name(dbData.name.toStdString());
|
||||
result.lastChange(dbData.lastChange);
|
||||
result.id = dbData.id;
|
||||
result.name = dbData.name.toStdString();
|
||||
result.lastChange = dbData.lastChange;
|
||||
|
||||
auto cb = [&result] (const Database::AvmFrequencySetData ¤tData)
|
||||
{
|
||||
result.data().push_back(toDdsFrequencySetDataWithId(currentData));
|
||||
result.data.push_back(toDdsFrequencySetDataWithId(currentData));
|
||||
};
|
||||
m_db->selectByFrequencySetId(cb, result.id());
|
||||
m_db->selectByFrequencySetId(cb, result.id);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Frequency Set with ID " << dbData.id << " has " << result.data().size() << " data entries";
|
||||
DEBUG_LOG(m_logger) << "Frequency Set with ID " << dbData.id << " has " << result.data.size() << " data entries";
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -75,37 +75,37 @@ FrequencyBand FrequencySetHandler::getFrequencyBand(const QString &deviceString)
|
||||
{
|
||||
QString intermediate = deviceString.left(3);
|
||||
if (QString::compare(intermediate, QStringLiteral("VHF"), Qt::CaseInsensitive) == 0)
|
||||
return FrequencyBand_def::VHF;
|
||||
return FrequencyBand::VHF;
|
||||
else if (QString::compare(intermediate, QStringLiteral("UHF"), Qt::CaseInsensitive) == 0)
|
||||
return FrequencyBand_def::UHF;
|
||||
return FrequencyBand::UHF;
|
||||
else if (QString::compare(intermediate, QStringLiteral("HF"), Qt::CaseInsensitive) == 0)
|
||||
return FrequencyBand_def::HF;
|
||||
return FrequencyBand::HF;
|
||||
else //if (QString::compare(intermediate.left(1), QStringLiteral("R"), Qt::CaseInsensitive) == 0)
|
||||
return FrequencyBand_def::REL;
|
||||
return FrequencyBand::REL;
|
||||
}
|
||||
|
||||
FrequencySetDataWithId FrequencySetHandler::toDdsFrequencySetDataWithId(const Database::AvmFrequencySetData &dbData)
|
||||
{
|
||||
FrequencySetDataWithId result;
|
||||
|
||||
result.id(dbData.id);
|
||||
result.function(dbData.function.toStdString());
|
||||
result.frequency(dbData.frequency);
|
||||
result.id = dbData.id;
|
||||
result.function = dbData.function.toStdString();
|
||||
result.frequency = dbData.frequency;
|
||||
|
||||
// Todo: Put this into the database as well...
|
||||
result.frequencyBand(getFrequencyBand(dbData.device));
|
||||
result.frequencyBand = getFrequencyBand(dbData.device);
|
||||
|
||||
if (dbData.akwBundle >= 0)
|
||||
result.akwBundle().set(dbData.akwBundle);
|
||||
result.akwBundle = dbData.akwBundle;
|
||||
|
||||
if (dbData.fsbBundle >= 0)
|
||||
result.fsbBundle().set(dbData.fsbBundle);
|
||||
result.fsbBundle = dbData.fsbBundle;
|
||||
|
||||
if (dbData.akwRadioCircuit >= 0)
|
||||
result.akwRadioCircuit().set(dbData.akwRadioCircuit);
|
||||
result.akwRadioCircuit = dbData.akwRadioCircuit;
|
||||
|
||||
if (dbData.comsec >= 0)
|
||||
result.comsec().set(dbData.comsec);
|
||||
result.comsec = dbData.comsec;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -114,15 +114,15 @@ void FrequencySetHandler::addFrequencySet(const FrequencySet &frequencySet)
|
||||
{
|
||||
QVector<int32_t> dataIds;
|
||||
|
||||
dataIds.reserve(frequencySet.data().size());
|
||||
dataIds.reserve(frequencySet.data.size());
|
||||
|
||||
for (const FrequencySetDataWithId ¤tData : frequencySet.data())
|
||||
dataIds << currentData.id();
|
||||
for (const FrequencySetDataWithId ¤tData : frequencySet.data)
|
||||
dataIds << currentData.id;
|
||||
|
||||
m_frequencySetDatas.insert(frequencySet.id(), dataIds);
|
||||
m_frequencySetDatas.insert(frequencySet.id, dataIds);
|
||||
|
||||
if (!m_dts->publish(frequencySet))
|
||||
ERROR_LOG(m_logger) << "Error while publishing Frequency Set with id " << frequencySet.id();
|
||||
ERROR_LOG(m_logger) << "Error while publishing Frequency Set with id " << frequencySet.id;
|
||||
}
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
+20
-20
@@ -18,31 +18,31 @@ namespace AudioVideoManagement
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
static FrequencyPlanningStatus convert(const ModifyFrequencyPlanningStatusRequest &request, const FrequencyPlanningStatus &oldData)
|
||||
{
|
||||
Q_ASSERT(request.client() == oldData.client());
|
||||
Q_ASSERT(request.client == oldData.client);
|
||||
|
||||
FrequencyPlanningStatus newData(oldData);
|
||||
if (!oldData.uuid().empty())
|
||||
if (!oldData.uuid.empty())
|
||||
{
|
||||
if (oldData.uuid() != request.uuid())
|
||||
if (oldData.uuid != request.uuid)
|
||||
WARNING_LOG(getLogger("HandlerFrequencyPlanningStatus")) << "WARNING: Same client has concurrent GetConfigCNR requests.";
|
||||
}
|
||||
newData.uuid() = request.uuid().empty() ? oldData.uuid() : request.uuid();
|
||||
newData.id() = oldData.id();
|
||||
newData.uuid = request.uuid.empty() ? oldData.uuid : request.uuid;
|
||||
newData.id = oldData.id;
|
||||
if (request.sent.is_set())
|
||||
{
|
||||
newData.sent() = request.sent.get();
|
||||
newData.requester() = request.requester(); // ! Requester is only sent, when data gets sent.
|
||||
newData.sent = request.sent.get();
|
||||
newData.requester = request.requester; // ! Requester is only sent, when data gets sent.
|
||||
}
|
||||
if (request.received.is_set())
|
||||
newData.received() = request.received.get();
|
||||
newData.received = request.received.get();
|
||||
if (request.activated.is_set())
|
||||
{
|
||||
newData.activated() = request.activated.get();
|
||||
newData.requester() = request.requester(); // ! Requester is only sent, when data gets activated.
|
||||
newData.activated = request.activated.get();
|
||||
newData.requester = request.requester; // ! Requester is only sent, when data gets activated.
|
||||
}
|
||||
newData.isActive() = request.isActive();
|
||||
newData.content() = request.content();
|
||||
newData.reason() = request.reason();
|
||||
newData.isActive = request.isActive;
|
||||
newData.content = request.content;
|
||||
newData.reason = request.reason;
|
||||
return newData;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ bool HandlerFrequencyPlanningStatus::init()
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return false;
|
||||
}
|
||||
m_data.insert(ifs->getData().client(), ifs);
|
||||
m_data.insert(ifs->getData().client, ifs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void HandlerFrequencyPlanningStatus::onModifyFrequencyPlanningStatusRequest(cons
|
||||
const ModifyFrequencyPlanningStatusRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onModifyFrequencyPlanningStatusRequest: " << request;
|
||||
auto ret = m_data.contains(request.client()) ? frequencyPlanningStatusModifyRequest(request) : frequencyPlanningStatusCreateRequest(request);
|
||||
auto ret = m_data.contains(request.client) ? frequencyPlanningStatusModifyRequest(request) : frequencyPlanningStatusCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_fts->modifyFrequencyPlanningStatusReply(cookie, ret);
|
||||
@@ -127,9 +127,9 @@ void HandlerFrequencyPlanningStatus::onRemoveFrequencyPlanningStatusByClientRequ
|
||||
QVector<int> clients;
|
||||
for (ObjectFrequencyPlanningStatus *ifs : qAsConst(m_data))
|
||||
{
|
||||
if (request.client() == 0 || ifs->getData().client() == request.client())
|
||||
if (request.client == 0 || ifs->getData().client == request.client)
|
||||
{
|
||||
int client = ifs->getData().client();
|
||||
int client = ifs->getData().client;
|
||||
ret = ifs->removeObject();
|
||||
if (ret.error())
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
@@ -150,9 +150,9 @@ void HandlerFrequencyPlanningStatus::onRemoveFrequencyPlanningStatusByClientRequ
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerFrequencyPlanningStatus::frequencyPlanningStatusModifyRequest(const ModifyFrequencyPlanningStatusRequest &request)
|
||||
{
|
||||
ObjectFrequencyPlanningStatus *ifs = m_data.value(request.client());
|
||||
ObjectFrequencyPlanningStatus *ifs = m_data.value(request.client);
|
||||
if (ifs == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Video Team with id %1 not found")).arg(request.id());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Video Team with id %1 not found")).arg(request.id);
|
||||
|
||||
FrequencyPlanningStatus ddsData = convert(request, ifs->getData());
|
||||
|
||||
@@ -170,7 +170,7 @@ Core::FunctionReplyObject HandlerFrequencyPlanningStatus::frequencyPlanningStatu
|
||||
if (ret.error())
|
||||
delete ifs;
|
||||
else
|
||||
m_data.insert(ifs->getData().client(), ifs);
|
||||
m_data.insert(ifs->getData().client, ifs);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
+30
-30
@@ -25,9 +25,9 @@ AudioVideoManagement::MenuStruct toDdsToplevel(const AudioVideoManagement::Datab
|
||||
Q_ASSERT(dbEntry.name.isValid());
|
||||
|
||||
AudioVideoManagement::MenuStruct ms;
|
||||
ms.id(dbEntry.id);
|
||||
ms.name(dbEntry.name.toString().toStdString());
|
||||
ms.isAudio(dbEntry.isAudio);
|
||||
ms.id = dbEntry.id;
|
||||
ms.name = dbEntry.name.toString().toStdString();
|
||||
ms.isAudio = dbEntry.isAudio;
|
||||
|
||||
return ms;
|
||||
}
|
||||
@@ -46,13 +46,13 @@ void insertChildren(std::vector<AudioVideoManagement::AvMenuEntry>& contToAdd,
|
||||
bool lessToplevel(const AudioVideoManagement::AvMenuEntry &a,
|
||||
const AudioVideoManagement::AvMenuEntry &b)
|
||||
{
|
||||
return a.id() < b.id();
|
||||
return a.id < b.id;
|
||||
}
|
||||
|
||||
bool lessSublevel(const AudioVideoManagement::AvMenuEntry &a,
|
||||
const AudioVideoManagement::AvMenuEntry &b)
|
||||
{
|
||||
return std::make_tuple(a.parentId(), a.rowId(), a.id()) < std::make_tuple(b.parentId(), b.rowId(), b.id());
|
||||
return std::make_tuple(a.parentId, a.rowId, a.id) < std::make_tuple(b.parentId, b.rowId, b.id);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -67,14 +67,14 @@ AvMenuEntry HandlerMenuStruct::toDds(const Database::AvmMenuStruct &dbEntry)
|
||||
|
||||
AvMenuEntry ddsItem;
|
||||
|
||||
ddsItem.id(dbEntry.id);
|
||||
ddsItem.parentId(dbEntry.parentId);
|
||||
ddsItem.isGroup(dbEntry.isGroup);
|
||||
ddsItem.rowId(dbEntry.rowid);
|
||||
ddsItem.id = dbEntry.id;
|
||||
ddsItem.parentId = dbEntry.parentId;
|
||||
ddsItem.isGroup = dbEntry.isGroup;
|
||||
ddsItem.rowId = dbEntry.rowid;
|
||||
if (dbEntry.isGroup)
|
||||
{
|
||||
Q_ASSERT(dbEntry.name.isValid());
|
||||
ddsItem.name().set(dbEntry.name.toString().toStdString());
|
||||
ddsItem.name = dbEntry.name.toString().toStdString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -84,8 +84,8 @@ AvMenuEntry HandlerMenuStruct::toDds(const Database::AvmMenuStruct &dbEntry)
|
||||
// Using the internal stream name here makes it easy for clients to directly
|
||||
// use those when communicating with AVS.
|
||||
Q_ASSERT(dbEntry.mountingPointId.isValid());
|
||||
ddsItem.mountingPointId(dbEntry.mountingPointId.toInt());
|
||||
ddsItem.name().set(AudioVideoHandlerImpl::internalStreamName(dbEntry.mountingPointId.toInt()).toStdString());
|
||||
ddsItem.mountingPointId = dbEntry.mountingPointId.toInt();
|
||||
ddsItem.name = AudioVideoHandlerImpl::internalStreamName(dbEntry.mountingPointId.toInt()).toStdString();
|
||||
}
|
||||
|
||||
return ddsItem;
|
||||
@@ -93,11 +93,11 @@ AvMenuEntry HandlerMenuStruct::toDds(const Database::AvmMenuStruct &dbEntry)
|
||||
|
||||
void HandlerMenuStruct::sortEntries(MenuStruct &menu)
|
||||
{
|
||||
auto isToplevel = [&menu] (const AvMenuEntry& entry) { return entry.parentId() == menu.id(); };
|
||||
auto sublevelStart = std::partition(menu.menuEntries().begin(), menu.menuEntries().end(), isToplevel);
|
||||
auto isToplevel = [&menu] (const AvMenuEntry& entry) { return entry.parentId == menu.id; };
|
||||
auto sublevelStart = std::partition(menu.menuEntries.begin(), menu.menuEntries.end(), isToplevel);
|
||||
|
||||
std::sort(menu.menuEntries().begin(), sublevelStart, lessToplevel);
|
||||
std::sort(sublevelStart, menu.menuEntries().end(), lessSublevel);
|
||||
std::sort(menu.menuEntries.begin(), sublevelStart, lessToplevel);
|
||||
std::sort(sublevelStart, menu.menuEntries.end(), lessSublevel);
|
||||
}
|
||||
|
||||
HandlerMenuStruct::HandlerMenuStruct(Interface::Dts *dts, Interface::Fts *fts, DatabaseInterface *db)
|
||||
@@ -163,7 +163,7 @@ void HandlerMenuStruct::reload()
|
||||
|
||||
for (const auto &ms : dbItems)
|
||||
{
|
||||
auto found = m_objMap.find(ms.id());
|
||||
auto found = m_objMap.find(ms.id);
|
||||
Q_ASSERT(found != m_objMap.end());
|
||||
(*found)->updateFromDb(ms);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ QList<MenuStruct> HandlerMenuStruct::loadFromDb(bool &status)
|
||||
for (auto dbEntry = vecMenuStruct.begin(); dbEntry != sublevelStart; ++dbEntry)
|
||||
{
|
||||
MenuStruct ms = toDdsToplevel(*dbEntry);
|
||||
msMap.insert(ms.id(), ms);
|
||||
msMap.insert(ms.id, ms);
|
||||
}
|
||||
|
||||
// Go over all non-toplevel entries and create AvMenuEntries for those
|
||||
@@ -198,9 +198,9 @@ QList<MenuStruct> HandlerMenuStruct::loadFromDb(bool &status)
|
||||
MenuStruct &parent = it.value();
|
||||
|
||||
AudioVideoManagement::AvMenuEntry me = toDds(*dbEntry);
|
||||
parent.menuEntries().push_back(me);
|
||||
parent.menuEntries.push_back(me);
|
||||
|
||||
insertChildren(parent.menuEntries(), me.id(), vecMenuStruct);
|
||||
insertChildren(parent.menuEntries, me.id, vecMenuStruct);
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ QList<MenuStruct> HandlerMenuStruct::loadFromDb(bool &status)
|
||||
for (auto &ms : msMap)
|
||||
{
|
||||
sortEntries(ms);
|
||||
totalCount += ms.menuEntries().size();
|
||||
totalCount += ms.menuEntries.size();
|
||||
}
|
||||
Q_ASSERT(totalCount == vecMenuStruct.size());
|
||||
|
||||
@@ -224,7 +224,7 @@ void HandlerMenuStruct::onModifyMenuStructRequest(const rti::core::SampleIdentit
|
||||
const MenuStruct &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onModifyMenuStructRequest: " << request;
|
||||
auto ret = request.id() > 0 ? modifyMenuStructRequest(request) : createMenuStructRequest(request);
|
||||
auto ret = request.id > 0 ? modifyMenuStructRequest(request) : createMenuStructRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_fts->modifyMenuStructReply(cookie, ret);
|
||||
@@ -234,7 +234,7 @@ Core::FunctionReplyObject HandlerMenuStruct::createMenuStructRequest(const MenuS
|
||||
{
|
||||
ObjectMenuStruct *ifs = new ObjectMenuStruct(m_dts, m_db);
|
||||
|
||||
DEBUG_LOG(m_logger) << "request.menuEntries.size() : " << request.menuEntries().size();
|
||||
DEBUG_LOG(m_logger) << "request.menuEntries.size() : " << request.menuEntries.size();
|
||||
Core::FunctionReplyObject ret = ifs->createFromDds(request);
|
||||
|
||||
if (ret.error())
|
||||
@@ -247,15 +247,15 @@ Core::FunctionReplyObject HandlerMenuStruct::createMenuStructRequest(const MenuS
|
||||
|
||||
Core::FunctionReplyObject HandlerMenuStruct::modifyMenuStructRequest(const MenuStruct &request)
|
||||
{
|
||||
ObjectMenuStruct *ifs = m_objMap.value(request.id());
|
||||
ObjectMenuStruct *ifs = m_objMap.value(request.id);
|
||||
if (ifs == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "MenuStruct with id %1 not found")).arg(request.id());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "MenuStruct with id %1 not found")).arg(request.id);
|
||||
|
||||
auto ret = ifs->updateFromDds(request);
|
||||
if (ret.error())
|
||||
return ret;
|
||||
|
||||
Q_ASSERT(ifs->getId() == request.id());
|
||||
Q_ASSERT(ifs->getId() == request.id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -264,12 +264,12 @@ void HandlerMenuStruct::onRemoveMenuStructRequest(const rti::core::SampleIdentit
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
INFO_LOG(m_logger) << "onRemoveMenuStructRequest id = " << request.id();
|
||||
INFO_LOG(m_logger) << "onRemoveMenuStructRequest id = " << request.id;
|
||||
|
||||
ObjectMenuStruct *ifs = m_objMap.value(request.id());
|
||||
ObjectMenuStruct *ifs = m_objMap.value(request.id);
|
||||
if (ifs == nullptr)
|
||||
{
|
||||
ret = Core::FunctionReplyObject(request.id(), tr_lts("dds", "MenuStruct with id %1 not found")).arg(request.id());
|
||||
ret = Core::FunctionReplyObject(request.id, tr_lts("dds", "MenuStruct with id %1 not found")).arg(request.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -277,7 +277,7 @@ void HandlerMenuStruct::onRemoveMenuStructRequest(const rti::core::SampleIdentit
|
||||
|
||||
if (!ret.error())
|
||||
{
|
||||
m_objMap.remove(request.id());
|
||||
m_objMap.remove(request.id);
|
||||
delete ifs;
|
||||
}
|
||||
}
|
||||
|
||||
+60
-60
@@ -100,7 +100,7 @@ void HandlerVideoReceiver::onVideoReceiverModifyRequest(const rti::core::SampleI
|
||||
const VideoReceiverModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onVideoReceiverModifyRequest: " << request;
|
||||
auto ret = request.id() > 0 ? videoReceiverModifyRequest(request) : videoReceiverCreateRequest(request);
|
||||
auto ret = request.id > 0 ? videoReceiverModifyRequest(request) : videoReceiverCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_fts->videoReceiverModifyReply(cookie, ret);
|
||||
@@ -116,7 +116,7 @@ void HandlerVideoReceiver::onVideoReceiverModifyActiveRequest(const rti::core::S
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
else
|
||||
// activate channel here
|
||||
activateChannel(request.id(), request.isActive());
|
||||
activateChannel(request.id, request.isActive);
|
||||
m_fts->videoReceiverModifyActiveReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -134,17 +134,17 @@ void HandlerVideoReceiver::onVideoReceiverModifyAvsRequest(const rti::core::Samp
|
||||
VideoReceiver HandlerVideoReceiver::convert(const VideoReceiverModifyRequest &request)
|
||||
{
|
||||
VideoReceiver newData;
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id());
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id);
|
||||
if (ifs)
|
||||
newData = ifs->getData();
|
||||
newData.id(request.id());
|
||||
newData.mainStructureElementId(request.mainStructureElementId());
|
||||
newData.teamId(request.teamId());
|
||||
newData.streamName(request.streamName());
|
||||
newData.info(request.info());
|
||||
newData.hostName(request.hostName());
|
||||
newData.frequency(request.frequency());
|
||||
newData.isLocked(request.isLocked());
|
||||
newData.id = request.id;
|
||||
newData.mainStructureElementId = request.mainStructureElementId;
|
||||
newData.teamId = request.teamId;
|
||||
newData.streamName = request.streamName;
|
||||
newData.info = request.info;
|
||||
newData.hostName = request.hostName;
|
||||
newData.frequency = request.frequency;
|
||||
newData.isLocked = request.isLocked;
|
||||
return newData;
|
||||
}
|
||||
|
||||
@@ -152,12 +152,12 @@ VideoReceiver HandlerVideoReceiver::convert(const VideoReceiverModifyRequest &re
|
||||
VideoReceiver HandlerVideoReceiver::convertAvs(const VideoReceiverModifyAvsRequest &request)
|
||||
{
|
||||
VideoReceiver newData;
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id());
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id);
|
||||
if (ifs)
|
||||
newData = ifs->getData();
|
||||
newData.id(request.id());
|
||||
newData.dbm(request.dbm());
|
||||
newData.snr(request.snr());
|
||||
newData.id = request.id;
|
||||
newData.dbm = request.dbm;
|
||||
newData.snr = request.snr;
|
||||
return newData;
|
||||
}
|
||||
|
||||
@@ -165,11 +165,11 @@ VideoReceiver HandlerVideoReceiver::convertAvs(const VideoReceiverModifyAvsReque
|
||||
VideoReceiver HandlerVideoReceiver::convertActive(const VideoReceiverModifyActiveRequest &request)
|
||||
{
|
||||
VideoReceiver newData;
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id());
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id);
|
||||
if (ifs)
|
||||
newData = ifs->getData();
|
||||
newData.id(request.id());
|
||||
newData.isActive(request.isActive());
|
||||
newData.id = request.id;
|
||||
newData.isActive = request.isActive;
|
||||
return newData;
|
||||
}
|
||||
|
||||
@@ -177,9 +177,9 @@ VideoReceiver HandlerVideoReceiver::convertActive(const VideoReceiverModifyActiv
|
||||
Core::FunctionReplyObject HandlerVideoReceiver::videoReceiverModifyRequest(const VideoReceiverModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "videoReceiverModifyRequest";
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id());
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id);
|
||||
if (ifs == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id);
|
||||
|
||||
return ifs->updateObject(convert(request));
|
||||
}
|
||||
@@ -187,9 +187,9 @@ Core::FunctionReplyObject HandlerVideoReceiver::videoReceiverModifyRequest(const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerVideoReceiver::videoReceiverModifyActiveRequest(const VideoReceiverModifyActiveRequest &request)
|
||||
{
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id());
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id);
|
||||
if (ifs == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id);
|
||||
|
||||
return ifs->updateObject(convertActive(request));
|
||||
}
|
||||
@@ -197,9 +197,9 @@ Core::FunctionReplyObject HandlerVideoReceiver::videoReceiverModifyActiveRequest
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerVideoReceiver::videoReceiverModifyAvsRequest(const VideoReceiverModifyAvsRequest &request)
|
||||
{
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id());
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id);
|
||||
if (ifs == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id);
|
||||
|
||||
return ifs->updateObject(convertAvs(request));
|
||||
}
|
||||
@@ -223,18 +223,18 @@ void HandlerVideoReceiver::onVideoReceiverRemoveRequest(const rti::core::SampleI
|
||||
const Core::RemoveElementRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id());
|
||||
ObjectVideoReceiver *ifs = m_videoReceiverObjMap.value(request.id);
|
||||
|
||||
if (ifs == nullptr)
|
||||
{
|
||||
ret = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id());
|
||||
ret = Core::FunctionReplyObject(request.id, tr_lts("dds", "Video Receiver with id %1 not found")).arg(request.id);
|
||||
m_fts->videoReceiverRemoveReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_mainHandler->ddsHandler()->topicLockMaster()->isLocked(ifs->getData(), m_mainHandler->exerciseId()))
|
||||
{
|
||||
ret = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Video Receiver '%1' is used by another user!")).arg(ifs->getId());
|
||||
ret = Core::FunctionReplyObject(request.id, tr_lts("dds", "Video Receiver '%1' is used by another user!")).arg(ifs->getId());
|
||||
m_fts->videoReceiverRemoveReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ void HandlerVideoReceiver::onVideoReceiverRemoveRequest(const rti::core::SampleI
|
||||
{
|
||||
// delete ObjectVideoReceiver
|
||||
delete ifs;
|
||||
m_videoReceiverObjMap.remove(request.id());
|
||||
m_videoReceiverObjMap.remove(request.id);
|
||||
}
|
||||
|
||||
m_fts->videoReceiverRemoveReply(cookie, ret);
|
||||
@@ -266,16 +266,16 @@ void HandlerVideoReceiver::onGetStatus()
|
||||
{
|
||||
i.next();
|
||||
ObjectVideoReceiver *objectVideoReceiver = i.value();
|
||||
QString host = QString::fromStdString(objectVideoReceiver->getData().hostName()).toLower();
|
||||
QString host = QString::fromStdString(objectVideoReceiver->getData().hostName).toLower();
|
||||
|
||||
DEBUG_LOG(m_logger) << " streamName=" << objectVideoReceiver->getData().streamName()
|
||||
DEBUG_LOG(m_logger) << " streamName=" << objectVideoReceiver->getData().streamName
|
||||
<< " hostName=" << host
|
||||
<< " teamId=" << objectVideoReceiver->getData().teamId();
|
||||
if ((objectVideoReceiver->getData().teamId() == 1)
|
||||
<< " teamId=" << objectVideoReceiver->getData().teamId;
|
||||
if ((objectVideoReceiver->getData().teamId == 1)
|
||||
&& (!m_receiver.contains(host)))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " onSendHttpRequest host=" << host << " key=" << i.key()
|
||||
<< " id=" << objectVideoReceiver->getData().id();
|
||||
<< " id=" << objectVideoReceiver->getData().id;
|
||||
m_receiver.insert(host, i.key());
|
||||
onSendHttpRequest(i.key());
|
||||
}
|
||||
@@ -289,7 +289,7 @@ void HandlerVideoReceiver::onSendHttpRequest(const int key)
|
||||
//request = QStringLiteral("http://localhost/set_param?remuxBitrate=90.0");
|
||||
//request = QStringLiteral("http://localhost/status.json");
|
||||
ObjectVideoReceiver *objectVideoReceiver = m_videoReceiverObjMap.value(key);
|
||||
QString hostname = QString::fromStdString(objectVideoReceiver->getData().hostName());
|
||||
QString hostname = QString::fromStdString(objectVideoReceiver->getData().hostName);
|
||||
const QString request = QStringLiteral("http://%1/status.json").arg(hostname);
|
||||
|
||||
startRequest(QUrl(request));
|
||||
@@ -547,13 +547,13 @@ void HandlerVideoReceiver::onHttpFinished(QNetworkReply *reply)
|
||||
ObjectVideoReceiver *objectVideoReceiver = i.value();
|
||||
DEBUG_LOG(m_logger) << "key=" << i.key()
|
||||
<< " : value.Id=" << objectVideoReceiver->getId()
|
||||
<< " mse=" << objectVideoReceiver->getData().mainStructureElementId()
|
||||
<< " streamName=" << objectVideoReceiver->getData().streamName()
|
||||
<< " hostName=" << objectVideoReceiver->getData().hostName()
|
||||
<< " teamId=" << objectVideoReceiver->getData().teamId()
|
||||
<< " snr=" << objectVideoReceiver->getData().snr()
|
||||
<< " dbm=" << objectVideoReceiver->getData().dbm()
|
||||
<< " isActive=" << objectVideoReceiver->getData().isActive();
|
||||
<< " mse=" << objectVideoReceiver->getData().mainStructureElementId
|
||||
<< " streamName=" << objectVideoReceiver->getData().streamName
|
||||
<< " hostName=" << objectVideoReceiver->getData().hostName
|
||||
<< " teamId=" << objectVideoReceiver->getData().teamId
|
||||
<< " snr=" << objectVideoReceiver->getData().snr
|
||||
<< " dbm=" << objectVideoReceiver->getData().dbm
|
||||
<< " isActive=" << objectVideoReceiver->getData().isActive;
|
||||
}
|
||||
reply->deleteLater();
|
||||
checkActiveState(key, remuxInputMask);
|
||||
@@ -566,17 +566,17 @@ void HandlerVideoReceiver::updateObject(const int key, const double powerLevel,
|
||||
if (ifs)
|
||||
{
|
||||
newData = ifs->getData();
|
||||
newData.id(ifs->getId());
|
||||
newData.mainStructureElementId(ifs->getData().mainStructureElementId());
|
||||
newData.teamId(ifs->getData().teamId());
|
||||
newData.streamName(ifs->getData().streamName());
|
||||
newData.hostName(ifs->getData().hostName());
|
||||
newData.info(ifs->getData().info());
|
||||
newData.dbm(powerLevel);
|
||||
newData.snr(snr);
|
||||
newData.isActive(ifs->getData().isActive());
|
||||
newData.isLocked(lockstatus);
|
||||
newData.frequency(frequency);
|
||||
newData.id = ifs->getId();
|
||||
newData.mainStructureElementId = ifs->getData().mainStructureElementId;
|
||||
newData.teamId = ifs->getData().teamId;
|
||||
newData.streamName = ifs->getData().streamName;
|
||||
newData.hostName = ifs->getData().hostName;
|
||||
newData.info = ifs->getData().info;
|
||||
newData.dbm = powerLevel;
|
||||
newData.snr = snr;
|
||||
newData.isActive = ifs->getData().isActive;
|
||||
newData.isLocked = lockstatus;
|
||||
newData.frequency = frequency;
|
||||
ifs->updateObject(newData);
|
||||
}
|
||||
}
|
||||
@@ -584,7 +584,7 @@ void HandlerVideoReceiver::updateObject(const int key, const double powerLevel,
|
||||
void HandlerVideoReceiver::activateChannel(const int channelId, const bool activate)
|
||||
{
|
||||
// send new Host HTTP-Request to VideoReceiver
|
||||
QString hostName = QString::fromStdString(m_videoReceiverObjMap.value(channelId)->getData().hostName());
|
||||
QString hostName = QString::fromStdString(m_videoReceiverObjMap.value(channelId)->getData().hostName);
|
||||
int active1 = 0;
|
||||
int active2 = 0;
|
||||
int active = 0;
|
||||
@@ -592,7 +592,7 @@ void HandlerVideoReceiver::activateChannel(const int channelId, const bool activ
|
||||
DEBUG_LOG(m_logger) << "activateChannel channelId=" << channelId
|
||||
<< " activate = " << activate
|
||||
<< " hostname = " << hostName
|
||||
<< " teamId = " << m_videoReceiverObjMap.value(channelId)->getData().teamId();
|
||||
<< " teamId = " << m_videoReceiverObjMap.value(channelId)->getData().teamId;
|
||||
|
||||
// make sure there are 2 channels
|
||||
|
||||
@@ -602,7 +602,7 @@ void HandlerVideoReceiver::activateChannel(const int channelId, const bool activ
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_videoReceiverObjMap.value(channelId)->getData().teamId() == 1)
|
||||
if (m_videoReceiverObjMap.value(channelId)->getData().teamId == 1)
|
||||
{
|
||||
id = channelId;
|
||||
active1 = activate;
|
||||
@@ -611,14 +611,14 @@ void HandlerVideoReceiver::activateChannel(const int channelId, const bool activ
|
||||
ERROR_LOG(m_logger) << "channelId " << id + 1 << " does not exist";
|
||||
return;
|
||||
}
|
||||
active2 = m_videoReceiverObjMap.value(id + 1)->getData().isActive();
|
||||
active2 = m_videoReceiverObjMap.value(id + 1)->getData().isActive;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = channelId - 1;
|
||||
if (!m_videoReceiverObjMap.contains(id))
|
||||
return;
|
||||
active1 = m_videoReceiverObjMap.value(id)->getData().isActive();
|
||||
active1 = m_videoReceiverObjMap.value(id)->getData().isActive;
|
||||
active2 = activate;
|
||||
}
|
||||
active = active1 + active2 * 2;
|
||||
@@ -646,10 +646,10 @@ void HandlerVideoReceiver::checkActiveState(const int key, const int remuxInputM
|
||||
<< " remuxInputMask=" << remuxInputMask << " channel1 == nullptr";
|
||||
return;
|
||||
}
|
||||
int channel1Active = channel1->getData().isActive();
|
||||
QString host = QString::fromStdString(channel1->getData().hostName()).toLower();
|
||||
int channel1Active = channel1->getData().isActive;
|
||||
QString host = QString::fromStdString(channel1->getData().hostName).toLower();
|
||||
ObjectVideoReceiver *channel2 = m_videoReceiverObjMap.value(key + 1);
|
||||
int channel2Active = channel2->getData().isActive();
|
||||
int channel2Active = channel2->getData().isActive;
|
||||
int active = channel1Active + channel2Active * 2;
|
||||
DEBUG_LOG(m_logger) << "checkActiveState "
|
||||
<< " key=" << key
|
||||
|
||||
+23
-23
@@ -31,36 +31,36 @@ public:
|
||||
|
||||
void create(const VideoTeam &videoTeam)
|
||||
{
|
||||
Q_ASSERT(!m_cache.contains(videoTeam.id()));
|
||||
Q_ASSERT(!m_cache.contains(videoTeam.id));
|
||||
|
||||
Database::AvmDeviceConfig deviceConfig = toDeviceConfig(videoTeam);
|
||||
|
||||
if (!m_db->insert(deviceConfig))
|
||||
ERROR_LOG(m_logger) << "Error while inserting device config into database";
|
||||
|
||||
m_cache.insert(videoTeam.id(), deviceConfig);
|
||||
m_cache.insert(videoTeam.id, deviceConfig);
|
||||
emit m_handler->avDbReloadNeeded();
|
||||
}
|
||||
|
||||
void update(const VideoTeam &videoTeam)
|
||||
{
|
||||
Q_ASSERT(m_cache.contains(videoTeam.id()));
|
||||
Q_ASSERT(m_cache.contains(videoTeam.id));
|
||||
|
||||
Database::AvmDeviceConfig deviceConfig = toDeviceConfig(videoTeam);
|
||||
|
||||
const Database::AvmDeviceConfig &oldDeviceConfig = m_cache[videoTeam.id()];
|
||||
const Database::AvmDeviceConfig &oldDeviceConfig = m_cache[videoTeam.id];
|
||||
deviceConfig.id = oldDeviceConfig.id;
|
||||
|
||||
if (!m_db->update(deviceConfig))
|
||||
ERROR_LOG(m_logger) << "Error while updating device config";
|
||||
|
||||
m_cache[videoTeam.id()] = deviceConfig;
|
||||
m_cache[videoTeam.id] = deviceConfig;
|
||||
emit m_handler->avDbReloadNeeded();
|
||||
}
|
||||
|
||||
void createOrUpdate(const VideoTeam &videoTeam)
|
||||
{
|
||||
if (m_cache.contains(videoTeam.id()))
|
||||
if (m_cache.contains(videoTeam.id))
|
||||
update(videoTeam);
|
||||
else
|
||||
create(videoTeam);
|
||||
@@ -88,12 +88,12 @@ private:
|
||||
static Database::AvmDeviceConfig toDeviceConfig(const VideoTeam &videoTeam)
|
||||
{
|
||||
Database::AvmDeviceConfig result;
|
||||
result.context = ExerciseContext(videoTeam.exerciseId()).toString();
|
||||
result.context = ExerciseContext(videoTeam.exerciseId).toString();
|
||||
result.type = QStringLiteral("DEKTEC_VIDEO_CHANNEL");
|
||||
result.name = QString::fromStdString(videoTeam.streamName());
|
||||
result.name = QString::fromStdString(videoTeam.streamName);
|
||||
result.controller = QStringLiteral("EXCAVS01");
|
||||
result.definition = QStringLiteral("mode=1;ssrc=%1;port=%2;programid=%3;programtimeoffset=%4;recording=ECRS@%5")
|
||||
.arg(videoTeam.ssrc()).arg(videoTeam.vtPort()).arg(videoTeam.programId()).arg(videoTeam.timeOffset()).arg(result.controller);
|
||||
.arg(videoTeam.ssrc).arg(videoTeam.vtPort).arg(videoTeam.programId).arg(videoTeam.timeOffset).arg(result.controller);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ void HandlerVideoTeam::onVideoTeamModifyRequest(const rti::core::SampleIdentity
|
||||
const VideoTeamModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onVideoTeamModifyRequest: " << request;
|
||||
auto ret = request.id() > 0 ? videoTeamModifyRequest(request) : videoTeamCreateRequest(request);
|
||||
auto ret = request.id > 0 ? videoTeamModifyRequest(request) : videoTeamCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_fts->videoTeamModifyReply(cookie, ret);
|
||||
@@ -186,9 +186,9 @@ void HandlerVideoTeam::onVideoTeamModifyRequest(const rti::core::SampleIdentity
|
||||
|
||||
bool HandlerVideoTeam::needDeviceConfig(const VideoTeam &videoTeam) const
|
||||
{
|
||||
if (videoTeam.exerciseId() == 0)
|
||||
if (videoTeam.exerciseId == 0)
|
||||
return false;
|
||||
return m_activeExercises->isActive(ExerciseContext(videoTeam.exerciseId()));
|
||||
return m_activeExercises->isActive(ExerciseContext(videoTeam.exerciseId));
|
||||
}
|
||||
|
||||
void HandlerVideoTeam::onContextActivated(const ExerciseContext &context)
|
||||
@@ -196,7 +196,7 @@ void HandlerVideoTeam::onContextActivated(const ExerciseContext &context)
|
||||
for (const auto *ifs : qAsConst(m_videoTeamObjMap))
|
||||
{
|
||||
VideoTeam ddsData = ifs->getData();
|
||||
if (ddsData.exerciseId() == context.id())
|
||||
if (ddsData.exerciseId == context.id())
|
||||
m_deviceConfig->create(ddsData);
|
||||
}
|
||||
}
|
||||
@@ -208,10 +208,10 @@ void HandlerVideoTeam::onContextDeactivated(const ExerciseContext &context)
|
||||
if (ifs->exerciseId() == context.id())
|
||||
{
|
||||
VideoTeam ddsData = ifs->getData();
|
||||
ddsData.exerciseId(0);
|
||||
ddsData.streamName(std::string());
|
||||
ddsData.exerciseId = 0;
|
||||
ddsData.streamName = std::string();
|
||||
ifs->updateObject(ddsData);
|
||||
m_deviceConfig->remove(ddsData.id());
|
||||
m_deviceConfig->remove(ddsData.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,27 +219,27 @@ void HandlerVideoTeam::onContextDeactivated(const ExerciseContext &context)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
static VideoTeam convert(const VideoTeamModifyRequest &request, const VideoTeam &oldData)
|
||||
{
|
||||
Q_ASSERT(request.id() == oldData.id());
|
||||
Q_ASSERT(request.id == oldData.id);
|
||||
|
||||
VideoTeam newData(oldData);
|
||||
newData.streamName(request.streamName());
|
||||
newData.exerciseId(request.exerciseId());
|
||||
newData.streamName = request.streamName;
|
||||
newData.exerciseId = request.exerciseId;
|
||||
return newData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerVideoTeam::videoTeamModifyRequest(const VideoTeamModifyRequest &request)
|
||||
{
|
||||
ObjectVideoTeam *ifs = m_videoTeamObjMap.value(request.id());
|
||||
ObjectVideoTeam *ifs = m_videoTeamObjMap.value(request.id);
|
||||
if (ifs == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Video Team with id %1 not found")).arg(request.id());
|
||||
DEBUG_LOG(m_logger) << "on Modify Request" << request.streamName() << " ID: " << request.name() << " exId " << request.exerciseId();
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Video Team with id %1 not found")).arg(request.id);
|
||||
DEBUG_LOG(m_logger) << "on Modify Request" << request.streamName << " ID: " << request.name << " exId " << request.exerciseId;
|
||||
|
||||
VideoTeam ddsData = convert(request, ifs->getData());
|
||||
if (needDeviceConfig(ddsData))
|
||||
m_deviceConfig->createOrUpdate(ddsData);
|
||||
else
|
||||
m_deviceConfig->tryRemove(ddsData.id());
|
||||
m_deviceConfig->tryRemove(ddsData.id);
|
||||
|
||||
Core::FunctionReplyObject ret = ifs->updateObject(ddsData);
|
||||
emit mvsChanged();
|
||||
|
||||
@@ -26,7 +26,7 @@ Database::AvmDeviceConfig toDb(const ExerciseContext &context, const AssetManage
|
||||
deviceConfig.context = context.toString();
|
||||
deviceConfig.type = QStringLiteral("IMPORT_VIDEO_CHANNEL");
|
||||
deviceConfig.name = QStringLiteral("ECRS");
|
||||
deviceConfig.controller = QString::fromStdString(asset.name());
|
||||
deviceConfig.controller = QString::fromStdString(asset.name);
|
||||
deviceConfig.definition = QStringLiteral("recording=ECRS@EXCAVS01");
|
||||
return deviceConfig;
|
||||
}
|
||||
@@ -91,11 +91,11 @@ void ImportHandler::onAssetChanged(const AssetManagement::Asset &asset, DataModi
|
||||
if (!m_isActive)
|
||||
return;
|
||||
|
||||
if (asset.assetTypeId() != AssetManagement::AssetType::Workstation)
|
||||
if (asset.assetTypeId != AssetManagement::AssetType::Workstation)
|
||||
return;
|
||||
|
||||
// Guard against a possible race condition, see comments in onContextActivated().
|
||||
auto found = m_deviceConfigs.find(asset.id());
|
||||
auto found = m_deviceConfigs.find(asset.id);
|
||||
if (found != m_deviceConfigs.end())
|
||||
return;
|
||||
|
||||
@@ -121,14 +121,14 @@ void ImportHandler::addToDb(const AssetManagement::Asset &asset)
|
||||
{
|
||||
Database::AvmDeviceConfig newConfig = ::toDb(m_context, asset);
|
||||
m_db->insert(newConfig);
|
||||
auto insertResult = m_deviceConfigs.insert({asset.id(), newConfig});
|
||||
auto insertResult = m_deviceConfigs.insert({asset.id, newConfig});
|
||||
Q_ASSERT(insertResult.second);
|
||||
emit avDbReloadNeeded();
|
||||
}
|
||||
|
||||
void ImportHandler::removeFromDb(const AssetManagement::Asset &asset)
|
||||
{
|
||||
auto found = m_deviceConfigs.find(asset.id());
|
||||
auto found = m_deviceConfigs.find(asset.id);
|
||||
Q_ASSERT(found != m_deviceConfigs.end());
|
||||
m_db->removeAvmDeviceConfig(found->second.id);
|
||||
m_deviceConfigs.erase(found);
|
||||
|
||||
+45
-45
@@ -28,29 +28,29 @@ ObjectFrequencyPlanningStatus::~ObjectFrequencyPlanningStatus()
|
||||
Core::FunctionReplyObject ObjectFrequencyPlanningStatus::clearValues()
|
||||
{
|
||||
auto data(m_data);
|
||||
data.uuid() = std::string();
|
||||
data.sent().reset();
|
||||
data.received().reset();
|
||||
data.activated().reset();
|
||||
data.isActive() = false;
|
||||
data.requester() = std::string();
|
||||
data.content() = std::string();
|
||||
data.reason() = TransmissionReason::TR_Unknown;
|
||||
data.uuid = std::string();
|
||||
data.sent.reset();
|
||||
data.received.reset();
|
||||
data.activated.reset();
|
||||
data.isActive = false;
|
||||
data.requester = std::string();
|
||||
data.content = std::string();
|
||||
data.reason = TransmissionReason::TR_Unknown;
|
||||
return updateObject(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectFrequencyPlanningStatus::createObject(const FrequencyPlanningStatus &data)
|
||||
{
|
||||
Q_ASSERT(m_data.id() <= 0);
|
||||
Q_ASSERT(data.id() > 0); // only allow creation from existing db-entries
|
||||
Q_ASSERT(m_data.id <= 0);
|
||||
Q_ASSERT(data.id > 0); // only allow creation from existing db-entries
|
||||
|
||||
m_data = data;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
@@ -60,52 +60,52 @@ Core::FunctionReplyObject ObjectFrequencyPlanningStatus::createObjectFromDDS(con
|
||||
|
||||
Database::AvmFrequencyPlanningStatus dbData(toDbData(data));
|
||||
if (!m_db->insert(dbData))
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating VideoTeam into database"));
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Error updating VideoTeam into database"));
|
||||
|
||||
m_data.id() = dbData.id;
|
||||
DEBUG_LOG(m_logger) << "Data changed for VideoTeam Id: " << m_data.id();
|
||||
m_data.id = dbData.id;
|
||||
DEBUG_LOG(m_logger) << "Data changed for VideoTeam Id: " << m_data.id;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(data.id());
|
||||
return Core::FunctionReplyObject(data.id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectFrequencyPlanningStatus::updateObject(const FrequencyPlanningStatus &data)
|
||||
{
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Object not valid/blocked"));
|
||||
|
||||
m_data = data;
|
||||
|
||||
Database::AvmFrequencyPlanningStatus dbData(toDbData(m_data));
|
||||
if (!m_db->update(dbData))
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating FrequencyPlanningStatus into database"));
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Error updating FrequencyPlanningStatus into database"));
|
||||
|
||||
DEBUG_LOG(m_logger) << "Data changed for FrequencyPlanningStatus Id: " << data.id();
|
||||
DEBUG_LOG(m_logger) << "Data changed for FrequencyPlanningStatus Id: " << data.id;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(data.id());
|
||||
return Core::FunctionReplyObject(data.id);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject ObjectFrequencyPlanningStatus::removeObject()
|
||||
{
|
||||
if (!m_db->removeAvmFrequencyPlanningStatus(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "FrequencyPlanningStatus with id %1 can not be removed from DB")).arg(m_data.id());
|
||||
if (!m_db->removeAvmFrequencyPlanningStatus(m_data.id))
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "FrequencyPlanningStatus with id %1 can not be removed from DB")).arg(m_data.id);
|
||||
|
||||
if (!m_dts->removeFrequencyPlanningStatusByKey(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "FrequencyPlanningStatus with id %1 can not be removed from DDS")).arg(m_data.id());
|
||||
if (!m_dts->removeFrequencyPlanningStatusByKey(m_data.id))
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "FrequencyPlanningStatus with id %1 can not be removed from DDS")).arg(m_data.id);
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
void ObjectFrequencyPlanningStatus::onPublishData()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Publish ObjectFrequencyPlanningStatus to dds (" << m_data.id() << ") ..." << m_data.client() << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish ObjectFrequencyPlanningStatus to dds (" << m_data.id << ") ..." << m_data.client << ") ...";
|
||||
|
||||
if (!m_dts->publish(m_data))
|
||||
ERROR_LOG(m_logger) << "Error publishing ObjectFrequencyPlanningStatus to dds";
|
||||
@@ -116,20 +116,20 @@ Database::AvmFrequencyPlanningStatus ObjectFrequencyPlanningStatus::toDbData(con
|
||||
{
|
||||
Database::AvmFrequencyPlanningStatus dbData;
|
||||
|
||||
dbData.id = ddsData.id();
|
||||
dbData.uuid = QString::fromStdString(ddsData.uuid());
|
||||
dbData.client = ddsData.client();
|
||||
dbData.isActive = ddsData.isActive();
|
||||
dbData.requester = QString::fromStdString(ddsData.requester());
|
||||
dbData.content = QString::fromStdString(ddsData.content());
|
||||
dbData.reason = ddsData.reason().underlying();
|
||||
dbData.id = ddsData.id;
|
||||
dbData.uuid = QString::fromStdString(ddsData.uuid);
|
||||
dbData.client = ddsData.client;
|
||||
dbData.isActive = ddsData.isActive;
|
||||
dbData.requester = QString::fromStdString(ddsData.requester);
|
||||
dbData.content = QString::fromStdString(ddsData.content);
|
||||
dbData.reason = static_cast<int>(ddsData.reason);
|
||||
|
||||
if (ddsData.sent.is_set())
|
||||
dbData.sent = ddsData.sent.get();
|
||||
dbData.sent = static_cast<qint64>(ddsData.sent.get());
|
||||
if (ddsData.received.is_set())
|
||||
dbData.received = ddsData.received.get();
|
||||
dbData.received = static_cast<qint64>(ddsData.received.get());
|
||||
if (ddsData.activated.is_set())
|
||||
dbData.activated = ddsData.activated.get();
|
||||
dbData.activated = static_cast<qint64>(ddsData.activated.get());
|
||||
|
||||
return dbData;
|
||||
}
|
||||
@@ -139,20 +139,20 @@ AudioVideoManagement::FrequencyPlanningStatus ObjectFrequencyPlanningStatus::toD
|
||||
{
|
||||
AudioVideoManagement::FrequencyPlanningStatus ddsData;
|
||||
|
||||
ddsData.id(dbData.id);
|
||||
ddsData.uuid() = dbData.uuid.toStdString();
|
||||
ddsData.client() = dbData.client;
|
||||
ddsData.isActive() = dbData.isActive;
|
||||
ddsData.requester() = dbData.requester.toStdString();
|
||||
ddsData.content() = dbData.content.toStdString();
|
||||
ddsData.reason() = static_cast<TransmissionReason::inner_enum>(dbData.reason);
|
||||
ddsData.id = dbData.id;
|
||||
ddsData.uuid = dbData.uuid.toStdString();
|
||||
ddsData.client = dbData.client;
|
||||
ddsData.isActive = dbData.isActive;
|
||||
ddsData.requester = dbData.requester.toStdString();
|
||||
ddsData.content = dbData.content.toStdString();
|
||||
ddsData.reason = static_cast<TransmissionReason>(dbData.reason);
|
||||
|
||||
if (!dbData.sent.isNull())
|
||||
ddsData.sent(dbData.sent.value<int>());
|
||||
ddsData.sent = dbData.sent.value<int>();
|
||||
if (!dbData.received.isNull())
|
||||
ddsData.received(dbData.received.value<int>());
|
||||
ddsData.received = dbData.received.value<int>();
|
||||
if (!dbData.activated.isNull())
|
||||
ddsData.activated(dbData.activated.value<int>());
|
||||
ddsData.activated = dbData.activated.value<int>();
|
||||
|
||||
return ddsData;
|
||||
} // end of toDdsData()
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ public:
|
||||
DatabaseInterface *db);
|
||||
~ObjectFrequencyPlanningStatus();
|
||||
|
||||
int getId() const { return m_data.id(); }
|
||||
int getId() const { return m_data.id; }
|
||||
FrequencyPlanningStatus getData() const { return m_data; }
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
static Database::AvmFrequencyPlanningStatus toDbData(const FrequencyPlanningStatus &ddsData); // dds -> db
|
||||
static FrequencyPlanningStatus toDdsData(const Database::AvmFrequencyPlanningStatus &dbData); // db -> dds
|
||||
|
||||
bool isValid() const { return (m_data.client() > 0); }
|
||||
bool isValid() const { return (m_data.client > 0); }
|
||||
|
||||
protected:
|
||||
void onPublishData();
|
||||
|
||||
+50
-50
@@ -28,12 +28,12 @@ AudioVideoManagement::Database::AvmMenuStruct toDb(const AudioVideoManagement::A
|
||||
{
|
||||
AudioVideoManagement::Database::AvmMenuStruct dbItem;
|
||||
|
||||
dbItem.id = ddsItem.id() <= 0 ? 0 : ddsItem.id();
|
||||
dbItem.id = ddsItem.id <= 0 ? 0 : ddsItem.id;
|
||||
dbItem.parentId = parentId;
|
||||
dbItem.isGroup = ddsItem.isGroup();
|
||||
dbItem.rowid = ddsItem.rowId();
|
||||
dbItem.isGroup = ddsItem.isGroup;
|
||||
dbItem.rowid = ddsItem.rowId;
|
||||
|
||||
if (ddsItem.isGroup())
|
||||
if (ddsItem.isGroup)
|
||||
dbItem.name = QString::fromStdString(ddsItem.name.get());
|
||||
else
|
||||
dbItem.mountingPointId = ddsItem.mountingPointId.get();
|
||||
@@ -45,27 +45,27 @@ void checkHierarchy(const std::vector<AudioVideoManagement::AvMenuEntry> &entrie
|
||||
{
|
||||
std::vector<AudioVideoManagement::AvMenuEntry> entries = entries_;
|
||||
|
||||
auto isToplevel = [toplevelId] (const AudioVideoManagement::AvMenuEntry &entry) { return entry.parentId() == toplevelId; };
|
||||
auto isToplevel = [toplevelId] (const AudioVideoManagement::AvMenuEntry &entry) { return entry.parentId == toplevelId; };
|
||||
auto sublevelStart = std::partition(entries.begin(), entries.end(), isToplevel);
|
||||
|
||||
std::set<int32_t> ids;
|
||||
std::set<int32_t> groupIds;
|
||||
for (auto entry = entries.begin(); entry != sublevelStart; ++entry)
|
||||
{
|
||||
auto result = ids.insert(entry->id());
|
||||
auto result = ids.insert(entry->id);
|
||||
Q_ASSERT(result.second);
|
||||
|
||||
if (entry->isGroup())
|
||||
groupIds.insert(entry->id());
|
||||
if (entry->isGroup)
|
||||
groupIds.insert(entry->id);
|
||||
}
|
||||
|
||||
for (auto entry = sublevelStart; entry != entries.end(); ++entry)
|
||||
{
|
||||
auto result = ids.insert(entry->id());
|
||||
auto result = ids.insert(entry->id);
|
||||
Q_ASSERT(result.second);
|
||||
|
||||
Q_ASSERT(!entry->isGroup());
|
||||
Q_ASSERT(groupIds.count(entry->parentId()) > 0);
|
||||
Q_ASSERT(!entry->isGroup);
|
||||
Q_ASSERT(groupIds.count(entry->parentId) > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ ObjectMenuStruct::ObjectMenuStruct(Interface::Dts *dts, DatabaseInterface *db)
|
||||
|
||||
ObjectMenuStruct::~ObjectMenuStruct()
|
||||
{
|
||||
m_dts->removeMenuStructByKey(m_data.id());
|
||||
m_dts->removeMenuStructByKey(m_data.id);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject ObjectMenuStruct::createFromDds(const MenuStruct &data)
|
||||
{
|
||||
Q_ASSERT(data.id() <= 0 && m_data.id() <= 0);
|
||||
Q_ASSERT(data.id <= 0 && m_data.id <= 0);
|
||||
auto reply = insertUpdateDb(data);
|
||||
onPublishData();
|
||||
return reply;
|
||||
@@ -99,7 +99,7 @@ Core::FunctionReplyObject ObjectMenuStruct::createFromDds(const MenuStruct &data
|
||||
|
||||
Core::FunctionReplyObject ObjectMenuStruct::updateFromDds(const MenuStruct &data)
|
||||
{
|
||||
Q_ASSERT(data.id() > 0 && data.id() == m_data.id());
|
||||
Q_ASSERT(data.id > 0 && data.id == m_data.id);
|
||||
auto reply = insertUpdateDb(data);
|
||||
onPublishData();
|
||||
return reply;
|
||||
@@ -107,19 +107,19 @@ Core::FunctionReplyObject ObjectMenuStruct::updateFromDds(const MenuStruct &data
|
||||
|
||||
void ObjectMenuStruct::createFromDb(const MenuStruct &data)
|
||||
{
|
||||
Q_ASSERT(data.id() > 0 && m_data.id() <= 0);
|
||||
checkHierarchy(data.menuEntries(), data.id());
|
||||
Q_ASSERT(data.id > 0 && m_data.id <= 0);
|
||||
checkHierarchy(data.menuEntries, data.id);
|
||||
m_data = data;
|
||||
onPublishData();
|
||||
}
|
||||
|
||||
void ObjectMenuStruct::updateFromDb(const MenuStruct &data)
|
||||
{
|
||||
Q_ASSERT(data.id() > 0 && data.id() == m_data.id());
|
||||
Q_ASSERT(data.id > 0 && data.id == m_data.id);
|
||||
if (data == m_data)
|
||||
return;
|
||||
|
||||
checkHierarchy(data.menuEntries(), data.id());
|
||||
checkHierarchy(data.menuEntries, data.id);
|
||||
m_data = data;
|
||||
onPublishData();
|
||||
}
|
||||
@@ -128,31 +128,31 @@ Core::FunctionReplyObject ObjectMenuStruct::remove()
|
||||
{
|
||||
DBTransaction trans(m_db->database());
|
||||
|
||||
INFO_LOG(m_logger) << "menuEntries.size(): " << m_data.menuEntries().size();
|
||||
for (const AudioVideoManagement::AvMenuEntry &me : m_data.menuEntries())
|
||||
INFO_LOG(m_logger) << "menuEntries.size(): " << m_data.menuEntries.size();
|
||||
for (const AudioVideoManagement::AvMenuEntry &me : m_data.menuEntries)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Remove entries with id/parentId: " << me.id();
|
||||
INFO_LOG(m_logger) << "Remove entries with id/parentId: " << me.id;
|
||||
// no recursion needed, only 2 levels allowed
|
||||
if (me.isGroup())
|
||||
if (!m_db->removeAvmMenuStructByParentId(me.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), "Error while removing menu entries");
|
||||
if (!m_db->removeAvmMenuStruct(me.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), "Error while removing menu entries");
|
||||
if (me.isGroup)
|
||||
if (!m_db->removeAvmMenuStructByParentId(me.id))
|
||||
return Core::FunctionReplyObject(m_data.id, "Error while removing menu entries");
|
||||
if (!m_db->removeAvmMenuStruct(me.id))
|
||||
return Core::FunctionReplyObject(m_data.id, "Error while removing menu entries");
|
||||
}
|
||||
if (!m_db->removeAvmMenuStruct(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), "Error while removing menu struct");
|
||||
if (!m_db->removeAvmMenuStruct(m_data.id))
|
||||
return Core::FunctionReplyObject(m_data.id, "Error while removing menu struct");
|
||||
|
||||
trans.commit();
|
||||
|
||||
m_dts->removeMenuStructByKey(m_data.id());
|
||||
m_dts->removeMenuStructByKey(m_data.id);
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
void ObjectMenuStruct::onPublishData()
|
||||
{
|
||||
|
||||
INFO_LOG(m_logger) << "Publish MenuStruct-data to dds (" << m_data.id() << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish MenuStruct-data to dds (" << m_data.id << ") ...";
|
||||
|
||||
if (!m_dts->publish(m_data))
|
||||
ERROR_LOG(m_logger) << "Error publishing MenuStruct-data to dds";
|
||||
@@ -161,24 +161,24 @@ void ObjectMenuStruct::onPublishData()
|
||||
|
||||
Core::FunctionReplyObject ObjectMenuStruct::insertUpdateDb(const MenuStruct &data)
|
||||
{
|
||||
checkHierarchy(data.menuEntries(), data.id());
|
||||
checkHierarchy(data.menuEntries, data.id);
|
||||
|
||||
const auto oldEntries = m_data.menuEntries();
|
||||
const auto oldEntries = m_data.menuEntries;
|
||||
m_data = data;
|
||||
|
||||
Database::AvmMenuStruct ms;
|
||||
|
||||
// Insert Parent
|
||||
ms.parentId = 0;
|
||||
ms.name = QString::fromStdString(data.name());
|
||||
ms.isAudio = data.isAudio();
|
||||
ms.name = QString::fromStdString(data.name);
|
||||
ms.isAudio = data.isAudio;
|
||||
ms.isGroup = true;
|
||||
|
||||
DBTransaction trans(m_db->database());
|
||||
|
||||
if (m_data.id() > 0)
|
||||
if (m_data.id > 0)
|
||||
{
|
||||
ms.id = m_data.id();
|
||||
ms.id = m_data.id;
|
||||
if (!m_db->update(ms))
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting AvmMenuStruct-data into database"));
|
||||
}
|
||||
@@ -188,14 +188,14 @@ Core::FunctionReplyObject ObjectMenuStruct::insertUpdateDb(const MenuStruct &dat
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting AvmMenuStruct-data into database"));
|
||||
}
|
||||
|
||||
m_data.id(ms.id);
|
||||
const int virtualMenuStructId = data.id();
|
||||
const int realMenuStructId = m_data.id();
|
||||
m_data.id = ms.id;
|
||||
const int virtualMenuStructId = data.id;
|
||||
const int realMenuStructId = m_data.id;
|
||||
|
||||
std::vector<AvMenuEntry> newEntries;
|
||||
newEntries.reserve(data.menuEntries().size());
|
||||
newEntries.reserve(data.menuEntries.size());
|
||||
|
||||
auto ret = insertUpdateChildren(virtualMenuStructId, realMenuStructId, data.menuEntries(), newEntries);
|
||||
auto ret = insertUpdateChildren(virtualMenuStructId, realMenuStructId, data.menuEntries, newEntries);
|
||||
if (ret.error())
|
||||
return ret;
|
||||
|
||||
@@ -203,23 +203,23 @@ Core::FunctionReplyObject ObjectMenuStruct::insertUpdateDb(const MenuStruct &dat
|
||||
for (const AvMenuEntry &me : oldEntries)
|
||||
{
|
||||
// new entries - ignore
|
||||
if (me.id() <= 0)
|
||||
if (me.id <= 0)
|
||||
continue;
|
||||
|
||||
auto found = std::find_if(newEntries.begin(), newEntries.end(), [&me] (const AvMenuEntry &newEntry) { return me.id() == newEntry.id(); });
|
||||
auto found = std::find_if(newEntries.begin(), newEntries.end(), [&me] (const AvMenuEntry &newEntry) { return me.id == newEntry.id; });
|
||||
if (found == newEntries.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Menu Entry with id not found - was removed: " << me.id();
|
||||
m_db->removeAvmMenuStruct(me.id());
|
||||
DEBUG_LOG(m_logger) << "Menu Entry with id not found - was removed: " << me.id;
|
||||
m_db->removeAvmMenuStruct(me.id);
|
||||
}
|
||||
}
|
||||
|
||||
m_data.menuEntries(newEntries);
|
||||
m_data.menuEntries = newEntries;
|
||||
HandlerMenuStruct::sortEntries(m_data);
|
||||
DEBUG_LOG(m_logger) << "new entries: " << m_data;
|
||||
|
||||
trans.commit();
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject ObjectMenuStruct::insertUpdateChildren(int virtualParentId,
|
||||
@@ -229,7 +229,7 @@ Core::FunctionReplyObject ObjectMenuStruct::insertUpdateChildren(int virtualPare
|
||||
{
|
||||
for(const AudioVideoManagement::AvMenuEntry &ddsItem : entries)
|
||||
{
|
||||
if (ddsItem.parentId() != virtualParentId)
|
||||
if (ddsItem.parentId != virtualParentId)
|
||||
continue;
|
||||
|
||||
Database::AvmMenuStruct dbEntry = ::toDb(ddsItem, realParentId);
|
||||
@@ -250,7 +250,7 @@ Core::FunctionReplyObject ObjectMenuStruct::insertUpdateChildren(int virtualPare
|
||||
|
||||
if (dbEntry.isGroup)
|
||||
{
|
||||
const int virtualId = ddsItem.id();
|
||||
const int virtualId = ddsItem.id;
|
||||
const int realId = dbEntry.id;
|
||||
insertUpdateChildren(virtualId, realId, entries, newEntries);
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public:
|
||||
/** Called as a result of a Remove-request. */
|
||||
Core::FunctionReplyObject remove();
|
||||
|
||||
long getId() const { return m_data.id(); }
|
||||
long getId() const { return m_data.id; }
|
||||
|
||||
private:
|
||||
void onPublishData();
|
||||
|
||||
+37
-37
@@ -30,7 +30,7 @@ ObjectVideoReceiver::~ObjectVideoReceiver()
|
||||
Core::FunctionReplyObject ObjectVideoReceiver::createObject(const VideoReceiver &data)
|
||||
{
|
||||
m_data = data;
|
||||
if (m_data.id() <= 0)
|
||||
if (m_data.id <= 0)
|
||||
{
|
||||
Database::AvmVideoReceiver dbData;
|
||||
dbData = toDbData(data);
|
||||
@@ -38,55 +38,55 @@ Core::FunctionReplyObject ObjectVideoReceiver::createObject(const VideoReceiver
|
||||
if (!m_db->insert(dbData))
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting AvmVideoReceiver-data into database"));
|
||||
|
||||
m_data.id(dbData.id);
|
||||
DEBUG_LOG(m_logger) << "New Id: " << m_data.id();
|
||||
m_data.id = dbData.id;
|
||||
DEBUG_LOG(m_logger) << "New Id: " << m_data.id;
|
||||
}
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectVideoReceiver::updateObject(const VideoReceiver &data)
|
||||
{
|
||||
m_data = data;
|
||||
DEBUG_LOG(m_logger) << "ObjectVideoReceiver::updateObject id=" << data.id()
|
||||
<< " isActive=" << data.isActive()
|
||||
<< " hostName=" << data.hostName()
|
||||
<< " isLocked=" << data.isLocked();
|
||||
DEBUG_LOG(m_logger) << "ObjectVideoReceiver::updateObject id=" << data.id
|
||||
<< " isActive=" << data.isActive
|
||||
<< " hostName=" << data.hostName
|
||||
<< " isLocked=" << data.isLocked;
|
||||
Database::AvmVideoReceiver dbData(toDbData(data));
|
||||
|
||||
|
||||
if (!m_db->update(dbData))
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating VideoReceiver2 into database"));
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Error updating VideoReceiver2 into database"));
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "Data changed for VideoReceiver Id: " << data.id();
|
||||
DEBUG_LOG(m_logger) << "Data changed for VideoReceiver Id: " << data.id;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(data.id());
|
||||
return Core::FunctionReplyObject(data.id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectVideoReceiver::removeObject()
|
||||
{
|
||||
if (!m_db->removeAvmVideoReceiver(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Video Receiver with id %1 can not be removed from DB")).arg(m_data.id());
|
||||
if (!m_db->removeAvmVideoReceiver(m_data.id))
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Video Receiver with id %1 can not be removed from DB")).arg(m_data.id);
|
||||
|
||||
if (!m_dts->removeVideoReceiverByKey(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Video Receiver with id %1 can not be removed from DDS")).arg(m_data.id());
|
||||
if (!m_dts->removeVideoReceiverByKey(m_data.id))
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Video Receiver with id %1 can not be removed from DDS")).arg(m_data.id);
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
void ObjectVideoReceiver::onPublishData()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Publish MvsVideoReceiver-data to dds (" << m_data.id() << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish MvsVideoReceiver-data to dds (" << m_data.id << ") ...";
|
||||
|
||||
if (!m_dts->publish(m_data))
|
||||
ERROR_LOG(m_logger) << "Error publishing MvsVideoReceiver-data to dds";
|
||||
@@ -97,15 +97,15 @@ Database::AvmVideoReceiver ObjectVideoReceiver::toDbData(const VideoReceiver &dd
|
||||
{
|
||||
Database::AvmVideoReceiver dbData;
|
||||
|
||||
dbData.id = ddsData.id();
|
||||
dbData.streamName = QString::fromStdString(ddsData.streamName());
|
||||
dbData.mainStructureElementId = ddsData.mainStructureElementId();
|
||||
dbData.teamId = ddsData.teamId();
|
||||
dbData.isActive = ddsData.isActive();
|
||||
dbData.info = QString::fromStdString(ddsData.info());
|
||||
dbData.hostName = QString::fromStdString(ddsData.hostName());
|
||||
dbData.frequency = ddsData.frequency();
|
||||
dbData.isLocked = ddsData.isLocked();
|
||||
dbData.id = ddsData.id;
|
||||
dbData.streamName = QString::fromStdString(ddsData.streamName);
|
||||
dbData.mainStructureElementId = ddsData.mainStructureElementId;
|
||||
dbData.teamId = ddsData.teamId;
|
||||
dbData.isActive = ddsData.isActive;
|
||||
dbData.info = QString::fromStdString(ddsData.info);
|
||||
dbData.hostName = QString::fromStdString(ddsData.hostName);
|
||||
dbData.frequency = ddsData.frequency;
|
||||
dbData.isLocked = ddsData.isLocked;
|
||||
|
||||
return dbData;
|
||||
}
|
||||
@@ -114,19 +114,19 @@ Database::AvmVideoReceiver ObjectVideoReceiver::toDbData(const VideoReceiver &dd
|
||||
AudioVideoManagement::VideoReceiver ObjectVideoReceiver::toDdsData(const Database::AvmVideoReceiver &dbData)
|
||||
{
|
||||
AudioVideoManagement::VideoReceiver ddsData;
|
||||
ddsData.id(dbData.id);
|
||||
ddsData.streamName(dbData.streamName.toStdString());
|
||||
ddsData.mainStructureElementId(dbData.mainStructureElementId);
|
||||
ddsData.teamId(dbData.teamId);
|
||||
ddsData.isActive(dbData.isActive);
|
||||
ddsData.isLocked(dbData.isLocked);
|
||||
ddsData.info(dbData.info.toStdString());
|
||||
ddsData.hostName(dbData.hostName.toStdString());
|
||||
ddsData.frequency(dbData.frequency);
|
||||
ddsData.id = dbData.id;
|
||||
ddsData.streamName = dbData.streamName.toStdString();
|
||||
ddsData.mainStructureElementId = dbData.mainStructureElementId;
|
||||
ddsData.teamId = dbData.teamId;
|
||||
ddsData.isActive = dbData.isActive;
|
||||
ddsData.isLocked = dbData.isLocked;
|
||||
ddsData.info = dbData.info.toStdString();
|
||||
ddsData.hostName = dbData.hostName.toStdString();
|
||||
ddsData.frequency = dbData.frequency;
|
||||
|
||||
// init data not in db
|
||||
ddsData.dbm(0);
|
||||
ddsData.snr(0);
|
||||
ddsData.dbm = 0;
|
||||
ddsData.snr = 0;
|
||||
|
||||
return ddsData;
|
||||
} // end of toDdsData()
|
||||
|
||||
+2
-2
@@ -31,13 +31,13 @@ public:
|
||||
Core::FunctionReplyObject updateObject(const VideoReceiver &data);
|
||||
Core::FunctionReplyObject removeObject();
|
||||
|
||||
int getId() const { return m_data.id(); }
|
||||
int getId() const { return m_data.id; }
|
||||
VideoReceiver getData() const { return m_data; }
|
||||
|
||||
static Database::AvmVideoReceiver toDbData(const VideoReceiver &ddsData); // dds -> db
|
||||
static AudioVideoManagement::VideoReceiver toDdsData(const Database::AvmVideoReceiver &dbData); // db -> dds
|
||||
|
||||
bool isValid() const { return (m_data.id() > 0); }
|
||||
bool isValid() const { return (m_data.id > 0); }
|
||||
|
||||
protected:
|
||||
void onPublishData();
|
||||
|
||||
+24
-24
@@ -28,39 +28,39 @@ ObjectVideoTeam::~ObjectVideoTeam()
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectVideoTeam::createObject(const VideoTeam &data)
|
||||
{
|
||||
Q_ASSERT(m_data.id() <= 0);
|
||||
Q_ASSERT(data.id() > 0); // only allow creation from existing db-entries
|
||||
Q_ASSERT(m_data.id <= 0);
|
||||
Q_ASSERT(data.id > 0); // only allow creation from existing db-entries
|
||||
|
||||
m_data = data;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectVideoTeam::updateObject(const VideoTeam &data)
|
||||
{
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Object not valid/blocked"));
|
||||
|
||||
m_data = data;
|
||||
Database::AvmVideoTeam dbData(toDbData(data));
|
||||
if (!m_db->update(dbData))
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating VideoTeam into database"));
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Error updating VideoTeam into database"));
|
||||
|
||||
DEBUG_LOG(m_logger) << "Data changed for VideoTeam Id: " << data.id();
|
||||
DEBUG_LOG(m_logger) << "Data changed for VideoTeam Id: " << data.id;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(data.id());}
|
||||
return Core::FunctionReplyObject(data.id);}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
void ObjectVideoTeam::onPublishData()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Publish AvmVideoTeam-data to dds (" << m_data.id() << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish AvmVideoTeam-data to dds (" << m_data.id << ") ...";
|
||||
|
||||
if (!m_dts->publish(m_data))
|
||||
ERROR_LOG(m_logger) << "Error publishing AvmVideoTeam-data to dds";
|
||||
@@ -71,14 +71,14 @@ Database::AvmVideoTeam ObjectVideoTeam::toDbData(const VideoTeam &ddsData)
|
||||
{
|
||||
Database::AvmVideoTeam dbData;
|
||||
|
||||
dbData.id = ddsData.id();
|
||||
dbData.name = QString::fromStdString(ddsData.name());
|
||||
dbData.ssrc = ddsData.ssrc();
|
||||
dbData.port = ddsData.vtPort();
|
||||
dbData.programId = ddsData.programId();
|
||||
dbData.timeOffset = ddsData.timeOffset();
|
||||
dbData.streamName = QString::fromStdString(ddsData.streamName());
|
||||
dbData.exerciseId = ddsData.exerciseId();
|
||||
dbData.id = ddsData.id;
|
||||
dbData.name = QString::fromStdString(ddsData.name);
|
||||
dbData.ssrc = ddsData.ssrc;
|
||||
dbData.port = ddsData.vtPort;
|
||||
dbData.programId = ddsData.programId;
|
||||
dbData.timeOffset = ddsData.timeOffset;
|
||||
dbData.streamName = QString::fromStdString(ddsData.streamName);
|
||||
dbData.exerciseId = ddsData.exerciseId;
|
||||
|
||||
return dbData;
|
||||
}
|
||||
@@ -88,14 +88,14 @@ AudioVideoManagement::VideoTeam ObjectVideoTeam::toDdsData(const Database::AvmVi
|
||||
{
|
||||
AudioVideoManagement::VideoTeam ddsData;
|
||||
|
||||
ddsData.id(dbData.id);
|
||||
ddsData.name(dbData.name.toStdString());
|
||||
ddsData.ssrc(dbData.ssrc);
|
||||
ddsData.vtPort(dbData.port);
|
||||
ddsData.programId(dbData.programId);
|
||||
ddsData.timeOffset(dbData.timeOffset);
|
||||
ddsData.exerciseId(dbData.exerciseId);
|
||||
ddsData.streamName(dbData.streamName.toStdString());
|
||||
ddsData.id = dbData.id;
|
||||
ddsData.name = dbData.name.toStdString();
|
||||
ddsData.ssrc = dbData.ssrc;
|
||||
ddsData.vtPort = dbData.port;
|
||||
ddsData.programId = dbData.programId;
|
||||
ddsData.timeOffset = dbData.timeOffset;
|
||||
ddsData.exerciseId = dbData.exerciseId;
|
||||
ddsData.streamName = dbData.streamName.toStdString();
|
||||
|
||||
return ddsData;
|
||||
} // end of toDdsData()
|
||||
|
||||
+4
-4
@@ -24,15 +24,15 @@ public:
|
||||
Core::FunctionReplyObject createObject(const VideoTeam &data);
|
||||
Core::FunctionReplyObject updateObject(const VideoTeam &data);
|
||||
|
||||
int getId() const { return m_data.id(); }
|
||||
int exerciseId() const { return m_data.exerciseId(); }
|
||||
int getId() const { return m_data.id; }
|
||||
int exerciseId() const { return m_data.exerciseId; }
|
||||
VideoTeam getData() const { return m_data; }
|
||||
QString getName() const { return QString::fromStdString(m_data.name()); }
|
||||
QString getName() const { return QString::fromStdString(m_data.name); }
|
||||
|
||||
static Database::AvmVideoTeam toDbData(const VideoTeam &ddsData); // dds -> db
|
||||
static VideoTeam toDdsData(const Database::AvmVideoTeam &dbData); // db -> dds
|
||||
|
||||
bool isValid() const { return (m_data.id() > 0); }
|
||||
bool isValid() const { return (m_data.id > 0); }
|
||||
|
||||
protected:
|
||||
void onPublishData();
|
||||
|
||||
+15
-15
@@ -21,12 +21,12 @@ namespace
|
||||
|
||||
bool isMountingPointOfInterest(const InfrastructureManagement::StructureElement &se)
|
||||
{
|
||||
if (se.structureElementTypeId() != InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
if (se.structureElementTypeId != InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
return false;
|
||||
|
||||
if (se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::OutdoorCamera ||
|
||||
se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::AnnouncementUnit)
|
||||
if (se.mountingPointTypeId == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
se.mountingPointTypeId == InfrastructureManagement::MountingPointType::OutdoorCamera ||
|
||||
se.mountingPointTypeId == InfrastructureManagement::MountingPointType::AnnouncementUnit)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -35,10 +35,10 @@ bool isMountingPointOfInterest(const InfrastructureManagement::StructureElement
|
||||
std::string displayName(const InfrastructureManagement::StructureElement &mp)
|
||||
{
|
||||
Q_ASSERT(isMountingPointOfInterest(mp));
|
||||
if (mp.displayName().size() > 0)
|
||||
return mp.displayName();
|
||||
if (mp.displayName.size() > 0)
|
||||
return mp.displayName;
|
||||
|
||||
return AudioVideoManagement::AudioVideoHandlerImpl::internalStreamName(mp.id()).toStdString();
|
||||
return AudioVideoManagement::AudioVideoHandlerImpl::internalStreamName(mp.id).toStdString();
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -78,7 +78,7 @@ void StreamNameMappingPublisher::onMainStructureElementChanged(const Infrastruct
|
||||
|
||||
void StreamNameMappingPublisher::onMseChanged(const InfrastructureManagement::MainStructureElement &mse)
|
||||
{
|
||||
const auto &structureElements = mse.elements();
|
||||
const auto &structureElements = mse.elements;
|
||||
for (auto &se : structureElements)
|
||||
if (isMountingPointOfInterest(se))
|
||||
publish(se);
|
||||
@@ -86,7 +86,7 @@ void StreamNameMappingPublisher::onMseChanged(const InfrastructureManagement::Ma
|
||||
|
||||
void StreamNameMappingPublisher::onMseRemoved(const InfrastructureManagement::MainStructureElement &mse)
|
||||
{
|
||||
const auto &structureElements = mse.elements();
|
||||
const auto &structureElements = mse.elements;
|
||||
for (auto &se : structureElements)
|
||||
if (isMountingPointOfInterest(se))
|
||||
remove(se);
|
||||
@@ -95,18 +95,18 @@ void StreamNameMappingPublisher::onMseRemoved(const InfrastructureManagement::Ma
|
||||
void StreamNameMappingPublisher::publish(const InfrastructureManagement::StructureElement &mountingPoint)
|
||||
{
|
||||
StreamName streamName;
|
||||
streamName.mountingPointId(mountingPoint.id());
|
||||
streamName.internalName(AudioVideoHandlerImpl::internalStreamName(mountingPoint.id()).toStdString());
|
||||
streamName.displayName(displayName(mountingPoint));
|
||||
streamName.mountingPointId = mountingPoint.id;
|
||||
streamName.internalName = AudioVideoHandlerImpl::internalStreamName(mountingPoint.id).toStdString();
|
||||
streamName.displayName = displayName(mountingPoint);
|
||||
|
||||
if (m_streamNames[mountingPoint.id()] != streamName)
|
||||
if (m_streamNames[mountingPoint.id] != streamName)
|
||||
m_dts->publish(streamName);
|
||||
m_streamNames[mountingPoint.id()] = streamName;
|
||||
m_streamNames[mountingPoint.id] = streamName;
|
||||
}
|
||||
|
||||
void StreamNameMappingPublisher::remove(const InfrastructureManagement::StructureElement &mountingPoint)
|
||||
{
|
||||
m_dts->removeStreamNameByKey(mountingPoint.id());
|
||||
m_dts->removeStreamNameByKey(mountingPoint.id);
|
||||
}
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -61,11 +61,11 @@ Database::AvmTvcConfig toDb(const ModifyTvcConfigRequest &request)
|
||||
{
|
||||
Database::AvmTvcConfig result;
|
||||
|
||||
result.id = request.id();
|
||||
result.radioCircuit = QString::fromStdString(request.radioCircuit());
|
||||
result.info = QString::fromStdString(request.info());
|
||||
result.recording = request.recording();
|
||||
result.tetraChannelId = request.tetraChannelId();
|
||||
result.id = request.id;
|
||||
result.radioCircuit = QString::fromStdString(request.radioCircuit);
|
||||
result.info = QString::fromStdString(request.info);
|
||||
result.recording = request.recording;
|
||||
result.tetraChannelId = request.tetraChannelId;
|
||||
if (request.exerciseId.is_set())
|
||||
result.exerciseId = request.exerciseId.get();
|
||||
|
||||
@@ -92,36 +92,36 @@ public:
|
||||
|
||||
void create(const TvcConfig &config)
|
||||
{
|
||||
Q_ASSERT(!m_cache.contains(config.id()));
|
||||
Q_ASSERT(!m_cache.contains(config.id));
|
||||
|
||||
Database::AvmDeviceConfig deviceConfig = toDeviceConfig(config);
|
||||
|
||||
if (!m_db->insert(deviceConfig))
|
||||
ERROR_LOG(m_logger) << "Error while inserting device config into database";
|
||||
|
||||
m_cache.insert(config.id(), deviceConfig);
|
||||
m_cache.insert(config.id, deviceConfig);
|
||||
emit m_handler->avDbReloadNeeded();
|
||||
}
|
||||
|
||||
void update(const TvcConfig &config)
|
||||
{
|
||||
Q_ASSERT(m_cache.contains(config.id()));
|
||||
Q_ASSERT(m_cache.contains(config.id));
|
||||
|
||||
Database::AvmDeviceConfig deviceConfig = toDeviceConfig(config);
|
||||
|
||||
const Database::AvmDeviceConfig &oldDeviceConfig = m_cache[config.id()];
|
||||
const Database::AvmDeviceConfig &oldDeviceConfig = m_cache[config.id];
|
||||
deviceConfig.id = oldDeviceConfig.id;
|
||||
|
||||
if (!m_db->update(deviceConfig))
|
||||
ERROR_LOG(m_logger) << "Error while updating device config";
|
||||
|
||||
m_cache[config.id()] = deviceConfig;
|
||||
m_cache[config.id] = deviceConfig;
|
||||
emit m_handler->avDbReloadNeeded();
|
||||
}
|
||||
|
||||
void createOrUpdate(const TvcConfig &config)
|
||||
{
|
||||
if (m_cache.contains(config.id()))
|
||||
if (m_cache.contains(config.id))
|
||||
update(config);
|
||||
else
|
||||
create(config);
|
||||
@@ -234,8 +234,8 @@ void TvcHandler::onModifyTvcConfigRequest(const rti::core::SampleIdentity &cooki
|
||||
const ModifyTvcConfigRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onModifyTvcConfigRequest: " << request;
|
||||
Q_ASSERT(request.id() >= 0);
|
||||
auto ret = request.id() > 0 ? modifyTvcConfig(request) : createTvcConfig(request);
|
||||
Q_ASSERT(request.id >= 0);
|
||||
auto ret = request.id > 0 ? modifyTvcConfig(request) : createTvcConfig(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_fts->modifyTvcConfigReply(cookie, ret);
|
||||
@@ -272,33 +272,33 @@ bool TvcHandler::isValidChannel(int64_t channelId) const
|
||||
// If there are conflicts between the then-active exercises the start of the new exercise must be denied.
|
||||
bool TvcHandler::isFreeChannel(const ModifyTvcConfigRequest &request) const
|
||||
{
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId());
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId);
|
||||
|
||||
if (request.id() <= 0)
|
||||
return isFreeChannel(request.tetraChannelId(), exerciseId);
|
||||
return isFreeChannel(request.tetraChannelId(), exerciseId, request.id());
|
||||
if (request.id <= 0)
|
||||
return isFreeChannel(request.tetraChannelId, exerciseId);
|
||||
return isFreeChannel(request.tetraChannelId, exerciseId, request.id);
|
||||
}
|
||||
|
||||
bool TvcHandler::isFreeChannel(int32_t channelId, const boost::optional<int> &exerciseId, const boost::optional<int32_t> &excludeId) const
|
||||
{
|
||||
auto constraint = [&channelId] (const TvcConfig &config) { return config.tetraChannelId() != channelId; };
|
||||
auto constraint = [&channelId] (const TvcConfig &config) { return config.tetraChannelId != channelId; };
|
||||
return checkConstraint(constraint, exerciseId, excludeId);
|
||||
}
|
||||
|
||||
bool TvcHandler::isNameUnique(const ModifyTvcConfigRequest &request) const
|
||||
{
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId());
|
||||
boost::optional<int> exerciseId = toBoost(request.exerciseId);
|
||||
|
||||
if (request.id() <= 0)
|
||||
return isNameUnique(request.radioCircuit(), exerciseId);
|
||||
return isNameUnique(request.radioCircuit(), exerciseId, request.id());
|
||||
if (request.id <= 0)
|
||||
return isNameUnique(request.radioCircuit, exerciseId);
|
||||
return isNameUnique(request.radioCircuit, exerciseId, request.id);
|
||||
}
|
||||
|
||||
// Needs to be revised.
|
||||
// See isFreeChannel().
|
||||
bool TvcHandler::isNameUnique(const std::string &name, const boost::optional<int> &exerciseId, const boost::optional<int32_t> &excludeId) const
|
||||
{
|
||||
auto constraint = [&name] (const TvcConfig &config) { return config.radioCircuit() != name; };
|
||||
auto constraint = [&name] (const TvcConfig &config) { return config.radioCircuit != name; };
|
||||
return checkConstraint(constraint, exerciseId, excludeId);
|
||||
}
|
||||
|
||||
@@ -321,13 +321,13 @@ Core::FunctionReplyObject TvcHandler::createTvcConfig(const ModifyTvcConfigReque
|
||||
}
|
||||
|
||||
TvcConfig tvcConfig = toDds(dbConfigData);
|
||||
m_cache.insert(tvcConfig.id(), tvcConfig);
|
||||
m_cache.insert(tvcConfig.id, tvcConfig);
|
||||
m_dts->publish(tvcConfig);
|
||||
|
||||
if (needDeviceConfig(tvcConfig))
|
||||
m_deviceConfig->create(tvcConfig);
|
||||
|
||||
return Core::FunctionReplyObject(tvcConfig.id());
|
||||
return Core::FunctionReplyObject(tvcConfig.id);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject TvcHandler::modifyTvcConfig(const ModifyTvcConfigRequest &request)
|
||||
@@ -339,17 +339,17 @@ Core::FunctionReplyObject TvcHandler::modifyTvcConfig(const ModifyTvcConfigReque
|
||||
Database::AvmTvcConfig dbConfigData = toDb(request);
|
||||
|
||||
if (!m_db->update(dbConfigData))
|
||||
return reply.setStr(tr_lts("dds", "Could not update TVC config data in database with id %1")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "Could not update TVC config data in database with id %1")).arg(request.id);
|
||||
|
||||
TvcConfig tvcConfig = toDds(dbConfigData);
|
||||
m_cache[tvcConfig.id()] = tvcConfig;
|
||||
m_cache[tvcConfig.id] = tvcConfig;
|
||||
|
||||
m_dts->publish(tvcConfig);
|
||||
|
||||
if (needDeviceConfig(tvcConfig))
|
||||
m_deviceConfig->createOrUpdate(tvcConfig);
|
||||
else
|
||||
m_deviceConfig->tryRemove(tvcConfig.id());
|
||||
m_deviceConfig->tryRemove(tvcConfig.id);
|
||||
|
||||
emit tvcConfigChanged(tvcConfig);
|
||||
return reply;
|
||||
@@ -357,7 +357,7 @@ Core::FunctionReplyObject TvcHandler::modifyTvcConfig(const ModifyTvcConfigReque
|
||||
|
||||
Core::FunctionReplyObject TvcHandler::removeTvcConfig(const Core::RemoveElementRequest &request)
|
||||
{
|
||||
int32_t configId = request.id();
|
||||
int32_t configId = request.id;
|
||||
Core::FunctionReplyObject reply(configId);
|
||||
|
||||
auto found = m_cache.find(configId);
|
||||
@@ -371,7 +371,7 @@ Core::FunctionReplyObject TvcHandler::removeTvcConfig(const Core::RemoveElementR
|
||||
m_dts->removeTvcConfigByKey(configId);
|
||||
|
||||
if (!m_db->removeAvmTvcConfig(configId))
|
||||
return reply.setStr(tr_lts("dds", "Could not remove TVC config data with id %1")).arg(request.id());
|
||||
return reply.setStr(tr_lts("dds", "Could not remove TVC config data with id %1")).arg(request.id);
|
||||
|
||||
return reply;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ Database::AvmDeviceConfig TvcHandler::toDeviceConfig(const TvcConfig &tvcConfig)
|
||||
{
|
||||
Database::AvmDeviceConfig result;
|
||||
|
||||
Database::AvmTvcChannel tetraChannel = channelById(tvcConfig.tetraChannelId());
|
||||
Database::AvmTvcChannel tetraChannel = channelById(tvcConfig.tetraChannelId);
|
||||
|
||||
QJsonObject settings = QJsonDocument::fromJson(tetraChannel.settings.toUtf8()).object();
|
||||
QJsonObject data = settings[QStringLiteral("data")].toObject();
|
||||
@@ -388,10 +388,10 @@ Database::AvmDeviceConfig TvcHandler::toDeviceConfig(const TvcConfig &tvcConfig)
|
||||
{
|
||||
result.context = exerciseList(tvcConfig);
|
||||
result.type = QStringLiteral("TETRA_RT_CHANNEL");
|
||||
result.name = QString::fromStdString(tvcConfig.radioCircuit());
|
||||
result.name = QString::fromStdString(tvcConfig.radioCircuit);
|
||||
result.controller = QStringLiteral("EXCAVS01");
|
||||
result.definition = QStringLiteral("mode=1;ssrc=%1;port=%2").arg(data[QStringLiteral("ssrc")].toInt()).arg(data[QStringLiteral("port")].toInt());
|
||||
if (tvcConfig.recording())
|
||||
if (tvcConfig.recording)
|
||||
result.definition.append(QStringLiteral(";recording=ECRS@%1").arg(result.controller));
|
||||
result.link = 0;
|
||||
}
|
||||
@@ -399,10 +399,10 @@ Database::AvmDeviceConfig TvcHandler::toDeviceConfig(const TvcConfig &tvcConfig)
|
||||
{
|
||||
result.context = exerciseList(tvcConfig);
|
||||
result.type = QStringLiteral("SOTAS_SIP_RT_CHANNEL");
|
||||
result.name = QString::fromStdString(tvcConfig.radioCircuit());
|
||||
result.name = QString::fromStdString(tvcConfig.radioCircuit);
|
||||
result.controller = QStringLiteral("EXCAVS01");
|
||||
result.definition = QStringLiteral("mode=1;sip=%1@%2").arg(data[QStringLiteral("role")].toString()).arg(data[QStringLiteral("host")].toString());
|
||||
if (tvcConfig.recording())
|
||||
if (tvcConfig.recording)
|
||||
result.definition.append(QStringLiteral(";recording=ECRS@%1").arg(result.controller));
|
||||
result.link = 0;
|
||||
}
|
||||
@@ -429,7 +429,7 @@ void TvcHandler::onContextActivated(const ExerciseContext &context)
|
||||
bool isLocal = tvcConfig.exerciseId.is_set();
|
||||
if (isLocal)
|
||||
{
|
||||
if (tvcConfig.exerciseId() == context.id())
|
||||
if (tvcConfig.exerciseId == context.id())
|
||||
m_deviceConfig->create(tvcConfig);
|
||||
}
|
||||
else
|
||||
@@ -452,13 +452,13 @@ void TvcHandler::onContextDeactivated(const ExerciseContext &context)
|
||||
|
||||
if (isLocal)
|
||||
{
|
||||
if (tvcConfig.exerciseId() == context.id())
|
||||
m_deviceConfig->remove(tvcConfig.id());
|
||||
if (tvcConfig.exerciseId == context.id())
|
||||
m_deviceConfig->remove(tvcConfig.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!haveActiveExercise)
|
||||
m_deviceConfig->remove(tvcConfig.id());
|
||||
m_deviceConfig->remove(tvcConfig.id);
|
||||
else
|
||||
m_deviceConfig->update(tvcConfig);
|
||||
}
|
||||
@@ -499,20 +499,20 @@ Core::FunctionReplyObject TvcHandler::validateRequest(const ModifyTvcConfigReque
|
||||
{
|
||||
Core::FunctionReplyObject reply;
|
||||
|
||||
if (request.id() > 0)
|
||||
if (request.id > 0)
|
||||
{
|
||||
reply.setId(request.id());
|
||||
if (!m_cache.contains(request.id()))
|
||||
return reply.setStr(tr_lts("dds", "Could not modify TVC config because id %1 is unknown")).arg(request.id());
|
||||
reply.setId(request.id);
|
||||
if (!m_cache.contains(request.id))
|
||||
return reply.setStr(tr_lts("dds", "Could not modify TVC config because id %1 is unknown")).arg(request.id);
|
||||
}
|
||||
|
||||
if (!isValidChannel(request.tetraChannelId()))
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify TVC config because the channel with id %1 is invalid")).arg(request.tetraChannelId());
|
||||
if (!isValidChannel(request.tetraChannelId))
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify TVC config because the channel with id %1 is invalid")).arg(request.tetraChannelId);
|
||||
|
||||
if (!isFreeChannel(request))
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify TVC config because channel id %1 is already taken")).arg(request.tetraChannelId());
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify TVC config because channel id %1 is already taken")).arg(request.tetraChannelId);
|
||||
|
||||
if (!isStreamNameValid(request.radioCircuit()))
|
||||
if (!isStreamNameValid(request.radioCircuit))
|
||||
return reply.setStr(tr_lts("dds", "Could not create/modify TVC config because the circuit name is invalid"));
|
||||
|
||||
if (!isNameUnique(request))
|
||||
@@ -528,7 +528,7 @@ bool TvcHandler::checkConstraint(const std::function<bool (const TvcConfig &)> &
|
||||
{
|
||||
for (const TvcConfig &config : qAsConst(m_cache))
|
||||
{
|
||||
if (excludeId == config.id())
|
||||
if (excludeId == config.id)
|
||||
continue;
|
||||
|
||||
// If both configs are local the constraint must hold if they are in the same exercise
|
||||
|
||||
Reference in new issue
Block a user