Style and log messages

This commit is contained in:
Klaus Basan
2019-11-07 00:05:30 +01:00
committed by Mat Sutcliffe
parent 441ca41ee3
commit 5fea046c0b
6 changed files with 41 additions and 48 deletions

View File

@@ -24,10 +24,11 @@
#include <QWriteLocker>
using namespace BlackMisc;
using namespace BlackMisc::Network;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Geo;
using namespace BlackMisc::Network;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Simulation;
using namespace BlackCore::Fsd;
namespace BlackCore
@@ -63,7 +64,7 @@ namespace BlackCore
// Monitor
c = connect(airspaceMonitorParent, &CAirspaceMonitor::addedAircraftSituation, this, &CAirspaceAnalyzer::watchdogTouchAircraftCallsign);
Q_ASSERT(c);
Q_UNUSED(c);
Q_UNUSED(c)
// start in own thread
this->start(QThread::LowestPriority);
@@ -89,7 +90,7 @@ namespace BlackCore
void CAirspaceAnalyzer::onNetworkPositionUpdate(const CAircraftSituation &situation, const CTransponder &transponder)
{
Q_UNUSED(transponder);
Q_UNUSED(transponder)
this->watchdogTouchAircraftCallsign(situation);
}
@@ -99,17 +100,17 @@ namespace BlackCore
m_aircraftCallsignTimestamps[situation.getCallsign()] = QDateTime::currentMSecsSinceEpoch();
}
void CAirspaceAnalyzer::watchdogTouchAtcCallsign(const CCallsign &callsign, const CFrequency &frequency, const Geo::CCoordinateGeodetic &position, const CLength &range)
void CAirspaceAnalyzer::watchdogTouchAtcCallsign(const CCallsign &callsign, const CFrequency &frequency, const CCoordinateGeodetic &position, const CLength &range)
{
Q_UNUSED(frequency);
Q_UNUSED(position);
Q_UNUSED(range);
Q_UNUSED(frequency)
Q_UNUSED(position)
Q_UNUSED(range)
m_atcCallsignTimestamps[callsign] = QDateTime::currentMSecsSinceEpoch();
}
void CAirspaceAnalyzer::onConnectionStatusChanged(CConnectionStatus oldStatus, CConnectionStatus newStatus)
{
Q_UNUSED(oldStatus);
Q_UNUSED(oldStatus)
if (newStatus.isDisconnected())
{
this->clear();
@@ -164,11 +165,11 @@ namespace BlackCore
m_doNotRunAgainBefore = -1;
// checks
const qint64 aircraftTimeoutMs = m_timeoutAircraft.valueInteger(CTimeUnit::ms());
const qint64 atcTimeoutMs = m_timeoutAtc.valueInteger(CTimeUnit::ms());
const qint64 aircraftTimeoutMs = m_timeoutAircraft.valueInteger(CTimeUnit::ms());
const qint64 atcTimeoutMs = m_timeoutAtc.valueInteger(CTimeUnit::ms());
const qint64 timeoutAircraftEpochMs = currentTimeMsEpoch - aircraftTimeoutMs;
const qint64 timeoutAtcEpochMs = currentTimeMsEpoch - atcTimeoutMs;
const bool enabled = m_enabledWatchdog;
const qint64 timeoutAtcEpochMs = currentTimeMsEpoch - atcTimeoutMs;
const bool enabled = m_enabledWatchdog;
const QList<CCallsign> callsignsAircraft = m_aircraftCallsignTimestamps.keys();
for (const CCallsign &callsign : callsignsAircraft) // clazy:exclude=container-anti-pattern,range-loop

View File

@@ -69,7 +69,7 @@ namespace BlackCore
CAirspaceMonitor *airspaceMonitorParent);
//! Destructor
virtual ~CAirspaceAnalyzer();
virtual ~CAirspaceAnalyzer() override;
//! Get the latest snapshot
//! \threadsafe
@@ -128,7 +128,7 @@ namespace BlackCore
CCallsignTimestampSet m_aircraftCallsignTimestamps; //!< for watchdog (pilots)
CCallsignTimestampSet m_atcCallsignTimestamps; //!< for watchdog (ATC)
BlackMisc::PhysicalQuantities::CTime m_timeoutAircraft = { 15, BlackMisc::PhysicalQuantities::CTimeUnit::s() }; //!< Timeout value for watchdog functionality
BlackMisc::PhysicalQuantities::CTime m_timeoutAtc = { 50, BlackMisc::PhysicalQuantities::CTimeUnit::s() }; //!< Timeout value for watchdog functionality
BlackMisc::PhysicalQuantities::CTime m_timeoutAtc = { 50, BlackMisc::PhysicalQuantities::CTimeUnit::s() }; //!< Timeout value for watchdog functionality
qint64 m_lastWatchdogCallMsSinceEpoch; //!< when last called
qint64 m_doNotRunAgainBefore = -1; //!< do not run again before, also used to detect debugging
std::atomic_bool m_enabledWatchdog { true }; //!< watchdog enabled

View File

@@ -729,15 +729,6 @@ namespace BlackCore
if (changedAtis) { emit this->changedAtisReceived(callsign); }
}
void CAirspaceMonitor::onAtisVoiceRoomReceived(const CCallsign &callsign, const QString &url)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
if (!this->isConnectedAndNotShuttingDown()) { return; }
Q_UNUSED(url)
Q_UNUSED(callsign)
return;
}
void CAirspaceMonitor::onAtisLogoffTimeReceived(const CCallsign &callsign, const QString &zuluTime)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));

View File

@@ -391,9 +391,6 @@ namespace BlackCore
void onAircraftConfigReceived(const BlackMisc::Aviation::CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs);
void onAircraftInterimUpdateReceived(const BlackMisc::Aviation::CAircraftSituation &situation);
void onConnectionStatusChanged(BlackMisc::Network::CConnectionStatus oldStatus, BlackMisc::Network::CConnectionStatus newStatus);
//! \deprecated
void onAtisVoiceRoomReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &url);
};
} // namespace

View File

@@ -7,9 +7,10 @@
*/
#include "deletepilot.h"
#include "blackmisc/logmessage.h"
using namespace BlackMisc;
namespace BlackCore
{
namespace Fsd
@@ -34,9 +35,10 @@ namespace BlackCore
{
if (tokens.size() < 1)
{
BlackMisc::CLogMessage(static_cast<DeletePilot *>(nullptr)).debug(u"Wrong number of arguments.");
CLogMessage(static_cast<DeletePilot *>(nullptr)).debug(u"Wrong number of arguments.");
return {};
};
}
// VATSIM FSD will always supply the CERTIFICATE ID when it rebroadcasts this PDU without regard for whether
// the client originally specified it. But other FSDs might not.
DeletePilot packet(tokens[0], (tokens.size() >= 2) ? tokens[1] : "");