mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Ref T659, get network preset values from network vatlib
This commit is contained in:
committed by
Mat Sutcliffe
parent
22bdb730f4
commit
75579cda38
@@ -291,10 +291,10 @@ namespace BlackCore
|
|||||||
//! Enable/disable support of gnd. flag
|
//! Enable/disable support of gnd. flag
|
||||||
virtual bool updateAircraftSupportingGndFLag(const BlackMisc::Aviation::CCallsign &callsign, bool supportGndFlag) = 0;
|
virtual bool updateAircraftSupportingGndFLag(const BlackMisc::Aviation::CCallsign &callsign, bool supportGndFlag) = 0;
|
||||||
|
|
||||||
//! Change model
|
//! Change model (for remote aircraft)
|
||||||
virtual bool updateAircraftModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &originator) = 0;
|
virtual bool updateAircraftModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &originator) = 0;
|
||||||
|
|
||||||
//! Change network model
|
//! Change network model (for remote aircraft)
|
||||||
virtual bool updateAircraftNetworkModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &originator) = 0;
|
virtual bool updateAircraftNetworkModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &originator) = 0;
|
||||||
|
|
||||||
//! Change fast position updates
|
//! Change fast position updates
|
||||||
@@ -333,6 +333,9 @@ namespace BlackCore
|
|||||||
//! Statistics enable/disable
|
//! Statistics enable/disable
|
||||||
virtual bool setNetworkStatisticsEnable(bool enabled) = 0;
|
virtual bool setNetworkStatisticsEnable(bool enabled) = 0;
|
||||||
|
|
||||||
|
//! Network preset values
|
||||||
|
virtual QStringList getNetworkPresetValues() const = 0;
|
||||||
|
|
||||||
// ------------------------ testing ------------------------
|
// ------------------------ testing ------------------------
|
||||||
|
|
||||||
//! Create dummy ATC stations for performance tests etc.
|
//! Create dummy ATC stations for performance tests etc.
|
||||||
|
|||||||
@@ -136,6 +136,13 @@ namespace BlackCore
|
|||||||
return statusMessageEmptyContext();
|
return statusMessageEmptyContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc IContextNetwork::getNetworkPresetValues
|
||||||
|
virtual QStringList getNetworkPresetValues() const override
|
||||||
|
{
|
||||||
|
logEmptyContextWarning(Q_FUNC_INFO);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::disconnectFromNetwork()
|
//! \copydoc IContextNetwork::disconnectFromNetwork()
|
||||||
virtual BlackMisc::CStatusMessage disconnectFromNetwork() override
|
virtual BlackMisc::CStatusMessage disconnectFromNetwork() override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -847,6 +847,12 @@ namespace BlackCore
|
|||||||
return m_airspace->testAddAltitudeOffset(callsign, offset);
|
return m_airspace->testAddAltitudeOffset(callsign, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList CContextNetwork::getNetworkPresetValues() const
|
||||||
|
{
|
||||||
|
if (!m_network) { return {}; }
|
||||||
|
return m_network->getPresetValues();
|
||||||
|
}
|
||||||
|
|
||||||
CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const
|
CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ namespace BlackCore
|
|||||||
virtual QString getNetworkStatistics(bool reset, const QString &separator) override;
|
virtual QString getNetworkStatistics(bool reset, const QString &separator) override;
|
||||||
virtual bool setNetworkStatisticsEnable(bool enabled) override;
|
virtual bool setNetworkStatisticsEnable(bool enabled) override;
|
||||||
virtual bool testAddAltitudeOffset(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CLength &offset = BlackMisc::PhysicalQuantities::CLength::null()) override;
|
virtual bool testAddAltitudeOffset(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CLength &offset = BlackMisc::PhysicalQuantities::CLength::null()) override;
|
||||||
|
virtual QStringList getNetworkPresetValues() const override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! \ingroup clientprovider
|
//! \ingroup clientprovider
|
||||||
|
|||||||
@@ -318,6 +318,11 @@ namespace BlackCore
|
|||||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("setNetworkStatisticsEnable"), enabled);
|
return m_dBusInterface->callDBusRet<bool>(QLatin1String("setNetworkStatisticsEnable"), enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList CContextNetworkProxy::getNetworkPresetValues() const
|
||||||
|
{
|
||||||
|
return m_dBusInterface->callDBusRet<QStringList>(QLatin1String("getNetworkPresetValues"));
|
||||||
|
}
|
||||||
|
|
||||||
void CContextNetworkProxy::testCreateDummyOnlineAtcStations(int number)
|
void CContextNetworkProxy::testCreateDummyOnlineAtcStations(int number)
|
||||||
{
|
{
|
||||||
m_dBusInterface->callDBus(QLatin1String("testCreateDummyOnlineAtcStations"), number);
|
m_dBusInterface->callDBus(QLatin1String("testCreateDummyOnlineAtcStations"), number);
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ namespace BlackCore
|
|||||||
virtual void enableAircraftPartsHistory(bool enabled) override;
|
virtual void enableAircraftPartsHistory(bool enabled) override;
|
||||||
virtual QString getNetworkStatistics(bool reset, const QString &separator) override;
|
virtual QString getNetworkStatistics(bool reset, const QString &separator) override;
|
||||||
virtual bool setNetworkStatisticsEnable(bool enabled) override;
|
virtual bool setNetworkStatisticsEnable(bool enabled) override;
|
||||||
|
virtual QStringList getNetworkPresetValues() const override;
|
||||||
virtual void testCreateDummyOnlineAtcStations(int number) override;
|
virtual void testCreateDummyOnlineAtcStations(int number) override;
|
||||||
virtual void testAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts, bool incremental) override;
|
virtual void testAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts, bool incremental) override;
|
||||||
virtual void testReceivedTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) override;
|
virtual void testReceivedTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) override;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "blackmisc/pq/time.h"
|
#include "blackmisc/pq/time.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QStringList>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
@@ -178,6 +178,11 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
virtual const BlackMisc::Network::CServer &getPresetServer() const = 0;
|
virtual const BlackMisc::Network::CServer &getPresetServer() const = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Get preset values.
|
||||||
|
*/
|
||||||
|
virtual QStringList getPresetValues() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns true if the current ConnectionStatus is in transition, e.g. connecting.
|
* Returns true if the current ConnectionStatus is in transition, e.g. connecting.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -182,6 +182,19 @@ namespace BlackCore
|
|||||||
return detailed ? vd : vs;
|
return detailed ? vd : vs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList CNetworkVatlib::getPresetValues() const
|
||||||
|
{
|
||||||
|
const QStringList v =
|
||||||
|
{
|
||||||
|
m_ownModelString,
|
||||||
|
m_ownLivery,
|
||||||
|
m_ownAircraftIcaoCode.getDesignator(),
|
||||||
|
m_ownAirlineIcaoCode.getVDesignator(),
|
||||||
|
m_ownCallsign.asString()
|
||||||
|
};
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
void CNetworkVatlib::process()
|
void CNetworkVatlib::process()
|
||||||
{
|
{
|
||||||
if (!m_net) { return; }
|
if (!m_net) { return; }
|
||||||
@@ -1712,17 +1725,18 @@ namespace BlackCore
|
|||||||
void CNetworkVatlib::onErrorReceived(VatFsdClient *, VatServerError error, const char *msg, const char *data, void *cbvar)
|
void CNetworkVatlib::onErrorReceived(VatFsdClient *, VatServerError error, const char *msg, const char *data, void *cbvar)
|
||||||
{
|
{
|
||||||
auto *self = cbvar_cast(cbvar);
|
auto *self = cbvar_cast(cbvar);
|
||||||
|
const QString sn = self->m_server.getName();
|
||||||
switch (error)
|
switch (error)
|
||||||
{
|
{
|
||||||
case vatServerErrorCsInUs: CLogMessage(self).error(u"The requested callsign is already taken"); emit self->terminate(); break;
|
case vatServerErrorCsInUs: CLogMessage(self).error(u"The requested callsign is already taken"); emit self->terminate(); break;
|
||||||
case vatServerErrorCallsignInvalid: CLogMessage(self).error(u"The requested callsign is not valid"); emit self->terminate(); break;
|
case vatServerErrorCallsignInvalid: CLogMessage(self).error(u"The requested callsign is not valid"); emit self->terminate(); break;
|
||||||
case vatServerErrorCidInvalid: CLogMessage(self).error(u"Wrong user ID or password, inactive account"); emit self->terminate(); break;
|
case vatServerErrorCidInvalid: CLogMessage(self).error(u"Wrong user ID or password, inactive account. Server: '%1'") << sn; emit self->terminate(); break;
|
||||||
case vatServerErrorRevision: CLogMessage(self).error(u"This server does not support our protocol version"); emit self->terminate(); break;
|
case vatServerErrorRevision: CLogMessage(self).error(u"This server '%1' does not support our protocol version") << sn; emit self->terminate(); break;
|
||||||
case vatServerErrorLevel: CLogMessage(self).error(u"You are not authorized to use the requested pilot rating"); emit self->terminate(); break;
|
case vatServerErrorLevel: CLogMessage(self).error(u"You are not authorized to use the requested pilot rating"); emit self->terminate(); break;
|
||||||
case vatServerErrorServFull: CLogMessage(self).error(u"The server is full"); emit self->terminate(); break;
|
case vatServerErrorServFull: CLogMessage(self).error(u"The server '%1' is full") << sn; emit self->terminate(); break;
|
||||||
case vatServerErrorCsSuspended: CLogMessage(self).error(u"Your user account is suspended"); emit self->terminate(); break;
|
case vatServerErrorCsSuspended: CLogMessage(self).error(u"Your user account is suspended"); emit self->terminate(); break;
|
||||||
case vatServerErrorInvPos: CLogMessage(self).error(u"You are not authorized to use the requested rating"); emit self->terminate(); break;
|
case vatServerErrorInvPos: CLogMessage(self).error(u"You are not authorized to use the requested rating"); emit self->terminate(); break;
|
||||||
case vatServerErrorUnAuth: CLogMessage(self).error(u"This software is not authorized for use on this network %1") << self->m_server.getName(); emit self->terminate(); break;
|
case vatServerErrorUnAuth: CLogMessage(self).error(u"This software is not authorized for use on this network '%1'") << sn; emit self->terminate(); break;
|
||||||
|
|
||||||
case vatServerErrorNone: CLogMessage(self).info(u"OK"); break;
|
case vatServerErrorNone: CLogMessage(self).info(u"OK"); break;
|
||||||
case vatServerErrorSyntax: CLogMessage(self).info(u"Malformed packet: Syntax error: %1") << self->fromFSD(data); break;
|
case vatServerErrorSyntax: CLogMessage(self).info(u"Malformed packet: Syntax error: %1") << self->fromFSD(data); break;
|
||||||
|
|||||||
@@ -78,8 +78,9 @@ namespace BlackCore
|
|||||||
//! \name Network functions
|
//! \name Network functions
|
||||||
//! @{
|
//! @{
|
||||||
virtual bool isConnected() const override { return m_status == vatStatusConnected; }
|
virtual bool isConnected() const override { return m_status == vatStatusConnected; }
|
||||||
virtual const BlackMisc::Network::CServer &getPresetServer() const override { return m_server; }
|
|
||||||
virtual bool isPendingConnection() const override { return m_status == vatStatusConnecting; }
|
virtual bool isPendingConnection() const override { return m_status == vatStatusConnecting; }
|
||||||
|
virtual const BlackMisc::Network::CServer &getPresetServer() const override { return m_server; }
|
||||||
|
virtual QStringList getPresetValues() const override;
|
||||||
virtual void presetLoginMode(LoginMode mode) override;
|
virtual void presetLoginMode(LoginMode mode) override;
|
||||||
virtual void presetServer(const BlackMisc::Network::CServer &server) override;
|
virtual void presetServer(const BlackMisc::Network::CServer &server) override;
|
||||||
virtual void presetCallsign(const BlackMisc::Aviation::CCallsign &callsign) override;
|
virtual void presetCallsign(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user