mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
refs #469, adjusted network context due to changes in signals and METAR naming
This commit is contained in:
committed by
Mathew Sutcliffe
parent
8827b68b3b
commit
2ba061bbc0
@@ -20,7 +20,7 @@
|
|||||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
#include "blackmisc/network/dbflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
#include "blackmisc/network/textmessagelist.h"
|
#include "blackmisc/network/textmessagelist.h"
|
||||||
#include "blackmisc/network/userlist.h"
|
#include "blackmisc/network/userlist.h"
|
||||||
#include "blackmisc/network/clientlist.h"
|
#include "blackmisc/network/clientlist.h"
|
||||||
@@ -135,17 +135,9 @@ namespace BlackCore
|
|||||||
|
|
||||||
// --------------------------- data readers -------------------------------
|
// --------------------------- data readers -------------------------------
|
||||||
|
|
||||||
//! Data file read
|
//! Web serice data read
|
||||||
void vatsimDataFileRead(int lines);
|
// void webServiceDataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
void webServiceDataRead(int entity, int state, int number);
|
||||||
//! Bookings read
|
|
||||||
void vatsimBookingsRead(int number);
|
|
||||||
|
|
||||||
//! Metar read
|
|
||||||
void vatsimMetarsRead(int number);
|
|
||||||
|
|
||||||
//! swift DB data read
|
|
||||||
void swiftDbDataRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState, int number);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Reload bookings from booking service
|
//! Reload bookings from booking service
|
||||||
@@ -166,6 +158,9 @@ namespace BlackCore
|
|||||||
//! Aircraft count
|
//! Aircraft count
|
||||||
virtual int getAircraftInRangeCount() const = 0;
|
virtual int getAircraftInRangeCount() const = 0;
|
||||||
|
|
||||||
|
//! Get METAR, if not available request it (code such as EDDF, KLAX)
|
||||||
|
virtual BlackMisc::Weather::CMetar getMetarForAirport(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) const = 0;
|
||||||
|
|
||||||
//! Online station for callsign
|
//! Online station for callsign
|
||||||
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||||
|
|
||||||
@@ -229,9 +224,6 @@ namespace BlackCore
|
|||||||
//! Command line was entered
|
//! Command line was entered
|
||||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
|
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
|
||||||
|
|
||||||
//! Get METAR, if not available request it (code such as EDDF, KLAX)
|
|
||||||
virtual BlackMisc::Weather::CMetar getMetar(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) = 0;
|
|
||||||
|
|
||||||
//! Use the selected COM1/2 frequencies, and get the corresponding voice room for it
|
//! Use the selected COM1/2 frequencies, and get the corresponding voice room for it
|
||||||
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const = 0;
|
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::getMetar
|
//! \copydoc IContextNetwork::getMetar
|
||||||
BlackMisc::Weather::CMetar getMetar(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) override
|
BlackMisc::Weather::CMetar getMetarForAirport(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) const override
|
||||||
{
|
{
|
||||||
Q_UNUSED(airportIcaoCode);
|
Q_UNUSED(airportIcaoCode);
|
||||||
logEmptyContextWarning(Q_FUNC_INFO);
|
logEmptyContextWarning(Q_FUNC_INFO);
|
||||||
|
|||||||
@@ -59,15 +59,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
// 3. data reader
|
// 3. data reader
|
||||||
this->m_webDataReader = new CWebDataServices(CWebReaderFlags::AllReaders, this);
|
this->m_webDataReader = new CWebDataServices(CWebReaderFlags::AllReaders, this);
|
||||||
this->m_webReaderSignalConnections = this->m_webDataReader->connectVatsimDataSignals(
|
|
||||||
this, // the object here must be the same as in the bind
|
|
||||||
std::bind(&CContextNetwork::vatsimBookingsRead, this, std::placeholders::_1),
|
|
||||||
std::bind(&CContextNetwork::vatsimDataFileRead, this, std::placeholders::_1),
|
|
||||||
std::bind(&CContextNetwork::vatsimMetarsRead, this, std::placeholders::_1));
|
|
||||||
this->m_webReaderSignalConnections.append(
|
this->m_webReaderSignalConnections.append(
|
||||||
this->m_webDataReader->connectSwiftDatabaseSignals(
|
this->m_webDataReader->connectDataReadSignal(
|
||||||
this, // the object here must be the same as in the bind
|
this, // the object here must be the same as in the bind
|
||||||
std::bind(&CContextNetwork::swiftDbDataRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
|
std::bind(&CContextNetwork::webServiceDataRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this->m_webDataReader->readAllInBackground(1000);
|
this->m_webDataReader->readAllInBackground(1000);
|
||||||
@@ -639,10 +634,10 @@ namespace BlackCore
|
|||||||
this->m_airspace->testAddAircraftParts(callsign, parts, incremental);
|
this->m_airspace->testAddAircraftParts(callsign, parts, incremental);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMetar CContextNetwork::getMetar(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode)
|
CMetar CContextNetwork::getMetarForAirport(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) const
|
||||||
{
|
{
|
||||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << airportIcaoCode; }
|
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << airportIcaoCode; }
|
||||||
return m_airspace->getMetar(airportIcaoCode);
|
return m_airspace->getMetarForAirport(airportIcaoCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAtcStationList CContextNetwork::getSelectedAtcStations() const
|
CAtcStationList CContextNetwork::getSelectedAtcStations() const
|
||||||
|
|||||||
@@ -173,8 +173,8 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextNetwork::loadFlightPlanFromNetwork()
|
//! \copydoc IContextNetwork::loadFlightPlanFromNetwork()
|
||||||
virtual BlackMisc::Aviation::CFlightPlan loadFlightPlanFromNetwork(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
virtual BlackMisc::Aviation::CFlightPlan loadFlightPlanFromNetwork(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::getMetar
|
//! \copydoc IContextNetwork::getMetarForAirport
|
||||||
BlackMisc::Weather::CMetar getMetar(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) override;
|
BlackMisc::Weather::CMetar getMetarForAirport(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) const override;
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::getSelectedVoiceRooms()
|
//! \copydoc IContextNetwork::getSelectedVoiceRooms()
|
||||||
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const override;
|
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const override;
|
||||||
@@ -238,12 +238,12 @@ namespace BlackCore
|
|||||||
CContextNetwork *registerWithDBus(CDBusServer *server);
|
CContextNetwork *registerWithDBus(CDBusServer *server);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CAirspaceMonitor *m_airspace = nullptr;
|
CAirspaceMonitor *m_airspace = nullptr;
|
||||||
INetwork *m_network = nullptr;
|
INetwork *m_network = nullptr;
|
||||||
CWebDataServices *m_webDataReader = nullptr; //!< web service readers
|
CWebDataServices *m_webDataReader = nullptr; //!< web service readers
|
||||||
QList<QMetaObject::Connection> m_webReaderSignalConnections;
|
QList<QMetaObject::Connection> m_webReaderSignalConnections;
|
||||||
INetwork::ConnectionStatus m_currentStatus = INetwork::Disconnected; //!< used to detect pending connections
|
INetwork::ConnectionStatus m_currentStatus = INetwork::Disconnected; //!< used to detect pending connections
|
||||||
QTimer *m_dataUpdateTimer = nullptr; //!< general updates such as ATIS, frequencies, see requestDataUpdates()
|
QTimer *m_dataUpdateTimer = nullptr; //!< general updates such as ATIS, frequencies, see requestDataUpdates()
|
||||||
|
|
||||||
// Digest signals, only sending after some time
|
// Digest signals, only sending after some time
|
||||||
BlackMisc::CDigestSignal m_dsAtcStationsBookedChanged { this, &IContextNetwork::changedAtcStationsBooked, &IContextNetwork::changedAtcStationsBookedDigest, 750, 2 };
|
BlackMisc::CDigestSignal m_dsAtcStationsBookedChanged { this, &IContextNetwork::changedAtcStationsBooked, &IContextNetwork::changedAtcStationsBookedDigest, 750, 2 };
|
||||||
|
|||||||
@@ -69,17 +69,11 @@ namespace BlackCore
|
|||||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||||
"textMessageSent", this, SIGNAL(textMessageSent(BlackMisc::Network::CTextMessage)));
|
"textMessageSent", this, SIGNAL(textMessageSent(BlackMisc::Network::CTextMessage)));
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
|
// s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||||
|
// "webServiceDataRead", this, SIGNAL(webServiceDataRead(BlackMisc::Network::CEntityFlags::Entity, BlackMisc::Network::CEntityFlags::ReadState, int)));
|
||||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||||
"vatsimDataFileRead", this, SIGNAL(vatsimDataFileRead(int)));
|
"webServiceDataRead", this, SIGNAL(webServiceDataRead(int, int, int)));
|
||||||
Q_ASSERT(s);
|
|
||||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
|
||||||
"vatsimBookingsRead", this, SIGNAL(vatsimBookingsRead(int)));
|
|
||||||
Q_ASSERT(s);
|
|
||||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
|
||||||
"vatsimMetarsRead", this, SIGNAL(vatsimMetarsRead(int)));
|
|
||||||
Q_ASSERT(s);
|
|
||||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
|
||||||
"changedRemoteAircraftModel", this, SIGNAL(changedRemoteAircraftModel(BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::CIdentifier)));
|
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||||
"changedRemoteAircraftEnabled", this, SIGNAL(changedRemoteAircraftEnabled(BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::CIdentifier)));
|
"changedRemoteAircraftEnabled", this, SIGNAL(changedRemoteAircraftEnabled(BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::CIdentifier)));
|
||||||
@@ -271,9 +265,9 @@ namespace BlackCore
|
|||||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CFlightPlan>(QLatin1Literal("loadFlightPlanFromNetwork"), callsign);
|
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CFlightPlan>(QLatin1Literal("loadFlightPlanFromNetwork"), callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMetar CContextNetworkProxy::getMetar(const CAirportIcaoCode &airportIcaoCode)
|
CMetar CContextNetworkProxy::getMetarForAirport(const CAirportIcaoCode &airportIcaoCode) const
|
||||||
{
|
{
|
||||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Weather::CMetar>(QLatin1Literal("getMetar"), airportIcaoCode);
|
return this->m_dBusInterface->callDBusRet<BlackMisc::Weather::CMetar>(QLatin1Literal("getMetarForAirport"), airportIcaoCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextNetwork::loadFlightPlanFromNetwork()
|
//! \copydoc IContextNetwork::loadFlightPlanFromNetwork()
|
||||||
virtual BlackMisc::Aviation::CFlightPlan loadFlightPlanFromNetwork(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
virtual BlackMisc::Aviation::CFlightPlan loadFlightPlanFromNetwork(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::getMetar
|
//! \copydoc IContextNetwork::getMetarForAirport
|
||||||
BlackMisc::Weather::CMetar getMetar(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) override;
|
BlackMisc::Weather::CMetar getMetarForAirport(const BlackMisc::Aviation::CAirportIcaoCode &airportIcaoCode) const override;
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::getSelectedVoiceRooms()
|
//! \copydoc IContextNetwork::getSelectedVoiceRooms()
|
||||||
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const override;
|
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const override;
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace BlackGui
|
|||||||
QString icao = airportIcaoCode.isEmpty() ? this->ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper();
|
QString icao = airportIcaoCode.isEmpty() ? this->ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper();
|
||||||
this->ui->le_AtcStationsOnlineMetar->setText(icao);
|
this->ui->le_AtcStationsOnlineMetar->setText(icao);
|
||||||
if (icao.length() != 4) { return; }
|
if (icao.length() != 4) { return; }
|
||||||
CMetar metar = this->getIContextNetwork()->getMetar(icao);
|
CMetar metar(this->getIContextNetwork()->getMetarForAirport(icao));
|
||||||
if (metar == CMetar())
|
if (metar == CMetar())
|
||||||
{
|
{
|
||||||
this->ui->te_AtcStationsOnlineInfo->clear();
|
this->ui->te_AtcStationsOnlineInfo->clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user