6 #ifndef SWIFT_CORE_AIRSPACE_MONITOR_H
7 #define SWIFT_CORE_AIRSPACE_MONITOR_H
10 #include <QJsonObject>
11 #include <QMetaObject>
52 class CAirspaceAnalyzer;
70 static const QStringList &getLogCategories();
83 bool enableFastPositonUpdates)
override;
115 void requestAircraftDataUpdates();
118 void requestAtisUpdates();
124 void gracefulShutdown();
127 int reInitializeAllAircraft();
134 void testCreateDummyOnlineAtcStations(
int number);
145 ReceivedIcaoCodes = 1 << 0,
146 ReceivedFsInnPacket = 1 << 1,
147 ReadyForMatchingSent = 1 << 2,
148 RecursiveCall = 1 << 3,
149 ReceivedAll = ReceivedIcaoCodes | ReceivedFsInnPacket,
152 Q_DECLARE_FLAGS(MatchingReadiness, MatchingReadinessFlag)
156 static const QString &enumFlagToString(MatchingReadinessFlag r);
157 static QString enumToString(MatchingReadiness r);
185 const QString &airlineDesignator,
const QString &livery);
201 FsInnPacket(
const QString &aircraftIcaoDesignator,
const QString &airlineIcaoDesignator,
202 const QString &combinedCode,
const QString &modelString);
204 QString aircraftIcaoDesignator;
205 QString airlineIcaoDesignator;
206 QString combinedCode;
215 MatchingReadiness readyness = NotReady;
219 Readiness &addFlag(MatchingReadinessFlag flag)
221 if (flag == RecursiveCall) {
return *
this; }
222 if (ts < 0) { ts = QDateTime::currentMSecsSinceEpoch(); }
223 readyness.setFlag(flag,
true);
228 void resetTimestampToNow() { ts = QDateTime::currentMSecsSinceEpoch(); }
231 Readiness &setFlag(MatchingReadinessFlag flag)
233 if (flag == RecursiveCall) {
return *
this; }
234 readyness = NotReady;
240 bool receivedAll()
const
242 return readyness.testFlag(ReceivedIcaoCodes) && readyness.testFlag(ReceivedFsInnPacket);
246 bool receivedIcaoCodes()
const {
return readyness.testFlag(ReceivedIcaoCodes); }
249 bool wasMatchingSent()
const {
return readyness.testFlag(ReadyForMatchingSent); }
252 bool wasVerified()
const {
return readyness.testFlag(Verified); }
255 qint64 getAgeMs()
const
257 if (ts < 0) {
return -1; }
258 return QDateTime::currentMSecsSinceEpoch() - ts;
262 QString toQString()
const
276 QQueue<swift::misc::aviation::CCallsign> m_queryAtis;
277 QQueue<swift::misc::aviation::CCallsign> m_queryPilot;
278 misc::simulation::IAircraftModelSetProvider *m_modelSetProvider =
nullptr;
279 fsd::CFSDClient *m_fsdClient =
nullptr;
280 CAirspaceAnalyzer *m_analyzer =
nullptr;
281 int m_maxDistanceNM = 125;
282 int m_maxDistanceNMHysteresis = qRound(1.1 * m_maxDistanceNM);
283 int m_foundInNonMovingAircraft = 0;
284 int m_foundInElevationsOnGnd = 0;
287 static constexpr
int FastProcessIntervalMs = 50;
288 QTimer m_fastProcessTimer;
291 void fastProcessing();
294 static constexpr
int SlowProcessIntervalMs = 125 * 1000;
295 QTimer m_slowProcessTimer;
298 void slowProcessing();
301 static constexpr qint64 MMCheckAgainMs = 2000;
302 static constexpr qint64 MMMaxAgeMs = MMCheckAgainMs * 3;
303 static constexpr qint64 MMMaxAgeThresholdMs = MMCheckAgainMs * 10;
304 static constexpr qint64 MMVerifyMs = MMCheckAgainMs * 12;
307 void removeAllOnlineAtcStations();
311 void removeAllAircraft();
321 void queryAllOnlineAtcStations();
324 bool sendNextStaggeredAtisQuery();
331 bool sendNextStaggeredPilotDataQuery();
334 bool isConnected()
const;
337 bool isConnectedAndNotShuttingDown()
const;
347 bool supportsVatsimDataFile()
const;
363 bool allowTestOffset =
true)
override;
368 const QString &airlineIcao,
const QString &livery,
const QString &modelString,
381 bool readyForModelMatching);
386 bool sendSignal =
true);
408 const QString &aircraftIcao,
const QString &airlineIcao,
409 const QString &liveryString,
const QString &modelString,
418 MatchingReadinessFlag mrf);
447 const QString &airlineIcaoDesignator,
const QString &aircraftIcaoDesignator,
448 const QString &combinedAircraftType,
const QString &modelString);
452 swift::misc::network::CClient::Capabilities clientCaps);
461 const QString &aircraftIcaoDesignator,
const QString &airlineIcaoDesignator,
462 const QString &livery);
466 void onReceivedVatsimDataFile();
468 qint64 currentOffsetMs);
473 const QString &aircraftIcao,
const QString &airlineIcao);
477 qint64 currentOffsetMs);
482 Q_DECLARE_OPERATORS_FOR_FLAGS(swift::core::CAirspaceMonitor::MatchingReadiness)
Class monitoring and analyzing (closest aircraft, outdated aircraft / watchdog) airspace in backgroun...
Keeps track of other entities in the airspace: aircraft, ATC stations, etc. Central instance of data ...
MatchingReadinessFlag
Matching readiness.
misc::aviation::CAtcStationList getAtcStationsOnline() const
Returns the current online ATC stations.
QObject * asQObject()
Members not implenented or fully implenented by CRemoteAircraftProvider.
void atcStationDisconnected(const swift::misc::aviation::CAtcStation &station)
ATC station disconnected.
CAirspaceAnalyzer * analyzer() const
Analyzer.
void readyForModelMatching(const swift::misc::simulation::CSimulatedAircraft &remoteAircraft)
Ready for model matching.
void changedAtisReceived(const swift::misc::aviation::CCallsign &callsign)
An ATIS has been received.
void changedAtcStationsOnline()
Online ATC stations were changed.
static QString enumToString(MatchingReadiness r)
As string.
static void registerHelp()
Register help.
FSD client Todo: Send (interim) data updates automatically Todo Check ':' in FSD messages....
Value object encapsulating information identifying a component of a modular distributed swift process...
Specialized value object compliant map for variants, based on indexes.
static void registerCommand(const CommandHtmlHelp &command)
Register a command.
static bool registered(const QString &helpContext)
Help already registered.
Status messages, e.g. from Core -> GUI.
Value object encapsulating information of aircraft's parts.
Value object about changes in situations.
Value object encapsulating information of an aircraft's situation.
List of aircraft situations.
Value object encapsulating information about an ATC station.
Value object for a list of ATC stations.
Value object encapsulating information of a callsign.
Value object for a set of callsigns.
Value object for a flight plan.
Direct in memory access to client (network client) data.
Value object encapsulating information about a connection status.
Ecosystem of server belonging together.
Value object encapsulating information of a server.
Value object encapsulating a list of voice rooms.
Direct in memory access to client (network client) data.
Physical unit angle (radians, degrees)
Physical unit length (length)
Aircraft model (used by another pilot, my models on disk)
Current situation in the skies analyzed.
Delegating class which can be directly used to access an.
Implementaion of the interface, which can also be used for testing.
Comprehensive information of an aircraft.
Value object encapsulating a list of aircraft.
Class which can be directly used to access an.
Value object encapsulating a list of aircraft models.
Direct threadsafe in memory access to own aircraft.
Direct thread safe in memory access to remote aircraft.
Backend services of the swift project, like dealing with the network or the simulators.
#define SWIFT_CORE_EXPORT
Export a class or function from the library.