mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Ref T385, OBS aircraft callsign
* in CAirspaceMonitor::onIcaoCodesReceived we know we deal with aircraft only and explicitly deal with it * in other cases we can not tell if we deal with aircraft/ATC callsign for sure, we ignore invalid callsigns
This commit is contained in:
@@ -663,10 +663,8 @@ namespace BlackCore
|
||||
// ES sends FsInn packets for callsigns such as ACCGER1, which are hard to distinguish
|
||||
// 1) checking if they are already in the list checks again ATC position which is safe
|
||||
// 2) the ATC alike callsign check is guessing
|
||||
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "not in main thread");
|
||||
BLACK_VERIFY_X(callsign.isValid(), Q_FUNC_INFO, "invalid callsign");
|
||||
if (!callsign.isValid()) { return; }
|
||||
if (!callsign.isValid()) { return; } // aircraft OBS, other invalid callsigns
|
||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||
|
||||
const bool isAircraft = this->isAircraftInRange(callsign);
|
||||
@@ -685,9 +683,16 @@ namespace BlackCore
|
||||
|
||||
if (isAircraft)
|
||||
{
|
||||
if (callsign.isCopilotCallsign())
|
||||
{
|
||||
this->copilotDetected();
|
||||
return;
|
||||
}
|
||||
|
||||
CStatusMessageList reverseLookupMessages;
|
||||
CStatusMessageList *pReverseLookupMessages = this->isReverseLookupMessagesEnabled() ? &reverseLookupMessages : nullptr;
|
||||
CMatchingUtils::addLogDetailsToList(pReverseLookupMessages, callsign, QString("FsInn data from network: aircraft '%1', airline '%2', model '%3', combined '%4'").
|
||||
CMatchingUtils::addLogDetailsToList(pReverseLookupMessages, callsign,
|
||||
QStringLiteral("FsInn data from network: aircraft '%1', airline '%2', model '%3', combined '%4'").
|
||||
arg(aircraftIcaoDesignator, airlineIcaoDesignator, modelString, combinedAircraftType));
|
||||
|
||||
this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, "", modelString, CAircraftModel::TypeFSInnData, pReverseLookupMessages);
|
||||
@@ -696,13 +701,19 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::onIcaoCodesReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftIcaoDesignator, const QString &airlineIcaoDesignator, const QString &livery)
|
||||
void CAirspaceMonitor::onIcaoCodesReceived(const CCallsign &callsign, const QString &aircraftIcaoDesignator, const QString &airlineIcaoDesignator, const QString &livery)
|
||||
{
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "not in main thread");
|
||||
if (callsign.isCopilotCallsign())
|
||||
{
|
||||
// We already know that plane by its normall callsign
|
||||
this->copilotDetected();
|
||||
return;
|
||||
}
|
||||
|
||||
BLACK_VERIFY_X(callsign.isValid(), Q_FUNC_INFO, "invalid callsign");
|
||||
if (!callsign.isValid()) { return; }
|
||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||
|
||||
CStatusMessageList reverseLookupMessages;
|
||||
CStatusMessageList *pReverseLookupMessages = this->isReverseLookupMessagesEnabled() ? &reverseLookupMessages : nullptr;
|
||||
CMatchingUtils::addLogDetailsToList(pReverseLookupMessages, callsign, QString("Data from network: aircraft '%1', airline '%2', livery '%3'").
|
||||
@@ -832,6 +843,11 @@ namespace BlackCore
|
||||
return c;
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::copilotDetected()
|
||||
{
|
||||
// for future usage
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::recallFsInnPacket(const CCallsign &callsign)
|
||||
{
|
||||
if (!m_tempFsInnPackets.contains(callsign)) { return; }
|
||||
|
||||
@@ -251,6 +251,9 @@ namespace BlackCore
|
||||
//! Update booked station by callsign
|
||||
int updateBookedStation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::CPropertyIndexVariantMap &vm, bool skipEqualValues = true, bool sendSignal = true);
|
||||
|
||||
//! Co-pilot detected
|
||||
void copilotDetected();
|
||||
|
||||
//! Call CAirspaceMonitor::onCustomFSInnPacketReceived with stored packet
|
||||
void recallFsInnPacket(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@ namespace BlackMisc
|
||||
return m_callsign.endsWith("SUP");
|
||||
}
|
||||
|
||||
bool CCallsign::isCopilotCallsign() const
|
||||
{
|
||||
return (this->getTypeHint() == Aircraft) && this->isObserverCallsign();
|
||||
}
|
||||
|
||||
QString CCallsign::getIcaoCode() const
|
||||
{
|
||||
if (this->isAtcCallsign())
|
||||
@@ -96,7 +101,7 @@ namespace BlackMisc
|
||||
return m_callsign.left(4).toUpper();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return QStringLiteral("");
|
||||
}
|
||||
|
||||
bool CCallsign::isAtcAlikeCallsign() const
|
||||
@@ -108,7 +113,6 @@ namespace BlackMisc
|
||||
|
||||
bool CCallsign::isObserverCallsign() const
|
||||
{
|
||||
if (this->getTypeHint() == Aircraft) { return false; }
|
||||
return m_callsignAsSet.endsWith("_OBS", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,9 @@ namespace BlackMisc
|
||||
//! Supervisor?
|
||||
bool isSupervisorCallsign() const;
|
||||
|
||||
//! Pilot OBS callsign, normally a co-pilot
|
||||
bool isCopilotCallsign() const;
|
||||
|
||||
//! Get callsign (normalized)
|
||||
const QString &asString() const { return m_callsign; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user