Doxygen, renaming, formatting

* Formatting, renaming to current schema
* Minor tweaks
This commit is contained in:
Klaus Basan
2014-09-08 22:47:53 +02:00
parent 681201377a
commit 2127238ed4
19 changed files with 83 additions and 67 deletions

View File

@@ -31,7 +31,7 @@ namespace BlackCore
this->connect(this->m_network, &INetwork::atisVoiceRoomReplyReceived, this, &CAirspaceMonitor::ps_atisVoiceRoomReceived);
this->connect(this->m_network, &INetwork::atisLogoffTimeReplyReceived, this, &CAirspaceMonitor::ps_atisLogoffTimeReceived);
this->connect(this->m_network, &INetwork::metarReplyReceived, this, &CAirspaceMonitor::ps_metarReceived);
this->connect(this->m_network, &INetwork::flightPlanReplyReceived, this, &CAirspaceMonitor::ps_flightplanReceived);
this->connect(this->m_network, &INetwork::flightPlanReplyReceived, this, &CAirspaceMonitor::ps_flightPlanReceived);
this->connect(this->m_network, &INetwork::realNameReplyReceived, this, &CAirspaceMonitor::ps_realNameReplyReceived);
this->connect(this->m_network, &INetwork::icaoCodesReplyReceived, this, &CAirspaceMonitor::ps_icaoCodesReceived);
this->connect(this->m_network, &INetwork::pilotDisconnected, this, &CAirspaceMonitor::ps_pilotDisconnected);
@@ -434,9 +434,9 @@ namespace BlackCore
// Logic to set logoff time
bool ok;
int h = zuluTime.left(2).toInt(&ok);
if (!ok) return;
if (!ok) { return; }
int m = zuluTime.right(2).toInt(&ok);
if (!ok) return;
if (!ok) { return; }
QDateTime logoffDateTime = QDateTime::currentDateTimeUtc();
logoffDateTime.setTime(QTime(h, m));
CIndexVariantMap vm(CAtcStation::IndexBookedUntil, logoffDateTime);

View File

@@ -106,7 +106,7 @@ namespace BlackCore
//! Own aircraft model updated
void setOwnAircraftModel(const BlackMisc::Network::CAircraftModel &model) { m_ownAircraftModel = model; }
public:
//! Clear the contents
void clear()
@@ -122,16 +122,16 @@ namespace BlackCore
private:
BlackMisc::Aviation::CAtcStationList m_atcStationsOnline;
BlackMisc::Aviation::CAtcStationList m_atcStationsBooked;
BlackMisc::Aviation::CAircraftList m_aircraftsInRange;
BlackMisc::Network::CClientList m_otherClients;
BlackMisc::Aviation::CAircraftList m_aircraftsInRange;
BlackMisc::Network::CClientList m_otherClients;
QMap<BlackMisc::Aviation::CAirportIcao, BlackMisc::Aviation::CInformationMessage> m_metarCache;
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CFlightPlan> m_flightPlanCache;
BlackMisc::Aviation::CAircraft m_ownAircraft;
BlackMisc::Aviation::CAircraft m_ownAircraft;
BlackMisc::Network::CAircraftModel m_ownAircraftModel;
INetwork *m_network;
CVatsimBookingReader *m_vatsimBookingReader;
CVatsimBookingReader *m_vatsimBookingReader;
CVatsimDataFileReader *m_vatsimDataFileReader;
// FIXME (MS) should be in INetwork
@@ -145,8 +145,7 @@ namespace BlackCore
void ps_fsipirCustomPacketReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &, const QString &, const QString &, const QString &model);
void ps_serverReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &server);
void ps_metarReceived(const QString &metarMessage);
void ps_flightplanReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CFlightPlan &flightPlan);
void ps_receivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
void ps_flightPlanReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CFlightPlan &flightPlan);
void ps_atcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range);
void ps_atcControllerDisconnected(const BlackMisc::Aviation::CCallsign &callsign);
void ps_atisReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atisMessage);
@@ -156,6 +155,10 @@ namespace BlackCore
void ps_aircraftUpdateReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CTransponder &transponder);
void ps_pilotDisconnected(const BlackMisc::Aviation::CCallsign &callsign);
void ps_frequencyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency);
void ps_receivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
void ps_receivedDataFile();
};
} // namespace

