swift
vatsimdatafilereader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 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_VATSIM_VATSIMDATAFILEREADER_H
7 #define SWIFT_CORE_VATSIM_VATSIMDATAFILEREADER_H
8 
9 #include <QMap>
10 #include <QObject>
11 #include <QString>
12 #include <QStringList>
13 
14 #include "core/data/vatsimsetup.h"
15 #include "core/swiftcoreexport.h"
16 #include "core/threadedreader.h"
22 #include "misc/datacache.h"
24 #include "misc/network/userlist.h"
27 
28 class QNetworkReply;
29 
30 namespace swift::misc::simulation
31 {
32  class CSimulatedAircraft;
33 }
34 namespace swift::core::vatsim
35 {
38  {
39  Q_OBJECT
40 
41  public:
43  explicit CVatsimDataFileReader(QObject *owner);
44 
48 
51  swift::misc::aviation::CAtcStationList getAtcStations() const;
52 
56  getAtcStationsForCallsign(const swift::misc::aviation::CCallsign &callsign) const;
57 
61  getAtcStationsForCallsigns(const swift::misc::aviation::CCallsignSet &callsigns) const;
62 
66  getUsersForCallsigns(const swift::misc::aviation::CCallsignSet &callsigns) const;
67 
70  swift::misc::network::CUserList getUsersForCallsign(const swift::misc::aviation::CCallsign &callsign) const;
71 
75  getControllersForCallsigns(const swift::misc::aviation::CCallsignSet &callsigns) const;
76 
80  getControllersForCallsign(const swift::misc::aviation::CCallsign &callsign) const;
81 
85  getPilotsForCallsigns(const swift::misc::aviation::CCallsignSet &callsigns) const;
86 
89  swift::misc::network::CUserList getPilotsForCallsign(const swift::misc::aviation::CCallsign &callsign) const;
90 
94  getAircraftIcaoCode(const swift::misc::aviation::CCallsign &callsign) const;
95 
99  getAirlineIcaoCode(const swift::misc::aviation::CCallsign &callsign) const;
100 
104  getVoiceCapabilityForCallsign(const swift::misc::aviation::CCallsign &callsign) const;
105 
109  getFlightPlanRemarksForCallsign(const swift::misc::aviation::CCallsign &callsign) const;
110 
113  void updateWithVatsimDataFileData(swift::misc::simulation::CSimulatedAircraft &aircraftToBeUdpated) const;
114 
116  void readInBackgroundThread();
117 
118  signals:
120  void dataFileRead(int kB);
121 
123  void dataRead(swift::misc::network::CEntityFlags::Entity entity,
124  swift::misc::network::CEntityFlags::ReadState state, int number, const QUrl &url);
125 
126  protected:
127  // CThreadedReader overrides
128  virtual void doWorkImpl() override;
129 
130  private:
132  enum Section
133  {
134  SectionNone,
135  SectionFsdServers,
136  SectionVoiceServers,
137  SectionClients,
138  SectionGeneral
139  };
140 
144  this, &CVatsimDataFileReader::reloadSettings
145  };
147  m_flightPlanRemarks;
148 
150  void parseVatsimFile(QNetworkReply *nwReply);
151 
152  swift::misc::simulation::CSimulatedAircraft parsePilot(const QJsonObject &,
153  QStringList &o_illegalEquipmentCodes) const;
154  swift::misc::aviation::CFlightPlanRemarks parseFlightPlanRemarks(const QJsonObject &) const;
155  swift::misc::aviation::CAtcStation parseController(const QJsonObject &) const;
156 
158  void read();
159 
161  void reloadSettings();
162  };
163 } // namespace swift::core::vatsim
164 
165 #endif // SWIFT_CORE_VATSIM_VATSIMDATAFILEREADER_H
Support for threaded based reading and parsing tasks such as data files via http, or file system and ...
void dataRead(swift::misc::network::CEntityFlags::Entity entity, swift::misc::network::CEntityFlags::ReadState state, int number, const QUrl &url)
Data have been read.
void dataFileRead(int kB)
Data have been read.
Value object for ICAO classification.
Value object for ICAO classification.
Value object encapsulating information about an ATC station.
Definition: atcstation.h:38
Value object for a list of ATC stations.
Value object encapsulating information of a callsign.
Definition: callsign.h:30
Value object for a set of callsigns.
Definition: callsignset.h:26
Flight plan remarks, parsed values.
Definition: flightplan.h:46
Value object encapsulating a list of voice rooms.
Definition: userlist.h:26
Value object encapsulating information for voice capabilities.
Comprehensive information of an aircraft.
Value object encapsulating a list of aircraft.
#define SWIFT_CORE_EXPORT
Export a class or function from the library.