Migrates AudioVideoManagement to generated rtiddsgen API
Converts accessor calls to plain member access across avm service and plugin.
This commit is contained in:
29 files changed
+308
-295
No files matched your search
-1
@@ -29,7 +29,6 @@ class TopicEditor : public TopicEditorBase::TopicEditor
|
||||
~TopicEditor();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void updateInternalData() override final;
|
||||
void retranslate() override final;
|
||||
|
||||
|
||||
+31
-31
@@ -79,26 +79,26 @@ void AvmFtTests::tryCreate()
|
||||
|
||||
m_menuStructId = -2;
|
||||
ModifyMenuStructRequest request;
|
||||
request.id(0);
|
||||
request.name("TestGlobalMenu");
|
||||
request.id = 0;
|
||||
request.name = "TestGlobalMenu";
|
||||
|
||||
int newId = -10000000;
|
||||
|
||||
request.menuEntries().resize(3);
|
||||
request.menuEntries()[0].name().set("Test-1");
|
||||
request.menuEntries()[0].id(newId++);
|
||||
request.menuEntries()[0].parentId(request.id());
|
||||
request.menuEntries()[0].isGroup(true);
|
||||
request.menuEntries.resize(3);
|
||||
request.menuEntries[0].name.set("Test-1");
|
||||
request.menuEntries[0].id = newId++;
|
||||
request.menuEntries[0].parentId = request.id;
|
||||
request.menuEntries[0].isGroup = true;
|
||||
|
||||
request.menuEntries()[1].mountingPointId(m_mountingPointId);
|
||||
request.menuEntries()[1].id(newId++);
|
||||
request.menuEntries()[1].parentId(request.menuEntries()[0].id());
|
||||
request.menuEntries()[1].isGroup(false);
|
||||
request.menuEntries[1].mountingPointId = m_mountingPointId;
|
||||
request.menuEntries[1].id = newId++;
|
||||
request.menuEntries[1].parentId = request.menuEntries[0].id;
|
||||
request.menuEntries[1].isGroup = false;
|
||||
|
||||
request.menuEntries()[2].mountingPointId(m_mountingPointId+1);
|
||||
request.menuEntries()[2].id(newId++);
|
||||
request.menuEntries()[2].parentId(request.menuEntries()[0].id());
|
||||
request.menuEntries()[2].isGroup(false);
|
||||
request.menuEntries[2].mountingPointId = m_mountingPointId+1;
|
||||
request.menuEntries[2].id = newId++;
|
||||
request.menuEntries[2].parentId = request.menuEntries[0].id;
|
||||
request.menuEntries[2].isGroup = false;
|
||||
|
||||
if (!m_ftc->modifyMenuStructRequest(request, this))
|
||||
{
|
||||
@@ -112,26 +112,26 @@ void AvmFtTests::tryModify()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send modify request for menuStructId = " << m_menuStructId;
|
||||
ModifyMenuStructRequest request;
|
||||
request.id(m_menuStructId);
|
||||
request.name("TestGlobalMenuModify");
|
||||
request.id = m_menuStructId;
|
||||
request.name = "TestGlobalMenuModify";
|
||||
|
||||
int newId = -10000000;
|
||||
|
||||
request.menuEntries().resize(3);
|
||||
request.menuEntries()[0].name().set("Test-1-mod");
|
||||
request.menuEntries()[0].id(newId++);
|
||||
request.menuEntries()[0].parentId(request.id());
|
||||
request.menuEntries()[0].isGroup(true);
|
||||
request.menuEntries.resize(3);
|
||||
request.menuEntries[0].name.set("Test-1-mod");
|
||||
request.menuEntries[0].id = newId++;
|
||||
request.menuEntries[0].parentId = request.id;
|
||||
request.menuEntries[0].isGroup = true;
|
||||
|
||||
request.menuEntries()[1].mountingPointId(m_mountingPointId);
|
||||
request.menuEntries()[1].id(newId++);
|
||||
request.menuEntries()[1].parentId(request.menuEntries()[0].id());
|
||||
request.menuEntries()[1].isGroup(false);
|
||||
request.menuEntries[1].mountingPointId = m_mountingPointId;
|
||||
request.menuEntries[1].id = newId++;
|
||||
request.menuEntries[1].parentId = request.menuEntries[0].id;
|
||||
request.menuEntries[1].isGroup = false;
|
||||
|
||||
request.menuEntries()[2].mountingPointId(m_mountingPointId+1);
|
||||
request.menuEntries()[2].id(newId++);
|
||||
request.menuEntries()[2].parentId(request.menuEntries()[0].id());
|
||||
request.menuEntries()[2].isGroup(false);
|
||||
request.menuEntries[2].mountingPointId = m_mountingPointId+1;
|
||||
request.menuEntries[2].id = newId++;
|
||||
request.menuEntries[2].parentId = request.menuEntries[0].id;
|
||||
request.menuEntries[2].isGroup = false;
|
||||
|
||||
if (!m_ftc->modifyMenuStructRequest(request, this))
|
||||
{
|
||||
@@ -145,7 +145,7 @@ void AvmFtTests::tryDelete()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send delete request for menuStructId = " << m_menuStructId;
|
||||
RemoveMenuStructRequest request;
|
||||
request.id(m_menuStructId);
|
||||
request.id = m_menuStructId;
|
||||
|
||||
if (!m_ftc->removeMenuStructRequest(request, this))
|
||||
{
|
||||
|
||||
+19
-19
@@ -84,14 +84,14 @@ void AvmVcaTests::create()
|
||||
{
|
||||
CnrTvcProfile createRequest;
|
||||
|
||||
createRequest.id(0); // create
|
||||
createRequest.exerciseId(m_exerciseId);
|
||||
createRequest.operatorId(m_operatorId);
|
||||
createRequest.id = 0; // create
|
||||
createRequest.exerciseId = m_exerciseId;
|
||||
createRequest.operatorId = m_operatorId;
|
||||
|
||||
createRequest.data().resize(3);
|
||||
createRequest.data()[0] = CnrTvcProfileData(m_cnrConfigIds.at(0), RadioSystem::Cnr);
|
||||
createRequest.data()[1] = CnrTvcProfileData(m_tvcConfigIds.at(0), RadioSystem::Tvc);
|
||||
createRequest.data()[2] = CnrTvcProfileData(m_cnrConfigIds.at(1), RadioSystem::Cnr);
|
||||
createRequest.data.resize(3);
|
||||
createRequest.data[0] = CnrTvcProfileData(m_cnrConfigIds.at(0), RadioSystem::Cnr);
|
||||
createRequest.data[1] = CnrTvcProfileData(m_tvcConfigIds.at(0), RadioSystem::Tvc);
|
||||
createRequest.data[2] = CnrTvcProfileData(m_cnrConfigIds.at(1), RadioSystem::Cnr);
|
||||
|
||||
m_modifyReplyReceived = false;
|
||||
bool status = m_ftc->modifyCnrTvcProfileRequest(createRequest, this);
|
||||
@@ -100,7 +100,7 @@ void AvmVcaTests::create()
|
||||
QVERIFY(m_circuitId > 0);
|
||||
|
||||
CnrTvcProfile expected = createRequest;
|
||||
expected.id(m_circuitId);
|
||||
expected.id = m_circuitId;
|
||||
QTRY_COMPARE(m_dtc->cnrTvcProfile(m_circuitId), expected);
|
||||
}
|
||||
|
||||
@@ -108,21 +108,21 @@ void AvmVcaTests::modify()
|
||||
{
|
||||
CnrTvcProfile request;
|
||||
|
||||
request.id(m_circuitId); // modify
|
||||
request.exerciseId(m_exerciseId);
|
||||
request.operatorId(m_operatorId);
|
||||
request.id = m_circuitId; // modify
|
||||
request.exerciseId = m_exerciseId;
|
||||
request.operatorId = m_operatorId;
|
||||
|
||||
request.data().resize(4);
|
||||
request.data()[0] = CnrTvcProfileData(m_tvcConfigIds.at(0), RadioSystem::Tvc);
|
||||
request.data()[1] = CnrTvcProfileData(m_tvcConfigIds.at(1), RadioSystem::Tvc);
|
||||
request.data()[2] = CnrTvcProfileData(m_cnrConfigIds.at(2), RadioSystem::Cnr);
|
||||
request.data()[3] = CnrTvcProfileData(m_cnrConfigIds.at(1), RadioSystem::Cnr);
|
||||
request.data.resize(4);
|
||||
request.data[0] = CnrTvcProfileData(m_tvcConfigIds.at(0), RadioSystem::Tvc);
|
||||
request.data[1] = CnrTvcProfileData(m_tvcConfigIds.at(1), RadioSystem::Tvc);
|
||||
request.data[2] = CnrTvcProfileData(m_cnrConfigIds.at(2), RadioSystem::Cnr);
|
||||
request.data[3] = CnrTvcProfileData(m_cnrConfigIds.at(1), RadioSystem::Cnr);
|
||||
|
||||
m_modifyReplyReceived = false;
|
||||
bool status = m_ftc->modifyCnrTvcProfileRequest(request, this);
|
||||
QVERIFY(status);
|
||||
QTRY_VERIFY(m_modifyReplyReceived);
|
||||
QCOMPARE(m_circuitId, request.id());
|
||||
QCOMPARE(m_circuitId, request.id);
|
||||
|
||||
CnrTvcProfile expected = request;
|
||||
QTRY_COMPARE(m_dtc->cnrTvcProfile(m_circuitId), expected);
|
||||
@@ -131,13 +131,13 @@ void AvmVcaTests::modify()
|
||||
void AvmVcaTests::remove()
|
||||
{
|
||||
Core::RemoveElementRequest request;
|
||||
request.id(m_circuitId);
|
||||
request.id = m_circuitId;
|
||||
|
||||
m_removeReplyReceived = false;
|
||||
bool status = m_ftc->removeCnrTvcProfileRequest(request, this);
|
||||
QVERIFY(status);
|
||||
QTRY_VERIFY(m_removeReplyReceived);
|
||||
QCOMPARE(m_circuitId, request.id());
|
||||
QCOMPARE(m_circuitId, request.id);
|
||||
|
||||
CnrTvcProfile expected;
|
||||
QTRY_COMPARE(m_dtc->cnrTvcProfile(m_circuitId), expected);
|
||||
|
||||
+27
-27
@@ -138,16 +138,16 @@ void MvsTests::tryModifyVideoTeam()
|
||||
{
|
||||
VideoTeamModifyRequest request;
|
||||
|
||||
request.id(m_teamId);
|
||||
request.name("MVS001");
|
||||
request.streamName("Stream name for MVS001");
|
||||
request.id = m_teamId;
|
||||
request.name = "MVS001";
|
||||
request.streamName = "Stream name for MVS001";
|
||||
if (m_exerciseId > 0)
|
||||
request.exerciseId(m_exerciseId);
|
||||
request.exerciseId = m_exerciseId;
|
||||
else
|
||||
request.exerciseId(0);
|
||||
request.exerciseId = 0;
|
||||
|
||||
request.vtPort(0);
|
||||
request.ssrc(0);
|
||||
request.vtPort = 0;
|
||||
request.ssrc = 0;
|
||||
|
||||
if (!m_ftc->videoTeamModifyRequest(request, this))
|
||||
{
|
||||
@@ -180,13 +180,13 @@ void MvsTests::tryCreateVideoReceiver()
|
||||
INFO_LOG(m_logger) << "trying to send createRequest VideoReceiver";
|
||||
VideoReceiverModifyRequest request;
|
||||
|
||||
request.id(0);
|
||||
request.streamName("Stream name MVS_00");
|
||||
request.mainStructureElementId(m_radioStationId);
|
||||
request.teamId(m_teamId);
|
||||
request.hostName("Hostname");
|
||||
request.frequency(0);
|
||||
request.isLocked(false);
|
||||
request.id = 0;
|
||||
request.streamName = "Stream name MVS_00";
|
||||
request.mainStructureElementId = m_radioStationId;
|
||||
request.teamId = m_teamId;
|
||||
request.hostName = "Hostname";
|
||||
request.frequency = 0;
|
||||
request.isLocked = false;
|
||||
|
||||
if (!m_ftc->videoReceiverModifyRequest(request, this))
|
||||
{
|
||||
@@ -202,13 +202,13 @@ void MvsTests::tryModifyVideoReceiver()
|
||||
{
|
||||
VideoReceiverModifyRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
request.streamName("Stream name MVS_001");
|
||||
request.mainStructureElementId(m_radioStationId);
|
||||
request.teamId(m_teamId);
|
||||
request.hostName("Hostname");
|
||||
request.frequency(0);
|
||||
request.isLocked(false);
|
||||
request.id = m_receiverId;
|
||||
request.streamName = "Stream name MVS_001";
|
||||
request.mainStructureElementId = m_radioStationId;
|
||||
request.teamId = m_teamId;
|
||||
request.hostName = "Hostname";
|
||||
request.frequency = 0;
|
||||
request.isLocked = false;
|
||||
|
||||
if (!m_ftc->videoReceiverModifyRequest(request, this))
|
||||
{
|
||||
@@ -224,9 +224,9 @@ void MvsTests::tryModifyAvsVideoReceiver()
|
||||
{
|
||||
VideoReceiverModifyAvsRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
request.dbm(80);
|
||||
request.snr(20);
|
||||
request.id = m_receiverId;
|
||||
request.dbm = 80;
|
||||
request.snr = 20;
|
||||
|
||||
if (!m_ftc->videoReceiverModifyAvsRequest(request, this))
|
||||
{
|
||||
@@ -242,8 +242,8 @@ void MvsTests::tryModifyActiveVideoReceiver()
|
||||
{
|
||||
VideoReceiverModifyActiveRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
request.isActive(true);
|
||||
request.id = m_receiverId;
|
||||
request.isActive = true;
|
||||
|
||||
if (!m_ftc->videoReceiverModifyActiveRequest(request, this))
|
||||
{
|
||||
@@ -260,7 +260,7 @@ void MvsTests::tryDeleteVideoReceiver()
|
||||
{
|
||||
Core::RemoveElementRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
request.id = m_receiverId;
|
||||
|
||||
if (!m_ftc->videoReceiverRemoveRequest(request, this))
|
||||
{
|
||||
|
||||
+36
-36
@@ -34,20 +34,20 @@ MainStructureElement createBuilding()
|
||||
static int mseId = 0;
|
||||
static int seId = 0;
|
||||
MainStructureElement building;
|
||||
building.id(++mseId);
|
||||
building.name("Building");
|
||||
building.structureElementId(++seId);
|
||||
building.properties("{}");
|
||||
building.id = ++mseId;
|
||||
building.name = "Building";
|
||||
building.structureElementId = ++seId;
|
||||
building.properties = "{}";
|
||||
|
||||
StructureElement mountingPoint;
|
||||
mountingPoint.id(++seId);
|
||||
mountingPoint.name("MP_OUT0001");
|
||||
mountingPoint.displayName("Outdoor Camera 1");
|
||||
mountingPoint.mainStructureElementId(building.id());
|
||||
mountingPoint.structureElementTypeId(StructureElementType::MountingPoint);
|
||||
mountingPoint.mountingPointTypeId(MountingPointType::OutdoorCamera);
|
||||
mountingPoint.properties("{}");
|
||||
building.elements().push_back(mountingPoint);
|
||||
mountingPoint.id = ++seId;
|
||||
mountingPoint.name = "MP_OUT0001";
|
||||
mountingPoint.displayName = "Outdoor Camera 1";
|
||||
mountingPoint.mainStructureElementId = building.id;
|
||||
mountingPoint.structureElementTypeId = StructureElementType::MountingPoint;
|
||||
mountingPoint.mountingPointTypeId = MountingPointType::OutdoorCamera;
|
||||
mountingPoint.properties = "{}";
|
||||
building.elements.push_back(mountingPoint);
|
||||
|
||||
return building;
|
||||
}
|
||||
@@ -57,9 +57,9 @@ InstrumentationAsset createAsset()
|
||||
static int id = 0;
|
||||
|
||||
InstrumentationAsset asset;
|
||||
asset.id(++id);
|
||||
asset.name(QStringLiteral("CAM_UBEOCE000%1").arg(id).toUtf8().constData());
|
||||
asset.mountingPointTypeId(MountingPointType::OutdoorCamera);
|
||||
asset.id = ++id;
|
||||
asset.name = QStringLiteral("CAM_UBEOCE000%1").arg(id).toUtf8().constData();
|
||||
asset.mountingPointTypeId = MountingPointType::OutdoorCamera;
|
||||
|
||||
return asset;
|
||||
}
|
||||
@@ -68,41 +68,41 @@ MountingPointAsset createMount(InstrumentationAsset &asset, const StructureEleme
|
||||
{
|
||||
static int id = 0;
|
||||
MountingPointAsset mount;
|
||||
mount.id(++id);
|
||||
mount.assetId(asset.id());
|
||||
mount.structureElementId(mountingPoint.id());
|
||||
mount.id = ++id;
|
||||
mount.assetId = asset.id;
|
||||
mount.structureElementId = mountingPoint.id;
|
||||
|
||||
asset.assetStateId(InstrumentationAssetState::Mounted);
|
||||
asset.assetStateId = InstrumentationAssetState::Mounted;
|
||||
|
||||
return mount;
|
||||
}
|
||||
|
||||
void unmount(InstrumentationAsset &asset)
|
||||
{
|
||||
asset.assetStateId(InstrumentationAssetState::Unmounted);
|
||||
asset.assetStateId = InstrumentationAssetState::Unmounted;
|
||||
}
|
||||
|
||||
void assign(MainStructureElement &building, int exerciseId)
|
||||
{
|
||||
building.properties(QStringLiteral("{\"available_in_exercise\": [%1]}").arg(exerciseId).toUtf8().constData());
|
||||
building.properties = QStringLiteral("{\"available_in_exercise\": [%1]}").arg(exerciseId).toUtf8().constData();
|
||||
}
|
||||
|
||||
void unassign(MainStructureElement &building)
|
||||
{
|
||||
building.properties("{}");
|
||||
building.properties = "{}";
|
||||
}
|
||||
|
||||
void assign(InstrumentationAsset &asset, int exerciseId)
|
||||
{
|
||||
Q_ASSERT(asset.assetStateId() == InstrumentationAssetState::Mounted);
|
||||
Q_ASSERT(asset.assetStateId == InstrumentationAssetState::Mounted);
|
||||
std::vector<int> exercises{exerciseId};
|
||||
asset.availableInExercise(exercises);
|
||||
asset.availableInExercise = exercises;
|
||||
}
|
||||
|
||||
void unassign(InstrumentationAsset &asset)
|
||||
{
|
||||
Q_ASSERT(asset.assetStateId() == InstrumentationAssetState::Mounted);
|
||||
asset.availableInExercise().clear();
|
||||
Q_ASSERT(asset.assetStateId == InstrumentationAssetState::Mounted);
|
||||
asset.availableInExercise.clear();
|
||||
}
|
||||
|
||||
class AssignmentSpy : public QObject
|
||||
@@ -196,7 +196,7 @@ void AssetAssignmentManagerTest::testStartMountedAssigned()
|
||||
MainStructureElement building = createBuilding();
|
||||
InstrumentationAsset asset1 = createAsset();
|
||||
InstrumentationAsset asset2 = createAsset();
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(building, EXERCISE_42);
|
||||
assign(asset1, EXERCISE_42);
|
||||
|
||||
@@ -236,7 +236,7 @@ void AssetAssignmentManagerTest::testRuntimeMountAssign()
|
||||
|
||||
|
||||
// create the mount, building still unassigned
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onAssetChanged, &mgr, asset1, DataModification::eModified));
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onMountingChanged, &mgr, mount, DataModification::eAdded));
|
||||
fireRandomly(notifications);
|
||||
@@ -290,7 +290,7 @@ void AssetAssignmentManagerTest::testRuntimeAssignMount()
|
||||
|
||||
|
||||
// mount the asset and assign it as the building is assigned already
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(asset1, EXERCISE_42);
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onMountingChanged, &mgr, mount, DataModification::eAdded));
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onAssetChanged, &mgr, asset1, DataModification::eModified));
|
||||
@@ -316,7 +316,7 @@ void AssetAssignmentManagerTest::testStartMountedRuntimeAssign()
|
||||
MainStructureElement building = createBuilding();
|
||||
InstrumentationAsset asset1 = createAsset();
|
||||
InstrumentationAsset asset2 = createAsset();
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onMainStructureElementChanged, &mgr, building, DataModification::eAdded));
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onAssetChanged, &mgr, asset1, DataModification::eAdded));
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onAssetChanged, &mgr, asset2, DataModification::eAdded));
|
||||
@@ -365,7 +365,7 @@ void AssetAssignmentManagerTest::testStartAssignedRuntimeMount()
|
||||
|
||||
|
||||
// mount asset1 and assign it as the building is assigned already
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(asset1, EXERCISE_42);
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onAssetChanged, &mgr, asset1, DataModification::eModified));
|
||||
notifications.push_back(std::bind(&AssetAssignmentManager::onMountingChanged, &mgr, mount, DataModification::eAdded));
|
||||
@@ -390,7 +390,7 @@ void AssetAssignmentManagerTest::testRuntimeUnmountUnassign()
|
||||
MainStructureElement building = createBuilding();
|
||||
InstrumentationAsset asset1 = createAsset();
|
||||
InstrumentationAsset asset2 = createAsset();
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(building, EXERCISE_42);
|
||||
assign(asset1, EXERCISE_42);
|
||||
|
||||
@@ -440,7 +440,7 @@ void AssetAssignmentManagerTest::testRuntimeUnassignUnmount()
|
||||
MainStructureElement building = createBuilding();
|
||||
InstrumentationAsset asset1 = createAsset();
|
||||
InstrumentationAsset asset2 = createAsset();
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(building, EXERCISE_42);
|
||||
assign(asset1, EXERCISE_42);
|
||||
|
||||
@@ -490,7 +490,7 @@ void AssetAssignmentManagerTest::testRuntimeReassign()
|
||||
MainStructureElement building = createBuilding();
|
||||
InstrumentationAsset asset1 = createAsset();
|
||||
InstrumentationAsset asset2 = createAsset();
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(building, EXERCISE_42);
|
||||
assign(asset1, EXERCISE_42);
|
||||
|
||||
@@ -535,7 +535,7 @@ void AssetAssignmentManagerTest::testShutdownMountedAssigned()
|
||||
MainStructureElement building = createBuilding();
|
||||
InstrumentationAsset asset1 = createAsset();
|
||||
InstrumentationAsset asset2 = createAsset();
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(building, EXERCISE_42);
|
||||
assign(asset1, EXERCISE_42);
|
||||
|
||||
@@ -576,7 +576,7 @@ void AssetAssignmentManagerTest::testDoublePendingAssign()
|
||||
MainStructureElement building = createBuilding();
|
||||
InstrumentationAsset asset1 = createAsset();
|
||||
InstrumentationAsset asset2 = createAsset();
|
||||
MountingPointAsset mount = createMount(asset1, building.elements()[0]);
|
||||
MountingPointAsset mount = createMount(asset1, building.elements[0]);
|
||||
assign(building, EXERCISE_42);
|
||||
assign(asset1, EXERCISE_42);
|
||||
|
||||
|
||||
+51
-36
@@ -50,7 +50,7 @@ public:
|
||||
const Streams &findStreams(Asset *asset) override
|
||||
{
|
||||
Q_ASSERT(asset);
|
||||
return findStreams(asset->data().id());
|
||||
return findStreams(asset->data().id);
|
||||
}
|
||||
|
||||
bool isEmpty() const { return m_cache.empty(); }
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
void remove(Asset *asset) override
|
||||
{
|
||||
Q_ASSERT(asset);
|
||||
auto count = m_cache.erase(asset->data().id());
|
||||
auto count = m_cache.erase(asset->data().id);
|
||||
Q_ASSERT(count == 1);
|
||||
}
|
||||
|
||||
@@ -151,11 +151,11 @@ public:
|
||||
Asset *createAsset(int id, MountingPointType mpType, const std::string &properties)
|
||||
{
|
||||
InstrumentationAsset data;
|
||||
data.id(id);
|
||||
data.name(QStringLiteral("ASSET_000%1").arg(id).toUtf8().constData());
|
||||
data.hostname(QStringLiteral("host_000%1").arg(id).toUtf8().constData());
|
||||
data.mountingPointTypeId(mpType);
|
||||
data.properties(properties);
|
||||
data.id = id;
|
||||
data.name = QStringLiteral("ASSET_000%1").arg(id).toUtf8().constData();
|
||||
data.hostname = QStringLiteral("host_000%1").arg(id).toUtf8().constData();
|
||||
data.mountingPointTypeId = mpType;
|
||||
data.properties = properties;
|
||||
|
||||
return new Asset(data);
|
||||
}
|
||||
@@ -163,12 +163,12 @@ Asset *createAsset(int id, MountingPointType mpType, const std::string &properti
|
||||
MountingPoint *createMountingPoint(int id, MountingPointType mpType)
|
||||
{
|
||||
StructureElement data;
|
||||
data.id(id);
|
||||
data.name(QStringLiteral("MP_000%1").arg(id).toUtf8().constData());
|
||||
data.displayName(QStringLiteral("display name %1").arg(id).toUtf8().constData());
|
||||
data.structureElementTypeId(StructureElementType::MountingPoint);
|
||||
data.mountingPointTypeId(mpType);
|
||||
data.properties("{}");
|
||||
data.id = id;
|
||||
data.name = QStringLiteral("MP_000%1").arg(id).toUtf8().constData();
|
||||
data.displayName = QStringLiteral("display name %1").arg(id).toUtf8().constData();
|
||||
data.structureElementTypeId = StructureElementType::MountingPoint;
|
||||
data.mountingPointTypeId = mpType;
|
||||
data.properties = "{}";
|
||||
|
||||
return new MountingPoint(data);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void setProperties(Asset *asset, const std::string &newProperties)
|
||||
{
|
||||
Q_ASSERT(asset);
|
||||
InstrumentationAsset data = asset->data();
|
||||
data.properties(newProperties);
|
||||
data.properties = newProperties;
|
||||
asset->update(data);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ void setDisplayName(MountingPoint *mp, const std::string &newDisplayName)
|
||||
{
|
||||
Q_ASSERT(mp);
|
||||
StructureElement data = mp->data();
|
||||
data.displayName(newDisplayName);
|
||||
data.displayName = newDisplayName;
|
||||
mp->update(data);
|
||||
}
|
||||
|
||||
@@ -194,9 +194,9 @@ void setRecording(MountingPoint *mp, bool on)
|
||||
Q_ASSERT(mp);
|
||||
StructureElement data = mp->data();
|
||||
if (on)
|
||||
data.properties(R"({"record": true})");
|
||||
data.properties = R"({"record": true})";
|
||||
else
|
||||
data.properties(R"({"record": false})");
|
||||
data.properties = R"({"record": false})";
|
||||
mp->update(data);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ void mount(Asset *asset, MountingPoint *mp)
|
||||
{
|
||||
Q_ASSERT(asset);
|
||||
InstrumentationAsset data = asset->data();
|
||||
data.assetStateId(InstrumentationAssetState::Mounted);
|
||||
data.assetStateId = InstrumentationAssetState::Mounted;
|
||||
asset->update(data);
|
||||
asset->mount(mp);
|
||||
}
|
||||
@@ -222,7 +222,21 @@ Database::AvmDeviceConfig dcEntry(int64_t id, const std::string &context, cons
|
||||
return dc;
|
||||
}
|
||||
|
||||
bool operator==(const Database::AvmDeviceConfig &lhs, const Database::AvmDeviceConfig &rhs)
|
||||
} // anonymous namespace
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
namespace Database
|
||||
{
|
||||
|
||||
// rtiddsgen 4.7 emits the generated Database structs without any comparison
|
||||
// operators and also declares 30 unreleated free operator== overloads directly
|
||||
// in namespace AudioVideoManagement (avm.hpp). Unqualified lookup from that
|
||||
// namespace stops at the first enclosing declaration found, so an operator
|
||||
// defined at global scope is never reached, and ADL cannot see it either
|
||||
// because the anonymous namespace is not associated with these operands.
|
||||
// Declaring it in the namespace of the operands is what makes it findable.
|
||||
bool operator==(const AvmDeviceConfig &lhs, const AvmDeviceConfig &rhs)
|
||||
{
|
||||
if (lhs.id != rhs.id)
|
||||
return false;
|
||||
@@ -242,7 +256,8 @@ bool operator==(const Database::AvmDeviceConfig &lhs, const Database::AvmDeviceC
|
||||
return true;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace Database
|
||||
} // namespace AudioVideoManagement
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
@@ -307,12 +322,12 @@ void AudioVideoHandlerImplTest::testAssignCameraVideo()
|
||||
QVERIFY(dtsSpy.m_removed.empty());
|
||||
|
||||
// verify DB
|
||||
const Streams &streams = dbMock.findStreams(m_indoorCam->data().id());
|
||||
const Streams &streams = dbMock.findStreams(m_indoorCam->data().id);
|
||||
QVERIFY(!streams.second);
|
||||
QVERIFY(streams.first == dcEntry(1, "ex_42", "AXIS_VIDEO_CHANNEL", "av_0001", "EXCAVS01", "url=rtsp://root:root@host_0001:554;mode=1;", 0));
|
||||
|
||||
// verify DDS
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id()));
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -356,16 +371,16 @@ void AudioVideoHandlerImplTest::testAssignCameraVideoAudio(const std::string &ca
|
||||
QVERIFY(dtsSpy.m_removed.empty());
|
||||
|
||||
// verfiy DB
|
||||
const Streams &streams = dbMock.findStreams(m_outdoorCam->data().id());
|
||||
const Streams &streams = dbMock.findStreams(m_outdoorCam->data().id);
|
||||
QVERIFY(streams.second);
|
||||
QVERIFY(streams.first == dcEntry(1, "ex_42", "AXIS_VIDEO_CHANNEL", "av_0002", "EXCAVS01", "url=rtsp://root:root@host_0002:554;mode=1;", 2));
|
||||
QVERIFY(*streams.second == dcEntry(2, "ex_42", "AXIS_AUDIO_CHANNEL", "av_0002", "EXCAVS01", "url=http://root:root@host_0002:80;mode=1;", 1));
|
||||
|
||||
// verify DDS
|
||||
const Stream &videoStream = dtsSpy.m_published[0];
|
||||
QCOMPARE(videoStream, Stream(1, "av_0002", StreamType::Video, m_mpOutdoor->data().id()));
|
||||
QCOMPARE(videoStream, Stream(1, "av_0002", StreamType::Video, m_mpOutdoor->data().id));
|
||||
const Stream &audioStream = dtsSpy.m_published[1];
|
||||
QCOMPARE(audioStream, Stream(2, "av_0002", expectedStreamType, m_mpOutdoor->data().id()));
|
||||
QCOMPARE(audioStream, Stream(2, "av_0002", expectedStreamType, m_mpOutdoor->data().id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,12 +400,12 @@ void AudioVideoHandlerImplTest::testAssignAnnouncementUnit()
|
||||
QVERIFY(dtsSpy.m_removed.empty());
|
||||
|
||||
// verfiy DB
|
||||
const Streams &streams = dbMock.findStreams(m_announcementUnit->data().id());
|
||||
const Streams &streams = dbMock.findStreams(m_announcementUnit->data().id);
|
||||
QVERIFY(!streams.second);
|
||||
QVERIFY(streams.first == dcEntry(1, "ex_42", "AXIS_AUDIO_CHANNEL", "av_0003", "EXCAVS01", "url=http://root:root@host_0003:80;codec=aac;mode=1;", 0));
|
||||
|
||||
// verify DDS
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0003", StreamType::AudioOut, m_mpAnnouncementUnit->data().id()));
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0003", StreamType::AudioOut, m_mpAnnouncementUnit->data().id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,14 +478,14 @@ void AudioVideoHandlerImplTest::testUpdateRemoveAssignedAsset()
|
||||
QVERIFY(dtsSpy.m_removed.empty());
|
||||
|
||||
// verify DB
|
||||
Streams streams = dbMock.findStreams(m_indoorCam->data().id());
|
||||
Streams streams = dbMock.findStreams(m_indoorCam->data().id);
|
||||
QVERIFY(streams.second);
|
||||
QVERIFY(streams.first == dcEntry(1, "ex_42", "AXIS_VIDEO_CHANNEL", "av_0001", "EXCAVS01", "url=rtsp://root:root@host_0001:554;mode=1;", 2));
|
||||
QVERIFY(*streams.second == dcEntry(2, "ex_42", "AXIS_AUDIO_CHANNEL", "av_0001", "EXCAVS01", "url=http://root:root@host_0001:80;mode=1;", 1));
|
||||
|
||||
// verify DDS
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id()));
|
||||
QCOMPARE(dtsSpy.m_published[1], Stream(2, "av_0001", StreamType::AudioIn, m_mpIndoor->data().id()));
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id));
|
||||
QCOMPARE(dtsSpy.m_published[1], Stream(2, "av_0001", StreamType::AudioIn, m_mpIndoor->data().id));
|
||||
|
||||
|
||||
// remove microphone again => removal of audio stream
|
||||
@@ -482,12 +497,12 @@ void AudioVideoHandlerImplTest::testUpdateRemoveAssignedAsset()
|
||||
QCOMPARE(static_cast<int>(dtsSpy.m_removed.size()), 1);
|
||||
|
||||
// verify DB
|
||||
streams = dbMock.findStreams(m_indoorCam->data().id());
|
||||
streams = dbMock.findStreams(m_indoorCam->data().id);
|
||||
QVERIFY(!streams.second);
|
||||
QVERIFY(streams.first == dcEntry(1, "ex_42", "AXIS_VIDEO_CHANNEL", "av_0001", "EXCAVS01", "url=rtsp://root:root@host_0001:554;mode=1;", 0));
|
||||
|
||||
// verify DDS
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id()));
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id));
|
||||
QCOMPARE(static_cast<int>(dtsSpy.m_removed[0]), 2);
|
||||
|
||||
|
||||
@@ -529,12 +544,12 @@ void AudioVideoHandlerImplTest::testUpdateAssignedMountingPoint()
|
||||
QVERIFY(dtsSpy.m_removed.empty());
|
||||
|
||||
// verify DB
|
||||
Streams streams = dbMock.findStreams(m_indoorCam->data().id());
|
||||
Streams streams = dbMock.findStreams(m_indoorCam->data().id);
|
||||
QVERIFY(!streams.second);
|
||||
QVERIFY(streams.first == dcEntry(1, "ex_42", "AXIS_VIDEO_CHANNEL", "av_0001", "EXCAVS01", "url=rtsp://root:root@host_0001:554;mode=1;", 0));
|
||||
|
||||
// verify DDS
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id()));
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id));
|
||||
|
||||
|
||||
// set recording-flag on MountingPoint
|
||||
@@ -546,12 +561,12 @@ void AudioVideoHandlerImplTest::testUpdateAssignedMountingPoint()
|
||||
QVERIFY(dtsSpy.m_removed.empty());
|
||||
|
||||
// verify DB
|
||||
streams = dbMock.findStreams(m_indoorCam->data().id());
|
||||
streams = dbMock.findStreams(m_indoorCam->data().id);
|
||||
QVERIFY(!streams.second);
|
||||
QVERIFY(streams.first == dcEntry(1, "ex_42", "AXIS_VIDEO_CHANNEL", "av_0001", "EXCAVS01", "url=rtsp://root:root@host_0001:554;mode=1;recording=ECRS@EXCAVS01;recordcontrol=prealarm;", 0));
|
||||
|
||||
// verify DDS
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id())); // no change here
|
||||
QCOMPARE(dtsSpy.m_published[0], Stream(1, "av_0001", StreamType::Video, m_mpIndoor->data().id)); // no change here
|
||||
}
|
||||
|
||||
void AudioVideoHandlerImplTest::testDeviceDefinitionCameraVideo()
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace AudioVideoManagement
|
||||
Asset::Asset(const InfrastructureManagement::InstrumentationAsset &asset)
|
||||
: m_data(new InfrastructureManagement::InstrumentationAsset(asset))
|
||||
{
|
||||
Q_ASSERT(asset.id() > 0);
|
||||
Q_ASSERT(asset.id > 0);
|
||||
}
|
||||
|
||||
Asset::~Asset() = default;
|
||||
|
||||
+15
-15
@@ -23,18 +23,18 @@ namespace
|
||||
|
||||
bool isAssigned(const InfrastructureManagement::InstrumentationAsset &asset)
|
||||
{
|
||||
return asset.availableInExercise().size() > 0;
|
||||
return asset.availableInExercise.size() > 0;
|
||||
}
|
||||
|
||||
int assignedExercise(const InfrastructureManagement::InstrumentationAsset &asset)
|
||||
{
|
||||
Q_ASSERT(asset.availableInExercise().size() == 1);
|
||||
return asset.availableInExercise()[0];
|
||||
Q_ASSERT(asset.availableInExercise.size() == 1);
|
||||
return asset.availableInExercise[0];
|
||||
}
|
||||
|
||||
bool isMountingPoint(const InfrastructureManagement::StructureElement &structureElement)
|
||||
{
|
||||
return structureElement.structureElementTypeId() == InfrastructureManagement::StructureElementType::MountingPoint;
|
||||
return structureElement.structureElementTypeId == InfrastructureManagement::StructureElementType::MountingPoint;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -96,7 +96,7 @@ void AssetAssignmentManager::onMainStructureElementChanged(const InfrastructureM
|
||||
|
||||
if (modType == DataModification::eAdded)
|
||||
{
|
||||
for (const auto &structureElement: data.elements())
|
||||
for (const auto &structureElement: data.elements)
|
||||
{
|
||||
if (!isMountingPoint(structureElement))
|
||||
continue;
|
||||
@@ -115,11 +115,11 @@ void AssetAssignmentManager::onMainStructureElementChanged(const InfrastructureM
|
||||
// Are the contained StructureElements still the same as before?
|
||||
// For now we simply assume that the MountingPoints are still the same
|
||||
// and we just update them.
|
||||
for (const auto &structureElement: data.elements())
|
||||
for (const auto &structureElement: data.elements)
|
||||
{
|
||||
if (!isMountingPoint(structureElement))
|
||||
continue;
|
||||
MountingPoint *mountingPoint = findMountingPoint(structureElement.id()).second;
|
||||
MountingPoint *mountingPoint = findMountingPoint(structureElement.id).second;
|
||||
Q_ASSERT(mountingPoint);
|
||||
if (mountingPoint)
|
||||
mountingPoint->update(structureElement);
|
||||
@@ -162,10 +162,10 @@ void AssetAssignmentManager::addAsset(const InfrastructureManagement::Instrument
|
||||
*/
|
||||
void AssetAssignmentManager::modifyAsset(const InfrastructureManagement::InstrumentationAsset &asset)
|
||||
{
|
||||
if (hasPendingModifications(asset.id()))
|
||||
if (hasPendingModifications(asset.id))
|
||||
return m_pendingModifications.push_back(asset);
|
||||
|
||||
auto found = findAsset(asset.id());
|
||||
auto found = findAsset(asset.id);
|
||||
Asset *foundAsset = found.second;
|
||||
Q_ASSERT(foundAsset);
|
||||
|
||||
@@ -197,7 +197,7 @@ void AssetAssignmentManager::modifyAsset(const InfrastructureManagement::Instrum
|
||||
*/
|
||||
void AssetAssignmentManager::removeAsset(const InfrastructureManagement::InstrumentationAsset &asset)
|
||||
{
|
||||
auto assetAndExercise = findAsset(asset.id());
|
||||
auto assetAndExercise = findAsset(asset.id);
|
||||
Asset *foundAsset = assetAndExercise.second;
|
||||
Exercise *exercise = assetAndExercise.first;
|
||||
Q_ASSERT(foundAsset);
|
||||
@@ -258,14 +258,14 @@ void AssetAssignmentManager::unassignAsset(Asset *asset, Exercise *exercise, con
|
||||
*/
|
||||
void AssetAssignmentManager::addMount(const InfrastructureManagement::MountingPointAsset &mount)
|
||||
{
|
||||
Asset *asset = pool()->findAsset(mount.assetId());
|
||||
Asset *asset = pool()->findAsset(mount.assetId);
|
||||
if (!asset)
|
||||
{
|
||||
m_pendingMounts.push_back(mount);
|
||||
return;
|
||||
}
|
||||
|
||||
MountingPoint *mountingPoint = pool()->findMountingPoint(mount.structureElementId());
|
||||
MountingPoint *mountingPoint = pool()->findMountingPoint(mount.structureElementId);
|
||||
if (!mountingPoint)
|
||||
{
|
||||
m_pendingMounts.push_back(mount);
|
||||
@@ -279,7 +279,7 @@ void AssetAssignmentManager::addMount(const InfrastructureManagement::MountingPo
|
||||
|
||||
void AssetAssignmentManager::removeMount(const InfrastructureManagement::MountingPointAsset &mount)
|
||||
{
|
||||
auto exerciseAndAsset = findAsset(mount.assetId());
|
||||
auto exerciseAndAsset = findAsset(mount.assetId);
|
||||
Asset *asset = exerciseAndAsset.second;
|
||||
Exercise *exercise = exerciseAndAsset.first;
|
||||
Q_ASSERT(asset);
|
||||
@@ -304,7 +304,7 @@ void AssetAssignmentManager::tryUnmount(Asset *asset, Exercise *exercise)
|
||||
if (exercise)
|
||||
inPoolExercise = exercise == pool();
|
||||
else
|
||||
inPoolExercise = pool()->findAsset(asset->data().id());
|
||||
inPoolExercise = pool()->findAsset(asset->data().id);
|
||||
|
||||
if (!inPoolExercise)
|
||||
{
|
||||
@@ -366,7 +366,7 @@ void AssetAssignmentManager::processPendingRemoves()
|
||||
|
||||
bool AssetAssignmentManager::hasPendingModifications(int assetId)
|
||||
{
|
||||
auto idMatches = [assetId] (const InfrastructureManagement::InstrumentationAsset &asset) { return asset.id() == assetId; };
|
||||
auto idMatches = [assetId] (const InfrastructureManagement::InstrumentationAsset &asset) { return asset.id == assetId; };
|
||||
auto found = std::find_if(m_pendingModifications.begin(), m_pendingModifications.end(), idMatches);
|
||||
return found != m_pendingModifications.end();
|
||||
}
|
||||
|
||||
+20
-20
@@ -157,9 +157,9 @@ QString recordingString(bool hasRecordingOn_, bool usePrealarm)
|
||||
|
||||
bool isMountingPointOfInterest(const InfrastructureManagement::InstrumentationAsset &asset)
|
||||
{
|
||||
return (asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType::OutdoorCamera ||
|
||||
asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType::AnnouncementUnit);
|
||||
return (asset.mountingPointTypeId == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
asset.mountingPointTypeId == InfrastructureManagement::MountingPointType::OutdoorCamera ||
|
||||
asset.mountingPointTypeId == InfrastructureManagement::MountingPointType::AnnouncementUnit);
|
||||
}
|
||||
|
||||
bool hasRecordingOn(const JsonObject &mountingPointProperties)
|
||||
@@ -170,10 +170,10 @@ bool hasRecordingOn(const JsonObject &mountingPointProperties)
|
||||
Stream toDds(const AvmDeviceConfigEx &dc, int32_t mountintPointId)
|
||||
{
|
||||
Stream stream;
|
||||
stream.id(dc.id);
|
||||
stream.name(dc.name.toStdString());
|
||||
stream.type(dc.streamType);
|
||||
stream.mountingPointId(mountintPointId);
|
||||
stream.id = dc.id;
|
||||
stream.name = dc.name.toStdString();
|
||||
stream.type = dc.streamType;
|
||||
stream.mountingPointId = mountintPointId;
|
||||
return stream;
|
||||
}
|
||||
|
||||
@@ -208,12 +208,12 @@ Streams::Streams(Asset *asset_, const AvmDeviceConfigEx &first_, const AvmDevice
|
||||
|
||||
int32_t Streams::assetId() const
|
||||
{
|
||||
return asset->data().id();
|
||||
return asset->data().id;
|
||||
}
|
||||
|
||||
int32_t Streams::mountingPointId() const
|
||||
{
|
||||
return asset->mountingPoint()->data().id();
|
||||
return asset->mountingPoint()->data().id;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,23 +246,23 @@ Streams AudioVideoHandlerImpl::createStreams(Asset *asset_)
|
||||
Database::AvmDeviceConfig dc;
|
||||
dc.context = m_exContext.toString();
|
||||
dc.controller = avController();
|
||||
dc.name = internalStreamName(asset_->mountingPoint()->data().id());
|
||||
dc.name = internalStreamName(asset_->mountingPoint()->data().id);
|
||||
|
||||
const InfrastructureManagement::InstrumentationAsset &asset = asset_->data();
|
||||
const JsonObject assetProperties = jsonFromString(asset.properties());
|
||||
const JsonObject mpProperties = JsonObject::fromJson(asset_->mountingPoint()->data().properties());
|
||||
const JsonObject assetProperties = jsonFromString(asset.properties);
|
||||
const JsonObject mpProperties = JsonObject::fromJson(asset_->mountingPoint()->data().properties);
|
||||
|
||||
if (asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType::AnnouncementUnit)
|
||||
if (asset.mountingPointTypeId == InfrastructureManagement::MountingPointType::AnnouncementUnit)
|
||||
{
|
||||
dc.definition = deviceDefinitionAnnouncementUnit(asset.hostname(), assetProperties, mpProperties);
|
||||
dc.definition = deviceDefinitionAnnouncementUnit(asset.hostname, assetProperties, mpProperties);
|
||||
dc.type = avTypeAudioChannel(assetProperties);
|
||||
return {asset_, {dc, StreamType::AudioOut}};
|
||||
}
|
||||
|
||||
Q_ASSERT(asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType::OutdoorCamera);
|
||||
Q_ASSERT(asset.mountingPointTypeId == InfrastructureManagement::MountingPointType::IndoorCamera ||
|
||||
asset.mountingPointTypeId == InfrastructureManagement::MountingPointType::OutdoorCamera);
|
||||
|
||||
dc.definition = deviceDefinitionCameraVideo(asset.hostname(), assetProperties, mpProperties);
|
||||
dc.definition = deviceDefinitionCameraVideo(asset.hostname, assetProperties, mpProperties);
|
||||
dc.type = avTypeVideoChannel(assetProperties);
|
||||
|
||||
if (!cameraHasMicrophone(assetProperties) && !cameraHasSpeaker(assetProperties))
|
||||
@@ -279,7 +279,7 @@ Streams AudioVideoHandlerImpl::createStreams(Asset *asset_)
|
||||
else
|
||||
audioStreamType = StreamType::AudioOut;
|
||||
|
||||
dcAudio.definition = deviceDefinitionCameraAudio(asset.hostname(), assetProperties, mpProperties);
|
||||
dcAudio.definition = deviceDefinitionCameraAudio(asset.hostname, assetProperties, mpProperties);
|
||||
dcAudio.type = avTypeAudioChannel(assetProperties);
|
||||
return {asset_, {dc, StreamType::Video}, {dcAudio, audioStreamType}};
|
||||
}
|
||||
@@ -324,7 +324,7 @@ void AudioVideoHandlerImpl::onAssetChanged(Asset *asset)
|
||||
{
|
||||
Q_ASSERT(m_isActive);
|
||||
Q_ASSERT(asset);
|
||||
DEBUG_LOG(m_logger) << m_exContext << ": Asset changed: " << asset->data().name() << "(" << asset->data().id() << ")";
|
||||
DEBUG_LOG(m_logger) << m_exContext << ": Asset changed: " << asset->data().name << "(" << asset->data().id << ")";
|
||||
|
||||
updateDeviceConfig(asset);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ void AudioVideoHandlerImpl::onMountingPointChanged(MountingPoint *mountingPoint)
|
||||
{
|
||||
Q_ASSERT(m_isActive);
|
||||
Q_ASSERT(mountingPoint);
|
||||
DEBUG_LOG(m_logger) << m_exContext << ": MountingPoint changed: " << mountingPoint->data().name() << "(" << mountingPoint->data().id() << ")";
|
||||
DEBUG_LOG(m_logger) << m_exContext << ": MountingPoint changed: " << mountingPoint->data().name << "(" << mountingPoint->data().id << ")";
|
||||
|
||||
updateDeviceConfig(mountingPoint->asset());
|
||||
}
|
||||
|
||||
@@ -104,7 +104,9 @@ void AVSocket::onConnectToAVS()
|
||||
this, &AVSocket::onDisconnected);
|
||||
connect(m_avsSocket, &QTcpSocket::connected,
|
||||
this, [this] {m_bErrorInTcpComWarnedOnce = false;});
|
||||
connect(m_avsSocket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error),
|
||||
// Qt6: QAbstractSocket::error() (the getter/signal overload pair) was
|
||||
// replaced by the errorOccurred signal.
|
||||
connect(m_avsSocket, &QAbstractSocket::errorOccurred,
|
||||
this, &AVSocket::onError);
|
||||
connect(m_avsSocket, &QTcpSocket::readyRead,
|
||||
this, &AVSocket::onReadyRead);
|
||||
|
||||
@@ -141,7 +141,9 @@ void AvaComm::queryTimeline(const QString &streamName, const boost::optional<Ava
|
||||
void AvaComm::setVolume(AvaVolume db)
|
||||
{
|
||||
static const QString cmd = QStringLiteral("setVolume 1 %1");
|
||||
m_avSocket.send(cmd.arg(db).toUtf8());
|
||||
// Qt6 QString::arg is enable_if-constrained to arithmetic types and no
|
||||
// longer picks up the implicit operator int() of AvaVolume.
|
||||
m_avSocket.send(cmd.arg(int(db)).toUtf8());
|
||||
}
|
||||
|
||||
void AvaComm::startStream(const QString &dialogId, const QString &streamName, AvaSpeed speed)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
class QByteArray;
|
||||
class QString;
|
||||
class QStringList;
|
||||
class QRect;
|
||||
|
||||
namespace AudioVideoManagement
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <QtCore/QObject>
|
||||
#include <chrono>
|
||||
|
||||
class QStringList;
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QPair>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
+9
-9
@@ -30,9 +30,9 @@ bool DtcImplCustom::isFreeVideoTeam(int exerciseId, int videoTeamId)
|
||||
|
||||
for (const auto &sample : m_dtcVideoTeam->readAlive())
|
||||
{
|
||||
if (sample.data().id() == videoTeamId &&
|
||||
(sample.data().exerciseId() == exerciseId ||
|
||||
sample.data().exerciseId() != 0) )
|
||||
if (sample.data().id == videoTeamId &&
|
||||
(sample.data().exerciseId == exerciseId ||
|
||||
sample.data().exerciseId != 0) )
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ bool DtcImplCustom::getActiveFrequencyPlanningIdForExercise(int exerciseId, int
|
||||
|
||||
for (const auto &sample : m_dtcActiveFrequencyPlanning->readAlive())
|
||||
{
|
||||
if (sample.data().exerciseId() == exerciseId)
|
||||
if (sample.data().exerciseId == exerciseId)
|
||||
{
|
||||
frequencyPlanningId = sample.data().frequencyPlanningId();
|
||||
frequencyPlanningId = sample.data().frequencyPlanningId;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -74,9 +74,9 @@ bool DtcImplCustom::mountingPointForStreamName(const QString &streamName, int &m
|
||||
const std::string streamNameStd = streamName.toStdString();
|
||||
for (const auto &sample : m_dtcStreamName->readAlive())
|
||||
{
|
||||
if (sample.data().internalName() == streamNameStd)
|
||||
if (sample.data().internalName == streamNameStd)
|
||||
{
|
||||
mountingPointId = sample.data().mountingPointId();
|
||||
mountingPointId = sample.data().mountingPointId;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -94,8 +94,8 @@ int DtcImplCustom::getActiveVideoReceiver(int teamId)
|
||||
|
||||
for (const auto &sample : m_dtcVideoReceiver->readAlive())
|
||||
{
|
||||
if (sample.data().teamId() == teamId && sample.data().isActive() )
|
||||
return sample.data().id();
|
||||
if (sample.data().teamId == teamId && sample.data().isActive )
|
||||
return sample.data().id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -43,18 +43,18 @@ QString toMenuDef(const AudioVideoManagement::AvMenuEntry &menuEntry,
|
||||
// no prefix2
|
||||
}
|
||||
|
||||
if (!menuEntry.isGroup())
|
||||
return QStringLiteral("%1{%2}").arg(prefix1, QString::fromStdString(menuEntry.name().get()));
|
||||
if (!menuEntry.isGroup)
|
||||
return QStringLiteral("%1{%2}").arg(prefix1, QString::fromStdString(menuEntry.name.get()));
|
||||
|
||||
QString def = QStringLiteral("%1{%2:").arg(prefix1, QString::fromStdString(menuEntry.name().get()));
|
||||
QString def = QStringLiteral("%1{%2:").arg(prefix1, QString::fromStdString(menuEntry.name.get()));
|
||||
|
||||
for (const auto &entry : meCont)
|
||||
{
|
||||
bool isChildEntry = entry.parentId() == menuEntry.id();
|
||||
bool isChildEntry = entry.parentId == menuEntry.id;
|
||||
if (!isChildEntry)
|
||||
continue;
|
||||
Q_ASSERT(!entry.isGroup());
|
||||
def += QStringLiteral(" %1{%2}").arg(prefix2, QString::fromStdString(entry.name().get()));
|
||||
Q_ASSERT(!entry.isGroup);
|
||||
def += QStringLiteral(" %1{%2}").arg(prefix2, QString::fromStdString(entry.name.get()));
|
||||
}
|
||||
def += QLatin1Char('}');
|
||||
return def;
|
||||
@@ -65,12 +65,12 @@ QString toMenuDef(const AudioVideoManagement::MenuStruct &menuStruct)
|
||||
// Hint: MenuStruct-entries are sorted already (done by the Service (HandlerMenuStruct)).
|
||||
|
||||
QStringList entries;
|
||||
entries.reserve(menuStruct.menuEntries().size()); // probably more than needed, but avoid clazy warning
|
||||
for (const auto &entry : menuStruct.menuEntries())
|
||||
entries.reserve(menuStruct.menuEntries.size()); // probably more than needed, but avoid clazy warning
|
||||
for (const auto &entry : menuStruct.menuEntries)
|
||||
{
|
||||
bool isToplevelEntry = entry.parentId() == menuStruct.id();
|
||||
bool isToplevelEntry = entry.parentId == menuStruct.id;
|
||||
if (isToplevelEntry)
|
||||
entries.append(toMenuDef(entry, menuStruct.menuEntries(), menuStruct.isAudio()));
|
||||
entries.append(toMenuDef(entry, menuStruct.menuEntries, menuStruct.isAudio));
|
||||
}
|
||||
return entries.join(QLatin1Char(' '));
|
||||
}
|
||||
@@ -83,13 +83,13 @@ void selectAtFirstPos(const AudioVideoManagement::MenuStruct &menu, QStringList
|
||||
{
|
||||
using AudioVideoManagement::AvMenuEntry;
|
||||
|
||||
auto withMountingPointId = [mountingPointId] (const AvMenuEntry &entry) { return entry.mountingPointId() && entry.mountingPointId().get() == mountingPointId; };
|
||||
auto found = std::find_if(menu.menuEntries().begin(), menu.menuEntries().end(), withMountingPointId);
|
||||
auto withMountingPointId = [mountingPointId] (const AvMenuEntry &entry) { return entry.mountingPointId && entry.mountingPointId.get() == mountingPointId; };
|
||||
auto found = std::find_if(menu.menuEntries.begin(), menu.menuEntries.end(), withMountingPointId);
|
||||
|
||||
if (found == menu.menuEntries().end())
|
||||
if (found == menu.menuEntries.end())
|
||||
return;
|
||||
|
||||
QString streamName = QString::fromStdString(found->name().get());
|
||||
QString streamName = QString::fromStdString(found->name.get());
|
||||
|
||||
auto currentPosInSelection = std::find(selection.begin(), selection.end(), streamName);
|
||||
if (currentPosInSelection == selection.begin())
|
||||
@@ -170,7 +170,7 @@ void AvsMenus::onSessionEstablished()
|
||||
|
||||
void AvsMenus::onMenuStructChanged(const MenuStruct &menu, DataModification modType)
|
||||
{
|
||||
if (menu.isAudio())
|
||||
if (menu.isAudio)
|
||||
m_announcementMenu.onChanged(menu, modType);
|
||||
else
|
||||
m_videoMenu.onChanged(menu, modType);
|
||||
@@ -188,13 +188,13 @@ void AvsMenus::sendAnnouncementMenu(const MenuStruct &menu, const boost::optiona
|
||||
stateList.reserve(6);
|
||||
|
||||
int i = 0;
|
||||
for (const auto &audioEntry : menu.menuEntries())
|
||||
for (const auto &audioEntry : menu.menuEntries)
|
||||
{
|
||||
bool isToplevel = audioEntry.parentId() == menu.id();
|
||||
bool isToplevel = audioEntry.parentId == menu.id;
|
||||
if (!isToplevel)
|
||||
break; // only select toplevel entries. Hint: menuEntries are ordered so that all toplevel entries are at the front.
|
||||
|
||||
selection.append(QString::fromStdString(audioEntry.name().get()));
|
||||
selection.append(QString::fromStdString(audioEntry.name.get()));
|
||||
int zustand = 1; // wird derzeit nicht gespeichert, also per default auf 1
|
||||
stateList += QString::number(zustand);
|
||||
++i;
|
||||
@@ -247,10 +247,10 @@ void AvsMenus::Menu::setMenu(int menuId)
|
||||
{
|
||||
Q_ASSERT(menuId > 0);
|
||||
MenuStruct menu = m_dtc->menuStruct(menuId);
|
||||
if (menu.id() != menuId)
|
||||
if (menu.id != menuId)
|
||||
return;
|
||||
|
||||
Q_ASSERT(menu.isAudio() == m_isAudio);
|
||||
Q_ASSERT(menu.isAudio == m_isAudio);
|
||||
//replace mvs streams
|
||||
|
||||
replaceMvsEntries(menu);
|
||||
@@ -260,14 +260,14 @@ void AvsMenus::Menu::setMenu(int menuId)
|
||||
void AvsMenus::Menu::replaceMvsEntries(MenuStruct &menu) const
|
||||
{
|
||||
std::vector<AvMenuEntry> newMenu;
|
||||
newMenu.reserve(menu.menuEntries().size());
|
||||
for (auto menuEntry : menu.menuEntries())
|
||||
newMenu.reserve(menu.menuEntries.size());
|
||||
for (auto menuEntry : menu.menuEntries)
|
||||
{
|
||||
if (menuEntry.mountingPointId().is_set() && menuEntry.mountingPointId().get() < 0)
|
||||
menuEntry.name() = m_dtc->videoTeam(menuEntry.mountingPointId().get()*-1).streamName();
|
||||
if (menuEntry.mountingPointId.is_set() && menuEntry.mountingPointId.get() < 0)
|
||||
menuEntry.name = m_dtc->videoTeam(menuEntry.mountingPointId.get()*-1).streamName;
|
||||
newMenu.push_back(std::move(menuEntry));
|
||||
}
|
||||
std::swap(menu.menuEntries(), newMenu);
|
||||
std::swap(menu.menuEntries, newMenu);
|
||||
}
|
||||
|
||||
void AvsMenus::Menu::setAnnouncementUnit(int mountingPointId)
|
||||
@@ -278,10 +278,10 @@ void AvsMenus::Menu::setAnnouncementUnit(int mountingPointId)
|
||||
return;
|
||||
|
||||
const MenuStruct menu = m_dtc->menuStruct(*m_defaultMenu);
|
||||
if (menu.id() != *m_defaultMenu)
|
||||
if (menu.id != *m_defaultMenu)
|
||||
return;
|
||||
|
||||
Q_ASSERT(menu.isAudio() == m_isAudio);
|
||||
Q_ASSERT(menu.isAudio == m_isAudio);
|
||||
|
||||
setMenu(menu, mountingPointId);
|
||||
}
|
||||
@@ -317,10 +317,10 @@ void AvsMenus::Menu::onSessionEstablished()
|
||||
|
||||
void AvsMenus::Menu::onMenuAdded(MenuStruct menu)
|
||||
{
|
||||
if (!menu.isDefault())
|
||||
if (!menu.isDefault)
|
||||
return;
|
||||
|
||||
m_defaultMenu = menu.id();
|
||||
m_defaultMenu = menu.id;
|
||||
|
||||
if (!m_currentMenu)
|
||||
{
|
||||
@@ -331,7 +331,7 @@ void AvsMenus::Menu::onMenuAdded(MenuStruct menu)
|
||||
|
||||
void AvsMenus::Menu::onMenuChanged(MenuStruct menu)
|
||||
{
|
||||
if (m_currentMenu == menu.id())
|
||||
if (m_currentMenu == menu.id)
|
||||
{
|
||||
replaceMvsEntries(menu);
|
||||
setMenu(menu);
|
||||
@@ -340,7 +340,7 @@ void AvsMenus::Menu::onMenuChanged(MenuStruct menu)
|
||||
|
||||
void AvsMenus::Menu::onMenuRemoved(const MenuStruct &menu)
|
||||
{
|
||||
if (m_currentMenu != menu.id())
|
||||
if (m_currentMenu != menu.id)
|
||||
return;
|
||||
|
||||
m_currentMenu.reset();
|
||||
@@ -349,9 +349,9 @@ void AvsMenus::Menu::onMenuRemoved(const MenuStruct &menu)
|
||||
|
||||
void AvsMenus::Menu::setMenu(const MenuStruct &menu, const boost::optional<int> &mountingPointIdOfSelectedStream)
|
||||
{
|
||||
Q_ASSERT(menu.id() > 0);
|
||||
Q_ASSERT(menu.id > 0);
|
||||
Q_ASSERT(m_ismDtc);
|
||||
m_currentMenu = menu.id();
|
||||
m_currentMenu = menu.id;
|
||||
|
||||
/*
|
||||
const auto &mountedAssets = m_ismDtc->mountingPointAssets();
|
||||
@@ -360,17 +360,17 @@ void AvsMenus::Menu::setMenu(const MenuStruct &menu, const boost::optional<int>
|
||||
std::vector<AudioVideoManagement::AvMenuEntry> menuEntriesToUse;
|
||||
for (const auto &entry : realMenu.menuEntries())
|
||||
{
|
||||
if (!entry.isGroup() && !entry.mountingPointId().is_set() )
|
||||
if (!entry.isGroup() && !entry.mountingPointId.is_set() )
|
||||
continue;
|
||||
|
||||
bool isMounted = false;
|
||||
|
||||
if(!entry.isGroup() && entry.mountingPointId().is_set())
|
||||
if(!entry.isGroup() && entry.mountingPointId.is_set())
|
||||
{
|
||||
|
||||
for (const auto &mountedAsset : mountedAssets)
|
||||
{
|
||||
if (mountedAsset.structureElementId() == entry.mountingPointId().get())
|
||||
if (mountedAsset.structureElementId() == entry.mountingPointId.get())
|
||||
{
|
||||
isMounted = true;
|
||||
break;
|
||||
|
||||
@@ -91,11 +91,11 @@ Database::AvmCnrConfig toDb(const ModifyCnrConfigRequest &config)
|
||||
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();
|
||||
if (config.unitId.is_set())
|
||||
result.unitId = config.unitId.get();
|
||||
result.recording = config.recording();
|
||||
if (config.exerciseId().is_set())
|
||||
result.exerciseId = config.exerciseId().get();
|
||||
if (config.exerciseId.is_set())
|
||||
result.exerciseId = config.exerciseId.get();
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -490,21 +490,21 @@ bool CnrHandler::checkConstraint(const std::function<bool (const CnrConfig &)> &
|
||||
// or when both exercises are currently active.
|
||||
// If one is global and one local the constraint must always hold if the local exercise is active
|
||||
// Otherwise the constraint must always hold
|
||||
bool bothLocal = config.exerciseId().is_set() && exerciseId.is_initialized();
|
||||
bool bothLocal = config.exerciseId.is_set() && exerciseId.is_initialized();
|
||||
if (bothLocal)
|
||||
{
|
||||
bool sameExercise = config.exerciseId().get() == *exerciseId;
|
||||
bool bothActive = isActiveExercise(config.exerciseId().get()) && isActiveExercise(*exerciseId);
|
||||
bool sameExercise = config.exerciseId.get() == *exerciseId;
|
||||
bool bothActive = isActiveExercise(config.exerciseId.get()) && isActiveExercise(*exerciseId);
|
||||
|
||||
if (!sameExercise && !bothActive)
|
||||
continue;
|
||||
}
|
||||
else if(config.exerciseId().is_set() && !exerciseId.is_initialized())
|
||||
else if(config.exerciseId.is_set() && !exerciseId.is_initialized())
|
||||
{
|
||||
if(!isActiveExercise(config.exerciseId().get()))
|
||||
if(!isActiveExercise(config.exerciseId.get()))
|
||||
continue;
|
||||
}
|
||||
else if(exerciseId.is_initialized() && !config.exerciseId().is_set())
|
||||
else if(exerciseId.is_initialized() && !config.exerciseId.is_set())
|
||||
{
|
||||
if(!isActiveExercise(*exerciseId))
|
||||
continue;
|
||||
@@ -662,10 +662,10 @@ bool CnrHandler::isActiveExercise(int exerciseId) const
|
||||
bool CnrHandler::needDeviceConfig(const CnrConfig &config) const
|
||||
{
|
||||
// For global, we always need the config
|
||||
if (!config.exerciseId().is_set())
|
||||
if (!config.exerciseId.is_set())
|
||||
return true;
|
||||
|
||||
int32_t exerciseId = config.exerciseId().get();
|
||||
int32_t exerciseId = config.exerciseId.get();
|
||||
// Not for inactive exercises
|
||||
if (!isActiveExercise(exerciseId))
|
||||
return false;
|
||||
@@ -702,8 +702,8 @@ bool CnrHandler::haveActiveFrequencyPlanning() const
|
||||
QString CnrHandler::exerciseList(const CnrConfig &config) const
|
||||
{
|
||||
// Local
|
||||
if (config.exerciseId().is_set())
|
||||
return ExerciseContext(config.exerciseId().get()).toString();
|
||||
if (config.exerciseId.is_set())
|
||||
return ExerciseContext(config.exerciseId.get()).toString();
|
||||
|
||||
// Global - all active exercises, no matter if they have active plannings or not
|
||||
QStringList exerciseList;
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ Core::FunctionReplyObject isValid(int configId, int64_t exerciseId, Handler *han
|
||||
return reply.setStr(tr_lts("dds", "%1 config %2 does not exist")).arg(configTypeAsString).arg(configId);
|
||||
|
||||
const auto &config = handler->config(configId);
|
||||
if (config.exerciseId().is_set() && config.exerciseId().get() != exerciseId)
|
||||
if (config.exerciseId.is_set() && config.exerciseId.get() != exerciseId)
|
||||
return reply.setStr(tr_lts("dds", "%1 config %2 cannot be used in exercise %3")).arg(configTypeAsString).arg(configId).arg(exerciseId);
|
||||
|
||||
return reply;
|
||||
|
||||
@@ -17,21 +17,21 @@ namespace AudioVideoManagement
|
||||
void Exercise::add(std::unique_ptr<Asset> &&asset)
|
||||
{
|
||||
Q_ASSERT(asset.get());
|
||||
auto insertResult = m_assets.insert(std::make_pair(asset->data().id(), std::move(asset)));
|
||||
auto insertResult = m_assets.insert(std::make_pair(asset->data().id, std::move(asset)));
|
||||
Q_ASSERT(insertResult.second);
|
||||
}
|
||||
|
||||
void Exercise::add(std::unique_ptr<MountingPoint> &&mountingPoint)
|
||||
{
|
||||
Q_ASSERT(mountingPoint.get());
|
||||
auto insertResult = m_mountingPoints.insert(std::make_pair(mountingPoint->data().id(), std::move(mountingPoint)));
|
||||
auto insertResult = m_mountingPoints.insert(std::make_pair(mountingPoint->data().id, std::move(mountingPoint)));
|
||||
Q_ASSERT(insertResult.second);
|
||||
}
|
||||
|
||||
std::unique_ptr<Asset> Exercise::take(Asset *asset)
|
||||
{
|
||||
Q_ASSERT(asset);
|
||||
auto found = m_assets.find(asset->data().id());
|
||||
auto found = m_assets.find(asset->data().id);
|
||||
Q_ASSERT(found != m_assets.end());
|
||||
|
||||
std::unique_ptr<Asset> taken = std::move(found->second);
|
||||
@@ -42,7 +42,7 @@ std::unique_ptr<Asset> Exercise::take(Asset *asset)
|
||||
std::unique_ptr<MountingPoint> Exercise::take(MountingPoint *mountingPoint)
|
||||
{
|
||||
Q_ASSERT(mountingPoint);
|
||||
auto found = m_mountingPoints.find(mountingPoint->data().id());
|
||||
auto found = m_mountingPoints.find(mountingPoint->data().id);
|
||||
Q_ASSERT(found != m_mountingPoints.end());
|
||||
|
||||
std::unique_ptr<MountingPoint> taken = std::move(found->second);
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ ExerciseContext ExerciseContext::fromString(const QString &s)
|
||||
Q_ASSERT(s.startsWith(EX_PREFIX()));
|
||||
|
||||
bool couldConvert = false;
|
||||
int exerciseId = s.midRef(EX_PREFIX().size()).toInt(&couldConvert);
|
||||
int exerciseId = s.mid(EX_PREFIX().size()).toInt(&couldConvert);
|
||||
Q_ASSERT(couldConvert);
|
||||
return ExerciseContext(exerciseId);
|
||||
}
|
||||
|
||||
+8
-8
@@ -86,8 +86,8 @@ Database::AvmFrequencyPlanning toDb(const FrequencyPlanning &ddsPlan)
|
||||
{
|
||||
Database::AvmFrequencyPlanning dbPlan;
|
||||
dbPlan.id = ddsPlan.id();
|
||||
if (ddsPlan.exerciseId().is_set())
|
||||
dbPlan.exerciseId = ddsPlan.exerciseId().get();
|
||||
if (ddsPlan.exerciseId.is_set())
|
||||
dbPlan.exerciseId = ddsPlan.exerciseId.get();
|
||||
dbPlan.dateOfCreation = ddsPlan.date();
|
||||
dbPlan.frequencySetId = ddsPlan.frequencySetId();
|
||||
|
||||
@@ -384,8 +384,8 @@ Core::FunctionReplyObject FrequencyPlanningHandler::validateModifyRequest(const
|
||||
|
||||
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())
|
||||
@@ -417,7 +417,7 @@ Core::FunctionReplyObject FrequencyPlanningHandler::validateRequest(const Core::
|
||||
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;
|
||||
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();
|
||||
if (isActive)
|
||||
@@ -542,7 +542,7 @@ Core::FunctionReplyObject FrequencyPlanningHandler::testActivation(const std::ve
|
||||
for (const FrequencyPlanningData &entry : entries)
|
||||
{
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(entry.cnrConfigId());
|
||||
bool isGlobal = !cnrConfig.exerciseId().is_set();
|
||||
bool isGlobal = !cnrConfig.exerciseId.is_set();
|
||||
if (!isGlobal)
|
||||
continue;
|
||||
|
||||
@@ -619,7 +619,7 @@ std::vector<int> FrequencyPlanningHandler::takenGlobalCnrConfigs(const std::vect
|
||||
for (const FrequencyPlanningData &entry : plan.data())
|
||||
{
|
||||
const CnrConfig &cnrConfig = m_cnrHandler->config(entry.cnrConfigId());
|
||||
bool isGlobal = !cnrConfig.exerciseId().is_set();
|
||||
bool isGlobal = !cnrConfig.exerciseId.is_set();
|
||||
if (isGlobal)
|
||||
result.push_back(cnrConfig.id());
|
||||
}
|
||||
@@ -774,7 +774,7 @@ void FrequencyPlanningHandler::onCnrConfigRemoved(int cnrConfigId)
|
||||
req.data().erase(found);
|
||||
|
||||
req.date() = fp.date();
|
||||
req.exerciseId() = fp.exerciseId().is_set() ? fp.exerciseId().get() : 0;
|
||||
req.exerciseId() = fp.exerciseId.is_set() ? fp.exerciseId.get() : 0;
|
||||
req.frequencySetId() = fp.frequencySetId();
|
||||
req.id() = fp.id();
|
||||
req.name() = fp.name();
|
||||
|
||||
+6
-6
@@ -28,16 +28,16 @@ static FrequencyPlanningStatus convert(const ModifyFrequencyPlanningStatusReques
|
||||
}
|
||||
newData.uuid() = request.uuid().empty() ? oldData.uuid() : request.uuid();
|
||||
newData.id() = oldData.id();
|
||||
if (request.sent().is_set())
|
||||
if (request.sent.is_set())
|
||||
{
|
||||
newData.sent() = request.sent().get();
|
||||
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();
|
||||
if (request.activated().is_set())
|
||||
if (request.received.is_set())
|
||||
newData.received() = request.received.get();
|
||||
if (request.activated.is_set())
|
||||
{
|
||||
newData.activated() = request.activated().get();
|
||||
newData.activated() = request.activated.get();
|
||||
newData.requester() = request.requester(); // ! Requester is only sent, when data gets activated.
|
||||
}
|
||||
newData.isActive() = request.isActive();
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AudioVideoManagement
|
||||
MountingPoint::MountingPoint(const InfrastructureManagement::StructureElement &mountingPoint)
|
||||
: m_data(new InfrastructureManagement::StructureElement(mountingPoint))
|
||||
{
|
||||
Q_ASSERT(mountingPoint.id() > 0);
|
||||
Q_ASSERT(mountingPoint.id > 0);
|
||||
}
|
||||
|
||||
MountingPoint::~MountingPoint() = default;
|
||||
|
||||
+6
-6
@@ -124,12 +124,12 @@ Database::AvmFrequencyPlanningStatus ObjectFrequencyPlanningStatus::toDbData(con
|
||||
dbData.content = QString::fromStdString(ddsData.content());
|
||||
dbData.reason = ddsData.reason().underlying();
|
||||
|
||||
if (ddsData.sent().is_set())
|
||||
dbData.sent = ddsData.sent().get();
|
||||
if (ddsData.received().is_set())
|
||||
dbData.received = ddsData.received().get();
|
||||
if (ddsData.activated().is_set())
|
||||
dbData.activated = ddsData.activated().get();
|
||||
if (ddsData.sent.is_set())
|
||||
dbData.sent = ddsData.sent.get();
|
||||
if (ddsData.received.is_set())
|
||||
dbData.received = ddsData.received.get();
|
||||
if (ddsData.activated.is_set())
|
||||
dbData.activated = ddsData.activated.get();
|
||||
|
||||
return dbData;
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,9 +34,9 @@ AudioVideoManagement::Database::AvmMenuStruct toDb(const AudioVideoManagement::A
|
||||
dbItem.rowid = ddsItem.rowId();
|
||||
|
||||
if (ddsItem.isGroup())
|
||||
dbItem.name = QString::fromStdString(ddsItem.name().get());
|
||||
dbItem.name = QString::fromStdString(ddsItem.name.get());
|
||||
else
|
||||
dbItem.mountingPointId = ddsItem.mountingPointId().get();
|
||||
dbItem.mountingPointId = ddsItem.mountingPointId.get();
|
||||
|
||||
return dbItem;
|
||||
}
|
||||
|
||||
+2
-2
@@ -106,11 +106,11 @@ void StreamNameMapping::onStreamNameChanged(const StreamName &streamName, DataMo
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
define(streamName.mountingPointId(), {QString::fromStdString(streamName.internalName()), QString::fromStdString(streamName.displayName())});
|
||||
define(streamName.mountingPointId, {QString::fromStdString(streamName.internalName), QString::fromStdString(streamName.displayName)});
|
||||
return;
|
||||
|
||||
case DataModification::eRemoved:
|
||||
remove(streamName.mountingPointId());
|
||||
remove(streamName.mountingPointId);
|
||||
return;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
|
||||
@@ -66,8 +66,8 @@ Database::AvmTvcConfig toDb(const ModifyTvcConfigRequest &request)
|
||||
result.info = QString::fromStdString(request.info());
|
||||
result.recording = request.recording();
|
||||
result.tetraChannelId = request.tetraChannelId();
|
||||
if (request.exerciseId().is_set())
|
||||
result.exerciseId = request.exerciseId().get();
|
||||
if (request.exerciseId.is_set())
|
||||
result.exerciseId = request.exerciseId.get();
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -426,7 +426,7 @@ void TvcHandler::onContextActivated(const ExerciseContext &context)
|
||||
|
||||
for (const TvcConfig &tvcConfig : qAsConst(m_cache))
|
||||
{
|
||||
bool isLocal = tvcConfig.exerciseId().is_set();
|
||||
bool isLocal = tvcConfig.exerciseId.is_set();
|
||||
if (isLocal)
|
||||
{
|
||||
if (tvcConfig.exerciseId() == context.id())
|
||||
@@ -448,7 +448,7 @@ void TvcHandler::onContextDeactivated(const ExerciseContext &context)
|
||||
|
||||
for (const TvcConfig &tvcConfig : qAsConst(m_cache))
|
||||
{
|
||||
bool isLocal = tvcConfig.exerciseId().is_set();
|
||||
bool isLocal = tvcConfig.exerciseId.is_set();
|
||||
|
||||
if (isLocal)
|
||||
{
|
||||
@@ -534,11 +534,11 @@ bool TvcHandler::checkConstraint(const std::function<bool (const TvcConfig &)> &
|
||||
// If both configs are local the constraint must hold if they are in the same exercise
|
||||
// or when both exercises are currently active.
|
||||
// Otherwise (one or both are global) the constraint must always hold
|
||||
bool bothLocal = config.exerciseId().is_set() && exerciseId.is_initialized();
|
||||
bool bothLocal = config.exerciseId.is_set() && exerciseId.is_initialized();
|
||||
if (bothLocal)
|
||||
{
|
||||
bool sameExercise = config.exerciseId().get() == *exerciseId;
|
||||
bool bothActive = isActiveExercise(config.exerciseId().get()) && isActiveExercise(*exerciseId);
|
||||
bool sameExercise = config.exerciseId.get() == *exerciseId;
|
||||
bool bothActive = isActiveExercise(config.exerciseId.get()) && isActiveExercise(*exerciseId);
|
||||
if (!sameExercise && !bothActive)
|
||||
continue;
|
||||
}
|
||||
@@ -556,9 +556,9 @@ bool TvcHandler::checkConstraint(const std::function<bool (const TvcConfig &)> &
|
||||
*/
|
||||
QString TvcHandler::exerciseList(const TvcConfig &config) const
|
||||
{
|
||||
bool isLocal = config.exerciseId().is_set();
|
||||
bool isLocal = config.exerciseId.is_set();
|
||||
if (isLocal)
|
||||
return ExerciseContext(config.exerciseId().get()).toString();
|
||||
return ExerciseContext(config.exerciseId.get()).toString();
|
||||
|
||||
// for global config
|
||||
QString exerciseList;
|
||||
@@ -574,9 +574,9 @@ QString TvcHandler::exerciseList(const TvcConfig &config) const
|
||||
|
||||
bool TvcHandler::needDeviceConfig(const TvcConfig &config) const
|
||||
{
|
||||
bool isGlobal = !config.exerciseId().is_set();
|
||||
bool isGlobal = !config.exerciseId.is_set();
|
||||
bool hasActiveExericse = m_activeExercises->count() > 0;
|
||||
return (isGlobal && hasActiveExericse) || (!isGlobal && isActiveExercise(config.exerciseId().get()));
|
||||
return (isGlobal && hasActiveExericse) || (!isGlobal && isActiveExercise(config.exerciseId.get()));
|
||||
}
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
class QByteArray;
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <QtCore/QObject>
|
||||
#include <chrono>
|
||||
|
||||
class QStringList;
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
|
||||
Reference in new issue
Block a user