AutoPilotPlugin.h 2.39 KB
Newer Older
1 2
/****************************************************************************
 *
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
#ifndef AUTOPILOTPLUGIN_H
#define AUTOPILOTPLUGIN_H
12

13 14 15 16
#include <QObject>
#include <QList>
#include <QString>
#include <QQmlContext>
17

18 19 20
#include "VehicleComponent.h"
#include "FactSystem.h"
#include "Vehicle.h"
21

22 23
class Vehicle;
class FirmwarePlugin;
24

25 26 27 28 29 30
/// This is the base class for AutoPilot plugins
///
/// The AutoPilotPlugin class is an abstract base class which represent the methods and objects
/// which are specific to a certain AutoPilot. This is the only place where AutoPilot specific
/// code should reside in QGroundControl. The remainder of the QGroundControl source is
/// generic to a common mavlink implementation.
31

32 33 34
class AutoPilotPlugin : public QObject
{
    Q_OBJECT
35

36 37 38
public:
    AutoPilotPlugin(Vehicle* vehicle, QObject* parent);
    ~AutoPilotPlugin();
39

40 41
    Q_PROPERTY(QVariantList vehicleComponents   READ vehicleComponents  NOTIFY vehicleComponentsChanged)    ///< List of VehicleComponent objects
    Q_PROPERTY(bool         setupComplete       READ setupComplete      NOTIFY setupCompleteChanged)        ///< false: One or more vehicle components require setup
42

43 44 45
    /// Called when parameters are ready for the first time. Note that parameters may still be missing.
    /// Overrides must call base class.
    virtual void parametersReadyPreChecks(void);
46

47 48
    // Must be implemented by derived class
    virtual const QVariantList& vehicleComponents(void) = 0;
49

50 51 52
    /// Returns the name of the vehicle component which must complete setup prior to this one. Empty string for none.
    Q_INVOKABLE virtual QString prerequisiteSetup(VehicleComponent* component) const = 0;

53 54
    // Property accessors
    bool setupComplete(void);
55

56 57
signals:
    void setupCompleteChanged(bool setupComplete);
58
    void vehicleComponentsChanged(void);
59

60 61
protected:
    /// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin
62
    AutoPilotPlugin(QObject* parent = nullptr) : QObject(parent) { }
63

64 65 66
    Vehicle*        _vehicle;
    FirmwarePlugin* _firmwarePlugin;
    bool            _setupComplete;
67

68
private slots:
69 70
    void _recalcSetupComplete(void);
};
71

72
#endif