QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
NTRIPVehicleGgaSource.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4
5#include <QtCore/QMetaObject>
6#include <QtCore/QObject>
7#include <QtCore/qnumeric.h>
8#include <QtPositioning/QGeoCoordinate>
9#include <QtPositioning/QGeoPositionInfo>
10
11#include "GPSObservation.h"
12
13class NTRIPManager;
15class Vehicle;
16
19class NTRIPVehicleGgaSource : public QObject
20{
21 Q_OBJECT
22
23public:
25 explicit NTRIPVehicleGgaSource(RuntimeScheduler* scheduler, QObject* parent = nullptr);
26
29 void attach(NTRIPManager* ntrip);
31 void setVehicle(Vehicle* vehicle);
32
34 std::optional<GPSObservation> gpsObservation() const;
36 std::optional<GPSObservation> estimateObservation() const;
37
38private:
39 struct GpsReport
40 {
41 QGeoPositionInfo position;
42 int fixType = 0;
43 double horizontalDop = qQNaN();
44 quint64 receivedAtUs = 0;
45 };
46
47 struct EstimateReport
48 {
49 QGeoCoordinate coordinate;
50 quint64 receivedAtUs = 0;
51 };
52
53 bool _fresh(quint64 receivedAtUs) const;
54
55 RuntimeScheduler* const _scheduler;
56 std::optional<GpsReport> _gps;
57 std::optional<EstimateReport> _estimate;
58 QMetaObject::Connection _gpsConnection;
59 QMetaObject::Connection _messageConnection;
60};
std::optional< GPSObservation > estimateObservation() const
The fresh observation from the vehicle's GLOBAL_POSITION_INT estimate.
std::optional< GPSObservation > gpsObservation() const
The fresh observation from the vehicle's GPS with a fix.
void setVehicle(Vehicle *vehicle)
Tracks vehicle's reports; reports from before this call are not used.
void attach(NTRIPManager *ntrip)