mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +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;
|
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)
|
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 freqQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &freq);
|
||||||
void serverQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &hostname);
|
void serverQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &hostname);
|
||||||
void atcQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, bool isATC);
|
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 nameQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &realname);
|
||||||
void capabilitiesQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags);
|
void capabilitiesQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags);
|
||||||
void kicked(const QString &msg);
|
void kicked(const QString &msg);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "blackmisc/nwserverlist.h"
|
#include "blackmisc/nwserverlist.h"
|
||||||
#include "blackmisc/nwtextmessagelist.h"
|
#include "blackmisc/nwtextmessagelist.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
|
#include "blackmisc/avinformationmessage.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
@@ -94,7 +95,7 @@ namespace BlackCore
|
|||||||
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 atcQueryReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, bool isATC);
|
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);
|
void metarReceived(const QString &data);
|
||||||
|
|
||||||
// Aircraft
|
// Aircraft
|
||||||
|
|||||||
@@ -594,7 +594,18 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CNetworkVatlib::onAtisReplyReceived(Cvatlib_Network *, const char *callsign, Cvatlib_Network::atisLineType lineType, const char *data, void *cbvar)
|
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 **/)
|
void CNetworkVatlib::onTemperatureDataReceived(Cvatlib_Network *, Cvatlib_Network::TempLayer /** layers **/ [4], INT /** pressure **/, void * /** cbvar **/)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -115,6 +116,7 @@ namespace BlackCore
|
|||||||
QScopedPointer<Cvatlib_Network, VatlibQScopedPointerDeleter> m_net;
|
QScopedPointer<Cvatlib_Network, VatlibQScopedPointerDeleter> m_net;
|
||||||
Cvatlib_Network::connStatus m_status;
|
Cvatlib_Network::connStatus m_status;
|
||||||
BlackMisc::Network::CServer m_server;
|
BlackMisc::Network::CServer m_server;
|
||||||
|
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CInformationMessage> m_atisParts;
|
||||||
|
|
||||||
QTimer m_processingTimer;
|
QTimer m_processingTimer;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
|
|||||||
@@ -97,6 +97,16 @@ namespace BlackMisc
|
|||||||
this->m_message = message;
|
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
|
* \brief Type as string
|
||||||
* \return
|
* \return
|
||||||
@@ -109,6 +119,12 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
InformationType getType() const { return this->m_type; }
|
InformationType getType() const { return this->m_type; }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Set type
|
||||||
|
* \param type
|
||||||
|
*/
|
||||||
|
void setType(InformationType type) { this->m_type = type; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Timestamp
|
* \brief Timestamp
|
||||||
* \return
|
* \return
|
||||||
|
|||||||
Reference in New Issue
Block a user