mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-01 06:35:41 +08:00
Improved logging of "adding aircraft" so we can see details such as the model string
This commit is contained in:
committed by
Mat Sutcliffe
parent
d947baf344
commit
26afc5160d
@@ -174,7 +174,7 @@ namespace BlackCore
|
|||||||
if (!enabled) { m_aircraftCallsignTimestamps[callsign] = timeoutAircraftEpochMs + 1000; } // fake value so it can be re-enabled
|
if (!enabled) { m_aircraftCallsignTimestamps[callsign] = timeoutAircraftEpochMs + 1000; } // fake value so it can be re-enabled
|
||||||
const qint64 tsv = m_aircraftCallsignTimestamps.value(callsign);
|
const qint64 tsv = m_aircraftCallsignTimestamps.value(callsign);
|
||||||
if (tsv > timeoutAircraftEpochMs) { continue; }
|
if (tsv > timeoutAircraftEpochMs) { continue; }
|
||||||
CLogMessage(this).debug() << "Aircraft " << callsign.toQString() << "timed out! " << (currentTimeMsEpoch - tsv) << "ms";
|
CLogMessage(this).debug() << QStringLiteral("Aircraft '%1' timed out after %2ms").arg(callsign.toQString()).arg(currentTimeMsEpoch - tsv);
|
||||||
m_aircraftCallsignTimestamps.remove(callsign);
|
m_aircraftCallsignTimestamps.remove(callsign);
|
||||||
emit this->timeoutAircraft(callsign);
|
emit this->timeoutAircraft(callsign);
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ namespace BlackCore
|
|||||||
if (!enabled) { m_aircraftCallsignTimestamps[callsign] = timeoutAtcEpochMs + 1000; } // fake value so it can be re-enabled
|
if (!enabled) { m_aircraftCallsignTimestamps[callsign] = timeoutAtcEpochMs + 1000; } // fake value so it can be re-enabled
|
||||||
const qint64 tsv = m_aircraftCallsignTimestamps.value(callsign);
|
const qint64 tsv = m_aircraftCallsignTimestamps.value(callsign);
|
||||||
if (m_atcCallsignTimestamps.value(callsign) > timeoutAtcEpochMs) { continue; }
|
if (m_atcCallsignTimestamps.value(callsign) > timeoutAtcEpochMs) { continue; }
|
||||||
CLogMessage(this).debug() << "ATC " << callsign.toQString() << "timed out! " << (currentTimeMsEpoch - tsv) << "ms";
|
CLogMessage(this).debug() << QStringLiteral("ATC '%1' timed out after %2ms").arg(callsign.toQString()).arg(currentTimeMsEpoch - tsv);
|
||||||
m_atcCallsignTimestamps.remove(callsign);
|
m_atcCallsignTimestamps.remove(callsign);
|
||||||
emit this->timeoutAtc(callsign);
|
emit this->timeoutAtc(callsign);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1186,6 +1186,11 @@ namespace BlackCore
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ISimulator::logAddingAircraftModel(const CSimulatedAircraft &aircraft) const
|
||||||
|
{
|
||||||
|
CLogMessage(this).info(u"Adding '%1' '%2' to '%3'") << aircraft.getCallsign() << aircraft.getModel().getModelStringAndDbKey() << this->getSimulatorInfo().toQString(true);
|
||||||
|
}
|
||||||
|
|
||||||
QString ISimulator::latestLoggedDataFormatted(const CCallsign &cs) const
|
QString ISimulator::latestLoggedDataFormatted(const CCallsign &cs) const
|
||||||
{
|
{
|
||||||
const SituationLog s = m_interpolationLogger.getLastSituationLog(cs);
|
const SituationLog s = m_interpolationLogger.getLastSituationLog(cs);
|
||||||
|
|||||||
@@ -548,6 +548,9 @@ namespace BlackCore
|
|||||||
//! Validate if model has callsign and such
|
//! Validate if model has callsign and such
|
||||||
bool validateModelOfAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) const;
|
bool validateModelOfAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) const;
|
||||||
|
|
||||||
|
//! Unified qeeing aircraft message
|
||||||
|
void logAddingAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) const;
|
||||||
|
|
||||||
//! Lookup against DB data
|
//! Lookup against DB data
|
||||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
|
|
||||||
|
|||||||
@@ -313,6 +313,8 @@ namespace BlackSimPlugin
|
|||||||
aircraft.setRendered(true);
|
aircraft.setRendered(true);
|
||||||
const CCallsign cs = aircraft.getCallsign();
|
const CCallsign cs = aircraft.getCallsign();
|
||||||
m_interpolators.insert(cs, CInterpolatorMultiWrapper(cs, this, this, this->getRemoteAircraftProvider(), &m_interpolationLogger));
|
m_interpolators.insert(cs, CInterpolatorMultiWrapper(cs, this, this, this->getRemoteAircraftProvider(), &m_interpolationLogger));
|
||||||
|
|
||||||
|
this->logAddingAircraftModel(aircraft);
|
||||||
m_renderedAircraft.push_back(aircraft); // my simulator list
|
m_renderedAircraft.push_back(aircraft); // my simulator list
|
||||||
this->updateAircraftRendered(cs, true); // in provider
|
this->updateAircraftRendered(cs, true); // in provider
|
||||||
emit this->aircraftRenderingChanged(aircraft);
|
emit this->aircraftRenderingChanged(aircraft);
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->canAddAircraft())
|
if (this->canAddAircraft())
|
||||||
{
|
{
|
||||||
// no aircraft pending, add
|
// no aircraft pending, add
|
||||||
CLogMessage(this).info(u"Adding '%1' to Flightgear") << newRemoteAircraft.getCallsign();
|
this->logAddingAircraftModel(newRemoteAircraft);
|
||||||
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
||||||
m_addingInProgressAircraft.insert(newRemoteAircraft.getCallsign(), now);
|
m_addingInProgressAircraft.insert(newRemoteAircraft.getCallsign(), now);
|
||||||
const QString callsign = newRemoteAircraft.getCallsign().asString();
|
const QString callsign = newRemoteAircraft.getCallsign().asString();
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ namespace BlackSimPlugin
|
|||||||
bool CSimulatorFs9::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
bool CSimulatorFs9::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
||||||
{
|
{
|
||||||
const CCallsign callsign = newRemoteAircraft.getCallsign();
|
const CCallsign callsign = newRemoteAircraft.getCallsign();
|
||||||
|
this->logAddingAircraftModel(newRemoteAircraft);
|
||||||
|
|
||||||
if (m_hashFs9Clients.contains(callsign))
|
if (m_hashFs9Clients.contains(callsign))
|
||||||
{
|
{
|
||||||
// already exists, remove first
|
// already exists, remove first
|
||||||
@@ -188,7 +190,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
emit aircraftRenderingChanged(remoteAircraftCopy);
|
emit aircraftRenderingChanged(remoteAircraftCopy);
|
||||||
}
|
}
|
||||||
CLogMessage(this).info(u"FS9: Added aircraft %1") << callsign.toQString();
|
CLogMessage(this).info(u"FS9: Added aircraft '%1'") << callsign.toQString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsxCommon::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
bool CSimulatorFsxCommon::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
||||||
{
|
{
|
||||||
|
this->logAddingAircraftModel(newRemoteAircraft);
|
||||||
return this->physicallyAddRemoteAircraftImpl(newRemoteAircraft, ExternalCall);
|
return this->physicallyAddRemoteAircraftImpl(newRemoteAircraft, ExternalCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->canAddAircraft())
|
if (this->canAddAircraft())
|
||||||
{
|
{
|
||||||
// no aircraft pending, add
|
// no aircraft pending, add
|
||||||
CLogMessage(this).info(u"Adding '%1' to XPlane") << newRemoteAircraft.getCallsign();
|
this->logAddingAircraftModel(newRemoteAircraft);
|
||||||
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
||||||
m_addingInProgressAircraft.insert(newRemoteAircraft.getCallsign(), now);
|
m_addingInProgressAircraft.insert(newRemoteAircraft.getCallsign(), now);
|
||||||
const QString callsign = newRemoteAircraft.getCallsign().asString();
|
const QString callsign = newRemoteAircraft.getCallsign().asString();
|
||||||
|
|||||||
Reference in New Issue
Block a user