AutoPilotPlugin.h 2.41 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * 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
class ParameterManager;
23 24
class Vehicle;
class FirmwarePlugin;
25

26 27 28 29 30 31
/// 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.
32

33 34 35
class AutoPilotPlugin : public QObject
{
    Q_OBJECT
36

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

41 42
    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
43

44 45 46
    /// 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);
47

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

51 52 53
    /// 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;

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

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

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

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

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

73
#endif