AirMapFlightManager.h 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/****************************************************************************
 *
 *   (c) 2017 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.
 *
 ****************************************************************************/

#pragma once

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

16
#include <QTimer>
Gus Grubba's avatar
Gus Grubba committed
17
#include <QObject>
Gus Grubba's avatar
Gus Grubba committed
18
#include <QList>
Gus Grubba's avatar
Gus Grubba committed
19 20
#include <QGeoCoordinate>

21 22 23 24 25 26
//-----------------------------------------------------------------------------
/// class to upload a flight
class AirMapFlightManager : public QObject, public LifetimeChecker
{
    Q_OBJECT
public:
27
    AirMapFlightManager             (AirMapSharedState& shared);
28

29 30 31
    void    findFlight              (const QGCGeoBoundingCube& bc);
    void    endFlight               (const QString& id);
    QString flightID                () { return _flightID; }
32 33

signals:
Gus Grubba's avatar
Gus Grubba committed
34 35
    void    error                   (const QString& what, const QString& airmapdMessage, const QString& airmapdDetails);
    void    flightIDChanged         ();
36 37 38 39 40 41

private:

    enum class State {
        Idle,
        GetPilotID,
42
        FetchFlights,
43 44 45 46 47
        FlightEnd,
    };

    State                               _state = State::Idle;
    AirMapSharedState&                  _shared;
48
    QString                             _flightID;
Gus Grubba's avatar
Gus Grubba committed
49
    QGCGeoBoundingCube                  _searchArea;
50 51
};