1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/****************************************************************************
*
* (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.
*
****************************************************************************/
#ifndef AUTOPILOTPLUGIN_H
#define AUTOPILOTPLUGIN_H
#include <QObject>
#include <QList>
#include <QString>
#include <QQmlContext>
#include "VehicleComponent.h"
#include "FactSystem.h"
#include "Vehicle.h"
class Vehicle;
class FirmwarePlugin;
/// 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.
class AutoPilotPlugin : public QObject
{
Q_OBJECT
public:
AutoPilotPlugin(Vehicle* vehicle, QObject* parent);
~AutoPilotPlugin();
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
/// 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);
// Must be implemented by derived class
virtual const QVariantList& vehicleComponents(void) = 0;
/// 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;
// Property accessors
bool setupComplete(void);
signals:
void setupCompleteChanged(bool setupComplete);
void vehicleComponentsChanged(void);
protected:
/// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin
AutoPilotPlugin(QObject* parent = NULL) : QObject(parent) { }
Vehicle* _vehicle;
FirmwarePlugin* _firmwarePlugin;
bool _setupComplete;
private slots:
void _recalcSetupComplete(void);
};
#endif