diff --git a/samples/cli_client/client.cpp b/samples/cli_client/client.cpp index 7e9f25334..5cd46c637 100644 --- a/samples/cli_client/client.cpp +++ b/samples/cli_client/client.cpp @@ -365,9 +365,9 @@ void Client::atcQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsig std::cout << "ATC_REPLY " << callsign << (isATC ? " yes" : " no") << std::endl; } -void Client::atisQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &data) +void Client::atisQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atis) { - std::cout << "ATIS_REPLY " << callsign << " " << data.toStdString() << std::endl; + std::cout << "ATIS_REPLY " << callsign << " " << atis << std::endl; } void Client::nameQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &realname) diff --git a/samples/cli_client/client.h b/samples/cli_client/client.h index 4d891a2fb..328db0062 100644 --- a/samples/cli_client/client.h +++ b/samples/cli_client/client.h @@ -90,7 +90,7 @@ public slots: //to receive from INetwork void freqQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &freq); void serverQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &hostname); void atcQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, bool isATC); - void atisQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &data); + void atisQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atis); void nameQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &realname); void capabilitiesQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags); void kicked(const QString &msg); diff --git a/src/blackcore/network.h b/src/blackcore/network.h index 5356622a4..51cb8108b 100644 --- a/src/blackcore/network.h +++ b/src/blackcore/network.h @@ -18,6 +18,7 @@ #include "blackmisc/nwserverlist.h" #include "blackmisc/nwtextmessagelist.h" #include "blackmisc/statusmessagelist.h" +#include "blackmisc/avinformationmessage.h" #include #include #include @@ -94,7 +95,7 @@ namespace BlackCore const BlackMisc::Geo::CCoordinateGeodetic &pos, const BlackMisc::PhysicalQuantities::CLength &range); void atcDisconnected(const BlackMisc::Aviation::CCallsign &callsign); void atcQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, bool isATC); - void atisQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &data); + void atisQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atis); void metarReceived(const QString &data); // Aircraft diff --git a/src/blackcore/network_vatlib.cpp b/src/blackcore/network_vatlib.cpp index 7723f601a..846a0a032 100644 --- a/src/blackcore/network_vatlib.cpp +++ b/src/blackcore/network_vatlib.cpp @@ -594,7 +594,18 @@ namespace BlackCore void CNetworkVatlib::onAtisReplyReceived(Cvatlib_Network *, const char *callsign, Cvatlib_Network::atisLineType lineType, const char *data, void *cbvar) { - emit cbvar_cast(cbvar)->atisQueryReplyReceived(cbvar_cast(cbvar)->fromFSD(callsign), cbvar_cast(cbvar)->fromFSD(data)); + auto &atis = cbvar_cast(cbvar)->m_atisParts[cbvar_cast(cbvar)->fromFSD(callsign)]; + + if (lineType == Cvatlib_Network::atisLineType_LineCount) + { + atis.setType(CInformationMessage::ATIS); + emit cbvar_cast(cbvar)->atisQueryReplyReceived(cbvar_cast(cbvar)->fromFSD(callsign), atis); + cbvar_cast(cbvar)->m_atisParts.remove(cbvar_cast(cbvar)->fromFSD(callsign)); + } + else + { + atis.appendMessage("\n" + cbvar_cast(cbvar)->fromFSD(data)); + } } void CNetworkVatlib::onTemperatureDataReceived(Cvatlib_Network *, Cvatlib_Network::TempLayer /** layers **/ [4], INT /** pressure **/, void * /** cbvar **/) diff --git a/src/blackcore/network_vatlib.h b/src/blackcore/network_vatlib.h index 6f60f00e1..edda31c13 100644 --- a/src/blackcore/network_vatlib.h +++ b/src/blackcore/network_vatlib.h @@ -17,6 +17,7 @@ #include #include #include +#include namespace BlackCore { @@ -115,6 +116,7 @@ namespace BlackCore QScopedPointer m_net; Cvatlib_Network::connStatus m_status; BlackMisc::Network::CServer m_server; + QMap m_atisParts; QTimer m_processingTimer; QTimer m_updateTimer; diff --git a/src/blackmisc/avinformationmessage.h b/src/blackmisc/avinformationmessage.h index 3986601f8..f04484299 100644 --- a/src/blackmisc/avinformationmessage.h +++ b/src/blackmisc/avinformationmessage.h @@ -97,6 +97,16 @@ namespace BlackMisc this->m_message = message; } + /*! + * \brief Append message part + * \param messagePart + */ + void appendMessage(const QString &messagePart) + { + this->m_receivedTimestamp = QDateTime::currentDateTimeUtc(); + this->m_message.append(messagePart); + } + /*! * \brief Type as string * \return @@ -109,6 +119,12 @@ namespace BlackMisc */ InformationType getType() const { return this->m_type; } + /*! + * \brief Set type + * \param type + */ + void setType(InformationType type) { this->m_type = type; } + /*! * \brief Timestamp * \return