swift
atcdataupdate.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_ATCPOSITION_H
7 #define SWIFT_CORE_FSD_ATCPOSITION_H
8 
9 #include <QtGlobal>
10 
11 #include "core/fsd/enums.h"
12 #include "core/fsd/messagebase.h"
14 
15 namespace swift::core::fsd
16 {
19  {
20  friend bool operator==(const AtcDataUpdate &, const AtcDataUpdate &);
21 
22  public:
24  AtcDataUpdate(const QString &sender, int frequencykHz, swift::misc::network::CFacilityType facility,
25  int visibleRange, AtcRating rating, double latitude, double longitude, int elevation);
26 
28  QStringList toTokens() const;
29 
31  static AtcDataUpdate fromTokens(const QStringList &tokens);
32 
35  int m_frequencykHz = 0.0;
37  int m_visibleRange = 0.0;
38  AtcRating m_rating = AtcRating::Unknown;
39  double m_latitude = 0.0;
40  double m_longitude = 0.0;
41  int m_elevation = 0.0;
43 
45  static QString pdu() { return "%"; }
46 
47  private:
49  AtcDataUpdate();
50  };
51 
53  inline bool operator==(const AtcDataUpdate &lhs, const AtcDataUpdate &rhs)
54  {
55  return lhs.sender() == rhs.sender() && lhs.receiver() == rhs.receiver() &&
56  lhs.m_frequencykHz == rhs.m_frequencykHz && lhs.m_facility == rhs.m_facility &&
57  lhs.m_visibleRange == rhs.m_visibleRange && lhs.m_rating == rhs.m_rating &&
58  qFuzzyCompare(1 + lhs.m_latitude, 1 + rhs.m_latitude) &&
59  qFuzzyCompare(1 + lhs.m_longitude, 1 + rhs.m_longitude) && lhs.m_elevation == rhs.m_elevation;
60  }
61 
63  inline bool operator!=(const AtcDataUpdate &lhs, const AtcDataUpdate &rhs) { return !(lhs == rhs); }
64 } // namespace swift::core::fsd
65 
66 #endif // SWIFT_CORE_FSD_ATCPOSITION_H
bool operator!=(const AddAtc &lhs, const AddAtc &rhs)
Not equal operator.
Definition: addatc.h:68
FSD Message: ATC data update.
Definition: atcdataupdate.h:19
swift::misc::network::CFacilityType m_facility
Properties.
Definition: atcdataupdate.h:36
static QString pdu()
PDU identifier.
Definition: atcdataupdate.h:45
AtcRating m_rating
Properties.
Definition: atcdataupdate.h:38
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
Value object encapsulating the ATC facility type, e.g. TWR, DEP, APP.
Definition: facilitytype.h:18
AtcRating
ATC ratings.
Definition: enums.h:15
#define SWIFT_CORE_EXPORT
Export a class or function from the library.