FirmwarePluginManager.h 1.68 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 9
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10
#pragma once
Don Gagne's avatar
Don Gagne committed
11 12 13 14 15

#include <QObject>

#include "FirmwarePlugin.h"
#include "QGCMAVLink.h"
16 17 18
#include "QGCToolbox.h"

class QGCApplication;
Don Gagne's avatar
Don Gagne committed
19 20 21

/// FirmwarePluginManager is a singleton which is used to return the correct FirmwarePlugin for a MAV_AUTOPILOT type.

22
class FirmwarePluginManager : public QGCTool
Don Gagne's avatar
Don Gagne committed
23 24 25 26
{
    Q_OBJECT

public:
27
    FirmwarePluginManager(QGCApplication* app, QGCToolbox* toolbox);
Don Gagne's avatar
Don Gagne committed
28
    ~FirmwarePluginManager();
29

30
    /// Returns list of firmwares which are supported by the system
31
    QList<QGCMAVLink::FirmwareClass_t> supportedFirmwareClasses(void);
32 33

    /// Returns the list of supported vehicle types for the specified firmware
34
    QList<QGCMAVLink::VehicleClass_t> supportedVehicleClasses(QGCMAVLink::FirmwareClass_t firmwareClass);
35

Don Gagne's avatar
Don Gagne committed
36
    /// Returns appropriate plugin for autopilot type.
37 38
    ///     @param firmwareType Type of firmwware to return plugin for.
    ///     @param vehicleType Vehicle type to return plugin for.
Don Gagne's avatar
Don Gagne committed
39
    /// @return Singleton FirmwarePlugin instance for the specified MAV_AUTOPILOT.
40
    FirmwarePlugin* firmwarePluginForAutopilot(MAV_AUTOPILOT firmwareType, MAV_TYPE vehicleType);
Don Gagne's avatar
Don Gagne committed
41 42

private:
43
    FirmwarePluginFactory* _findPluginFactory(QGCMAVLink::FirmwareClass_t firmwareClass);
44

45 46
    FirmwarePlugin*                     _genericFirmwarePlugin;
    QList<QGCMAVLink::FirmwareClass_t>  _supportedFirmwareClasses;
Don Gagne's avatar
Don Gagne committed
47
};