View File

@@ -95,7 +95,7 @@ namespace BlackCore
void connectionTerminated();
/*!
* \brief Connection status changed
* Connection status changed
* \param from old status
* \param to new status
* \param message further details
@@ -113,7 +113,7 @@ namespace BlackCore
virtual void readAtcBookingsFromSource() const = 0;
/*!
* \brief The ATC list with online ATC controllers
* The ATC list with online ATC controllers
* \remarks If I make this &getAtcStations XML is not generated correctly
*/
virtual const BlackMisc::Aviation::CAtcStationList getAtcStationsOnline() const = 0;
@@ -140,19 +140,19 @@ namespace BlackCore
virtual BlackMisc::Network::CClientList getOtherClientsForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns) const = 0;
/*!
* \brief Connect to Network
* Connect to Network
* \return messages gererated during connecting
* \see INetwork::LoginMode
*/
virtual BlackMisc::CStatusMessageList connectToNetwork(uint loginMode) = 0;
/*!
* \brief Disconnect from network
* Disconnect from network
* \return messages generated during disconnecting
*/
virtual BlackMisc::CStatusMessageList disconnectFromNetwork() = 0;
//! \brief Network connected?
//! Network connected?
virtual bool isConnected() const = 0;
//! Text messages (radio and private chat messages)
@@ -165,7 +165,7 @@ namespace BlackCore
virtual BlackMisc::Aviation::CFlightPlan loadFlightPlanFromNetwork(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
/*!
* \brief Get METAR, if not available request it
* Get METAR, if not available request it
* \param airportIcaoCode such as EDDF, KLAX
* \return
*/

View File

@@ -45,19 +45,19 @@ namespace BlackCore
// 1. Init by "network driver"
this->m_network = new CNetworkVatlib(this);
this->connect(this->m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::ps_FsdConnectionStatusChanged);
this->connect(this->m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::ps_FsdTextMessageReceived);
this->connect(this->m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::ps_fsdConnectionStatusChanged);
this->connect(this->m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::ps_fsdTextMessageReceived);
// 2. VATSIM bookings
this->m_vatsimBookingReader = new CVatsimBookingReader(this->getRuntime()->getIContextSettings()->getNetworkSettings().getBookingServiceUrl(), this);
this->connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CContextNetwork::ps_ReceivedBookings);
this->connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CContextNetwork::ps_receivedBookings);
this->m_vatsimBookingReader->read(); // first read
this->m_vatsimBookingReader->setInterval(180 * 1000);
// 3. VATSIM data file
const QStringList dataFileUrls = { "http://info.vroute.net/vatsim-data.txt" };
this->m_vatsimDataFileReader = new CVatsimDataFileReader(dataFileUrls, this);
this->connect(this->m_vatsimDataFileReader, &CVatsimDataFileReader::dataRead, this, &CContextNetwork::ps_DataFileRead);
this->connect(this->m_vatsimDataFileReader, &CVatsimDataFileReader::dataRead, this, &CContextNetwork::ps_dataFileRead);
this->m_vatsimDataFileReader->read(); // first read
this->m_vatsimDataFileReader->setInterval(90 * 1000);
@@ -267,9 +267,8 @@ namespace BlackCore
/*
* Connection status changed
*/
void CContextNetwork::ps_FsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message)
void CContextNetwork::ps_fsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message)
{
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { QString::number(from), QString::number(to) });
INetwork::ConnectionStatus fromOld = this->m_currentStatus;
this->m_currentStatus = to;
@@ -310,17 +309,19 @@ namespace BlackCore
/*
* Data file (VATSIM) has been read
*/
void CContextNetwork::ps_DataFileRead()
void CContextNetwork::ps_dataFileRead()
{
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
// TODO (MS) no test for if (this->getIContextApplication()) here?
this->getIContextApplication()->sendStatusMessage(CStatusMessage::getInfoMessage("Read VATSIM data file", CStatusMessage::TypeTrafficNetwork));
if (this->getIContextApplication())
{
this->getIContextApplication()->sendStatusMessage(CStatusMessage::getInfoMessage("Read VATSIM data file", CStatusMessage::TypeTrafficNetwork));
}
}
/*
* Radio text message received
*/
void CContextNetwork::ps_FsdTextMessageReceived(const CTextMessageList &messages)
void CContextNetwork::ps_fsdTextMessageReceived(const CTextMessageList &messages)
{
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, messages.toQString());
this->textMessagesReceived(messages); // relay
@@ -333,7 +334,7 @@ namespace BlackCore
return this->getRuntime()->getCContextOwnAircraft()->ownAircraft();
}
void CContextNetwork::ps_ChangedOwnAircraft(const CAircraft &aircraft, const QString &originator)
void CContextNetwork::ps_changedOwnAircraft(const CAircraft &aircraft, const QString &originator)
{
Q_ASSERT(this->m_network);
Q_UNUSED(originator);
@@ -352,7 +353,7 @@ namespace BlackCore
/*
* Updated bookings
*/
void CContextNetwork::ps_ReceivedBookings(const CAtcStationList &)
void CContextNetwork::ps_receivedBookings(const CAtcStationList &)
{
// TODO (MS) no test for if (this->getIContextApplication()) here?
this->getIContextApplication()->sendStatusMessage(CStatusMessage::getInfoMessage("Read bookings from network", CStatusMessage::TypeTrafficNetwork));

View File

@@ -7,11 +7,11 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORE_CONTEXTNETWORK_IMPL_H
#define BLACKCORE_CONTEXTNETWORK_IMPL_H
//! \file
#include "blackcore/context_network.h"
#include "blackcore/context_settings.h"
#include "blackcore/context_runtime.h"
@@ -175,23 +175,23 @@ namespace BlackCore
private slots:
//! Own aircraft was updated
void ps_ChangedOwnAircraft(const BlackMisc::Aviation::CAircraft &aircraft, const QString &originator);
void ps_changedOwnAircraft(const BlackMisc::Aviation::CAircraft &aircraft, const QString &originator);
//! ATC bookings received
void ps_ReceivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
void ps_receivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
//! Data file has been read
void ps_DataFileRead();
void ps_dataFileRead();
/*!
* \brief Connection status changed?
* \param from old status
* \param to new status
*/
void ps_FsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message);
void ps_fsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message);
//! Radio text messages received
void ps_FsdTextMessageReceived(const BlackMisc::Network::CTextMessageList &messages);
void ps_fsdTextMessageReceived(const BlackMisc::Network::CTextMessageList &messages);
};
}

