swift
Loading...
Searching...
No Matches
pilotdataupdate.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_CORE_FSD_PILOTDATAUPDATE_H
7#define SWIFT_CORE_FSD_PILOTDATAUPDATE_H
8
9#include "core/fsd/enums.h"
12
13namespace swift::core::fsd
14{
17 {
18 public:
21 int transponderCode, PilotRating rating, double latitude, double longitude, int altitudeTrue,
22 int altitudePressure, int groundSpeed, double pitch, double bank, double heading,
23 bool onGround);
24
26 QStringList toTokens() const;
27
29 static PilotDataUpdate fromTokens(const QStringList &tokens);
30
32 static QString pdu() { return "@"; }
33
40 double m_latitude = 0.0;
41 double m_longitude = 0.0;
42 int m_altitudeTrue = 0.0;
45 double m_pitch = 0.0;
46 double m_bank = 0.0;
47 double m_heading = 0.0;
48 bool m_onGround = false;
50
51 private:
52 PilotDataUpdate() = default;
53 };
54
56 inline bool operator==(const PilotDataUpdate &lhs, const PilotDataUpdate &rhs)
57 {
58 return lhs.getSender() == rhs.getSender() && lhs.getReceiver() == rhs.getReceiver() &&
60 lhs.m_rating == rhs.m_rating && qFuzzyCompare(lhs.m_latitude, rhs.m_latitude) &&
61 qFuzzyCompare(lhs.m_longitude, rhs.m_longitude) && lhs.m_altitudeTrue == rhs.m_altitudeTrue &&
63 qFuzzyCompare(lhs.m_pitch, rhs.m_pitch) && qFuzzyCompare(lhs.m_bank, rhs.m_bank) &&
64 qFuzzyCompare(lhs.m_heading, rhs.m_heading) && lhs.m_onGround == rhs.m_onGround;
65 }
66
68 inline bool operator!=(const PilotDataUpdate &lhs, const PilotDataUpdate &rhs) { return !(lhs == rhs); }
69} // namespace swift::core::fsd
70
71#endif // SWIFT_CORE_FSD_PILOTDATAUPDATE_H
bool operator!=(const AddAtc &lhs, const AddAtc &rhs)
Not equal operator.
Definition addatc.h:68
bool operator==(const AddAtc &lhs, const AddAtc &rhs)
Equal operator.
Definition addatc.h:60
MessageBase()=default
Default Constructor.
const QString & getReceiver() const
Get message receiver.
Definition messagebase.h:76
const QString & getSender() const
get message sender
Definition messagebase.h:70
Pilot data update broadcasted to all clients in range every 5 seconds.
swift::misc::aviation::CTransponder::TransponderMode m_transponderMode
Properties.
static QString pdu()
PDU identifier.
PilotRating m_rating
Properties.
static PilotDataUpdate fromTokens(const QStringList &tokens)
Construct from tokens.
QStringList toTokens() const
Message converted to tokens.
PilotDataUpdate(swift::misc::aviation::CTransponder::TransponderMode transponderMode, const QString &sender, int transponderCode, PilotRating rating, double latitude, double longitude, int altitudeTrue, int altitudePressure, int groundSpeed, double pitch, double bank, double heading, bool onGround)
Constructor.
@ StateStandby
not a real mode, more a state
Definition transponder.h:33
PilotRating
Pilot ratings.
Definition enums.h:33
@ Unknown
Unknown rating.
Definition enums.h:34
#define SWIFT_CORE_EXPORT
Export a class or function from the library.