mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #849, airspace monitor signals received raw data
This commit is contained in:
committed by
Mathew Sutcliffe
parent
17b9d95a8a
commit
88f7a19d4c
@@ -278,7 +278,7 @@ namespace BlackCore
|
||||
|
||||
// with this little trick we try to make an asynchronous signal / slot
|
||||
// based approach a synchronous return value
|
||||
QTime waitForFlightPlan = QTime::currentTime().addMSecs(1000);
|
||||
const QTime waitForFlightPlan = QTime::currentTime().addMSecs(1000);
|
||||
while (QTime::currentTime() < waitForFlightPlan)
|
||||
{
|
||||
// process some other events and hope network answer is received already
|
||||
@@ -327,10 +327,10 @@ namespace BlackCore
|
||||
for (const CSimulatedAircraft &aircraft : this->getAircraftInRange())
|
||||
{
|
||||
if (searchList.isEmpty()) break;
|
||||
CCallsign callsign = aircraft.getCallsign();
|
||||
const CCallsign callsign = aircraft.getCallsign();
|
||||
if (searchList.contains(callsign))
|
||||
{
|
||||
CUser user = aircraft.getPilot();
|
||||
const CUser user = aircraft.getPilot();
|
||||
users.push_back(user);
|
||||
searchList.remove(callsign);
|
||||
}
|
||||
@@ -339,10 +339,10 @@ namespace BlackCore
|
||||
for (const CAtcStation &station : this->m_atcStationsOnline)
|
||||
{
|
||||
if (searchList.isEmpty()) break;
|
||||
CCallsign callsign = station.getCallsign();
|
||||
const CCallsign callsign = station.getCallsign();
|
||||
if (searchList.contains(callsign))
|
||||
{
|
||||
CUser user = station.getController();
|
||||
const CUser user = station.getController();
|
||||
users.push_back(user);
|
||||
searchList.remove(callsign);
|
||||
}
|
||||
@@ -350,7 +350,7 @@ namespace BlackCore
|
||||
|
||||
// we might have unresolved callsigns
|
||||
// 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);
|
||||
if (usersByCallsign.isEmpty())
|
||||
@@ -858,6 +858,8 @@ namespace BlackCore
|
||||
this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery, client.getQueriedModelString(), CAircraftModel::TypeQueriedFromNetwork, pReverseLookupMessages);
|
||||
this->addReverseLookupMessages(callsign, reverseLookupMessages);
|
||||
this->ps_sendReadyForModelMatching(callsign);
|
||||
|
||||
emit this->requestedNewAircraft(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
return aircraft;
|
||||
}
|
||||
@@ -1097,6 +1099,8 @@ namespace BlackCore
|
||||
Q_UNUSED(oldStatus);
|
||||
switch (newStatus)
|
||||
{
|
||||
case INetwork::Connected:
|
||||
break;
|
||||
case INetwork::Disconnected:
|
||||
case INetwork::DisconnectedError:
|
||||
case INetwork::DisconnectedLost:
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace BlackCore
|
||||
//! Central instance of data for \sa IRemoteAircraftProvider.
|
||||
class BLACKCORE_EXPORT CAirspaceMonitor :
|
||||
public QObject,
|
||||
public BlackMisc::Simulation::IRemoteAircraftProvider, // those data will be provided from the class CAirspaceMonitor
|
||||
public BlackMisc::Simulation::IRemoteAircraftProvider, // those data will be provided from the class CAirspaceMonitor
|
||||
public BlackMisc::Simulation::COwnAircraftAware, // used to obtain in memory information about own aircraft
|
||||
public BlackMisc::CIdentifiable
|
||||
{
|
||||
@@ -182,9 +182,6 @@ namespace BlackCore
|
||||
//! Gracefully shut down, e.g. for thread safety
|
||||
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:
|
||||
//! Online ATC stations were changed
|
||||
void changedAtcStationsOnline();
|
||||
@@ -198,6 +195,9 @@ namespace BlackCore
|
||||
//! Aircraft were changed
|
||||
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
|
||||
void addedAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft);
|
||||
|
||||
@@ -254,12 +254,12 @@ namespace BlackCore
|
||||
bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal
|
||||
|
||||
// locks
|
||||
mutable QReadWriteLock m_lockSituations; //!< lock for situations: m_situationsByCallsign
|
||||
mutable QReadWriteLock m_lockParts; //!< lock for parts: m_partsByCallsign, m_aircraftSupportingParts
|
||||
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft: m_aircraftInRange
|
||||
mutable QReadWriteLock m_lockClient; //!< lock clients: m_otherClients
|
||||
mutable QReadWriteLock m_lockMessages; //!< lock for messages
|
||||
mutable QReadWriteLock m_lockPartsHistory; //!< lock for aircraft parts
|
||||
mutable QReadWriteLock m_lockSituations; //!< lock for situations: m_situationsByCallsign
|
||||
mutable QReadWriteLock m_lockParts; //!< lock for parts: m_partsByCallsign, m_aircraftSupportingParts
|
||||
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft: m_aircraftInRange
|
||||
mutable QReadWriteLock m_lockClient; //!< lock clients: m_otherClients
|
||||
mutable QReadWriteLock m_lockMessages; //!< lock for messages
|
||||
mutable QReadWriteLock m_lockPartsHistory; //!< lock for aircraft parts
|
||||
|
||||
//! Remove ATC online stations
|
||||
void removeAllOnlineAtcStations();
|
||||
|
||||
Reference in New Issue
Block a user