mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-04 16:22:52 +08:00
INetwork builds up the ATIS as it is received, line-by-line, keeping this implementation detail more encapsulated
refs #81
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "blackmisc/nwserverlist.h"
|
||||
#include "blackmisc/nwtextmessagelist.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/avinformationmessage.h"
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
@@ -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
|
||||
|
||||
@@ -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 **/)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <QTimer>
|
||||
#include <QTextCodec>
|
||||
#include <QByteArray>
|
||||
#include <QMap>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -115,6 +116,7 @@ namespace BlackCore
|
||||
QScopedPointer<Cvatlib_Network, VatlibQScopedPointerDeleter> m_net;
|
||||
Cvatlib_Network::connStatus m_status;
|
||||
BlackMisc::Network::CServer m_server;
|
||||
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CInformationMessage> m_atisParts;
|
||||
|
||||
QTimer m_processingTimer;
|
||||
QTimer m_updateTimer;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user