refs #849, network context

* formatting
* made some functions protected instead public
This commit is contained in:
Klaus Basan
2017-01-05 02:29:33 +01:00
committed by Mathew Sutcliffe
parent 44d7e3cca9
commit 194b2fd9ba
3 changed files with 23 additions and 19 deletions

View File

@@ -29,8 +29,7 @@ namespace BlackCore
//! Constructor //! Constructor
CContextNetworkEmpty(CCoreFacade *runtime) : IContextNetwork(CCoreFacadeConfig::NotUsed, runtime) {} CContextNetworkEmpty(CCoreFacade *runtime) : IContextNetwork(CCoreFacadeConfig::NotUsed, runtime) {}
public slots: // IContextNetwork overrides public slots:
//! \copydoc IContextNetwork::requestAtcBookingsUpdate() //! \copydoc IContextNetwork::requestAtcBookingsUpdate()
virtual void requestAtcBookingsUpdate() const override virtual void requestAtcBookingsUpdate() const override
{ {

View File

@@ -497,31 +497,31 @@ namespace BlackCore
CSimulatedAircraft CContextNetwork::getAircraftInRangeForCallsign(const CCallsign &callsign) const CSimulatedAircraft CContextNetwork::getAircraftInRangeForCallsign(const CCallsign &callsign) const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return this->m_airspace->getAircraftInRangeForCallsign(callsign); return this->m_airspace->getAircraftInRangeForCallsign(callsign);
} }
CAircraftModel CContextNetwork::getAircraftInRangeModelForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const CAircraftModel CContextNetwork::getAircraftInRangeModelForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return this->m_airspace->getAircraftInRangeModelForCallsign(callsign); return this->m_airspace->getAircraftInRangeModelForCallsign(callsign);
} }
CStatusMessageList CContextNetwork::getReverseLookupMessages(const CCallsign &callsign) const CStatusMessageList CContextNetwork::getReverseLookupMessages(const CCallsign &callsign) const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return this->m_airspace->getReverseLookupMessages(callsign); return this->m_airspace->getReverseLookupMessages(callsign);
} }
bool CContextNetwork::isReverseLookupMessagesEnabled() const bool CContextNetwork::isReverseLookupMessagesEnabled() const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
return this->m_airspace->isReverseLookupMessagesEnabled(); return this->m_airspace->isReverseLookupMessagesEnabled();
} }
void CContextNetwork::enableReverseLookupMessages(bool enabled) void CContextNetwork::enableReverseLookupMessages(bool enabled)
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; }
if (this->m_airspace->isReverseLookupMessagesEnabled() == enabled) { return; } if (this->m_airspace->isReverseLookupMessagesEnabled() == enabled) { return; }
this->m_airspace->enableReverseLookupMessages(enabled); this->m_airspace->enableReverseLookupMessages(enabled);
emit CContext::changedLogOrDebugSettings(); emit CContext::changedLogOrDebugSettings();
@@ -529,32 +529,32 @@ namespace BlackCore
CStatusMessageList CContextNetwork::getAircraftPartsHistory(const CCallsign &callsign) const CStatusMessageList CContextNetwork::getAircraftPartsHistory(const CCallsign &callsign) const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return this->m_airspace->getAircraftPartsHistory(callsign); return this->m_airspace->getAircraftPartsHistory(callsign);
} }
CAircraftPartsList CContextNetwork::getRemoteAircraftParts(const CCallsign &callsign, qint64 cutoffTimeValuesBefore) const CAircraftPartsList CContextNetwork::getRemoteAircraftParts(const CCallsign &callsign, qint64 cutoffTimeValuesBefore) const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return this->m_airspace->remoteAircraftParts(callsign, cutoffTimeValuesBefore); return this->m_airspace->remoteAircraftParts(callsign, cutoffTimeValuesBefore);
} }
bool CContextNetwork::isAircraftPartsHistoryEnabled() const bool CContextNetwork::isAircraftPartsHistoryEnabled() const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
return this->m_airspace->isAircraftPartsHistoryEnabled(); return this->m_airspace->isAircraftPartsHistoryEnabled();
} }
void CContextNetwork::enableAircraftPartsHistory(bool enabled) void CContextNetwork::enableAircraftPartsHistory(bool enabled)
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; }
this->m_airspace->enableAircraftPartsHistory(enabled); this->m_airspace->enableAircraftPartsHistory(enabled);
emit CContext::changedLogOrDebugSettings(); emit CContext::changedLogOrDebugSettings();
} }
CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const
{ {
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return this->m_airspace->getAtcStationsOnline().findFirstByCallsign(callsign); return this->m_airspace->getAtcStationsOnline().findFirstByCallsign(callsign);
} }
@@ -606,7 +606,7 @@ namespace BlackCore
bool CContextNetwork::updateAircraftNetworkModel(const CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator) bool CContextNetwork::updateAircraftNetworkModel(const CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
{ {
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; } if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; }
bool c = this->m_airspace->updateAircraftNetworkModel(callsign, model, originator); const bool c = this->m_airspace->updateAircraftNetworkModel(callsign, model, originator);
if (c) if (c)
{ {
const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign)); const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
@@ -711,11 +711,11 @@ namespace BlackCore
CVoiceRoomList CContextNetwork::getSelectedVoiceRooms() const CVoiceRoomList CContextNetwork::getSelectedVoiceRooms() const
{ {
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
CAtcStationList stations = this->getSelectedAtcStations(); const CAtcStationList stations = this->getSelectedAtcStations();
Q_ASSERT(stations.size() == 2); Q_ASSERT(stations.size() == 2);
CVoiceRoomList rooms; CVoiceRoomList rooms;
CAtcStation s1 = stations[0]; const CAtcStation s1 = stations[0];
CAtcStation s2 = stations[1]; const CAtcStation s2 = stations[1];
rooms.push_back(s1.getVoiceRoom()); rooms.push_back(s1.getVoiceRoom());
rooms.push_back(s2.getVoiceRoom()); rooms.push_back(s2.getVoiceRoom());
return rooms; return rooms;

View File

@@ -104,9 +104,6 @@ namespace BlackCore
virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override; virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override;
//! @} //! @}
//! Network library
INetwork *network() const { return m_network; }
public slots: public slots:
// from context and provider interface // from context and provider interface
//! \ingroup remoteaircraftprovider //! \ingroup remoteaircraftprovider
@@ -187,6 +184,14 @@ namespace BlackCore
//! Register myself in DBus //! Register myself in DBus
CContextNetwork *registerWithDBus(BlackMisc::CDBusServer *server); CContextNetwork *registerWithDBus(BlackMisc::CDBusServer *server);
//! Network library
//! \remarks normally only for core facade internal usage
INetwork *network() const { return m_network; }
//! Airspace
//! \remarks normally only for core facade internal usage
CAirspaceMonitor *airspace() const { return m_airspace; }
private: private:
CAirspaceMonitor *m_airspace = nullptr; CAirspaceMonitor *m_airspace = nullptr;
INetwork *m_network = nullptr; INetwork *m_network = nullptr;