refs #702, access to reverse lookup log messages per callsign

* added functions in airspace / context
* allow to retrieve "aircraft in range" callsigns
This commit is contained in:
Klaus Basan
2016-07-05 13:11:31 +02:00
parent 9f7fbaeda9
commit 83eca195a8
13 changed files with 312 additions and 63 deletions

View File

@@ -75,10 +75,13 @@ namespace BlackCore
//! Constructor
CAirspaceMonitor(BlackMisc::Simulation::IOwnAircraftProvider *ownAircraft, INetwork *network, QObject *parent);
//! \name IRemoteAircraftProvider overrides
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
//! \ingroup remoteaircraftprovider
//! @{
virtual BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const override;
virtual BlackMisc::Aviation::CCallsignSet getAircraftInRangeCallsigns() const override;
virtual BlackMisc::Simulation::CSimulatedAircraft getAircraftInRangeForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
virtual BlackMisc::Simulation::CAircraftModel getAircraftInRangeModelForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
virtual int getAircraftInRangeCount() const override;
@@ -93,6 +96,9 @@ namespace BlackCore
virtual bool updateFastPositionEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enableFastPositonUpdates, const BlackMisc::CIdentifier &originator) override;
virtual bool updateAircraftRendered(const BlackMisc::Aviation::CCallsign &callsign, bool rendered, const BlackMisc::CIdentifier &originator) override;
virtual void updateMarkAllAsNotRendered(const BlackMisc::CIdentifier &originator) override;
virtual void enableReverseLookupMessages(bool enabled) override;
virtual bool isReverseLookupMessagesEnabled() const override;
virtual BlackMisc::CStatusMessageList getReverseLookupMessages(const BlackMisc::Aviation::CCallsign &callsign) const override;
//! @}
//! Returns the list of users we know about
@@ -130,9 +136,6 @@ namespace BlackCore
//! Returns the closest ATC station operating on the given frequency, if any
BlackMisc::Aviation::CAtcStation getAtcStationForComUnit(const BlackMisc::Aviation::CComSystem &comSystem);
//! Logging for matching process (see why a model is matched like it is)
void logMatchingProcess(bool log) { this->m_logMatchingProcess = log; }
//! Clear the contents
void clear();
@@ -205,6 +208,7 @@ namespace BlackCore
BlackMisc::Aviation::CAtcStationList m_atcStationsBooked; //!< booked ATC stations
BlackMisc::Network::CClientList m_otherClients; //!< client informatiom, thread safe access required
BlackMisc::Simulation::CSimulatedAircraftList m_aircraftInRange; //!< aircraft, thread safe access required
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::CStatusMessageList> m_reverseLookupMessages;
// hashs, because not sorted by key but keeping order
CSituationsPerCallsign m_situationsByCallsign; //!< situations, for performance reasons per callsign, thread safe access required
@@ -214,16 +218,17 @@ namespace BlackCore
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CFlightPlan> m_flightPlanCache; //!< flight plan information retrieved any cached
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Simulation::CAircraftModel> m_modelTemporaryCache; //!< any model information recevived from network temporarily stored until it is "completed". Will be removed when aircraft is moved to aircraft in range
INetwork *m_network = nullptr;
CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer
bool m_connected = false; //!< retrieve data
bool m_logMatchingProcess = false; //!< shall we log. information about the matching process
INetwork *m_network = nullptr; //!< corresponding network interface
CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer
bool m_connected = false; //!< retrieve data
bool m_enableReverseLookupMsgs = false; //!< shall we log. information about the matching process
// 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
//! Remove ATC online stations
void removeAllOnlineAtcStations();
@@ -234,8 +239,8 @@ namespace BlackCore
//! Remove all other clients
void removeAllOtherClients();
//! Remove data from caches
void removeFromAircraftCaches(const BlackMisc::Aviation::CCallsign &callsign);
//! Remove data from caches and logs
void removeFromAircraftCachesAndLogs(const BlackMisc::Aviation::CCallsign &callsign);
//! Schedule a "ready for model matching"
void fireDelayedReadyForModelMatching(const BlackMisc::Aviation::CCallsign &callsign, int trial = 1, int delayMs = 2500);
@@ -243,9 +248,6 @@ namespace BlackCore
//! FSD or icao query received. Here we also replace the model with a model from DB if possible (reverse lookup)
void icaoOrFsdDataReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftIcaoDesignator, const QString &airlineIcaoDesignator, const QString &livery, const QString &modelString, BlackMisc::Simulation::CAircraftModel::ModelType type);
//! Log.matching
void logMatching(const QString &text) const;
//! Store an aircraft situation
//! \threadsafe
void storeAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
@@ -254,6 +256,18 @@ namespace BlackCore
//! \threadsafe
void storeAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts);
//! Reverse lookup messages
//! \threadsafe
void addReverseLookupMessages(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::CStatusMessageList &messages);
//! Reverse lookup messages
//! \threadsafe
void addReverseLookupMessage(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::CStatusMessage &message);
//! Reverse lookup messages
//! \threadsafe
void addReverseLookupMessage(const BlackMisc::Aviation::CCallsign &callsign, const QString &message, BlackMisc::CStatusMessage::StatusSeverity severity = BlackMisc::CStatusMessage::SeverityInfo);
private slots:
//! Create aircraft in range, this is the only place where a new aircraft should be added
void ps_aircraftUpdateReceived(const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CTransponder &transponder);