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
CContextNetworkEmpty(CCoreFacade *runtime) : IContextNetwork(CCoreFacadeConfig::NotUsed, runtime) {}
public slots: // IContextNetwork overrides
public slots:
//! \copydoc IContextNetwork::requestAtcBookingsUpdate()
virtual void requestAtcBookingsUpdate() const override
{

View File

@@ -497,31 +497,31 @@ namespace BlackCore
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);
}
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);
}
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);
}
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();
}
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; }
this->m_airspace->enableReverseLookupMessages(enabled);
emit CContext::changedLogOrDebugSettings();
@@ -529,32 +529,32 @@ namespace BlackCore
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);
}
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);
}
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();
}
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);
emit CContext::changedLogOrDebugSettings();
}
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);
}
@@ -606,7 +606,7 @@ namespace BlackCore
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; }
bool c = this->m_airspace->updateAircraftNetworkModel(callsign, model, originator);
const bool c = this->m_airspace->updateAircraftNetworkModel(callsign, model, originator);
if (c)
{
const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
@@ -711,11 +711,11 @@ namespace BlackCore
CVoiceRoomList CContextNetwork::getSelectedVoiceRooms() const
{
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);
CVoiceRoomList rooms;
CAtcStation s1 = stations[0];
CAtcStation s2 = stations[1];
const CAtcStation s1 = stations[0];
const CAtcStation s2 = stations[1];
rooms.push_back(s1.getVoiceRoom());
rooms.push_back(s2.getVoiceRoom());
return rooms;

View File

@@ -104,9 +104,6 @@ namespace BlackCore
virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override;
//! @}
//! Network library
INetwork *network() const { return m_network; }
public slots:
// from context and provider interface
//! \ingroup remoteaircraftprovider
@@ -187,6 +184,14 @@ namespace BlackCore
//! Register myself in DBus
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:
CAirspaceMonitor *m_airspace = nullptr;
INetwork *m_network = nullptr;