Commit c88b2837 authored by Jacob Walser's avatar Jacob Walser

Provide FactGroup names

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