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();
307 if (!m_queryAtis.contains(cs)) { m_queryAtis.
enqueue(cs); }
311 void CAirspaceMonitor::testCreateDummyOnlineAtcStations(
int number)
313 if (number < 1) {
return; }
314 m_atcStationsOnline.
push_back(CTesting::createAtcStations(number));
326 static const QString nr(
"not ready");
327 static const QString icao(
"rec. ICAO");
328 static const QString fsinn(
"rec. FsInn");
329 static const QString ready(
"ready sent");
330 static const QString rec(
"recursive");
340 static const QString unknown(
"????");
357 Q_UNUSED(originator;)
358 if (commandLine.
isEmpty()) {
return false; }
361 parser.parse(commandLine);
362 if (!parser.isKnownCommand()) {
return false; }
363 if (parser.matchesCommand(
".fsd"))
365 if (parser.countParts() < 2) {
return false; }
366 if (parser.matchesPart(1,
"range") && parser.countParts() > 2)
368 const QString r = parser.part(2);
369 const CLength d = CLength::parsedFromString(r);
376 void CAirspaceMonitor::fastProcessing()
378 if (!this->isConnectedAndNotShuttingDown()) {
return; }
381 const bool send = this->sendNextStaggeredAtisQuery();
382 if (!send) { this->sendNextStaggeredPilotDataQuery(); }
385 void CAirspaceMonitor::slowProcessing()
387 if (!this->isConnectedAndNotShuttingDown()) {
return; }
388 this->queryAllOnlineAtcStations();
393 m_flightPlanCache.
clear();
394 m_tempFsInnPackets.
clear();
396 this->removeAllOnlineAtcStations();
397 this->removeAllAircraft();
400 m_foundInNonMovingAircraft = 0;
401 m_foundInElevationsOnGnd = 0;
410 this->asyncReInitializeAllAircraft(aircraft,
true);
411 return aircraft.
size();
419 m_maxDistanceNM = -1;
420 m_maxDistanceNMHysteresis = -1;
425 const int rIntNM = range.
valueInteger(CLengthUnit::NM());
427 m_maxDistanceNM = rIntNM;
428 m_maxDistanceNMHysteresis = qRound(rIntNM * 1.1);
431 void CAirspaceMonitor::onRealNameReplyReceived(
const CCallsign &callsign,
const QString &realname)
433 if (!this->isConnectedAndNotShuttingDown() || realname.
isEmpty()) {
return; }
437 const QString rn = CUser::beautifyRealName(realname);
444 const int c1 = this->updateOnlineStation(callsign, vm,
false,
true);
458 vm.
addValue({ CClient::IndexVoiceCapabilities }, voiceCaps);
462 void CAirspaceMonitor::onCapabilitiesReplyReceived(
const CCallsign &callsign, CClient::Capabilities clientCaps)
464 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty()) {
return; }
467 vm.
addValue({ CClient::IndexVoiceCapabilities }, voiceCaps);
471 if (clientCaps.testFlag(CClient::FsdWithAircraftConfig))
477 void CAirspaceMonitor::onServerReplyReceived(
const CCallsign &callsign,
const QString &server)
479 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty() || server.
isEmpty()) {
return; }
484 void CAirspaceMonitor::onFlightPlanReceived(
const CCallsign &callsign,
const CFlightPlan &flightPlan)
486 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty()) {
return; }
489 m_flightPlanCache.
insert(callsign, plan);
492 void CAirspaceMonitor::removeAllOnlineAtcStations()
494 m_atcStationsOnline.
clear();
498 void CAirspaceMonitor::removeAllAircraft()
503 m_flightPlanCache.
clear();
505 m_queryPilot.clear();
508 void CAirspaceMonitor::removeFromAircraftCachesAndLogs(
const CCallsign &callsign)
510 if (callsign.
isEmpty()) {
return; }
511 m_flightPlanCache.
remove(callsign);
512 m_readiness.
remove(callsign);
516 void CAirspaceMonitor::onReceivedVatsimDataFile()
521 bool changed =
false;
522 for (
auto &client : clients)
524 if (client.hasSpecifiedVoiceCapabilities()) {
continue; }
529 client.setVoiceCapabilities(vc);
531 if (!changed) {
return; }
535 CAirspaceMonitor::Readiness &CAirspaceMonitor::addMatchingReadinessFlag(
const CCallsign &callsign,
538 Readiness &readiness = m_readiness[callsign].addFlag(mrf);
542 void CAirspaceMonitor::sendReadyForModelMatching(
const CCallsign &callsign, MatchingReadinessFlag rf)
544 if (!this->isConnectedAndNotShuttingDown()) {
return; }
545 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"missing callsign");
548 Readiness &readiness = this->addMatchingReadinessFlag(callsign, rf);
551 const qint64 ageMs = readiness.getAgeMs();
552 if (readiness.wasMatchingSent() && readiness.getAgeMs() < MMMaxAgeThresholdMs) {
return; }
558 const bool complete = validRemoteCs && minSituations &&
559 (readiness.receivedAll() ||
567 if (rf !=
Verified && validRemoteCs && ageMs <= MMMaxAgeMs && !complete)
569 static const QString ws(
"Wait for further data, '%1' age: %2ms ts: %3");
570 static const QString format(
"hh:mm:ss.zzz");
571 if (!revLogEnabled.testFlag(RevLogSimplifiedInfo))
591 if (this->recallFsInnPacket(callsign)) {
return; }
606 static const QString readyForMatching(
607 "Ready (%1) for matching callsign '%2' with model type '%3', ICAO: '%4' '%5'");
622 callsign,
"Ignoring this aircraft, not found in range list, disconnected, or no callsign",
625 m_readiness.
remove(callsign);
629 void CAirspaceMonitor::verifyReceivedIcaoData(
const CCallsign &callsign)
631 if (callsign.
isEmpty() || !this->isAircraftInRange(callsign)) {
return; }
634 Readiness &readiness = m_readiness[callsign];
635 if (readiness.wasMatchingSent()) {
return; }
636 if (readiness.wasVerified())
638 CLogMessage(
this).
warning(u
"Verfied ICAO data of '%1' again, using it as it is! Most likely incomplete "
639 u
"data from the other client")
641 this->sendReadyForModelMatching(callsign,
Verified);
648 if (!readiness.receivedIcaoCodes())
650 CLogMessage(
this).
info(u
"Query ICAO codes for '%1' again") << callsign;
651 this->sendInitialPilotQueries(callsign,
true,
true);
659 this->verifyReceivedIcaoData(callsign);
665 CLogMessage(
this).
info(u
"Verified '%1' again, has ICAO codes, ready for matching!") << callsign;
666 this->sendReadyForModelMatching(callsign,
Verified);
669 void CAirspaceMonitor::onAtcPositionUpdate(
const CCallsign &callsign,
const CFrequency &frequency,
674 if (!this->isConnectedAndNotShuttingDown()) {
return; }
677 if (stationsWithCallsign.
isEmpty())
682 if (this->getConnectedServer().getEcosystem() == CEcosystem::vatsim())
697 this->sendInitialAtcQueries(callsign);
708 vm.
addValue(CAtcStation::IndexFrequency, frequency);
709 vm.
addValue(CAtcStation::IndexPosition, position);
710 vm.
addValue(CAtcStation::IndexRange, range);
711 const int changed = m_atcStationsOnline.
applyIfCallsign(callsign, vm,
true);
716 void CAirspaceMonitor::onAtcControllerDisconnected(
const CCallsign &callsign)
719 if (!this->isConnectedAndNotShuttingDown()) {
return; }
734 if (!this->isConnectedAndNotShuttingDown() || callsign.
isEmpty())
return;
741 void CAirspaceMonitor::onAtisLogoffTimeReceived(
const CCallsign &callsign,
const QString &zuluTime)
744 if (!this->isConnectedAndNotShuttingDown()) {
return; }
746 if (zuluTime.
length() == 5)
752 zuluTimeView.chop(1);
755 const int h = zuluTimeView.left(2).toInt(&ok);
757 const int m = zuluTimeView.right(2).toInt(&ok);
763 this->updateOnlineStation(callsign, vm);
767 void CAirspaceMonitor::onCustomFSInnPacketReceived(
const CCallsign &callsign,
const QString &airlineIcaoDesignator,
768 const QString &aircraftIcaoDesignator,
776 if (!callsign.
isValid()) {
return; }
777 if (!this->isConnectedAndNotShuttingDown()) {
return; }
781 if (!isAircraft && !isAtc)
784 const FsInnPacket fsInn(aircraftIcaoDesignator, airlineIcaoDesignator, combinedAircraftType, modelString);
785 m_tempFsInnPackets[callsign] = fsInn;
801 reverseLookupEnabled.testFlag(RevLogEnabled) ? &reverseLookupMessages :
nullptr;
803 CCallsign::addLogDetailsToList(
804 pReverseLookupMessages, callsign,
805 QStringLiteral(
"FsInn data from network: aircraft '%1', airline '%2', model '%3', combined '%4'")
806 .arg(aircraftIcaoDesignator, airlineIcaoDesignator, modelString, combinedAircraftType));
808 QString usedModelString = modelString;
813 usedModelString.
clear();
814 CCallsign::addLogDetailsToList(
815 pReverseLookupMessages, callsign,
816 QStringLiteral(
"FsInn modelstring '%1' ignored because of setup").arg(modelString));
822 usedModelString.
clear();
823 CCallsign::addLogDetailsToList(
824 pReverseLookupMessages, callsign,
825 QStringLiteral(
"FsInn modelstring ignored, as modelstring '%1' is not known").arg(modelString));
830 if (!usedModelString.
isEmpty())
832 this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator,
QString(),
834 pReverseLookupMessages);
841 void CAirspaceMonitor::onIcaoCodesReceived(
const CCallsign &callsign,
const QString &aircraftIcaoDesignator,
845 if (!this->isConnectedAndNotShuttingDown()) {
return; }
846 if (CBuildConfig::isLocalDeveloperDebugBuild())
850 if (!callsign.
isValid()) {
return; }
856 reverseLookupEnabled.testFlag(RevLogEnabled) ? &reverseLookupMessages :
nullptr;
857 CCallsign::addLogDetailsToList(pReverseLookupMessages, callsign,
858 QStringLiteral(
"Data from network: aircraft '%1', airline '%2', livery '%3'")
859 .arg(aircraftIcaoDesignator, airlineIcaoDesignator, livery),
863 this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery,
865 pReverseLookupMessages);
869 emit this->requestedNewAircraft(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery);
872 CAircraftModel CAirspaceMonitor::reverseLookupModelWithFlightplanData(
878 CCallsign::addLogDetailsToList(
879 log, callsign, QStringLiteral(
"Reverse lookup (with FP data), model set count: %1").arg(modelSetCount),
883 const bool hasAnyId = ids.
hasAnyId();
904 CCallsign::addLogDetailsToList(
905 log, callsign, QStringLiteral(
"Reverse lookup of livery string '%1' disabled").arg(liveryString));
920 CCallsign::addLogDetailsToList(
922 QStringLiteral(
"Using DB livery %1 and aircraft ICAO %2 to create model")
928 CAircraftModel(modelString, type,
"By DB livery and aircraft ICAO", aircraftIcao, livery);
937 const bool knownAircraftIcao =
942 CCallsign::addLogDetailsToList(
944 QStringLiteral(
"Fuzzy search among airline aircraft because '%1' is not known ICAO designator")
945 .arg(aircraftIcaoString));
966 CCallsign::addLogDetailsToList(log, callsign,
967 QStringLiteral(
"No flight plan remarks, skipping FP resolution"));
971 CCallsign::addLogDetailsToList(log, callsign,
972 QStringLiteral(
"FP remarks: '%1'").arg(fpRemarks.
getRemarks()));
973 CCallsign::addLogDetailsToList(
974 log, callsign, QStringLiteral(
"FP rem.parsed: '%1'").arg(fpRemarks.
toQString(
true)));
986 if (!airlineNameLookup.
isEmpty())
988 CCallsign::addLogDetailsToList(
990 QStringLiteral(
"Using resolved airline name '%1' found by FP name '%2'")
991 .arg(airlineNameLookup, airlineNameFromFp),
994 if (!telephonyLookup.
isEmpty())
996 CCallsign::addLogDetailsToList(
998 QStringLiteral(
"Using resolved telephony designator '%1' found by FP telephoy '%2'")
999 .arg(telephonyLookup, telephonyFromFp),
1010 callsign, airlineIcaoString, airlineIcaoFromFp,
true, airlineNameFromFp, telephonyFromFp, modelSet,
1021 if (!airlineNameLookup.
isEmpty()) { airlineIcao.
setName(airlineNameLookup); }
1029 CCallsign::addLogDetailsToList(log, callsign,
1030 QStringLiteral(
"Used aircraft ICAO: '%1'").arg(aircraftIcao.
toQString(
true)),
1032 CCallsign::addLogDetailsToList(log, callsign,
1033 QStringLiteral(
"Used airline ICAO: '%1'").arg(airlineIcao.
toQString(
true)),
1038 modelString, setup, modelSet, type, log);
1054 CCallsign::addLogDetailsToList(
1055 log, callsign, QStringLiteral(
"Matching script: Re-run reverseLookupModelWithFlightplanData"),
1057 return CAirspaceMonitor::reverseLookupModelWithFlightplanData(
1061 lookupModel = rv.
model;
1062 CCallsign::addLogDetailsToList(log, callsign,
1063 QStringLiteral(
"Matching script: Using model from matching script"),
1067 else { CCallsign::addLogDetailsToList(log, callsign, QStringLiteral(
"No reverse lookup script used")); }
1077 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Missing callsign");
1082 newAircraft.setRendered(
false);
1083 newAircraft.calculcateAndUpdateRelativeDistanceAndBearing(
1086 if (this->getConnectedServer().getEcosystem() == CEcosystem::vatsim())
1097 this->verifyReceivedIcaoData(callsign);
1115 bool readyForModelMatching)
1117 if (aircraft.
isEmpty()) {
return; }
1125 if (!myself) {
return; }
1126 myself->addNewAircraftInRange(ac);
1132 myself->sendReadyForModelMatching(cs, ready);
1138 bool skipEqualValues,
bool sendSignal)
1140 const int c = m_atcStationsOnline.
applyIfCallsign(callsign, vm, skipEqualValues);
1147 if (situation.
isNull()) {
return false; }
1148 if (m_maxDistanceNM < 0) {
return true; }
1149 const int distanceNM =
1151 if (distanceNM > m_maxDistanceNMHysteresis)
1156 return distanceNM <= m_maxDistanceNM;
1159 bool CAirspaceMonitor::recallFsInnPacket(
const CCallsign &callsign)
1161 if (!m_tempFsInnPackets.
contains(callsign)) {
return false; }
1162 const FsInnPacket packet = m_tempFsInnPackets[callsign];
1163 m_tempFsInnPackets.
remove(callsign);
1164 this->onCustomFSInnPacketReceived(callsign, packet.airlineIcaoDesignator, packet.aircraftIcaoDesignator,
1165 packet.combinedCode, packet.modelString);
1179 CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao,
1180 livery, modelString, modelType, log);
1202 if (situations.
size() < 3) {
return false; }
1207 return extrapolateElevation(situations.
front(), old, older, change);
1210 bool CAirspaceMonitor::extrapolateElevation(
CAircraftSituation &situationToBeUpdated,
1224 if (oldSituation.
isNull() || olderSituation.
isNull()) {
return false; }
1226 if (oldChange.
isNull()) {
return false; }
1231 const double deltaAltFt = qAbs(situationToBeUpdated.
getAltitude().
value(CLengthUnit::ft()) -
1233 if (deltaAltFt <= CAircraftSituation::allowedAltitudeDeviation().value(CLengthUnit::ft()))
1237 CAircraftSituation::Extrapolated);
1249 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1252 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Empty callsign");
1254 if (this->isCopilotAircraft(callsign)) {
return; }
1257 const bool validMaxRange = this->handleMaxRange(situation);
1259 if (!validMaxRange && !existsInRange) {
return; }
1265 this->storeAircraftSituation(situation);
1268 if (!existsInRange && validMaxRange)
1271 const bool hasFsInnPacket = m_tempFsInnPackets.
contains(callsign);
1277 this->addNewAircraftInRange(aircraft);
1278 this->sendInitialPilotQueries(callsign,
true, !hasFsInnPacket);
1281 const CClient client(callsign);
1284 else if (existsInRange)
1288 vm.
addValue(CSimulatedAircraft::IndexTransponder, transponder);
1289 vm.
addValue(CSimulatedAircraft::IndexSituation, situation);
1290 vm.
addValue(CSimulatedAircraft::IndexRelativeDistance, this->calculateDistanceToOwnAircraft(situation));
1291 vm.
addValue(CSimulatedAircraft::IndexRelativeBearing, this->calculateBearingToOwnAircraft(situation));
1296 void CAirspaceMonitor::onAircraftInterimUpdateReceived(
const CAircraftSituation &situation)
1299 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1304 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Empty callsign");
1306 if (isCopilotAircraft(callsign)) {
return; }
1309 if (CBuildConfig::isLocalDeveloperDebugBuild())
1320 if (history.
isEmpty()) {
return; }
1324 interimSituation.setCurrentUtcTime();
1328 this->storeAircraftSituation(interimSituation);
1331 if (samePosition) {
return; }
1335 this->calculateDistanceToOwnAircraft(interimSituation),
1336 this->calculateBearingToOwnAircraft(interimSituation));
1343 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1348 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Empty callsign");
1350 if (isCopilotAircraft(callsign)) {
return; }
1353 if (CBuildConfig::isLocalDeveloperDebugBuild())
1365 if (history.
empty()) {
return; }
1369 visualSituation.setCurrentUtcTime();
1373 this->storeAircraftSituation(visualSituation);
1376 if (samePosition) {
return; }
1380 this->calculateDistanceToOwnAircraft(visualSituation),
1381 this->calculateBearingToOwnAircraft(visualSituation));
1384 void CAirspaceMonitor::onAircraftSimDataUpdateReceived(
const CAircraftSituation &situation,
1388 onAircraftUpdateReceived(situation,
CTransponder(2000, CTransponder::ModeC));
1394 onIcaoCodesReceived(situation.
getCallsign(), aircraftIcao, airlineIcao, airlineIcao);
1405 if (newStatus == CConnectionStatus::Connecting && m_fsdClient)
1409 const CLength maxRange(isVatsim ? 125 : -1, CLengthUnit::NM());
1416 void CAirspaceMonitor::onPilotDisconnected(
const CCallsign &callsign)
1421 this->removeFromAircraftCachesAndLogs(callsign);
1427 void CAirspaceMonitor::onFrequencyReceived(
const CCallsign &callsign,
const CFrequency &frequency)
1437 void CAirspaceMonitor::onAircraftConfigReceived(
const CCallsign &callsign,
const QJsonObject &jsonObject,
1438 qint64 currentOffsetMs)
1442 if (callsign.
isEmpty()) {
return; }
1450 if (client.
hasCapability(CClient::FsdWithAircraftConfig)) {
return; }
1456 bool allowTestOffset)
1460 if (callsign.
isEmpty()) {
return situation; }
1464 bool needToRequestElevation =
false;
1465 bool canLikelySkipNearGround = correctedSituation.canLikelySkipNearGroundInterpolation();
1473 if (canLikelySkipNearGround || correctedSituation.hasGroundElevation()) {
break; }
1476 correctedSituation.resetGroundElevation();
1492 CSpeed rotateSpeed(
nullptr);
1494 if (!rotateSpeed.isNull())
1496 rotateSpeed *= 1.25;
1505 if (!changesBeforeStoring.
isNull())
1508 if (canLikelySkipNearGround) {
break; }
1513 using namespace std::chrono_literals;
1514 const CLength dpt = correctedSituation.getDistancePerTime(100ms, CElevationPlane::singlePointRadius());
1526 const CLength distance(correctedSituation.getDistancePerTime250ms(
1527 CElevationPlane::singlePointRadius()));
1529 needToRequestElevation = ep.
isNull();
1530 Q_ASSERT_X(needToRequestElevation || !ep.
getRadius().
isNull(), Q_FUNC_INFO,
"null radius");
1533 correctedSituation.setGroundElevation(ep, CAircraftSituation::FromCache);
1544 if (!correctedSituation.hasGroundElevation())
1549 bool fromNonMoving =
false;
1550 bool triedExtrapolation =
false;
1551 bool couldNotExtrapolate =
false;
1556 if (averagePlane.
isNull())
1559 situation, CElevationPlane::minorAirportRadius(), 2, 3);
1560 fromNonMoving =
true;
1564 if (!averagePlane.
isNull())
1566 correctedSituation.setGroundElevation(averagePlane, CAircraftSituation::Average);
1567 if (fromNonMoving) { m_foundInNonMovingAircraft++; }
1568 else { m_foundInElevationsOnGnd++; }
1574 if (situationsBeforeStoring.
size() > 1)
1576 const bool extrapolated =
1577 extrapolateElevation(correctedSituation, situationsBeforeStoring[0],
1578 situationsBeforeStoring[1], changesBeforeStoring);
1579 triedExtrapolation =
true;
1580 couldNotExtrapolate = !extrapolated;
1587 if (!correctedSituation.hasGroundElevation())
1589 if (CBuildConfig::isLocalDeveloperDebugBuild())
1592 SWIFT_VERIFY_X(needToRequestElevation, Q_FUNC_INFO,
"Request should already be set");
1594 needToRequestElevation =
true;
1596 Q_UNUSED(triedExtrapolation)
1597 Q_UNUSED(couldNotExtrapolate)
1602 if (CBuildConfig::isLocalDeveloperDebugBuild())
1604 SWIFT_VERIFY_X(!correctedSituation.getGroundElevation().isZeroEpsilonConsidered(), Q_FUNC_INFO,
1605 "Suspicious elevation");
1619 correctedSituation.setOnGroundDetails(COnGroundInfo::InFromNetwork);
1621 else if (client.
hasCapability(CClient::FsdWithAircraftConfig))
1624 if (!parts.
isEmpty()) { correctedSituation.adjustGroundFlag(parts,
true); }
1633 if (!cg.
isNull()) { correctedSituation.setCG(cg); }
1640 if (needToRequestElevation && !canLikelySkipNearGround)
1644 if (correctedSituation.isOtherElevationInfoBetter(CAircraftSituation::FromCache,
false) ||
1645 (correctedSituation.isMoving() &&
1646 correctedSituation.isOtherElevationInfoBetter(CAircraftSituation::FromProvider,
false)))
1652 Q_UNUSED(needToRequestElevation)
1653 return correctedSituation;
1656 void CAirspaceMonitor::sendInitialAtcQueries(
const CCallsign &callsign)
1658 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1661 m_fsdClient->sendClientQueryCapabilities(callsign);
1665 void CAirspaceMonitor::queryAllOnlineAtcStations()
1667 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1672 if (cs.
isEmpty()) {
continue; }
1677 bool CAirspaceMonitor::sendNextStaggeredAtisQuery()
1679 if (m_queryAtis.isEmpty()) {
return false; }
1680 if (!this->isConnectedAndNotShuttingDown()) {
return false; }
1687 void CAirspaceMonitor::sendInitialPilotQueries(
const CCallsign &callsign,
bool withIcaoQuery,
bool withFsInn)
1689 if (!this->isConnectedAndNotShuttingDown()) {
return; }
1696 m_fsdClient->sendClientQueryCapabilities(callsign);
1700 bool CAirspaceMonitor::sendNextStaggeredPilotDataQuery()
1702 if (m_queryPilot.isEmpty()) {
return false; }
1703 if (!this->isConnectedAndNotShuttingDown()) {
return false; }
1715 bool CAirspaceMonitor::isConnected()
const
1720 bool CAirspaceMonitor::isConnectedAndNotShuttingDown()
const
1723 return this->isConnected();
1726 const CServer &CAirspaceMonitor::getConnectedServer()
const
1729 if (!this->isConnected()) {
return empty; }
1733 const CEcosystem &CAirspaceMonitor::getCurrentEcosystem()
const
1738 bool CAirspaceMonitor::supportsVatsimDataFile()
const
1740 const bool dataFile =
1759 bool CAirspaceMonitor::isCopilotAircraft(
const CCallsign &callsign)
const
1770 CAirspaceMonitor::FsInnPacket::FsInnPacket(
const QString &aircraftIcaoDesignator,
1771 const QString &airlineIcaoDesignator,
const QString &combinedCode,
1773 : aircraftIcaoDesignator(aircraftIcaoDesignator.trimmed().toUpper()),
1774 airlineIcaoDesignator(airlineIcaoDesignator.trimmed().toUpper()),
1775 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 fromValue(T &&value)
Construct a variant from a value.
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 FSD 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(Key &&key, 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.