refs #849, airspace monitor signals received raw data

This commit is contained in:
Klaus Basan
2017-01-05 02:32:07 +01:00
committed by Mathew Sutcliffe
parent 17b9d95a8a
commit 88f7a19d4c
2 changed files with 21 additions and 17 deletions

View File

@@ -278,7 +278,7 @@ namespace BlackCore
// with this little trick we try to make an asynchronous signal / slot // with this little trick we try to make an asynchronous signal / slot
// based approach a synchronous return value // based approach a synchronous return value
QTime waitForFlightPlan = QTime::currentTime().addMSecs(1000); const QTime waitForFlightPlan = QTime::currentTime().addMSecs(1000);
while (QTime::currentTime() < waitForFlightPlan) while (QTime::currentTime() < waitForFlightPlan)
{ {
// process some other events and hope network answer is received already // process some other events and hope network answer is received already
@@ -327,10 +327,10 @@ namespace BlackCore
for (const CSimulatedAircraft &aircraft : this->getAircraftInRange()) for (const CSimulatedAircraft &aircraft : this->getAircraftInRange())
{ {
if (searchList.isEmpty()) break; if (searchList.isEmpty()) break;
CCallsign callsign = aircraft.getCallsign(); const CCallsign callsign = aircraft.getCallsign();
if (searchList.contains(callsign)) if (searchList.contains(callsign))
{ {
CUser user = aircraft.getPilot(); const CUser user = aircraft.getPilot();
users.push_back(user); users.push_back(user);
searchList.remove(callsign); searchList.remove(callsign);
} }
@@ -339,10 +339,10 @@ namespace BlackCore
for (const CAtcStation &station : this->m_atcStationsOnline) for (const CAtcStation &station : this->m_atcStationsOnline)
{ {
if (searchList.isEmpty()) break; if (searchList.isEmpty()) break;
CCallsign callsign = station.getCallsign(); const CCallsign callsign = station.getCallsign();
if (searchList.contains(callsign)) if (searchList.contains(callsign))
{ {
CUser user = station.getController(); const CUser user = station.getController();
users.push_back(user); users.push_back(user);
searchList.remove(callsign); searchList.remove(callsign);
} }
@@ -350,7 +350,7 @@ namespace BlackCore
// we might have unresolved callsigns // we might have unresolved callsigns
// those are the ones not in range // those are the ones not in range
for (const CCallsign &callsign : searchList) for (const CCallsign &callsign : as_const(searchList))
{ {
const CUserList usersByCallsign = sApp->getWebDataServices()->getUsersForCallsign(callsign); const CUserList usersByCallsign = sApp->getWebDataServices()->getUsersForCallsign(callsign);
if (usersByCallsign.isEmpty()) if (usersByCallsign.isEmpty())
@@ -858,6 +858,8 @@ namespace BlackCore
this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery, client.getQueriedModelString(), CAircraftModel::TypeQueriedFromNetwork, pReverseLookupMessages); this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery, client.getQueriedModelString(), CAircraftModel::TypeQueriedFromNetwork, pReverseLookupMessages);
this->addReverseLookupMessages(callsign, reverseLookupMessages); this->addReverseLookupMessages(callsign, reverseLookupMessages);
this->ps_sendReadyForModelMatching(callsign); this->ps_sendReadyForModelMatching(callsign);
emit this->requestedNewAircraft(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery);
} }
void CAirspaceMonitor::addReverseLookupMessages(const CCallsign &callsign, const CStatusMessageList &messages) void CAirspaceMonitor::addReverseLookupMessages(const CCallsign &callsign, const CStatusMessageList &messages)
@@ -1006,7 +1008,7 @@ namespace BlackCore
CSimulatedAircraft CAirspaceMonitor::initNewAircraft(const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery, const QString &modelString, CAircraftModel::ModelType type, CStatusMessageList *log) CSimulatedAircraft CAirspaceMonitor::initNewAircraft(const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery, const QString &modelString, CAircraftModel::ModelType type, CStatusMessageList *log)
{ {
CAircraftModel model = CAircraftMatcher::reverselLookupModel(callsign, aircraftIcao, airlineIcao, livery, modelString, type, log); const CAircraftModel model = CAircraftMatcher::reverselLookupModel(callsign, aircraftIcao, airlineIcao, livery, modelString, type, log);
const CSimulatedAircraft aircraft(model); const CSimulatedAircraft aircraft(model);
return aircraft; return aircraft;
} }
@@ -1097,6 +1099,8 @@ namespace BlackCore
Q_UNUSED(oldStatus); Q_UNUSED(oldStatus);
switch (newStatus) switch (newStatus)
{ {
case INetwork::Connected:
break;
case INetwork::Disconnected: case INetwork::Disconnected:
case INetwork::DisconnectedError: case INetwork::DisconnectedError:
case INetwork::DisconnectedLost: case INetwork::DisconnectedLost:

View File

@@ -182,9 +182,6 @@ namespace BlackCore
//! Gracefully shut down, e.g. for thread safety //! Gracefully shut down, e.g. for thread safety
void gracefulShutdown(); void gracefulShutdown();
static const qint64 AircraftSituationsRemovedOffsetMs = 30 * 1000; //!< situations older than now - offset will be removed
static const qint64 AircraftPartsRemoveOffsetMs = 30 * 1000; //!< parts older than now - offset will be removed
signals: signals:
//! Online ATC stations were changed //! Online ATC stations were changed
void changedAtcStationsOnline(); void changedAtcStationsOnline();
@@ -198,6 +195,9 @@ namespace BlackCore
//! Aircraft were changed //! Aircraft were changed
void changedAircraftInRange(); void changedAircraftInRange();
//! Raw data as received from network
void requestedNewAircraft(const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftDesignator, const QString &airlineDesignator, const QString &livery);
//! A new aircraft appeared //! A new aircraft appeared
void addedAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft); void addedAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft);