42 using namespace swift::config;
44 using namespace swift::misc::aviation;
45 using namespace swift::misc::geo;
46 using namespace swift::misc::simulation;
48 using namespace swift::misc::json;
49 using namespace swift::misc::network;
50 using namespace swift::misc::physical_quantities;
51 using namespace swift::misc::weather;
52 using namespace swift::core::fsd;
53 using namespace swift::core::vatsim;
61 m_fsdClient(fsdClient), m_analyzer(new
CAirspaceAnalyzer(ownAircraftProvider, m_fsdClient, this))
66 RevLogEnabledSimplified);
69 connect(m_fsdClient, &CFSDClient::atcDataUpdateReceived,
this, &CAirspaceMonitor::onAtcPositionUpdate);
70 connect(m_fsdClient, &CFSDClient::atisReplyReceived,
this, &CAirspaceMonitor::onAtisReceived);
71 connect(m_fsdClient, &CFSDClient::atisLogoffTimeReplyReceived,
this,
72 &CAirspaceMonitor::onAtisLogoffTimeReceived);
73 connect(m_fsdClient, &CFSDClient::flightPlanReceived,
this, &CAirspaceMonitor::onFlightPlanReceived);
74 connect(m_fsdClient, &CFSDClient::realNameResponseReceived,
this, &CAirspaceMonitor::onRealNameReplyReceived);
75 connect(m_fsdClient, &CFSDClient::planeInformationReceived,
this, &CAirspaceMonitor::onIcaoCodesReceived);
76 connect(m_fsdClient, &CFSDClient::deletePilotReceived,
this, &CAirspaceMonitor::onPilotDisconnected);
77 connect(m_fsdClient, &CFSDClient::deleteAtcReceived,
this, &CAirspaceMonitor::onAtcControllerDisconnected);
78 connect(m_fsdClient, &CFSDClient::pilotDataUpdateReceived,
this, &CAirspaceMonitor::onAircraftUpdateReceived);
79 connect(m_fsdClient, &CFSDClient::interimPilotDataUpdatedReceived,
this,
80 &CAirspaceMonitor::onAircraftInterimUpdateReceived);
81 connect(m_fsdClient, &CFSDClient::visualPilotDataUpdateReceived,
this,
82 &CAirspaceMonitor::onAircraftVisualUpdateReceived);
83 connect(m_fsdClient, &CFSDClient::euroscopeSimDataUpdatedReceived,
this,
84 &CAirspaceMonitor::onAircraftSimDataUpdateReceived);
85 connect(m_fsdClient, &CFSDClient::com1FrequencyResponseReceived,
this, &CAirspaceMonitor::onFrequencyReceived);
86 connect(m_fsdClient, &CFSDClient::capabilityResponseReceived,
this,
87 &CAirspaceMonitor::onCapabilitiesReplyReceived);
88 connect(m_fsdClient, &CFSDClient::planeInformationFsinnReceived,
this,
89 &CAirspaceMonitor::onCustomFSInnPacketReceived);
90 connect(m_fsdClient, &CFSDClient::serverResponseReceived,
this, &CAirspaceMonitor::onServerReplyReceived);
91 connect(m_fsdClient, &CFSDClient::aircraftConfigReceived,
this, &CAirspaceMonitor::onAircraftConfigReceived);
92 connect(m_fsdClient, &CFSDClient::connectionStatusChanged,
this, &CAirspaceMonitor::onConnectionStatusChanged);
96 if (this->supportsVatsimDataFile())
99 &CAirspaceMonitor::onReceivedVatsimDataFile);
115 m_fastProcessTimer.
start(FastProcessIntervalMs);
116 m_slowProcessTimer.
start(SlowProcessIntervalMs);
130 if (!myself) {
return; }
149 Q_ASSERT_X(m_analyzer, Q_FUNC_INFO,
"No analyzer");
159 if (m_flightPlanCache.
contains(callsign)) { plan = m_flightPlanCache[callsign]; }
165 m_flightPlanCache.
remove(callsign);
171 eventLoop.
stopWhen(m_fsdClient, &CFSDClient::flightPlanReceived,
172 [=](
const auto &cs,
const auto &) {
return cs == callsign; });
173 if (eventLoop.
exec(1500))
179 if (m_flightPlanCache.
contains(callsign)) { plan = m_flightPlanCache[callsign]; }
187 if (callsign.
isEmpty()) {
return {}; }
190 if (m_flightPlanCache.
contains(callsign)) {
return m_flightPlanCache[callsign].getFlightPlanRemarks(); }
193 if (this->supportsVatsimDataFile())
205 return m_atcStationsOnline;
211 for (
const CAtcStation &station : m_atcStationsOnline)
213 CUser user = station.getController();
219 CUser user = aircraft.getPilot();
229 if (callsigns.
isEmpty()) {
return users; }
243 if (searchList.
isEmpty()) {
break; }
244 const CCallsign callsign = aircraft.getCallsign();
247 const CUser user = aircraft.getPilot();
249 searchList.
remove(callsign);
253 for (
const CAtcStation &station : m_atcStationsOnline)
255 if (searchList.
isEmpty()) {
break; }
256 const CCallsign callsign = station.getCallsign();
259 const CUser user = station.getController();
261 searchList.
remove(callsign);
267 for (
const CCallsign &callsign : std::as_const(searchList))
272 const CUser user(callsign);
275 else { users.
push_back(usersByCallsign[0]); }
283 if (stations.
isEmpty()) {
return {}; }
285 return stations.
front();
290 if (!this->isConnectedAndNotShuttingDown()) {
return; }
295 const CCallsign cs(aircraft.getCallsign());
296 if (!m_queryPilot.contains(cs)) { m_queryPilot.
enqueue(aircraft.getCallsign()); }
302 if (!this->isConnectedAndNotShuttingDown()) {
return; }
306 const CCallsign cs = station.getCallsign();
310 if (!m_queryAtis.contains(cs)) { m_queryAtis.
enqueue(cs); }
314 void CAirspaceMonitor::testCreateDummyOnlineAtcStations(
int number)
316 if (number < 1) {
return; }
317 m_atcStationsOnline.
push_back(CTesting::createAtcStations(number));
329 static const QString nr(
"not ready");
330 static const QString icao(
"rec. ICAO");
331 static const QString fsinn(
"rec. FsInn");
332 static const QString ready(
"ready sent");
333 static const QString rec(
"recursive");
343 static const QString unknown(
"????");
360 Q_UNUSED(originator;)
361 if (commandLine.
isEmpty()) {
return false; }
364 parser.parse(commandLine);
365 if (!parser.isKnownCommand()) {
return false; }
366 if (parser.matchesCommand(
".fsd"))
368 if (parser.countParts() < 2) {
return false; }
369 if (parser.matchesPart(1,
"range") && parser.countParts() > 2)
371 const QString r = parser.part(2);
372 const CLength d = CLength::parsedFromString(r);
379 void CAirspaceMonitor::fastProcessing()
381 if (!this->isConnectedAndNotShuttingDown()) {
return; }
384 const bool send = this->sendNextStaggeredAtisQuery();
385 if (!send) { this->sendNextStaggeredPilotDataQuery(); }
388 void CAirspaceMonitor::slowProcessing()
390 if (!this->isConnectedAndNotShuttingDown()) {
return; }
391 this->queryAllOnlineAtcStations();
396 m_flightPlanCache.
clear();
397 m_tempFsInnPackets.
clear();
399 this->removeAllOnlineAtcStations();
400 this->removeAllAircraft();
403 m_foundInNonMovingAircraft = 0;
404 m_foundInElevationsOnGnd = 0;
413 this->asyncReInitializeAllAircraft(aircraft,
true);
414 return aircraft.
size();
422 m_maxDistanceNM = -1;
423 m_maxDistanceNMHysteresis = -1;
428 const int rIntNM = range.
valueInteger(CLengthUnit::NM());
430 m_maxDistanceNM = rIntNM;
431 m_maxDistanceNMHysteresis = qRound(rIntNM * 1.1);
434 void CAirspaceMonitor::onRealNameReplyReceived(
const CCallsign &callsign,
const QString &realname)
436 if (!this->isConnectedAndNotShuttingDown() || realname.
isEmpty()) {
return; }
440 const QString rn = CUser::beautifyRealName(realname);
447 const int c1 = this->updateOnlineStation(callsign, vm,
false,
true);
461 vm.
addValue({ CClient::IndexVoiceCapabilities }, voiceCaps);
465 void CAirspaceMonitor::onCapabilitiesReplyReceived(
const CCallsign &callsign, CClient::Capabilities clientCaps)
467 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty()) {
return; }
470 vm.
addValue({ CClient::IndexVoiceCapabilities }, voiceCaps);
474 if (clientCaps.testFlag(CClient::FsdWithAircraftConfig))
480 void CAirspaceMonitor::onServerReplyReceived(
const CCallsign &callsign,
const QString &server)
482 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty() || server.
isEmpty()) {
return; }
487 void CAirspaceMonitor::onFlightPlanReceived(
const CCallsign &callsign,
const CFlightPlan &flightPlan)
489 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty()) {
return; }
492 m_flightPlanCache.
insert(callsign, plan);
495 void CAirspaceMonitor::removeAllOnlineAtcStations()
497 m_atcStationsOnline.
clear();
501 void CAirspaceMonitor::removeAllAircraft()
506 m_flightPlanCache.
clear();
508 m_queryPilot.clear();
511 void CAirspaceMonitor::removeFromAircraftCachesAndLogs(
const CCallsign &callsign)
513 if (callsign.
isEmpty()) {
return; }
514 m_flightPlanCache.
remove(callsign);
515 m_readiness.
remove(callsign);
519 void CAirspaceMonitor::onReceivedVatsimDataFile()
524 bool changed =
false;
525 for (
auto &client : clients)
527 if (client.hasSpecifiedVoiceCapabilities()) {
continue; }
532 client.setVoiceCapabilities(vc);
534 if (!changed) {
return; }
538 CAirspaceMonitor::Readiness &CAirspaceMonitor::addMatchingReadinessFlag(
const CCallsign &callsign,
541 Readiness &readiness = m_readiness[callsign].addFlag(mrf);
545 void CAirspaceMonitor::sendReadyForModelMatching(
const CCallsign &callsign, MatchingReadinessFlag rf)
547 if (!this->isConnectedAndNotShuttingDown()) {
return; }
548 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"missing callsign");
551 Readiness &readiness = this->addMatchingReadinessFlag(callsign, rf);
554 const qint64 ageMs = readiness.getAgeMs();
555 if (readiness.wasMatchingSent() && readiness.getAgeMs() < MMMaxAgeThresholdMs) {
return; }
561 const bool complete = validRemoteCs && minSituations &&
562 (readiness.receivedAll() ||
570 if (rf !=
Verified && validRemoteCs && ageMs <= MMMaxAgeMs && !complete)
572 static const QString ws(
"Wait for further data, '%1' age: %2ms ts: %3");
573 static const QString format(
"hh:mm:ss.zzz");
574 if (!revLogEnabled.testFlag(RevLogSimplifiedInfo))
594 if (this->recallFsInnPacket(callsign)) {
return; }
609 static const QString readyForMatching(
610 "Ready (%1) for matching callsign '%2' with model type '%3', ICAO: '%4' '%5'");
625 callsign,
"Ignoring this aircraft, not found in range list, disconnected, or no callsign",
628 m_readiness.
remove(callsign);
632 void CAirspaceMonitor::verifyReceivedIcaoData(
const CCallsign &callsign)
634 if (callsign.
isEmpty() || !this->isAircraftInRange(callsign)) {
return; }
637 Readiness &readiness = m_readiness[callsign];
638 if (readiness.wasMatchingSent()) {
return; }
639 if (readiness.wasVerified())
641 CLogMessage(
this).
warning(u
"Verfied ICAO data of '%1' again, using it as it is! Most likely incomplete "
642 u
"data from the other client")
644 this->sendReadyForModelMatching(callsign,
Verified);
651 if (!readiness.receivedIcaoCodes())
653 CLogMessage(
this).
info(u
"Query ICAO codes for '%1' again") << callsign;
654 this->sendInitialPilotQueries(callsign,
true,
true);
662 this->verifyReceivedIcaoData(callsign);
668 CLogMessage(
this).
info(u
"Verified '%1' again, has ICAO codes, ready for matching!") << callsign;
669 this->sendReadyForModelMatching(callsign,
Verified);
672 void CAirspaceMonitor::onAtcPositionUpdate(
const CCallsign &callsign,
const CFrequency &frequency,
677 if (!this->isConnectedAndNotShuttingDown()) {
return; }
680 if (stationsWithCallsign.
isEmpty())
685 if (this->getConnectedServer().getEcosystem() == CEcosystem::vatsim())
700 this->sendInitialAtcQueries(callsign);
711 vm.
addValue(CAtcStation::IndexFrequency, frequency);
712 vm.
addValue(CAtcStation::IndexPosition, position);
713 vm.
addValue(CAtcStation::IndexRange, range);
714 const int changed = m_atcStationsOnline.
applyIfCallsign(callsign, vm,
true);
719 void CAirspaceMonitor::onAtcControllerDisconnected(
const CCallsign &callsign)
722 if (!this->isConnectedAndNotShuttingDown()) {
return; }
737 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty())
return;
744 void CAirspaceMonitor::onAtisLogoffTimeReceived(
const CCallsign &callsign,
const QString &zuluTime)
747 if (!this->isConnectedAndNotShuttingDown()) {
return; }
749 if (zuluTime.
length() == 5)
755 zuluTimeView.chop(1);
758 const int h = zuluTimeView.left(2).toInt(&ok);
760 const int m = zuluTimeView.right(2).toInt(&ok);
766 this->updateOnlineStation(callsign, vm);
770 void CAirspaceMonitor::onCustomFSInnPacketReceived(
const CCallsign &callsign,
const QString &airlineIcaoDesignator,
771 const QString &aircraftIcaoDesignator,
779 if (!callsign.
isValid()) {
return; }
780 if (!this->isConnectedAndNotShuttingDown()) {
return; }
784 if (!isAircraft && !isAtc)
787 const FsInnPacket fsInn(aircraftIcaoDesignator, airlineIcaoDesignator, combinedAircraftType, modelString);
788 m_tempFsInnPackets[callsign] = fsInn;
804 reverseLookupEnabled.testFlag(RevLogEnabled) ? &reverseLookupMessages :
nullptr;
806 CCallsign::addLogDetailsToList(
807 pReverseLookupMessages, callsign,
808 QStringLiteral(
"FsInn data from network: aircraft '%1', airline '%2', model '%3', combined '%4'")
809 .arg(aircraftIcaoDesignator, airlineIcaoDesignator, modelString, combinedAircraftType));
811 QString usedModelString = modelString;
816 usedModelString.
clear();
817 CCallsign::addLogDetailsToList(
818 pReverseLookupMessages, callsign,
819 QStringLiteral(
"FsInn modelstring '%1' ignored because of setup").arg(modelString));
825 usedModelString.
clear();
826 CCallsign::addLogDetailsToList(
827 pReverseLookupMessages, callsign,
828 QStringLiteral(
"FsInn modelstring ignored, as modelstring '%1' is not known").arg(modelString));
833 if (!usedModelString.
isEmpty())
835 this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator,
QString(),
837 pReverseLookupMessages);
844 void CAirspaceMonitor::onIcaoCodesReceived(
const CCallsign &callsign,
const QString &aircraftIcaoDesignator,
848 if (!this->isConnectedAndNotShuttingDown()) {
return; }
849 if (CBuildConfig::isLocalDeveloperDebugBuild())
853 if (!callsign.
isValid()) {
return; }
859 reverseLookupEnabled.testFlag(RevLogEnabled) ? &reverseLookupMessages :
nullptr;
860 CCallsign::addLogDetailsToList(pReverseLookupMessages, callsign,
861 QStringLiteral(
"Data from network: aircraft '%1', airline '%2', livery '%3'")
862 .arg(aircraftIcaoDesignator, airlineIcaoDesignator, livery),
866 this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery,
868 pReverseLookupMessages);
872 emit this->requestedNewAircraft(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery);
875 CAircraftModel CAirspaceMonitor::reverseLookupModelWithFlightplanData(
881 CCallsign::addLogDetailsToList(
882 log, callsign, QStringLiteral(
"Reverse lookup (with FP data), model set count: %1").arg(modelSetCount),
886 const bool hasAnyId = ids.
hasAnyId();
907 CCallsign::addLogDetailsToList(
908 log, callsign, QStringLiteral(
"Reverse lookup of livery string '%1' disabled").arg(liveryString));
923 CCallsign::addLogDetailsToList(
925 QStringLiteral(
"Using DB livery %1 and aircraft ICAO %2 to create model")
931 CAircraftModel(modelString, type,
"By DB livery and aircraft ICAO", aircraftIcao, livery);
940 const bool knownAircraftIcao =
945 CCallsign::addLogDetailsToList(
947 QStringLiteral(
"Fuzzy search among airline aircraft because '%1' is not known ICAO designator")
948 .arg(aircraftIcaoString));
969 CCallsign::addLogDetailsToList(log, callsign,
970 QStringLiteral(
"No flight plan remarks, skipping FP resolution"));
974 CCallsign::addLogDetailsToList(log, callsign,
975 QStringLiteral(
"FP remarks: '%1'").arg(fpRemarks.
getRemarks()));
976 CCallsign::addLogDetailsToList(
977 log, callsign, QStringLiteral(
"FP rem.parsed: '%1'").arg(fpRemarks.
toQString(
true)));
989 if (!airlineNameLookup.
isEmpty())
991 CCallsign::addLogDetailsToList(
993 QStringLiteral(
"Using resolved airline name '%1' found by FP name '%2'")
994 .arg(airlineNameLookup, airlineNameFromFp),
997 if (!telephonyLookup.
isEmpty())
999 CCallsign::addLogDetailsToList(
1001 QStringLiteral(
"Using resolved telephony designator '%1' found by FP telephoy '%2'")
1002 .arg(telephonyLookup, telephonyFromFp),
1013 callsign, airlineIcaoString, airlineIcaoFromFp,
true, airlineNameFromFp, telephonyFromFp, modelSet,
1024 if (!airlineNameLookup.
isEmpty()) { airlineIcao.
setName(airlineNameLookup); }
1032 CCallsign::addLogDetailsToList(log, callsign,
1033 QStringLiteral(
"Used aircraft ICAO: '%1'").arg(aircraftIcao.
toQString(
true)),
1035 CCallsign::addLogDetailsToList(log, callsign,
1036 QStringLiteral(
"Used airline ICAO: '%1'").arg(airlineIcao.
toQString(
true)),
1041 modelString, setup, modelSet, type, log);
1057 CCallsign::addLogDetailsToList(
1058 log, callsign, QStringLiteral(
"Matching script: Re-run reverseLookupModelWithFlightplanData"),
1060 return CAirspaceMonitor::reverseLookupModelWithFlightplanData(
1064 lookupModel = rv.
model;
1065 CCallsign::addLogDetailsToList(log, callsign,
1066 QStringLiteral(
"Matching script: Using model from matching script"),
1070 else { CCallsign::addLogDetailsToList(log, callsign, QStringLiteral(
"No reverse lookup script used")); }
1080 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Missing callsign");
1085 newAircraft.setRendered(
false);
1086 newAircraft.calculcateAndUpdateRelativeDistanceAndBearing(
1089 if (this->getConnectedServer().getEcosystem() == CEcosystem::vatsim())
1100 this->verifyReceivedIcaoData(callsign);
1118 bool readyForModelMatching)
1120 if (aircraft.
isEmpty()) {
return; }
1128 if (!myself) {
return; }
1129 myself->addNewAircraftInRange(ac);
1135 myself->sendReadyForModelMatching(cs, ready);
1141 bool skipEqualValues,
bool sendSignal)
1143 const int c = m_atcStationsOnline.
applyIfCallsign(callsign, vm, skipEqualValues);
1150 if (situation.
isNull()) {
return false; }
1151 if (m_maxDistanceNM < 0) {
return true; }
1152 const int distanceNM =
1154 if (distanceNM > m_maxDistanceNMHysteresis)
1159 return distanceNM <= m_maxDistanceNM;
1162 bool CAirspaceMonitor::recallFsInnPacket(
const CCallsign &callsign)
1164 if (!m_tempFsInnPackets.
contains(callsign)) {
return false; }
1165 const FsInnPacket packet = m_tempFsInnPackets[callsign];
1166 m_tempFsInnPackets.
remove(callsign);
1167 this->onCustomFSInnPacketReceived(callsign, packet.airlineIcaoDesignator, packet.aircraftIcaoDesignator,
1168 packet.combinedCode, packet.modelString);
1182 CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao,
1183 livery, modelString, modelType, log);
1205 if (situations.
size() < 3) {
return false; }
1210 return extrapolateElevation(situations.
front(), old, older, change);
1213 bool CAirspaceMonitor::extrapolateElevation(
CAircraftSituation &situationToBeUpdated,
1227 if (oldSituation.
isNull() || olderSituation.
isNull()) {
return false; }
1229 if (oldChange.
isNull()) {
return false; }
1234 const double deltaAltFt = qAbs(situationToBeUpdated.
getAltitude().
value(CLengthUnit::ft()) -
1236 if (deltaAltFt <= CAircraftSituation::allowedAltitudeDeviation().value(CLengthUnit::ft()))
1240 CAircraftSituation::Extrapolated);
1252 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1255 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Empty callsign");
1257 if (this->isCopilotAircraft(callsign)) {
return; }
1260 const bool validMaxRange = this->handleMaxRange(situation);
1262 if (!validMaxRange && !existsInRange) {
return; }
1268 this->storeAircraftSituation(situation);
1271 if (!existsInRange && validMaxRange)
1274 const bool hasFsInnPacket = m_tempFsInnPackets.
contains(callsign);
1280 this->addNewAircraftInRange(aircraft);
1281 this->sendInitialPilotQueries(callsign,
true, !hasFsInnPacket);
1284 const CClient client(callsign);
1287 else if (existsInRange)
1291 vm.
addValue(CSimulatedAircraft::IndexTransponder, transponder);
1292 vm.
addValue(CSimulatedAircraft::IndexSituation, situation);
1293 vm.
addValue(CSimulatedAircraft::IndexRelativeDistance, this->calculateDistanceToOwnAircraft(situation));
1294 vm.
addValue(CSimulatedAircraft::IndexRelativeBearing, this->calculateBearingToOwnAircraft(situation));
1299 void CAirspaceMonitor::onAircraftInterimUpdateReceived(
const CAircraftSituation &situation)
1302 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1307 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Empty callsign");
1309 if (isCopilotAircraft(callsign)) {
return; }
1312 if (CBuildConfig::isLocalDeveloperDebugBuild())
1323 if (history.
isEmpty()) {
return; }
1327 interimSituation.setCurrentUtcTime();
1331 this->storeAircraftSituation(interimSituation);
1334 if (samePosition) {
return; }
1338 this->calculateDistanceToOwnAircraft(interimSituation),
1339 this->calculateBearingToOwnAircraft(interimSituation));
1346 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1351 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Empty callsign");
1353 if (isCopilotAircraft(callsign)) {
return; }
1356 if (CBuildConfig::isLocalDeveloperDebugBuild())
1368 if (history.
empty()) {
return; }
1372 visualSituation.setCurrentUtcTime();
1376 this->storeAircraftSituation(visualSituation);
1379 if (samePosition) {
return; }
1383 this->calculateDistanceToOwnAircraft(visualSituation),
1384 this->calculateBearingToOwnAircraft(visualSituation));
1387 void CAirspaceMonitor::onAircraftSimDataUpdateReceived(
const CAircraftSituation &situation,
1391 onAircraftUpdateReceived(situation,
CTransponder(2000, CTransponder::ModeC));
1397 onIcaoCodesReceived(situation.
getCallsign(), aircraftIcao, airlineIcao, airlineIcao);
1408 if (newStatus == CConnectionStatus::Connecting && m_fsdClient)
1412 const CLength maxRange(isVatsim ? 125 : -1, CLengthUnit::NM());
1419 void CAirspaceMonitor::onPilotDisconnected(
const CCallsign &callsign)
1424 this->removeFromAircraftCachesAndLogs(callsign);
1430 void CAirspaceMonitor::onFrequencyReceived(
const CCallsign &callsign,
const CFrequency &frequency)
1440 void CAirspaceMonitor::onAircraftConfigReceived(
const CCallsign &callsign,
const QJsonObject &jsonObject,
1441 qint64 currentOffsetMs)
1445 if (callsign.
isEmpty()) {
return; }
1453 if (client.
hasCapability(CClient::FsdWithAircraftConfig)) {
return; }
1459 bool allowTestOffset)
1463 if (callsign.
isEmpty()) {
return situation; }
1467 bool needToRequestElevation =
false;
1468 bool canLikelySkipNearGround = correctedSituation.canLikelySkipNearGroundInterpolation();
1476 if (canLikelySkipNearGround || correctedSituation.hasGroundElevation()) {
break; }
1479 correctedSituation.resetGroundElevation();
1495 CSpeed rotateSpeed(
nullptr);
1497 if (!rotateSpeed.isNull())
1499 rotateSpeed *= 1.25;
1508 if (!changesBeforeStoring.
isNull())
1511 if (canLikelySkipNearGround) {
break; }
1516 using namespace std::chrono_literals;
1517 const CLength dpt = correctedSituation.getDistancePerTime(100ms, CElevationPlane::singlePointRadius());
1529 const CLength distance(correctedSituation.getDistancePerTime250ms(
1530 CElevationPlane::singlePointRadius()));
1532 needToRequestElevation = ep.
isNull();
1533 Q_ASSERT_X(needToRequestElevation || !ep.
getRadius().
isNull(), Q_FUNC_INFO,
"null radius");
1536 correctedSituation.setGroundElevation(ep, CAircraftSituation::FromCache);
1547 if (!correctedSituation.hasGroundElevation())
1552 bool fromNonMoving =
false;
1553 bool triedExtrapolation =
false;
1554 bool couldNotExtrapolate =
false;
1559 if (averagePlane.
isNull())
1562 situation, CElevationPlane::minorAirportRadius(), 2, 3);
1563 fromNonMoving =
true;
1567 if (!averagePlane.
isNull())
1569 correctedSituation.setGroundElevation(averagePlane, CAircraftSituation::Average);
1570 if (fromNonMoving) { m_foundInNonMovingAircraft++; }
1571 else { m_foundInElevationsOnGnd++; }
1577 if (situationsBeforeStoring.
size() > 1)
1579 const bool extrapolated =
1580 extrapolateElevation(correctedSituation, situationsBeforeStoring[0],
1581 situationsBeforeStoring[1], changesBeforeStoring);
1582 triedExtrapolation =
true;
1583 couldNotExtrapolate = !extrapolated;
1590 if (!correctedSituation.hasGroundElevation())
1592 if (CBuildConfig::isLocalDeveloperDebugBuild())
1595 SWIFT_VERIFY_X(needToRequestElevation, Q_FUNC_INFO,
"Request should already be set");
1597 needToRequestElevation =
true;
1599 Q_UNUSED(triedExtrapolation)
1600 Q_UNUSED(couldNotExtrapolate)
1605 if (CBuildConfig::isLocalDeveloperDebugBuild())
1607 SWIFT_VERIFY_X(!correctedSituation.getGroundElevation().isZeroEpsilonConsidered(), Q_FUNC_INFO,
1608 "Suspicious elevation");
1622 correctedSituation.setOnGroundDetails(COnGroundInfo::InFromNetwork);
1624 else if (client.
hasCapability(CClient::FsdWithAircraftConfig))
1627 if (!parts.
isEmpty()) { correctedSituation.adjustGroundFlag(parts,
true); }
1636 if (!cg.
isNull()) { correctedSituation.setCG(cg); }
1643 if (needToRequestElevation && !canLikelySkipNearGround)
1647 if (correctedSituation.isOtherElevationInfoBetter(CAircraftSituation::FromCache,
false) ||
1648 (correctedSituation.isMoving() &&
1649 correctedSituation.isOtherElevationInfoBetter(CAircraftSituation::FromProvider,
false)))
1655 Q_UNUSED(needToRequestElevation)
1656 return correctedSituation;
1659 void CAirspaceMonitor::sendInitialAtcQueries(
const CCallsign &callsign)
1661 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1664 m_fsdClient->sendClientQueryCapabilities(callsign);
1668 void CAirspaceMonitor::queryAllOnlineAtcStations()
1670 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1675 if (cs.
isEmpty()) {
continue; }
1680 bool CAirspaceMonitor::sendNextStaggeredAtisQuery()
1682 if (m_queryAtis.isEmpty()) {
return false; }
1683 if (!this->isConnectedAndNotShuttingDown()) {
return false; }
1690 void CAirspaceMonitor::sendInitialPilotQueries(
const CCallsign &callsign,
bool withIcaoQuery,
bool withFsInn)
1692 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1699 m_fsdClient->sendClientQueryCapabilities(callsign);
1703 bool CAirspaceMonitor::sendNextStaggeredPilotDataQuery()
1705 if (m_queryPilot.isEmpty()) {
return false; }
1706 if (!this->isConnectedAndNotShuttingDown()) {
return false; }
1718 bool CAirspaceMonitor::isConnected()
const
1723 bool CAirspaceMonitor::isConnectedAndNotShuttingDown()
const
1726 return this->isConnected();
1729 const CServer &CAirspaceMonitor::getConnectedServer()
const
1732 if (!this->isConnected()) {
return empty; }
1736 const CEcosystem &CAirspaceMonitor::getCurrentEcosystem()
const
1741 bool CAirspaceMonitor::supportsVatsimDataFile()
const
1743 const bool dataFile =
1762 bool CAirspaceMonitor::isCopilotAircraft(
const CCallsign &callsign)
const
1773 CAirspaceMonitor::FsInnPacket::FsInnPacket(
const QString &aircraftIcaoDesignator,
1774 const QString &airlineIcaoDesignator,
const QString &combinedCode,
1776 : aircraftIcaoDesignator(aircraftIcaoDesignator.trimmed().toUpper()),
1777 airlineIcaoDesignator(airlineIcaoDesignator.trimmed().toUpper()),
1778 combinedCode(combinedCode.trimmed().toUpper()), modelString(modelString.trimmed())
SWIFT_CORE_EXPORT swift::core::CApplication * sApp
Single instance of application object.
static swift::misc::simulation::CAircraftModel reverseLookupModelId(int id, const swift::misc::aviation::CCallsign &callsign, swift::misc::CStatusMessageList *log)
Try to find model by id.
static swift::misc::simulation::CAircraftModel reverseLookupModelStringInDB(const QString &modelString, const swift::misc::aviation::CCallsign &callsign, bool doLookupString, swift::misc::CStatusMessageList *log)
Try to find model by model string.
static swift::misc::aviation::CAirlineIcaoCode failoverValidAirlineIcaoDesignatorModelsFirst(const swift::misc::aviation::CCallsign &callsign, const QString &primaryIcao, const QString &secondaryIcao, bool airlineFromCallsign, const QString &airlineName, const QString &airlineTelephony, const swift::misc::simulation::CAircraftModelList &models, swift::misc::CStatusMessageList *log=nullptr)
Return an valid airline ICAO code from a given model list and use webservices if NOT found.
static QString reverseLookupTelephonyDesignator(const QString &candidate, const swift::misc::aviation::CCallsign &callsign={}, swift::misc::CStatusMessageList *log=nullptr)
Lookup of telephony designator.
static swift::misc::aviation::CAirlineIcaoCode reverseLookupAirlineIcao(const swift::misc::aviation::CAirlineIcaoCode &icaoPattern, const swift::misc::aviation::CCallsign &callsign={}, swift::misc::CStatusMessageList *log=nullptr)
Try to find the DB corresponding ICAO code.
static QString reverseLookupAirlineName(const QString &candidate, const swift::misc::aviation::CCallsign &callsign={}, swift::misc::CStatusMessageList *log=nullptr)
Lookup of airline name.
static swift::misc::simulation::MatchingScriptReturnValues reverseLookupScript(const swift::misc::simulation::CAircraftModel &inModel, const swift::misc::simulation::CAircraftMatcherSetup &setup, const swift::misc::simulation::CAircraftModelList &modelSet, swift::misc::CStatusMessageList *log)
Run the network reverse lookup script.
static bool isKnownModelString(const QString &candidate, const swift::misc::aviation::CCallsign &callsign={}, swift::misc::CStatusMessageList *log=nullptr)
Is this aircraft designator known?
static swift::misc::aviation::CAircraftIcaoCode searchAmongAirlineAircraft(const QString &icaoString, const swift::misc::aviation::CAirlineIcaoCode &airline, const swift::misc::aviation::CCallsign &callsign={}, swift::misc::CStatusMessageList *log=nullptr)
Search among the airline aircraft.
static swift::misc::simulation::CAircraftModel reverseLookupModel(const swift::misc::aviation::CCallsign &callsign, const swift::misc::aviation::CAircraftIcaoCode &networkAircraftIcao, const swift::misc::aviation::CAirlineIcaoCode &networkAirlineIcao, const QString &networkLiveryInfo, const QString &networkModelString, const swift::misc::simulation::CAircraftMatcherSetup &setup, const swift::misc::simulation::CAircraftModelList &modelSet, swift::misc::simulation::CAircraftModel::ModelType type, swift::misc::CStatusMessageList *log)
Try to find the corresponding data in DB and get best information for given data.
static int reverseLookupByIds(const swift::misc::simulation::DBTripleIds &ids, swift::misc::aviation::CAircraftIcaoCode &aircraftIcao, swift::misc::aviation::CLivery &livery, const swift::misc::aviation::CCallsign &logCallsign, swift::misc::CStatusMessageList *log=nullptr)
Lookup by ids.
static bool isKnownAircraftDesignator(const QString &candidate, const swift::misc::aviation::CCallsign &callsign={}, swift::misc::CStatusMessageList *log=nullptr)
Is this aircraft designator known?
Class monitoring and analyzing (closest aircraft, outdated aircraft / watchdog) airspace in backgroun...
void timeoutAircraft(const swift::misc::aviation::CCallsign &callsign)
Callsign has timed out.
void timeoutAtc(const swift::misc::aviation::CCallsign &callsign)
Callsign has timed out.
void airspaceAircraftSnapshot(const swift::misc::simulation::CAirspaceAircraftSnapshot &snapshot)
New aircraft snapshot.
swift::misc::simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const
Get the latest snapshot.
misc::network::CUserList getUsers() const
Returns the list of users we know about.
MatchingReadinessFlag
Matching readiness.
@ Verified
verified already
@ ReceivedFsInnPacket
FsInn pcket received.
@ ReadyForMatchingSent
Read for matching sending.
@ ReceivedIcaoCodes
ICAO codes received.
void requestAtisUpdates()
Request to update ATC stations' ATIS data from the network.
misc::aviation::CAtcStationList getAtcStationsOnlineRecalculated()
Recalculate distance to own aircraft.
misc::aviation::CAtcStationList getAtcStationsOnline() const
Returns the current online ATC stations.
static const QStringList & getLogCategories()
Log categories.
misc::aviation::CFlightPlanRemarks tryToGetFlightPlanRemarks(const misc::aviation::CCallsign &callsign) const
Try to get flight plan remarks.
void atcStationDisconnected(const swift::misc::aviation::CAtcStation &station)
ATC station disconnected.
misc::network::CUserList getUsersForCallsigns(const misc::aviation::CCallsignSet &callsigns) const
Returns a list of the users corresponding to the given callsigns.
void requestAircraftDataUpdates()
Request to update other clients' data from the network.
misc::aviation::CFlightPlan loadFlightPlanFromNetwork(const misc::aviation::CCallsign &callsign)
Returns the loaded flight plan for the given callsign.
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.
int reInitializeAllAircraft()
Re-init all aircrft.
misc::aviation::CAtcStation getAtcStationForComUnit(const misc::aviation::CComSystem &comSystem) const
Returns the closest ATC station operating on the given frequency, if any.
static QString enumToString(MatchingReadiness r)
As string.
void setMaxRange(const swift::misc::physical_quantities::CLength &range)
Max (FSD) range.
void clear()
Clear the contents.
static void registerHelp()
Register help.
static const QString & enumFlagToString(MatchingReadinessFlag r)
As string.
void gracefulShutdown()
Gracefully shut down, e.g. for thread safety.
bool updateFastPositionEnabled(const misc::aviation::CCallsign &callsign, bool enableFastPositonUpdates)
Members not implenented or fully implenented by CRemoteAircraftProvider.
misc::simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const
Members not implenented or fully implenented by CRemoteAircraftProvider.
bool isDeveloperFlagSet() const
Running with dev.flag?
bool hasWebDataServices() const
Web data services available?
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
CWebDataServices * getWebDataServices() const
Get the web data services.
swift::misc::network::CUserList getUsersForCallsign(const swift::misc::aviation::CCallsign &callsign) const
Users by callsign.
void updateWithVatsimDataFileData(swift::misc::simulation::CSimulatedAircraft &aircraftToBeUdpated) const
Update with web data.
swift::misc::network::CVoiceCapabilities getVoiceCapabilityForCallsign(const swift::misc::aviation::CCallsign &callsign) const
Voice capabilities for given callsign.
swift::misc::simulation::CAircraftModel getModelForModelString(const QString &modelString) const
Model for model string if any.
vatsim::CVatsimDataFileReader * getVatsimDataFileReader() const
Data file reader.
swift::misc::aviation::CAtcStationList getAtcStationsForCallsign(const swift::misc::aviation::CCallsign &callsign) const
ATC stations by callsign.
virtual swift::misc::network::CLoginMode getLoginMode() const =0
Login mode.
FSD client Todo: Send (interim) data updates automatically Todo Check ':' in FSD messages....
void sendClientQueryCom1Freq(const swift::misc::aviation::CCallsign &callsign)
void sendClientQueryAtis(const swift::misc::aviation::CCallsign &callsign)
const swift::misc::network::CServer & getServer() const
Get the server.
void sendPlaneInfoRequest(const swift::misc::aviation::CCallsign &receiver)
void sendClientQueryRealName(const swift::misc::aviation::CCallsign &callsign)
void addInterimPositionReceiver(const swift::misc::aviation::CCallsign &receiver)
Interim positions.
void sendClientQueryServer(const swift::misc::aviation::CCallsign &callsign)
void removeInterimPositionReceiver(const swift::misc::aviation::CCallsign &receiver)
Interim positions.
void sendClientQueryAircraftConfig(const swift::misc::aviation::CCallsign &callsign)
void sendClientQueryFlightPlan(const swift::misc::aviation::CCallsign &callsign)
void sendPlaneInfoRequestFsinn(const swift::misc::aviation::CCallsign &callsign)
swift::misc::network::CConnectionStatus getConnectionStatus() const
Connection status.
swift::misc::aviation::CFlightPlanRemarks getFlightPlanRemarksForCallsign(const swift::misc::aviation::CCallsign &callsign) const
Flight plan remarks for callsign.
T get() const
Get a copy of the current value.
void remove(const T &object)
Efficient remove using the find and erase of the implementation container. Typically O(log n).
bool isEmpty() const
Synonym for empty.
Utility class which blocks until a signal is emitted or timeout reached.
bool exec(int timeoutMs)
Begin processing events until the timeout or stop condition occurs.
void stopWhen(const T *sender, F signal)
Event loop will stop if the given signal is received.
Value object encapsulating information identifying a component of a modular distributed swift process...
static const CIdentifier & null()
Null (empty) identifier.
static const QString & matching()
Matching.
static const QString & network()
Network specific, but not necessarily one specific flight network.
Class for emitting a log message.
Derived & warning(const char16_t(&format)[N])
Set the severity to warning, providing a format string.
Derived & info(const char16_t(&format)[N])
Set the severity to info, providing a format string.
Specialized value object compliant map for variants, based on indexes.
void addValue(const CPropertyIndex &index, const CVariant &value)
Add a value.
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
size_type size() const
Returns number of elements in the sequence.
const_reference frontOrDefault() const
Access the first element, or a default-initialized value if the sequence is empty.
bool empty() const
Returns true if the sequence is empty.
void push_back(const T &value)
Appends an element at the end of the sequence.
reference front()
Access the first element.
void clear()
Removes all elements in the sequence.
bool isEmpty() const
Synonym for empty.
Utility methods for simple line parsing used with the command line.
Streamable status message, e.g.
constexpr static auto SeverityWarning
Status severities.
Status messages, e.g. from Core -> GUI.
static bool isInThisThread(const QObject *toBeTested)
Is the current thread the object's thread?
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
static CVariant from(T &&value)
Synonym for fromValue().
OBJ latestObject() const
Latest object.
Value object for ICAO classification.
bool hasDesignator() const
Aircraft designator?
bool isVtol() const
Is VTOL aircraft (helicopter, tilt wing)
QString getDesignatorDbKey() const
Designator and DB key.
void guessModelParameters(physical_quantities::CLength &guessedCGOut, physical_quantities::CSpeed &guessedVRotateOut) const
Guess aircraft model parameters.
Value object encapsulating information of aircraft's parts.
QJsonObject toIncrementalJson() const
Incremental JSON object.
QJsonObject toFullJson() const
Full JSON Object.
Value object encapsulating a list of aircraft parts.
Value object about changes in situations.
bool isConstAscending() const
Constantly ascending?
bool hasAltitudeDevWithinAllowedRange() const
Altitude within CAircraftSituation::allowedAltitudeDeviation range.
bool hasElevationDevWithinAllowedRange() const
Elevation within CAircraftSituation::allowedAltitudeDeviation range.
bool isConstOnGround() const
Are all situations on ground?
Value object encapsulating information of an aircraft's situation.
const CAltitude & getGroundElevation() const
Elevation of the ground directly beneath.
bool hasGroundElevation() const
Is ground elevation value available.
bool setGroundElevation(const aviation::CAltitude &altitude, GndElevationInfo info, bool transferred=false)
Elevation of the ground directly beneath at the given situation.
bool transferGroundElevationFromMe(CAircraftSituation &transferToSituation, const physical_quantities::CLength &radius=geo::CElevationPlane::singlePointRadius()) const
Transfer from "this" situation to otherSituation.
aviation::COnGroundInfo getOnGroundInfo() const
On ground info.
const CCallsign & getCallsign() const
Corresponding callsign.
const physical_quantities::CSpeed & getGroundSpeed() const
Get ground speed.
const CAltitude & getAltitude() const
Get altitude.
bool isNull() const
Null situation.
List of aircraft situations.
CAircraftSituation findClosestElevationWithinRange(const geo::ICoordinateGeodetic &coordinate, const physical_quantities::CLength &range=geo::CElevationPlane::singlePointRadius()) const
CLosest elevation within given range.
Value object for ICAO classification.
void setTelephonyDesignator(const QString &telephony)
Telephony designator such as "Speedbird".
QString getDesignatorDbKey() const
Designator and DB key.
const QString & getDesignator() const
Get airline, e.g. "DLH".
bool hasValidDesignator() const
Airline designator available?
void setName(const QString &name)
Set name.
void setDesignator(const QString &icaoDesignator)
Set airline, e.g. "DLH".
Value object encapsulating information about an ATC station.
void setFrequency(const swift::misc::physical_quantities::CFrequency &frequency)
Set frequency.
const CCallsign & getCallsign() const
Get callsign.
void setCallsign(const CCallsign &callsign)
Set callsign.
void setPosition(const swift::misc::geo::CCoordinateGeodetic &position)
Set position.
bool setOnline(bool online)
Set online.
void setRange(const physical_quantities::CLength &range)
Set range.
Value object for a list of ATC stations.
CAtcStationList findIfComUnitTunedInChannelSpacing(const CComSystem &comUnit) const
Find 0..n stations tuned in frequency of COM unit (with channel spacing)
bool updateIfMessageChanged(const CInformationMessage &im, const CCallsign &callsign, bool overrideWithNewer)
Update if message changed.
Value object encapsulating information of a callsign.
bool isMaybeCopilotCallsign(const CCallsign &pilotCallsign) const
Returns true if this is a co-pilot callsign of pilot. The logic is that the callsign is the same as t...
bool hasSuffix() const
Suffix such as "_TWR"?
bool isEmpty() const
Is empty?
QString getAirlinePrefix() const
Airline suffix (e.g. DLH1234 -> DLH) if applicable.
bool isValid() const
Valid callsign?
Value object for a set of callsigns.
Value object for a flight plan.
bool wasSentOrLoaded() const
Flight plan already sent.
qint64 timeDiffSentOrLoadedMs() const
Received before n ms.
Value object encapsulating information about an airpot.
const CAirlineIcaoCode & getAirlineIcaoCode() const
Corresponding airline, if any.
const QString & getCombinedCode() const
Combined code.
OnGroundDetails getGroundDetails() const
Get ground details.
CONTAINER findByCallsign(const CCallsign &callsign) const
Find 0..n stations by callsign.
OBJ findFirstByCallsign(const CCallsign &callsign, const OBJ &ifNotFound={}) const
Find the first aircraft by callsign, if none return given one.
int applyIfCallsign(const CCallsign &callsign, const CPropertyIndexVariantMap &variantMap, bool skipEqualValues=true)
Apply for given callsign.
int removeByCallsign(const CCallsign &callsign)
Remove all objects with callsign.
bool containsCallsign(const CCallsign &callsign) const
Contains callsign?
QString getDbKeyAsString() const
DB key as string.
bool isLoadedFromDb() const
Loaded from DB.
bool hasValidDbKey() const
Has valid DB key.
Plane of same elevation, can be a single point or larger area (e.g. airport)
bool isNull() const
Existing value?
const physical_quantities::CLength & getRadius() const
Radius.
bool isNaNVectorDouble() const
Check values.
physical_quantities::CLength calculateGreatCircleDistance(const ICoordinateGeodetic &otherCoordinate) const
Great circle distance.
bool isInfVectorDouble() const
Check values.
bool isValidVectorRange() const
Check values.
bool equalNormalVectorDouble(const std::array< double, 3 > &otherVector) const
Is equal? Epsilon considered.
physical_quantities::CAngle calculateBearing(const ICoordinateGeodetic &otherCoordinate) const
Initial bearing.
physical_quantities::CLength calculcateAndUpdateRelativeDistanceAndBearing(const geo::ICoordinateGeodetic &position)
Calculcate distance and bearing to plane, set it, and return distance.
void calculcateAndUpdateRelativeDistanceAndBearing(const ICoordinateGeodetic &position)
Calculate distances.
void sortByDistanceToReferencePosition()
If distance is already set, just sort container.
QString toQString(bool i18n=false) const
Cast as QString.
bool hasCapability(Capability capability) const
Has capability?
const QString & getQueriedModelString() const
Model.
void addCapability(Capability capability)
Add capability.
bool setUserCallsign(const swift::misc::aviation::CCallsign &callsign)
User's callsign.
Value object encapsulating a list of voice rooms.
int removeClient(const aviation::CCallsign &callsign)
Remove client.
int updateOrAddClient(const aviation::CCallsign &callsign, const CPropertyIndexVariantMap &vm, bool skipEqualValues=true)
Update or add a client.
void markAsSwiftClient(const aviation::CCallsign &callsign)
Mark as other swift client.
bool setOtherClient(const swift::misc::network::CClient &client)
Set client for its callsign.
bool addNewClient(const CClient &client)
Add a new client, if existing nothing will be added.
void setClients(const CClientList &clients)
Set other clients.
CClientList getClients() const
clientprovider
void clearClients()
Set other clients.
CClient getClientOrDefaultForCallsign(const aviation::CCallsign &callsign) const
Other client for the given callsigns.
bool autoAdjustCientGndCapability(const aviation::CAircraftSituation &situation)
Adjust gnd.flag capability from situation.
Value object encapsulating information about a connection status.
bool isConnected() const
Query status.
bool isDisconnected() const
Query status.
Ecosystem of server belonging together.
bool isSystem(System s) const
Is system?
@ Observer
Login as observer.
Value object encapsulating information of a server.
const CEcosystem & getEcosystem() const
Get the ecosystem.
Value object encapsulating information of a user.
bool setCallsign(const aviation::CCallsign &callsign)
Set associated callsign.
bool hasCallsign() const
Has associated callsign?
Value object encapsulating a list of voice rooms.
Value object encapsulating information for voice capabilities.
bool isUnknown() const
Is capability known.
Physical unit angle (radians, degrees)
Physical unit length (length)
bool isNegativeWithEpsilonConsidered() const
Value <= 0 epsilon considered.
int valueInteger(MU unit) const
As integer value.
PQ & switchUnit(const MU &newUnit)
Change unit, and convert value to maintain the same quantity.
bool isNull() const
Is quantity null?
double value(MU unit) const
Value in given unit.
bool isZeroEpsilonConsidered() const
Quantity value <= epsilon.
bool isReverseLookupModelString() const
Reverse lookup.
bool isReverseLookupSwiftLiveryIds() const
Reverse lookup.
bool doRunMsReverseLookupScript() const
Run the scripts.
Aircraft model (used by another pilot, my models on disk)
static DBTripleIds parseNetworkLiveryString(const QString &liveryString)
Split swift network string.
const aviation::CLivery & getLivery() const
Get livery.
const QString & getAircraftIcaoCodeDesignator() const
Aircraft ICAO code designator.
@ TypeFSInnData
model based on FSD ICAO data
@ TypeQueriedFromNetwork
model was queried by network protocol (ICAO data)
void setCallsign(const aviation::CCallsign &callsign)
Corresponding callsign if applicable.
const physical_quantities::CLength & getCG() const
Get center of gravity.
const aviation::CAircraftIcaoCode & getAircraftIcaoCode() const
Aircraft ICAO code.
const QString & getModelTypeAsString() const
Model type.
const QString getAirlineIcaoCodeVDesignator() const
Airline ICAO code designator.
void updateMissingParts(const CAircraftModel &otherModel, bool dbModelPriority=true)
Update missing parts from another model.
Value object encapsulating a list of aircraft models.
Current situation in the skies analyzed.
Delegating class which can be directly used to access an.
aviation::CAircraftSituation getOwnAircraftSituation() const
Own aircraft's position.
aviation::CCallsign getOwnCallsign() const
Own aircraft's callsign.
swift::misc::geo::CCoordinateGeodetic getOwnAircraftPosition() const
Own aircraft's position.
CSimulatedAircraft getOwnAircraft() const
Own aircraft.
Implementaion of the interface, which can also be used for testing.
bool isAircraftInRange(const aviation::CCallsign &callsign) const
Is aircraft in range?
CSimulatedAircraftList getAircraftInRange() const
All remote aircraft.
virtual aviation::CAircraftSituation storeAircraftSituation(const aviation::CAircraftSituation &situation, bool allowTestAltitudeOffset=true)
Store an aircraft situation.
bool addNewAircraftInRange(const CSimulatedAircraft &aircraft)
Add new aircraft, ignored if aircraft already exists.
aviation::CAircraftSituation addTestAltitudeOffsetToSituation(const aviation::CAircraftSituation &situation) const
Add an offset for testing.
bool removeAircraft(const aviation::CCallsign &callsign)
Remove all aircraft in range.
int remoteAircraftSituationsCount(const aviation::CCallsign &callsign) const
Number of remote aircraft situations for callsign.
geo::CElevationPlane averageElevationOfNonMovingAircraft(const aviation::CAircraftSituation &reference, const physical_quantities::CLength &range, int minValues=1, int sufficientValues=2) const
Average elevation of aircraft in given range, which are NOT moving.
aviation::CAircraftSituationList remoteAircraftSituations(const aviation::CCallsign &callsign) const
Rendered aircraft situations (per callsign, time history)
aviation::CAircraftSituationChangeList remoteAircraftSituationChanges(const aviation::CCallsign &callsign) const
Aircraft changes.
int updateAircraftInRange(const aviation::CCallsign &callsign, const CPropertyIndexVariantMap &vm, bool skipEqualValues=true)
Update aircraft.
void storeAircraftParts(const aviation::CCallsign &callsign, const aviation::CAircraftParts &parts, bool removeOutdated)
Store an aircraft part.
bool updateAircraftInRangeDistanceBearing(const aviation::CCallsign &callsign, const aviation::CAircraftSituation &situation, const physical_quantities::CLength &distance, const physical_quantities::CAngle &bearing)
Update aircraft bearing, distance and situation.
void rememberCGFromDB(const physical_quantities::CLength &cgFromDB, const aviation::CCallsign &callsign)
CG values from DB.
void removeReverseLookupMessages(const aviation::CCallsign &callsign)
Remove the lookup messages.
void addReverseLookupMessages(const aviation::CCallsign &callsign, const CStatusMessageList &messages)
Reverse lookup messages.
void airspaceAircraftSnapshot(const swift::misc::simulation::CAirspaceAircraftSnapshot &snapshot)
New aircraft snapshot.
bool updateAircraftNetworkModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change network model.
bool updateAircraftModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change model.
physical_quantities::CLength getCGFromDB(const aviation::CCallsign &callsign) const
CG values from DB.
bool updateFastPositionEnabled(const aviation::CCallsign &callsign, bool enableFastPositonUpdates)
Change fast position updates.
ReverseLookupLogging whatToReverseLog() const
What to log?
ReverseLookupLogging isReverseLookupMessagesEnabled() const
Enabled reverse lookup logging?
CAircraftModel getAircraftInRangeModelForCallsign(const aviation::CCallsign &callsign) const
Aircraft model for callsign.
CSimulatedAircraft getAircraftInRangeForCallsign(const aviation::CCallsign &callsign) const
Aircraft for callsign.
aviation::CAircraftPartsList remoteAircraftParts(const aviation::CCallsign &callsign) const
All parts (per callsign, time history)
void enableReverseLookupMessages(ReverseLookupLogging enable)
Enable reverse lookup logging.
void removeAllAircraft()
Remove all aircraft in range.
void addReverseLookupMessage(const aviation::CCallsign &callsign, const CStatusMessage &message)
Reverse lookup messages.
void removedAircraft(const swift::misc::aviation::CCallsign &callsign)
An aircraft disappeared.
Comprehensive information of an aircraft.
void setCallsign(const aviation::CCallsign &callsign)
Set callsign.
bool hasModelString() const
Has model string?
void setSituation(const aviation::CAircraftSituation &situation)
Set situation. Won't overwrite the velocity unless it held the default value.
const network::CUser & getPilot() const
Get user.
const simulation::CAircraftModel & getNetworkModel() const
Get network model.
const aviation::CCallsign & getCallsign() const
Get callsign.
const aviation::CAircraftIcaoCode & getAircraftIcaoCode() const
Get aircraft ICAO info.
bool hasValidCallsign() const
Valid callsign?
const simulation::CAircraftModel & getModel() const
Get model (model used for mapping)
void setTransponder(const aviation::CTransponder &transponder)
Set transponder.
const aviation::CAirlineIcaoCode & getAirlineIcaoCode() const
Airline ICAO code if any.
const QString & getModelString() const
Get model string.
Value object encapsulating a list of aircraft.
bool requestElevation(const geo::ICoordinateGeodetic &reference, const aviation::CCallsign &callsign)
Request elevation, there is no guarantee the requested elevation will be available in the provider.
physical_quantities::CLength getSimulatorOrDbCG(const aviation::CCallsign &callsign, const physical_quantities::CLength &dbCG) const
Get CG per callsign, NULL if not found.
geo::CElevationPlane averageElevationOfOnGroundAircraft(const aviation::CAircraftSituation &reference, const physical_quantities::CLength &range, int minValues, int sufficientValues) const
Average elevation of "on ground" cached values.
geo::CElevationPlane findClosestElevationWithinRange(const geo::ICoordinateGeodetic &reference, const physical_quantities::CLength &range) const
Find closest elevation (or return NULL)
Value object encapsulating a list of aircraft models.
virtual int getModelSetCount() const =0
Get the model set models count.
virtual CAircraftModelList getModelSet() const =0
Get the model set models.
Direct threadsafe in memory access to own aircraft.
bool parseCommandLine(const QString &commandLine, const swift::misc::CIdentifier &originator)
Parse a given command line.
Backend services of the swift project, like dealing with the network or the simulators.
Generate data for testing purposes.
Free functions in swift::misc.
QDateTime currentDateTimeUtc()
void setTime(QTime time, QDateTime::TransitionResolution resolve)
QString toString(QStringView format) const const
bool contains(const Key &key) const const
QHash< Key, T >::iterator insert(const Key &key, const T &value)
bool remove(const Key &key)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
void setObjectName(QAnyStringView name)
QString arg(Args &&... args) const const
bool isEmpty() const const
qsizetype length() const const
QString join(QChar separator) const const
QTextStream & ws(QTextStream &stream)
bool hasAnyId() const
Any valid id?
swift::misc::simulation::CAircraftModel model
the model
bool runScriptAndModified() const
Did run the script with modified result.
bool runScriptAndRerun() const
Did run the script and re-run requested.
#define SWIFT_AUDIT_X(COND, WHERE, WHAT)
A weaker kind of verify.
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.