QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ADSBVehicle.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QElapsedTimer>
4#include <QtCore/QLoggingCategory>
5#include <QtCore/QtNumeric>
6#include <QtCore/QObject>
7#include <QtPositioning/QGeoCoordinate>
8#include <QtQmlIntegration/QtQmlIntegration>
9
10#include "ADSB.h"
11
12Q_DECLARE_LOGGING_CATEGORY(ADSBVehicleLog)
13
14class ADSBVehicle : public QObject
15{
16 Q_OBJECT
17 // QML_ELEMENT
18
19 Q_PROPERTY(uint icaoAddress READ icaoAddress CONSTANT)
20 Q_PROPERTY(QString callsign READ callsign NOTIFY callsignChanged)
21 Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged)
22 Q_PROPERTY(double altitude READ altitude NOTIFY altitudeChanged)
23 Q_PROPERTY(double heading READ heading NOTIFY headingChanged)
24 Q_PROPERTY(double velocity READ velocity NOTIFY velocityChanged)
25 Q_PROPERTY(double verticalVel READ verticalVel NOTIFY verticalVelChanged)
26 Q_PROPERTY(uint16_t squawk READ squawk NOTIFY squawkChanged)
27 Q_PROPERTY(bool alert READ alert NOTIFY alertChanged)
28
29public:
30 explicit ADSBVehicle(const ADSB::VehicleInfo_t &vehicleInfo, QObject *parent = nullptr);
32
33 uint32_t icaoAddress() const { return _info.icaoAddress; }
34 QString callsign() const { return _info.callsign; }
35 QGeoCoordinate coordinate() const { return _info.location; }
36 double altitude() const { return _info.location.altitude(); }
37 double heading() const { return _info.heading; }
38 double velocity() const { return _info.velocity; }
39 double verticalVel() const { return _info.verticalVel; }
40 uint16_t squawk() const { return _info.squawk; }
41 bool alert() const { return _info.alert; }
42 bool expired() const { return _lastUpdateTimer.hasExpired(_expirationTimeoutMs); }
43 void update(const ADSB::VehicleInfo_t &vehicleInfo);
44
45signals:
54
55private:
56 ADSB::VehicleInfo_t _info{};
57 QElapsedTimer _lastUpdateTimer;
58
59 static constexpr qint64 _expirationTimeoutMs = 120000;
60};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
void coordinateChanged()
void headingChanged()
void squawkChanged()
void callsignChanged()
void altitudeChanged()
void alertChanged()
void velocityChanged()
void verticalVelChanged()