Skip to content

Commit 4c5332f

Browse files
committed
Copilot review follow-up: Remove redundant code in GPS aggregate handling
1 parent ebf3a91 commit 4c5332f

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

src/Vehicle/FactGroups/VehicleGPS2FactGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class VehicleGPS2FactGroup : public VehicleGPSFactGroup
1919
explicit VehicleGPS2FactGroup(QObject *parent = nullptr)
2020
: VehicleGPSFactGroup(parent)
2121
{
22-
_setGnssIntegrityContext(1, QStringLiteral("GPS2"));
22+
_setGnssIntegrityContext(1);
2323
}
2424

2525
// Overrides from VehicleGPSFactGroup

src/Vehicle/FactGroups/VehicleGPSAggregateFactGroup.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,21 @@ void VehicleGPSAggregateFactGroup::bindToGps(VehicleGPSFactGroup* gps1, VehicleG
5656
_gps1 = gps1;
5757
_gps2 = gps2;
5858

59-
auto connectFact = [this](Fact* fact, const QString& name) {
59+
auto connectFact = [this](Fact* fact) {
6060
if (fact) {
61-
Q_UNUSED(name);
6261
_connections << connect(fact, &Fact::valueChanged, this, &VehicleGPSAggregateFactGroup::_onIntegrityUpdated);
6362
}
6463
};
6564

6665
if (_gps1) {
67-
connectFact(_gps1->spoofingState(), "GPS1 spoofingState");
68-
connectFact(_gps1->jammingState(), "GPS1 jammingState");
69-
connectFact(_gps1->authenticationState(), "GPS1 authenticationState");
66+
connectFact(_gps1->spoofingState());
67+
connectFact(_gps1->jammingState());
68+
connectFact(_gps1->authenticationState());
7069
}
7170
if (_gps2) {
72-
connectFact(_gps2->spoofingState(), "GPS2 spoofingState");
73-
connectFact(_gps2->jammingState(), "GPS2 jammingState");
74-
connectFact(_gps2->authenticationState(), "GPS2 authenticationState");
71+
connectFact(_gps2->spoofingState());
72+
connectFact(_gps2->jammingState());
73+
connectFact(_gps2->authenticationState());
7574
}
7675
_updateAggregates();
7776
}
@@ -94,7 +93,6 @@ void VehicleGPSAggregateFactGroup::_onStaleTimeout()
9493
_jammingStateFact.setRawValue(255);
9594
_authenticationStateFact.setRawValue(255);
9695
_isStaleFact.setRawValue(true);
97-
_updateAggregates();
9896
}
9997

10098
void VehicleGPSAggregateFactGroup::_clearConnections()

src/Vehicle/FactGroups/VehicleGPSFactGroup.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,12 @@ VehicleGPSFactGroup::VehicleGPSFactGroup(QObject *parent)
5151
_gnssSignalQualityFact.setRawValue(255);
5252
_postProcessingQualityFact.setRawValue(255);
5353

54-
_setGnssIntegrityContext(0, QStringLiteral("GPS1"));
54+
_setGnssIntegrityContext(0);
5555
}
5656

57-
void VehicleGPSFactGroup::_setGnssIntegrityContext(uint8_t id, const QString& logPrefix)
57+
void VehicleGPSFactGroup::_setGnssIntegrityContext(uint8_t id)
5858
{
5959
_gnssIntegrityId = id;
60-
_gnssLogPrefix = logPrefix;
6160
}
6261

6362
void VehicleGPSFactGroup::handleMessage(Vehicle *vehicle, const mavlink_message_t &message)

src/Vehicle/FactGroups/VehicleGPSFactGroup.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ class VehicleGPSFactGroup : public FactGroup
5555

5656
// Overrides from FactGroup
5757
void handleMessage(Vehicle *vehicle, const mavlink_message_t &message) override;
58-
59-
void _setGnssIntegrityContext(uint8_t id, const QString& logPrefix);
58+
void _setGnssIntegrityContext(uint8_t id);
6059

6160
protected:
6261
void _handleGpsRawInt(const mavlink_message_t &message);
@@ -83,5 +82,4 @@ class VehicleGPSFactGroup : public FactGroup
8382
Fact _postProcessingQualityFact = Fact(0, QStringLiteral("postProcessingQuality"), FactMetaData::valueTypeUint8);
8483

8584
uint8_t _gnssIntegrityId;
86-
QString _gnssLogPrefix;
8785
};

0 commit comments

Comments
 (0)