AirMapFlightManager.h 1.55 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
//-- TODO: This is not even WIP yet. Just a skeleton of what's to come.
22

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

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

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

private:

    enum class State {
        Idle,
        GetPilotID,
44
        FetchFlights,
45 46 47 48 49
        FlightEnd,
    };

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