diff --git a/samples/cliclient/client.cpp b/samples/cliclient/client.cpp index dcc95eca5..7e5a9fa96 100644 --- a/samples/cliclient/client.cpp +++ b/samples/cliclient/client.cpp @@ -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 *************/ /****************************************************************************/ diff --git a/samples/cliclient/client.h b/samples/cliclient/client.h index d69bcb3c8..6232b69d7 100644 --- a/samples/cliclient/client.h +++ b/samples/cliclient/client.h @@ -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: diff --git a/src/blackcore/network.h b/src/blackcore/network.h index 6e994d9e5..a9d9f705a 100644 --- a/src/blackcore/network.h +++ b/src/blackcore/network.h @@ -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. */ diff --git a/src/blackcore/vatsim/networkvatlib.cpp b/src/blackcore/vatsim/networkvatlib.cpp index 43d973db1..c4790301b 100644 --- a/src/blackcore/vatsim/networkvatlib.cpp +++ b/src/blackcore/vatsim/networkvatlib.cpp @@ -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) diff --git a/src/blackcore/vatsim/networkvatlib.h b/src/blackcore/vatsim/networkvatlib.h index 25470cdbe..ba46d455b 100644 --- a/src/blackcore/vatsim/networkvatlib.h +++ b/src/blackcore/vatsim/networkvatlib.h @@ -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() {