mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #320 port Network to new vatlib
* CNetworkVatlib * Contexts * Samples
This commit is contained in:
@@ -7,7 +7,7 @@ blackgui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
blackcore {
|
blackcore {
|
||||||
LIBS += -lblackcore -lvatlib
|
LIBS += -lblackcore -lvatlib2
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
contains(BLACK_CONFIG, FSX) {
|
contains(BLACK_CONFIG, FSX) {
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ Client::Client(QObject *parent)
|
|||||||
m_commands["help"] = std::bind(&Client::help, this, _1);
|
m_commands["help"] = std::bind(&Client::help, this, _1);
|
||||||
m_commands["echo"] = std::bind(&Client::echo, this, _1);
|
m_commands["echo"] = std::bind(&Client::echo, this, _1);
|
||||||
m_commands["exit"] = std::bind(&Client::exit, this, _1);
|
m_commands["exit"] = std::bind(&Client::exit, this, _1);
|
||||||
m_commands["getstatusurls"] = std::bind(&Client::getStatusUrlsCmd, this, _1);
|
|
||||||
m_commands["getservers"] = std::bind(&Client::getKnownServersCmd, this, _1);
|
|
||||||
m_commands["setserver"] = std::bind(&Client::presetServerCmd, this, _1);
|
m_commands["setserver"] = std::bind(&Client::presetServerCmd, this, _1);
|
||||||
m_commands["setcallsign"] = std::bind(&Client::presetCallsignCmd, this, _1);
|
m_commands["setcallsign"] = std::bind(&Client::presetCallsignCmd, this, _1);
|
||||||
m_commands["icaocodes"] = std::bind(&Client::presetIcaoCodesCmd, this, _1);
|
m_commands["icaocodes"] = std::bind(&Client::presetIcaoCodesCmd, this, _1);
|
||||||
@@ -133,24 +131,6 @@ void Client::exit(QTextStream &)
|
|||||||
emit quit();
|
emit quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::getStatusUrlsCmd(QTextStream &)
|
|
||||||
{
|
|
||||||
auto urls = m_net->getStatusUrls();
|
|
||||||
for (auto i = urls.begin(); i != urls.end(); ++i)
|
|
||||||
{
|
|
||||||
std::cout << i->toString().toStdString() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::getKnownServersCmd(QTextStream &)
|
|
||||||
{
|
|
||||||
auto servers = m_net->getKnownServers();
|
|
||||||
for (auto i = servers.begin(); i != servers.end(); ++i)
|
|
||||||
{
|
|
||||||
std::cout << i->toFormattedQString().toStdString() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::presetServerCmd(QTextStream &args)
|
void Client::presetServerCmd(QTextStream &args)
|
||||||
{
|
{
|
||||||
QString hostname;
|
QString hostname;
|
||||||
@@ -441,8 +421,7 @@ void Client::atcDisconnected(const BlackMisc::Aviation::CCallsign &callsign)
|
|||||||
std::cout << "ATC_DISCONNECTED " << callsign << std::endl;
|
std::cout << "ATC_DISCONNECTED " << callsign << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::connectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus,
|
void Client::connectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus)
|
||||||
const QString &errorMessage)
|
|
||||||
{
|
{
|
||||||
switch (newStatus)
|
switch (newStatus)
|
||||||
{
|
{
|
||||||
@@ -464,10 +443,6 @@ void Client::connectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldSt
|
|||||||
case BlackCore::INetwork::Connecting: std::cout << " (was CONN_STATUS_CONNECTING)\n"; break;
|
case BlackCore::INetwork::Connecting: std::cout << " (was CONN_STATUS_CONNECTING)\n"; break;
|
||||||
case BlackCore::INetwork::Connected: std::cout << " (was CONN_STATUS_CONNECTED)\n"; break;
|
case BlackCore::INetwork::Connected: std::cout << " (was CONN_STATUS_CONNECTED)\n"; break;
|
||||||
}
|
}
|
||||||
if (!errorMessage.isEmpty())
|
|
||||||
{
|
|
||||||
std::cout << "REASON " << errorMessage.toStdString() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::ipReplyReceived(const QString &ip)
|
void Client::ipReplyReceived(const QString &ip)
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ private: //commands
|
|||||||
void help(QTextStream &args);
|
void help(QTextStream &args);
|
||||||
void echo(QTextStream &args);
|
void echo(QTextStream &args);
|
||||||
void exit(QTextStream &args);
|
void exit(QTextStream &args);
|
||||||
void getStatusUrlsCmd(QTextStream &args);
|
|
||||||
void getKnownServersCmd(QTextStream &args);
|
|
||||||
void presetServerCmd(QTextStream &args);
|
void presetServerCmd(QTextStream &args);
|
||||||
void presetCallsignCmd(QTextStream &args);
|
void presetCallsignCmd(QTextStream &args);
|
||||||
void presetIcaoCodesCmd(QTextStream &args);
|
void presetIcaoCodesCmd(QTextStream &args);
|
||||||
@@ -92,8 +90,7 @@ public slots: //to receive from INetwork
|
|||||||
void atcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &freq,
|
void atcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &freq,
|
||||||
const BlackMisc::Geo::CCoordinateGeodetic &pos, const BlackMisc::PhysicalQuantities::CLength &range);
|
const BlackMisc::Geo::CCoordinateGeodetic &pos, const BlackMisc::PhysicalQuantities::CLength &range);
|
||||||
void atcDisconnected(const BlackMisc::Aviation::CCallsign &callsign);
|
void atcDisconnected(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus,
|
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus);
|
||||||
const QString &errorMessage);
|
|
||||||
void ipReplyReceived(const QString &ip);
|
void ipReplyReceived(const QString &ip);
|
||||||
void freqReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &freq);
|
void freqReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &freq);
|
||||||
void serverReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &server);
|
void serverReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &server);
|
||||||
|
|||||||
@@ -105,11 +105,10 @@ namespace BlackCore
|
|||||||
* Connection status changed
|
* Connection status changed
|
||||||
* \param from old status
|
* \param from old status
|
||||||
* \param to new status
|
* \param to new status
|
||||||
* \param message further details
|
|
||||||
* \remarks If I use the enum, adaptor / interface are not created correctly
|
* \remarks If I use the enum, adaptor / interface are not created correctly
|
||||||
* \see INetwork::ConnectionStatus
|
* \see INetwork::ConnectionStatus
|
||||||
*/
|
*/
|
||||||
void connectionStatusChanged(uint from, uint to, const QString &message);
|
void connectionStatusChanged(uint from, uint to);
|
||||||
|
|
||||||
//! Text messages received (also private chat messages, rfaio channel messages)
|
//! Text messages received (also private chat messages, rfaio channel messages)
|
||||||
void textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
|
void textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Connection status changed
|
* 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)
|
||||||
{
|
{
|
||||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to;
|
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to;
|
||||||
auto fromOld = this->m_currentStatus;
|
auto fromOld = this->m_currentStatus;
|
||||||
@@ -310,15 +310,15 @@ namespace BlackCore
|
|||||||
// send as message
|
// send as message
|
||||||
if (to == INetwork::DisconnectedError)
|
if (to == INetwork::DisconnectedError)
|
||||||
{
|
{
|
||||||
CLogMessage(this).error("Connection status changed from %1 to %2 %3") << INetwork::connectionStatusToString(from) << INetwork::connectionStatusToString(to) << message;
|
CLogMessage(this).error("Connection status changed from %1 to %2") << INetwork::connectionStatusToString(from) << INetwork::connectionStatusToString(to);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Connection status changed from %1 to %2 %3") << INetwork::connectionStatusToString(from) << INetwork::connectionStatusToString(to) << message;
|
CLogMessage(this).info("Connection status changed from %1 to %2") << INetwork::connectionStatusToString(from) << INetwork::connectionStatusToString(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send as own signal
|
// send as own signal
|
||||||
emit this->connectionStatusChanged(from, to, message);
|
emit this->connectionStatusChanged(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ namespace BlackCore
|
|||||||
* \param from old status
|
* \param from old status
|
||||||
* \param to new 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);
|
||||||
|
|
||||||
//! Radio text messages received
|
//! Radio text messages received
|
||||||
void ps_fsdTextMessageReceived(const BlackMisc::Network::CTextMessageList &messages);
|
void ps_fsdTextMessageReceived(const BlackMisc::Network::CTextMessageList &messages);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace BlackCore
|
|||||||
void CContextNetworkProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
void CContextNetworkProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
bool s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
bool s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||||
"connectionStatusChanged", this, SIGNAL(connectionStatusChanged(uint, uint, const QString &)));
|
"connectionStatusChanged", this, SIGNAL(connectionStatusChanged(uint, uint)));
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||||
"changedAtcStationsBooked", this, SIGNAL(changedAtcStationsBooked()));
|
"changedAtcStationsBooked", this, SIGNAL(changedAtcStationsBooked()));
|
||||||
|
|||||||
@@ -144,18 +144,6 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
virtual bool isPendingConnection() const = 0;
|
virtual bool isPendingConnection() const = 0;
|
||||||
|
|
||||||
/*!
|
|
||||||
* Returns a list of URLs where network status data can be found.
|
|
||||||
* To obtain the status, one of these URLs should be picked at random.
|
|
||||||
*/
|
|
||||||
virtual QList<QUrl> getStatusUrls() const = 0;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Returns a list of known servers which may be connected to.
|
|
||||||
* Not all servers may be accepting connections; consult the CServer::isAcceptingConnections method.
|
|
||||||
*/
|
|
||||||
virtual BlackMisc::Network::CServerList getKnownServers() const = 0;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
//! \name Network slots
|
//! \name Network slots
|
||||||
@@ -478,7 +466,7 @@ namespace BlackCore
|
|||||||
/*!
|
/*!
|
||||||
* The status of our connection has changed.
|
* The status of our connection has changed.
|
||||||
*/
|
*/
|
||||||
void connectionStatusChanged(ConnectionStatus oldStatus, ConnectionStatus newStatus, QString errorMessage = "");
|
void connectionStatusChanged(ConnectionStatus oldStatus, ConnectionStatus newStatus);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* We received a reply to one of our pings.
|
* We received a reply to one of our pings.
|
||||||
@@ -490,7 +478,7 @@ namespace BlackCore
|
|||||||
* We received a reply to one of our queries.
|
* We received a reply to one of our queries.
|
||||||
* \sa sendCapabilitiesQuery
|
* \sa sendCapabilitiesQuery
|
||||||
*/
|
*/
|
||||||
void capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 capabilitiesFlags);
|
void capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, int capabilitiesFlags);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* We received a reply to one of our queries.
|
* We received a reply to one of our queries.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
|||||||
#define BLACKCORE_NETWORK_VATLIB_H
|
#define BLACKCORE_NETWORK_VATLIB_H
|
||||||
|
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include <vatlib/vatlib.h>
|
#include <vatlib/vatlib2.h>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
@@ -33,16 +33,10 @@ namespace BlackCore
|
|||||||
virtual ~CNetworkVatlib();
|
virtual ~CNetworkVatlib();
|
||||||
|
|
||||||
//! \copydoc INetwork::isConnected()
|
//! \copydoc INetwork::isConnected()
|
||||||
virtual bool isConnected() const override { return m_status == Cvatlib_Network::connStatus_Connected; }
|
virtual bool isConnected() const override { return m_status == vatStatusConnected; }
|
||||||
|
|
||||||
//! \copydoc INetwork::pendingConnection()
|
//! \copydoc INetwork::pendingConnection()
|
||||||
virtual bool isPendingConnection() const override { return m_status == Cvatlib_Network::connStatus_Connecting; }
|
virtual bool isPendingConnection() const override { return m_status == vatStatusConnecting; }
|
||||||
|
|
||||||
//! \copydoc INetwork::getStatusUrls()
|
|
||||||
virtual QList<QUrl> getStatusUrls() const override;
|
|
||||||
|
|
||||||
//! \copydoc INetwork::getKnownServers()
|
|
||||||
virtual BlackMisc::Network::CServerList getKnownServers() const override;
|
|
||||||
|
|
||||||
// Network slots
|
// Network slots
|
||||||
//! \copydoc INetwork::presetLoginMode
|
//! \copydoc INetwork::presetLoginMode
|
||||||
@@ -93,29 +87,31 @@ namespace BlackCore
|
|||||||
void sendAircraftInfo(const BlackMisc::Aviation::CCallsign &callsign);
|
void sendAircraftInfo(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
private: //shimlib callbacks
|
private: //shimlib callbacks
|
||||||
static void onConnectionStatusChanged(Cvatlib_Network *, Cvatlib_Network::connStatus oldStatus, Cvatlib_Network::connStatus newStatus, void *cbvar);
|
static void onConnectionStatusChanged(VatSessionID, VatConnectionStatus oldStatus, VatConnectionStatus newStatus, void *cbvar);
|
||||||
static void onTextMessageReceived(Cvatlib_Network *, const char *from, const char *to, const char *msg, void *cbvar);
|
static void onTextMessageReceived(VatSessionID, const char *from, const char *to, const char *msg, void *cbvar);
|
||||||
static void onRadioMessageReceived(Cvatlib_Network *, const char *from, INT numFreq, INT *freqList, const char *msg, void *cbvar);
|
|
||||||
static void onControllerDisconnected(Cvatlib_Network *, const char *callsign, void *cbvar);
|
static void onRadioMessageReceived(VatSessionID, const char *from, int freqCount, int *freqList, const char *message, void *cbvar);
|
||||||
static void onInterimPilotPositionUpdate(Cvatlib_Network *, const char *callsign, Cvatlib_Network::PilotPosUpdate pos, void *cbvar);
|
|
||||||
static void onAtcPositionUpdate(Cvatlib_Network *, const char *callsign, Cvatlib_Network::ATCPosUpdate pos, void *cbvar);
|
static void onControllerDisconnected(VatSessionID, const char *callsign, void *cbvar);
|
||||||
static void onKicked(Cvatlib_Network *, const char *reason, void *cbvar);
|
static void onInterimPilotPositionUpdate(VatSessionID, const char *callsign, const VatPilotPosition *position, void *cbvar);
|
||||||
static void onPong(Cvatlib_Network *, const char *callsign, INT elapsedTime, void *cbvar);
|
static void onAtcPositionUpdate(VatSessionID, const char *callsign, const VatAtcPosition *pos, void *cbvar);
|
||||||
static void onMetarReceived(Cvatlib_Network *, const char *data, void *cbvar);
|
static void onKicked(VatSessionID, const char *reason, void *cbvar);
|
||||||
static void onInfoQueryRequestReceived(Cvatlib_Network *, const char *callsign, Cvatlib_Network::infoQuery type, const char *data, void *cbvar);
|
static void onPong(VatSessionID, const char *sender, double elapsedTime, void *cbvar);
|
||||||
static void onInfoQueryReplyReceived(Cvatlib_Network *, const char *callsign, Cvatlib_Network::infoQuery type, const char *data, const char *data2, void *cbvar);
|
static void onMetarReceived(VatSessionID, const char *data, void *cbvar);
|
||||||
static void onCapabilitiesReplyReceived(Cvatlib_Network *, const char *callsign, const char **keysValues, void *cbvar);
|
static void onInfoQueryRequestReceived(VatSessionID, const char *callsign, VatInfoQueryType type, const char *data, void *cbvar);
|
||||||
static void onAtisReplyReceived(Cvatlib_Network *, const char *callsign, Cvatlib_Network::atisLineType type, const char *data, void *cbvar);
|
static void onInfoQueryReplyReceived(VatSessionID, const char *callsign, VatInfoQueryType type, const char *data, const char *data2, void *cbvar);
|
||||||
static void onFlightPlanReceived(Cvatlib_Network *, const char *callsign, Cvatlib_Network::FlightPlan fp, void *cbvar);
|
static void onCapabilitiesReplyReceived(VatSessionID, const char *callsign, int capabilityFlags, void *cbvar);
|
||||||
static void onTemperatureDataReceived(Cvatlib_Network *, Cvatlib_Network::TempLayer layers[4], INT pressure, void *cbvar);
|
static void onAtisReplyReceived(VatSessionID, const char *callsign, const VatControllerAtis *atis, void *cbvar);
|
||||||
static void onErrorReceived(Cvatlib_Network *, Cvatlib_Network::error type, const char *msg, const char *data, void *cbvar);
|
static void onFlightPlanReceived(VatSessionID, const char *callsign, const VatFlightPlan *fp, void *cbvar);
|
||||||
static void onWindDataReceived(Cvatlib_Network *, Cvatlib_Network::WindLayer layers[4], void *cbvar);
|
static void onTemperatureDataReceived(VatSessionID, const VatTempLayer layer[4], int pressure, void *cbvar);
|
||||||
static void onCloudDataReceived(Cvatlib_Network *, Cvatlib_Network::CloudLayer layers[2], Cvatlib_Network::StormLayer storm, float vis, void *cbvar);
|
static void onWindDataReceived(VatSessionID, const VatWindLayer layer[4], void *cbvar);
|
||||||
static void onPilotDisconnected(Cvatlib_Network *, const char *callsign, void *cbvar);
|
static void onCloudDataReceived(VatSessionID, const VatCloudLayer cloudLayer[2], VatThunderStormLayer thunderStormLayer, float visibility, void *cbvar);
|
||||||
static void onPilotInfoRequestReceived(Cvatlib_Network *, const char *callsign, void *cbvar);
|
static void onErrorReceived(VatSessionID, VatServerError error, const char *msg, const char *data, void *cbvar);
|
||||||
static void onPilotInfoReceived(Cvatlib_Network *, const char *callsign, const char **keysValues, void *cbvar);
|
static void onPilotDisconnected(VatSessionID, const char *callsign, void *cbvar);
|
||||||
static void onPilotPositionUpdate(Cvatlib_Network *, const char *callsign, Cvatlib_Network::PilotPosUpdate pos, void *cbvar);
|
static void onPilotInfoRequestReceived(VatSessionID, const char *callsign, void *cbvar);
|
||||||
static void onCustomPacketReceived(Cvatlib_Network *, const char *callsign, const char *packetId, const char **data, INT dataSize, void *cbvar);
|
static void onPilotInfoReceived(VatSessionID, const char *callsign, const VatAircraftInfo *aircraftInfo, void *cbvar);
|
||||||
|
static void onPilotPositionUpdate(VatSessionID, const char *callsign, const VatPilotPosition *position, void *cbvar);
|
||||||
|
static void onCustomPacketReceived(VatSessionID, const char *callsign, const char *packetId, const char **data, int dataSize, void *cbvar);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray toFSD(QString qstr) const;
|
QByteArray toFSD(QString qstr) const;
|
||||||
@@ -125,9 +121,9 @@ namespace BlackCore
|
|||||||
QStringList fromFSD(const char **cstrArray, int size) const;
|
QStringList fromFSD(const char **cstrArray, int size) const;
|
||||||
|
|
||||||
void initializeSession();
|
void initializeSession();
|
||||||
void changeConnectionStatus(Cvatlib_Network::connStatus newStatus, QString errorMessage = "");
|
void changeConnectionStatus(VatConnectionStatus newStatus);
|
||||||
bool isDisconnected() const { return m_status != Cvatlib_Network::connStatus_Connecting && m_status != Cvatlib_Network::connStatus_Connected; }
|
bool isDisconnected() const { return m_status != vatStatusConnecting && m_status != vatStatusConnected; }
|
||||||
QString getSocketError() const;
|
static void networkErrorHandler(const char *message);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void process();
|
void process();
|
||||||
@@ -142,18 +138,17 @@ namespace BlackCore
|
|||||||
struct VatlibQScopedPointerDeleter
|
struct VatlibQScopedPointerDeleter
|
||||||
{
|
{
|
||||||
//! Called by QScopedPointer destructor
|
//! Called by QScopedPointer destructor
|
||||||
static void cleanup(Cvatlib_Network *net) { if (net) net->Destroy(); }
|
static void cleanup(VatSessionID session) { if (session) Vat_DestroyNetworkSession(session); }
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Cvatlib_Network, VatlibQScopedPointerDeleter> m_net;
|
QScopedPointer<PCSBClient, VatlibQScopedPointerDeleter> m_net;
|
||||||
LoginMode m_loginMode;
|
LoginMode m_loginMode;
|
||||||
Cvatlib_Network::connStatus m_status;
|
VatConnectionStatus m_status;
|
||||||
BlackMisc::Network::CServer m_server;
|
BlackMisc::Network::CServer m_server;
|
||||||
BlackMisc::Aviation::CCallsign m_callsign;
|
BlackMisc::Aviation::CCallsign m_callsign;
|
||||||
BlackMisc::Aviation::CAircraftIcao m_icaoCode;
|
BlackMisc::Aviation::CAircraftIcao m_icaoCode;
|
||||||
BlackMisc::Aviation::CAircraft m_ownAircraft; // not using callsign, user, or icao parts of this member because they can't be changed when connected
|
BlackMisc::Aviation::CAircraft m_ownAircraft; // not using callsign, user, or icao parts of this member because they can't be changed when connected
|
||||||
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CInformationMessage> m_atisParts;
|
|
||||||
|
|
||||||
QTimer m_processingTimer;
|
QTimer m_processingTimer;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
|
|||||||
@@ -191,12 +191,11 @@ namespace BlackGui
|
|||||||
this->m_timestampBookedStationsChanged = QDateTime::currentDateTimeUtc();
|
this->m_timestampBookedStationsChanged = QDateTime::currentDateTimeUtc();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAtcStationComponent::ps_connectionStatusChanged(uint from, uint to, const QString &message)
|
void CAtcStationComponent::ps_connectionStatusChanged(uint from, uint to)
|
||||||
{
|
{
|
||||||
INetwork::ConnectionStatus fromStatus = static_cast<INetwork::ConnectionStatus>(from);
|
INetwork::ConnectionStatus fromStatus = static_cast<INetwork::ConnectionStatus>(from);
|
||||||
INetwork::ConnectionStatus toStatus = static_cast<INetwork::ConnectionStatus>(to);
|
INetwork::ConnectionStatus toStatus = static_cast<INetwork::ConnectionStatus>(to);
|
||||||
Q_UNUSED(fromStatus);
|
Q_UNUSED(fromStatus);
|
||||||
Q_UNUSED(message);
|
|
||||||
if (INetwork::isDisconnectedStatus(toStatus))
|
if (INetwork::isDisconnectedStatus(toStatus))
|
||||||
{
|
{
|
||||||
this->ui->tvp_AtcStationsOnline->clear();
|
this->ui->tvp_AtcStationsOnline->clear();
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace BlackGui
|
|||||||
void ps_changedAtcStationsOnline();
|
void ps_changedAtcStationsOnline();
|
||||||
|
|
||||||
//! Connection status has been changed
|
//! Connection status has been changed
|
||||||
void ps_connectionStatusChanged(uint from, uint to, const QString &message);
|
void ps_connectionStatusChanged(uint from, uint to);
|
||||||
|
|
||||||
//! Request dummy ATC online stations
|
//! Request dummy ATC online stations
|
||||||
void ps_testCreateDummyOnlineAtcStations(int number);
|
void ps_testCreateDummyOnlineAtcStations(int number);
|
||||||
|
|||||||
@@ -113,12 +113,11 @@ namespace BlackGui
|
|||||||
Q_UNUSED(paused);
|
Q_UNUSED(paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoBarStatusComponent::ps_onNetworkConnectionChanged(uint from, uint to, const QString &message)
|
void CInfoBarStatusComponent::ps_onNetworkConnectionChanged(uint from, uint to)
|
||||||
{
|
{
|
||||||
INetwork::ConnectionStatus fromStatus = static_cast<INetwork::ConnectionStatus>(from);
|
INetwork::ConnectionStatus fromStatus = static_cast<INetwork::ConnectionStatus>(from);
|
||||||
INetwork::ConnectionStatus toStatus = static_cast<INetwork::ConnectionStatus>(to);
|
INetwork::ConnectionStatus toStatus = static_cast<INetwork::ConnectionStatus>(to);
|
||||||
Q_UNUSED(fromStatus);
|
Q_UNUSED(fromStatus);
|
||||||
Q_UNUSED(message);
|
|
||||||
|
|
||||||
switch (toStatus)
|
switch (toStatus)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace BlackGui
|
|||||||
void ps_onSimulatorStatusChanged(bool connected, bool running, bool paused);
|
void ps_onSimulatorStatusChanged(bool connected, bool running, bool paused);
|
||||||
|
|
||||||
//! Network connection has been changed
|
//! Network connection has been changed
|
||||||
void ps_onNetworkConnectionChanged(uint from, uint to, const QString &message);
|
void ps_onNetworkConnectionChanged(uint from, uint to);
|
||||||
|
|
||||||
//! Context menu requested
|
//! Context menu requested
|
||||||
void ps_customAudioContextMenuRequested(const QPoint &position);
|
void ps_customAudioContextMenuRequested(const QPoint &position);
|
||||||
|
|||||||
@@ -129,13 +129,12 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainKeypadAreaComponent::ps_connectionStatusChanged(uint from, uint to, const QString &message)
|
void CMainKeypadAreaComponent::ps_connectionStatusChanged(uint from, uint to)
|
||||||
{
|
{
|
||||||
INetwork::ConnectionStatus statusFrom = static_cast<INetwork::ConnectionStatus>(from);
|
INetwork::ConnectionStatus statusFrom = static_cast<INetwork::ConnectionStatus>(from);
|
||||||
INetwork::ConnectionStatus statusTo = static_cast<INetwork::ConnectionStatus>(to);
|
INetwork::ConnectionStatus statusTo = static_cast<INetwork::ConnectionStatus>(to);
|
||||||
|
|
||||||
Q_UNUSED(statusFrom);
|
Q_UNUSED(statusFrom);
|
||||||
Q_UNUSED(message);
|
|
||||||
|
|
||||||
// Connected button
|
// Connected button
|
||||||
if (statusTo == INetwork::Connected)
|
if (statusTo == INetwork::Connected)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace BlackGui
|
|||||||
void ps_buttonSelected();
|
void ps_buttonSelected();
|
||||||
|
|
||||||
//! \copydoc BlackCore::IContextNetwork::connectionStatusChanged
|
//! \copydoc BlackCore::IContextNetwork::connectionStatusChanged
|
||||||
void ps_connectionStatusChanged(uint from, uint to, const QString &message);
|
void ps_connectionStatusChanged(uint from, uint to);
|
||||||
|
|
||||||
//! Command line entered
|
//! Command line entered
|
||||||
void ps_commandEntered();
|
void ps_commandEntered();
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
VFR = 0, //!< Visual flight rules
|
VFR = 0, //!< Visual flight rules
|
||||||
IFR, //!< Instrument flight rules
|
IFR, //!< Instrument flight rules
|
||||||
SVFR //!< Special VFR (reserved for ATC use)
|
SVFR, //!< Special VFR (reserved for ATC use),
|
||||||
|
DVFR //!< Defense VFR
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int MaxRemarksLength = 150; //!< Max remarks length
|
static const int MaxRemarksLength = 150; //!< Max remarks length
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ void SwiftGuiStd::ps_onConnectionTerminated()
|
|||||||
/*
|
/*
|
||||||
* Connection status changed
|
* Connection status changed
|
||||||
*/
|
*/
|
||||||
void SwiftGuiStd::ps_onConnectionStatusChanged(uint /** from **/, uint to, const QString & /* message */)
|
void SwiftGuiStd::ps_onConnectionStatusChanged(uint /** from **/, uint to)
|
||||||
{
|
{
|
||||||
this->updateGuiStatusInformation();
|
this->updateGuiStatusInformation();
|
||||||
INetwork::ConnectionStatus newStatus = static_cast<INetwork::ConnectionStatus>(to);
|
INetwork::ConnectionStatus newStatus = static_cast<INetwork::ConnectionStatus>(to);
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ private slots:
|
|||||||
* \param from old status, as uint so it is compliant with DBus
|
* \param from old status, as uint so it is compliant with DBus
|
||||||
* \param to new status, as uint so it is compliant with DBus
|
* \param to new status, as uint so it is compliant with DBus
|
||||||
*/
|
*/
|
||||||
void ps_onConnectionStatusChanged(uint from, uint to, const QString &message);
|
void ps_onConnectionStatusChanged(uint from, uint to);
|
||||||
|
|
||||||
//
|
//
|
||||||
// GUI related slots
|
// GUI related slots
|
||||||
|
|||||||
Reference in New Issue
Block a user