View File

@@ -457,7 +457,7 @@ namespace BlackCore
// inject updated own aircraft to network
c = this->connect(this->m_contextOwnAircraft, &IContextOwnAircraft::changedAircraft,
this->getCContextNetwork(), &CContextNetwork::ps_ChangedOwnAircraft);
this->getCContextNetwork(), &CContextNetwork::ps_changedOwnAircraft);
Q_ASSERT(c);
}
}

View File

@@ -7,11 +7,11 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORE_VATSIMBOOKINGREADER_H
#define BLACKCORE_VATSIMBOOKINGREADER_H
//! \file
#include "blackmisc/threadedreader.h"
#include "blackmisc/avatcstationlist.h"

View File

@@ -304,7 +304,7 @@ namespace BlackCore
} // read success
nwReply->close();
nwReply->deleteLater(); // we are responsible for reading this
nwReply->deleteLater(); // we are responsible for deleting this
emit this->dataRead();
// warnings, if required

View File

@@ -37,7 +37,7 @@ namespace BlackCore
//! Constructor
explicit CVatsimDataFileReader(const QStringList &urls, QObject *parent = nullptr);
//! Read / re-read bookings
//! Read / re-read data file
void read();
//! Get aircrafts
@@ -92,9 +92,12 @@ namespace BlackCore
QStringList m_serviceUrls; /*!< URL of the service */
int m_currentUrlIndex;
QNetworkAccessManager *m_networkManager;
BlackMisc::Network::CServerList m_voiceServers;
BlackMisc::Network::CServerList m_voiceServers;
BlackMisc::Aviation::CAtcStationList m_atcStations;
BlackMisc::Aviation::CAircraftList m_aircrafts;
BlackMisc::Aviation::CAircraftList m_aircrafts;
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Network::CVoiceCapabilities> m_voiceCapabilities;
//! Split line and assign values to their corresponding attribute names
static const QMap<QString, QString> clientPartsToMap(const QString &currentLine, const QStringList &clientSectionAttributes);
//! Section in file
@@ -112,7 +115,6 @@ namespace BlackCore
signals:
//! Data have been read
void dataRead();
};
}

