Commit c88b2837 authored by Jacob Walser's avatar Jacob Walser

Provide FactGroup names

parent a148e3e9
......@@ -101,7 +101,7 @@ ArduSubFirmwarePlugin::ArduSubFirmwarePlugin(void):
_remapParamNameIntialized = true;
}
_factGroups.append(&_infoFactGroup);
_nameToFactGroupMap.insert("APMSubInfo", &_infoFactGroup);
}
int ArduSubFirmwarePlugin::remapParamNameHigestMinorVersionNumber(int majorVersionNumber) const
......
......@@ -419,8 +419,8 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
return _cameraList;
}
QList<FactGroup*> FirmwarePlugin::factGroups(void) {
return _factGroups;
const QMap<QString, FactGroup*>& FirmwarePlugin::factGroups(void) {
return _nameToFactGroupMap;
}
bool FirmwarePlugin::vehicleYawsToNextWaypointInMission(const Vehicle* vehicle) const
......
......@@ -273,7 +273,7 @@ public:
/// Returns a list of CameraMetaData objects for available cameras on the vehicle.
virtual const QVariantList& cameraList(const Vehicle* vehicle);
virtual QList<FactGroup*> factGroups(void);
virtual const QMap<QString, FactGroup*>& factGroups(void);
/// @true: When flying a mission the vehicle is always facing towards the next waypoint
virtual bool vehicleYawsToNextWaypointInMission(const Vehicle* vehicle) const;
......@@ -301,7 +301,7 @@ protected:
// Arms the vehicle with validation and retries
// @return: true - vehicle armed, false - vehicle failed to arm
bool _armVehicleAndValidate(Vehicle* vehicle);
QList<FactGroup*> _factGroups;
QMap<QString, FactGroup*> _nameToFactGroupMap;
// Sets the vehicle to the specified flight mode with validation and retries
// @return: true - vehicle in specified flight mode, false - flight mode change failed
......
......@@ -372,10 +372,12 @@ void Vehicle::_commonInit(void)
_addFactGroup(&_vibrationFactGroup, _vibrationFactGroupName);
_addFactGroup(&_temperatureFactGroup, _temperatureFactGroupName);
// Add firmware-specific fact group, if provided
QList<FactGroup*> fwFactGroups = _firmwarePlugin->factGroups();
for (int i = 0; i < fwFactGroups.count(); i++) {
_addFactGroup(fwFactGroups[i], QString("FWPlugin%1").arg(i));
// Add firmware-specific fact groups, if provided
QMap<QString, FactGroup*> fwFactGroups = _firmwarePlugin->factGroups();
QMapIterator<QString, FactGroup*> i(fwFactGroups);
while(i.hasNext()) {
i.next();
_addFactGroup(i.value(), i.key());
}
_flightDistanceFact.setRawValue(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment