swift
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"
10 #include "core/fsd/messagebase.h"
12 
13 namespace swift::core::fsd
14 {
17  {
18  public:
20  PilotDataUpdate(swift::misc::aviation::CTransponder::TransponderMode transponderMode, const QString &sender,
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 
38  int m_transponderCode = 0;
39  PilotRating m_rating = PilotRating::Unknown;
40  double m_latitude = 0.0;
41  double m_longitude = 0.0;
42  int m_altitudeTrue = 0.0;
43  int m_altitudePressure = 0.0;
44  int m_groundSpeed = 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:
53  };
54 
56  inline bool operator==(const PilotDataUpdate &lhs, const PilotDataUpdate &rhs)
57  {
58  return lhs.sender() == rhs.sender() && lhs.receiver() == rhs.receiver() &&
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
FSD message base class.
Definition: messagebase.h:58
QString sender() const
get message sender
Definition: messagebase.h:73
QString receiver() const
Get message receiver.
Definition: messagebase.h:79
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.
@ StateStandby
not a real mode, more a state
Definition: transponder.h:33
PilotRating
Pilot ratings.
Definition: enums.h:33
#define SWIFT_CORE_EXPORT
Export a class or function from the library.