View File

@@ -40,9 +40,10 @@ namespace BlackGui
Q_ASSERT(connected);
connect(this, &QTabWidget::currentChanged, this, &CAtcStationComponent::ps_atcStationsTabChanged);
connect(this->ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &CAtcStationComponent::ps_onlineAtcStationSelected);
connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &CAtcStationComponent::ps_requestAtis);
connect(this->ui->pb_ReloadAtcStationsBooked, &QPushButton::clicked, this, &CAtcStationComponent::ps_reloadAtcStationsBooked);
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::testRequestDummyAtcOnlineStations, this, &CAtcStationComponent::ps_testCreateDummyOnlineAtcStations);
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::requestUpdate, this->m_timerComponent, &CTimerBasedComponent::fireTimer);
connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &CAtcStationComponent::ps_requestAtis);
connect(this->ui->tvp_AtcStationsBooked, &CAtcStationView::requestUpdate, this, &CAtcStationComponent::ps_reloadAtcStationsBooked);
}
CAtcStationComponent::~CAtcStationComponent()

View File

@@ -104,9 +104,9 @@ namespace BlackMisc
}
/*
* Merge with booking
* Merge with booking, both (online/booking will be updated)
*/
int CAtcStationList::mergeWithBooking(CAtcStation &bookedAtcStation)
int CAtcStationList::mergeWithBooking(CAtcStation &bookedAtcStation)
{
int c = 0;
bookedAtcStation.setOnline(false); // reset
@@ -170,9 +170,13 @@ namespace BlackMisc
// both ways
onlineAtcStation.syncronizeControllerData(bookedAtcStation);
if (onlineAtcStation.hasValidDistance())
{
bookedAtcStation.setDistanceToPlane(onlineAtcStation.getDistanceToPlane());
}
else if (bookedAtcStation.hasValidDistance())
{
onlineAtcStation.setDistanceToPlane(bookedAtcStation.getDistanceToPlane());
}
// update
*i = onlineAtcStation;
@@ -181,6 +185,7 @@ namespace BlackMisc
// normally 1 expected, as I should find
// only one online station for this booking
Q_ASSERT(c == 0 || c == 1);
return c;
}

View File

@@ -54,7 +54,8 @@ namespace BlackMisc
//! Update distances to coordinate, usually own aircraft's position
void calculateDistancesToPlane(const BlackMisc::Geo::CCoordinateGeodetic &position);
//! Merge with ATC station representing booking information
//! Merge with ATC station representing booking information.
//! Both sides (booking, online station) will be updated.
//! \remarks Can be used if the stored data in this list are online ATC stations
int mergeWithBooking(CAtcStation &bookedAtcStation);

View File

