GPSManager.h 1.38 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 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

#pragma once

#include "GPSProvider.h"
#include "RTCM/RTCMMavlink.h"
#include <QGCToolbox.h>

#include <QString>
#include <QObject>

/**
 ** class GPSManager
 * handles a GPS provider and RTK
 */
class GPSManager : public QGCTool
{
    Q_OBJECT
public:
28
    GPSManager(QGCApplication* app, QGCToolbox* toolbox);
29 30
    ~GPSManager();

31
    void connectGPS     (const QString& device, const QString& gps_type);
32 33
    void disconnectGPS  (void);
    bool connected      (void) const { return _gpsProvider && _gpsProvider->isRunning(); }
34

35 36 37
signals:
    void onConnect();
    void onDisconnect();
38
    void surveyInStatus(float duration, float accuracyMM,  double latitude, double longitude, float altitude, bool valid, bool active);
39 40
    void satelliteUpdate(int numSats);

41 42 43 44
private slots:
    void GPSPositionUpdate(GPSPositionMessage msg);
    void GPSSatelliteUpdate(GPSSatelliteMessage msg);

45
private:
46 47 48 49 50
    GPSProvider* _gpsProvider = nullptr;
    RTCMMavlink* _rtcmMavlink = nullptr;

    std::atomic_bool _requestGpsStop; ///< signals the thread to quit
};