mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
Ref T632, minor improvements for no callsign
This commit is contained in:
@@ -239,7 +239,7 @@ namespace BlackCore
|
|||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
if (this->isSimulatorAvailable()) { return; }
|
if (this->isSimulatorAvailable()) { return; }
|
||||||
m_modelSetSimulator.set(simulator);
|
m_modelSetSimulator.set(simulator);
|
||||||
const CAircraftModelList models = this->getModelSet();
|
const CAircraftModelList models = this->getModelSet(); // cache synced
|
||||||
m_aircraftMatcher.setModelSet(models, simulator, false);
|
m_aircraftMatcher.setModelSet(models, simulator, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +451,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(simInfo.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
Q_ASSERT_X(simInfo.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
||||||
|
|
||||||
m_modelSetSimulator.set(simInfo);
|
m_modelSetSimulator.set(simInfo);
|
||||||
const CAircraftModelList modelSetModels = this->getModelSet();
|
const CAircraftModelList modelSetModels = this->getModelSet(); // synced
|
||||||
m_aircraftMatcher.setModelSet(modelSetModels, simInfo, true);
|
m_aircraftMatcher.setModelSet(modelSetModels, simInfo, true);
|
||||||
m_aircraftMatcher.setDefaultModel(simulator->getDefaultModel());
|
m_aircraftMatcher.setDefaultModel(simulator->getDefaultModel());
|
||||||
|
|
||||||
@@ -1152,7 +1152,7 @@ namespace BlackCore
|
|||||||
// no models in matcher, but in cache, we can set them as default
|
// no models in matcher, but in cache, we can set them as default
|
||||||
const CSimulatorInfo simulator(m_modelSetSimulator.get());
|
const CSimulatorInfo simulator(m_modelSetSimulator.get());
|
||||||
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
|
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
|
||||||
const CAircraftModelList models(this->getModelSet());
|
const CAircraftModelList models(this->getModelSet()); //synced
|
||||||
CLogMessage(this).info(u"Init aircraft matcher with %1 models from set for '%2'") << models.size() << simulator.toQString();
|
CLogMessage(this).info(u"Init aircraft matcher with %1 models from set for '%2'") << models.size() << simulator.toQString();
|
||||||
m_aircraftMatcher.setModelSet(models, simulator, false);
|
m_aircraftMatcher.setModelSet(models, simulator, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,12 +327,12 @@ namespace BlackSimPlugin
|
|||||||
if (isConnected()) { return true; }
|
if (isConnected()) { return true; }
|
||||||
QString dbusAddress = m_xswiftbusServerSetting.getThreadLocal();
|
QString dbusAddress = m_xswiftbusServerSetting.getThreadLocal();
|
||||||
|
|
||||||
if (BlackMisc::CDBusServer::isSessionOrSystemAddress(dbusAddress))
|
if (CDBusServer::isSessionOrSystemAddress(dbusAddress))
|
||||||
{
|
{
|
||||||
m_dBusConnection = connectionFromString(dbusAddress);
|
m_dBusConnection = connectionFromString(dbusAddress);
|
||||||
m_dbusMode = Session;
|
m_dbusMode = Session;
|
||||||
}
|
}
|
||||||
else if (BlackMisc::CDBusServer::isQtDBusAddress(dbusAddress))
|
else if (CDBusServer::isQtDBusAddress(dbusAddress))
|
||||||
{
|
{
|
||||||
m_dBusConnection = QDBusConnection::connectToPeer(dbusAddress, "xswiftbus");
|
m_dBusConnection = QDBusConnection::connectToPeer(dbusAddress, "xswiftbus");
|
||||||
if (! m_dBusConnection.isConnected()) { return false; }
|
if (! m_dBusConnection.isConnected()) { return false; }
|
||||||
@@ -600,7 +600,15 @@ namespace BlackSimPlugin
|
|||||||
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();
|
||||||
const CAircraftModel aircraftModel = newRemoteAircraft.getModel();
|
CAircraftModel aircraftModel = newRemoteAircraft.getModel();
|
||||||
|
if (aircraftModel.getCallsign() != newRemoteAircraft.getCallsign())
|
||||||
|
{
|
||||||
|
CLogMessage(this).warning(u"Model for '%1' has no callsign, maybe using a default model") << callsign;
|
||||||
|
aircraftModel.setCallsign(callsign); // fix callsign to avoid follow up issues
|
||||||
|
|
||||||
|
// we could disable the aircraft?
|
||||||
|
}
|
||||||
|
|
||||||
const QString livery = aircraftModel.getLivery().getCombinedCode(); //! \todo livery resolution for XP
|
const QString livery = aircraftModel.getLivery().getCombinedCode(); //! \todo livery resolution for XP
|
||||||
m_trafficProxy->addPlane(callsign, aircraftModel.getModelString(),
|
m_trafficProxy->addPlane(callsign, aircraftModel.getModelString(),
|
||||||
newRemoteAircraft.getAircraftIcaoCode().getDesignator(),
|
newRemoteAircraft.getAircraftIcaoCode().getDesignator(),
|
||||||
@@ -799,7 +807,13 @@ namespace BlackSimPlugin
|
|||||||
for (const CXPlaneMPAircraft &xplaneAircraft : m_xplaneAircraftObjects)
|
for (const CXPlaneMPAircraft &xplaneAircraft : m_xplaneAircraftObjects)
|
||||||
{
|
{
|
||||||
const CCallsign callsign(xplaneAircraft.getCallsign());
|
const CCallsign callsign(xplaneAircraft.getCallsign());
|
||||||
BLACK_VERIFY_X(!callsign.isEmpty(), Q_FUNC_INFO, "missing callsign");
|
const bool hasCallsign = !callsign.isEmpty();
|
||||||
|
if (!hasCallsign)
|
||||||
|
{
|
||||||
|
// does not make sense to continue here
|
||||||
|
BLACK_VERIFY_X(false, Q_FUNC_INFO, "missing callsign");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
planesTransponders.callsigns.push_back(callsign.asString());
|
planesTransponders.callsigns.push_back(callsign.asString());
|
||||||
planesTransponders.codes.push_back(xplaneAircraft.getAircraft().getTransponderCode());
|
planesTransponders.codes.push_back(xplaneAircraft.getAircraft().getTransponderCode());
|
||||||
@@ -901,10 +915,12 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorXPlane::requestRemoteAircraftDataFromXPlane(const CCallsignSet &callsigns)
|
void CSimulatorXPlane::requestRemoteAircraftDataFromXPlane(const CCallsignSet &callsigns)
|
||||||
{
|
{
|
||||||
if (callsigns.isEmpty()) { return; }
|
if (callsigns.isEmpty()) { return; }
|
||||||
if (this->isShuttingDown()) { return; }
|
if (!m_trafficProxy || this->isShuttingDown()) { return; }
|
||||||
const QStringList csStrings = callsigns.getCallsignStrings();
|
const QStringList csStrings = callsigns.getCallsignStrings();
|
||||||
|
QPointer<CSimulatorXPlane> myself(this);
|
||||||
m_trafficProxy->getRemoteAircraftData(csStrings, [ = ](const QStringList & callsigns, const QDoubleList & latitudesDeg, const QDoubleList & longitudesDeg, const QDoubleList & elevationsMeters, const QDoubleList & verticalOffsetsMeters)
|
m_trafficProxy->getRemoteAircraftData(csStrings, [ = ](const QStringList & callsigns, const QDoubleList & latitudesDeg, const QDoubleList & longitudesDeg, const QDoubleList & elevationsMeters, const QDoubleList & verticalOffsetsMeters)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
this->updateRemoteAircraftFromSimulator(callsigns, latitudesDeg, longitudesDeg, elevationsMeters, verticalOffsetsMeters);
|
this->updateRemoteAircraftFromSimulator(callsigns, latitudesDeg, longitudesDeg, elevationsMeters, verticalOffsetsMeters);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user