PX4AirframeLoader.h 1.58 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9 10


11 12 13 14
#ifndef PX4AIRFRAMELOADER_H
#define PX4AIRFRAMELOADER_H

#include <QObject>
15 16 17
#include <QMap>
#include <QXmlStreamReader>
#include <QLoggingCategory>
18

19
#include "ParameterManager.h"
20 21 22 23 24 25 26 27 28 29 30 31
#include "FactSystem.h"
#include "UASInterface.h"
#include "AutoPilotPlugin.h"

/// @file PX4AirframeLoader.h
///     @author Lorenz Meier <lm@qgroundcontrol.org>

Q_DECLARE_LOGGING_CATEGORY(PX4AirframeLoaderLog)

/// Collection of Parameter Facts for PX4 AutoPilot

class PX4AirframeLoader : QObject
32
{
33 34
    Q_OBJECT

35
public:
36
    /// @param uas Uas which this set of facts is associated with
37
    PX4AirframeLoader(AutoPilotPlugin* autpilot,UASInterface* uas, QObject* parent = nullptr);
38

39 40 41 42
    static void loadAirframeMetaData(void);

    /// @return Location of PX4 airframe fact meta data file
    static QString aiframeMetaDataFile(void);
43 44 45 46 47 48 49 50 51 52 53 54 55

private:
    enum {
        XmlStateNone,
        XmlStateFoundAirframes,
        XmlStateFoundVersion,
        XmlStateFoundGroup,
        XmlStateFoundAirframe,
        XmlStateDone
    };

    static bool _airframeMetaDataLoaded;   ///< true: parameter meta data already loaded
    static QMap<QString, FactMetaData*> _mapParameterName2FactMetaData; ///< Maps from a parameter name to FactMetaData
56 57 58
};

#endif // PX4AIRFRAMELOADER_H