@@ -226,7 +226,9 @@ bool BlackMisc::equalQVariants(const QVariant &v1, const QVariant &v2)
*/
int BlackMisc::compareQVariants(const QVariant &v1, const QVariant &v2)
{
if (v1 == v2) return 0; // compares on primitives or on address
// Compares this QVariant with v and returns true if they are equal; otherwise returns false.
// In the case of custom types, their equalness operators are not called. Instead the values' addresses are compared.
if (v1 == v2) return 0;
if (!v1.isValid() || !v2.isValid()) qFatal("Invalid variants");
if (v1.type() != v2.type()) qFatal("Mismatching types");
@@ -274,7 +276,7 @@ int BlackMisc::compareQVariants(const QVariant &v1, const QVariant &v2)
break;
}
// BlackObject
// CValueObject
if (v1Type == QMetaType::User)
{
const CValueObject *cs1 = CValueObject::fromQVariant(v1);

View File

@@ -24,7 +24,7 @@ namespace BlackMisc
*/
CVoiceCapabilities::CVoiceCapabilities(const QString &flightPlanRemarks)
{
this->fromFlightPlanRemarks(flightPlanRemarks);
this->setFromFlightPlanRemarks(flightPlanRemarks);
}
/*
@@ -50,8 +50,8 @@ namespace BlackMisc
static const QString r("voice listening only");
return r;
}
default:
case Unknown:
default:
{
static const QString u("unknown");
return u;
@@ -61,15 +61,16 @@ namespace BlackMisc
return QString(""); // never reached
}
void CVoiceCapabilities::fromFlightPlanRemarks(const QString &flightPlanRemarks)
void CVoiceCapabilities::setFromFlightPlanRemarks(const QString &flightPlanRemarks)
{
// http://www.vatpac.org/cms/index.php?option=com_content&view=article&id=608&Itemid=213
if (flightPlanRemarks.isEmpty())
{
this->m_voiceCapabilities = Unknown;
this->setCapabilities(Unknown);
return;
}
QString r = flightPlanRemarks.toLower();
const QString r = flightPlanRemarks.toLower();
if (r.contains("/v/") || r.contains("/voice/"))
{
this->setCapabilities(Voice);

View File

@@ -27,7 +27,7 @@ namespace BlackMisc
{
public:
//!< Voice capabilities
//! Voice capabilities
enum VoiceCapabilities
{
Unknown,

View File

@@ -17,7 +17,8 @@
namespace BlackMisc
{
/*! Wrapper container for shared lockable pointer.
/*!
* Wrapper container for shared lockable pointer.
* Provides BasicLockable characteristics to be used
* with std::lock_guard
*/

View File

@@ -8,6 +8,7 @@
*/
#include "testing.h"
#include "nwvoicecapabilities.h"
using namespace BlackMisc;
using namespace BlackMisc::Geo;
@@ -34,20 +35,20 @@ namespace BlackMisc
// from WGS is slow, so static const (only 1 time init)
// https://dev.vatsim-germany.org/issues/322#note-2
static const CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21 13″ N", "11° 47 09″ E", CLength(index, CLengthUnit::ft()));
QString cs = QString("%1_TWR").arg(index);
QString usr = QString("Joe %1").arg(index);
QString id = QString("00000%1").arg(index).right(6);
double f = 118.0 + (index % 30) * 0.25;
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
const QDateTime dtFrom = QDateTime::currentDateTimeUtc();
const QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
const CUser user(id, usr);
if (byPropertyIndex)
{
CAtcStation station;
station.setPropertyByIndex(CCallsign(cs).toQVariant(), CAtcStation::IndexCallsign);
station.setPropertyByIndex(CUser(id, usr).toQVariant(), CAtcStation::IndexController);
station.setPropertyByIndex(user.toQVariant(), CAtcStation::IndexController);
station.setPropertyByIndex(CFrequency(f, CFrequencyUnit::MHz()).toQVariant(), CAtcStation::IndexFrequency);
station.setPropertyByIndex(CLength(50, CLengthUnit::km()).toQVariant(), CAtcStation::IndexRange);
station.setPropertyByIndex(geoPos.toQVariant(), CAtcStation::IndexPosition);
@@ -59,7 +60,7 @@ namespace BlackMisc
}
else
{
CAtcStation station(CCallsign(cs), CUser(id, usr),
CAtcStation station(CCallsign(cs), user,
CFrequency(f, CFrequencyUnit::MHz()),
geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
station.setDistanceToPlane(CLength(index + 1, CLengthUnit::NM()));
@@ -134,7 +135,6 @@ namespace BlackMisc
}
}
void CTesting::parseWgs(int times)
{
static QStringList wgsLatLng(

View File

@@ -12,8 +12,7 @@
#ifndef BLACKMISC_TESTING_H
#define BLACKMISC_TESTING_H
#include "avallclasses.h"
#include "avatcstationlist.h"
/*!
* Generate data for testing purposes.

View File

@@ -19,13 +19,13 @@
#include <QFuture>
#include <QCoreApplication>
// Header only class, to avoid orward instantiation across subprojects
namespace BlackMisc
{
/*!
* Support for threaded based reading and parsing tasks such
* as data files via http, or file system and parsing (such as FSX models)
*
* \remarks Header only class to avoid forward instantiations across subprojects
*/
template <class FutureRet = void> class CThreadedReader
{