mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Remove deprecated custom packet API from INetwork
Usage of this API was already discouraged, since all official VATSIM packet handling should be in vatlib itself or for custom defined packets in CNetworkVatlib. If a new custom packet needs to be added, it should go into CNetworkVatlib directly and made available via normal API methods to abstract the packets custom nature. The fact that custom packets exist, should be kept internal. However, a debug message is raised in case of an unknown custom packet in order to allow detection and debugging. refs #870
This commit is contained in:
committed by
Mathew Sutcliffe
parent
7fde8eef07
commit
ba1122533f
@@ -75,7 +75,6 @@ namespace BlackSample
|
||||
connect(m_net, &INetwork::icaoCodesReplyReceived, this, &Client::icaoCodesReplyReceived);
|
||||
connect(m_net, &INetwork::pongReceived, this, &Client::pongReceived);
|
||||
connect(m_net, &INetwork::textMessagesReceived, this, &Client::textMessagesReceived);
|
||||
connect(m_net, &INetwork::customPacketReceived, this, &Client::customPacketReceived);
|
||||
|
||||
connect(this, &Client::presetServer, m_net, &INetwork::presetServer);
|
||||
connect(this, &Client::presetCallsign, m_net, &INetwork::presetCallsign);
|
||||
@@ -97,7 +96,6 @@ namespace BlackSample
|
||||
connect(this, &Client::setOwnAircraftCockpit, COwnAircraftProviderDummy::instance(), &COwnAircraftProviderDummy::updateCockpit);
|
||||
connect(this, &Client::sendPing, m_net, &INetwork::sendPing);
|
||||
connect(this, &Client::sendMetarQuery, m_net, &INetwork::sendMetarQuery);
|
||||
connect(this, &Client::sendCustomPacket, m_net, &INetwork::sendCustomPacket);
|
||||
|
||||
using namespace std::placeholders;
|
||||
m_commands["help"] = std::bind(&Client::help, this, _1);
|
||||
@@ -127,7 +125,6 @@ namespace BlackSample
|
||||
m_commands["setcockpit"] = std::bind(&Client::setOwnAircraftCockpitCmd, this, _1);
|
||||
m_commands["ping"] = std::bind(&Client::sendPingCmd, this, _1);
|
||||
m_commands["metar"] = std::bind(&Client::sendMetarQueryCmd, this, _1);
|
||||
m_commands["custom"] = std::bind(&Client::sendCustomPacketCmd, this, _1);
|
||||
}
|
||||
|
||||
void Client::command(QString line)
|
||||
@@ -429,21 +426,6 @@ namespace BlackSample
|
||||
emit sendMetarQuery(airportICAO);
|
||||
}
|
||||
|
||||
void Client::sendCustomPacketCmd(QTextStream &args)
|
||||
{
|
||||
QString callsign;
|
||||
QString packetId;
|
||||
args >> callsign >> packetId;
|
||||
QStringList data;
|
||||
while (!args.atEnd())
|
||||
{
|
||||
QString field;
|
||||
args >> field;
|
||||
data.push_back(field);
|
||||
}
|
||||
emit sendCustomPacket(callsign, packetId, data);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/************ Slots to receive signals from INetwork *************/
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -103,7 +103,6 @@ namespace BlackSample
|
||||
void setOwnAircraftCockpitCmd(QTextStream &args);
|
||||
void sendPingCmd(QTextStream &args);
|
||||
void sendMetarQueryCmd(QTextStream &args);
|
||||
void sendCustomPacketCmd(QTextStream &args);
|
||||
|
||||
signals: //to send to INetwork
|
||||
//! \name Signals to INetwork
|
||||
@@ -131,7 +130,6 @@ namespace BlackSample
|
||||
const BlackMisc::Aviation::CTransponder &xpdr, const QString &originator);
|
||||
void sendPing(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void sendMetarQuery(const QString &airportICAO);
|
||||
void sendCustomPacket(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data);
|
||||
//! @}
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -251,13 +251,6 @@ namespace BlackCore
|
||||
//! @{
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/*!
|
||||
* Send a custom packet.
|
||||
* \pre Network must be connected when calling this function.
|
||||
* \deprecated As a short cut you can use this slot directly, but it is better to implement the encoding in INetwork and add a new signal.
|
||||
*/
|
||||
virtual void sendCustomPacket(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data) = 0;
|
||||
|
||||
/*!
|
||||
* Send a FSInn custom packet.
|
||||
* \details FSIPI(R) queries, some example data below:
|
||||
@@ -517,13 +510,6 @@ namespace BlackCore
|
||||
*/
|
||||
void textMessageSent(const BlackMisc::Network::CTextMessage &sentMessage);
|
||||
|
||||
/*!
|
||||
* We received a custom packet.
|
||||
* \deprecated As a short cut you can use this signal directly, but it is better to implement the decoding in INetwork and add a new signal.
|
||||
* \sa CNetworkVatlib::customPacketDispatcher
|
||||
*/
|
||||
void customPacketReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data);
|
||||
|
||||
/*!
|
||||
* We received a FSInn custom packet.
|
||||
*/
|
||||
|
||||
@@ -80,7 +80,6 @@ namespace BlackCore
|
||||
m_tokenBucket(10, CTime(5, CTimeUnit::s()), 1)
|
||||
{
|
||||
connect(this, &CNetworkVatlib::terminate, this, &INetwork::terminateConnection, Qt::QueuedConnection);
|
||||
connect(this, &INetwork::customPacketReceived, this, &CNetworkVatlib::customPacketDispatcher);
|
||||
|
||||
Q_ASSERT_X(Vat_GetVersion() == VAT_LIBVATLIB_VERSION, "swift.network", "Wrong vatlib shared library installed");
|
||||
|
||||
@@ -949,7 +948,7 @@ namespace BlackCore
|
||||
|
||||
void CNetworkVatlib::onCustomPacketReceived(VatSessionID, const char *callsign, const char *packetId, const char **data, int dataSize, void *cbvar)
|
||||
{
|
||||
emit cbvar_cast(cbvar)->customPacketReceived(cbvar_cast(cbvar)->fromFSD(callsign), cbvar_cast(cbvar)->fromFSD(packetId), cbvar_cast(cbvar)->fromFSD(data, dataSize));
|
||||
emit cbvar_cast(cbvar)->customPacketDispatcher(cbvar_cast(cbvar)->fromFSD(callsign), cbvar_cast(cbvar)->fromFSD(packetId), cbvar_cast(cbvar)->fromFSD(data, dataSize));
|
||||
}
|
||||
|
||||
void CNetworkVatlib::customPacketDispatcher(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data)
|
||||
@@ -981,6 +980,10 @@ namespace BlackCore
|
||||
emit customFSInnPacketReceived(callsign, data[1], data[2], data[7], data[8]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).warning("Unknown custom packet from %1 - id: %2") << callsign.toQString() << packetId;
|
||||
}
|
||||
}
|
||||
|
||||
void CNetworkVatlib::onMetarReceived(VatSessionID, const char *data, void *cbvar)
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace BlackCore
|
||||
virtual void sendRealNameQuery(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void sendIpQuery() override;
|
||||
virtual void sendServerQuery(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void sendCustomPacket(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data) override;
|
||||
virtual void sendCustomFsinnQuery(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void sendCustomFsinnReponse(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void broadcastAircraftConfig(const QJsonObject &config) override;
|
||||
@@ -175,6 +174,7 @@ namespace BlackCore
|
||||
static QString convertToUnicodeEscaped(const QString &str);
|
||||
static VatSimType convertToSimType(BlackMisc::Simulation::CSimulatorPluginInfo &simInfo);
|
||||
static void networkLogHandler(SeverityLevel severity, const char *message);
|
||||
void sendCustomPacket(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data);
|
||||
|
||||
inline QString defaultModelString()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user