AirMapManager.h 2.67 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
11

Gus Grubba's avatar
Gus Grubba committed
12
#include "AirMapSharedState.h"
Gus Grubba's avatar
Gus Grubba committed
13
#include "AirspaceManager.h"
14 15
#include "QGCLoggingCategory.h"

16 17
#include <airmap/qt/logger.h>
#include <airmap/qt/types.h>
18

Gus Grubba's avatar
Gus Grubba committed
19
#include <memory>
20

21 22
#include <QTimer>

Gus Grubba's avatar
Gus Grubba committed
23 24 25
class QGCToolbox;

Q_DECLARE_LOGGING_CATEGORY(AirMapManagerLog)
26

27
//-----------------------------------------------------------------------------
28
/**
29 30
 * @class AirMapManager
 * AirMap implementation of AirspaceManager
31
 */
32

33 34 35 36 37
class AirMapManager : public AirspaceManager
{
    Q_OBJECT
public:
    AirMapManager(QGCApplication* app, QGCToolbox* toolbox);
38
    virtual ~AirMapManager() override;
39

40
    void setToolbox (QGCToolbox* toolbox) override;
41

42
    QString                         providerName                            () const override { return QString("AirMap"); }
43
    AirspaceVehicleManager*         instantiateVehicle                      (const Vehicle& vehicle) override;
Gus Grubba's avatar
Gus Grubba committed
44 45
    bool                            connected                               () const override;
    QString                         connectStatus                           () const override { return _connectStatus; }
46
    AirspaceManager::AuthStatus     authStatus                              () const override { return _authStatus; }
47

48 49 50 51 52
protected:
    AirspaceRulesetsProvider*       _instantiateRulesetsProvider            () override;
    AirspaceWeatherInfoProvider*    _instatiateAirspaceWeatherInfoProvider  () override;
    AirspaceAdvisoryProvider*       _instatiateAirspaceAdvisoryProvider     () override;
    AirspaceRestrictionProvider*    _instantiateAirspaceRestrictionProvider () override;
Gus Grubba's avatar
Gus Grubba committed
53
    AirspaceFlightPlanProvider*     _instantiateAirspaceFlightPlanProvider  () override;
54

55
private slots:
56 57
    void _error             (const QString& what, const QString& airmapdMessage, const QString& airmapdDetails);
    void _settingsChanged   ();
58
    void _settingsTimeout   ();
59
    void _airspaceEnabled   ();
60
    void _authStatusChanged (AirspaceManager::AuthStatus status);
61 62

private:
Gus Grubba's avatar
Gus Grubba committed
63
    QString                                         _connectStatus;
64
    QTimer                                          _settingsTimer;
65 66 67
    AirMapSharedState                               _shared;
    std::shared_ptr<airmap::qt::Logger>             _logger;
    std::shared_ptr<airmap::qt::DispatchingLogger>  _dispatchingLogger;
68
    AirspaceManager::AuthStatus                     _authStatus;
69 70
};

71