mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
refs #452 updated VATSIM readers
* use CSimulatedAircraft * changed signatures from CAircraftIcaoData (removed) to CAircraftIcaoCode * Formatting
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a8e8e5527a
commit
a8a26bc281
@@ -35,6 +35,10 @@ namespace BlackCore
|
|||||||
//! Read / re-read bookings
|
//! Read / re-read bookings
|
||||||
void readInBackgroundThread();
|
void readInBackgroundThread();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! Bookings have been read and converted to BlackMisc::Aviation::CAtcStationList
|
||||||
|
void dataRead(const BlackMisc::Aviation::CAtcStationList &bookedStations);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Bookings have been read
|
//! Bookings have been read
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -47,9 +51,6 @@ namespace BlackCore
|
|||||||
QString m_serviceUrl; //!< URL of the service
|
QString m_serviceUrl; //!< URL of the service
|
||||||
QNetworkAccessManager *m_networkManager = nullptr;
|
QNetworkAccessManager *m_networkManager = nullptr;
|
||||||
|
|
||||||
signals:
|
|
||||||
//! Bookings have been read and converted to BlackMisc::Aviation::CAtcStationList
|
|
||||||
void dataRead(const BlackMisc::Aviation::CAtcStationList &bookedStations);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using namespace BlackMisc;
|
|||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Geo;
|
using namespace BlackMisc::Geo;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
@@ -33,7 +34,7 @@ namespace BlackCore
|
|||||||
this->connect(this->m_updateTimer, &QTimer::timeout, this, &CVatsimDataFileReader::ps_read);
|
this->connect(this->m_updateTimer, &QTimer::timeout, this, &CVatsimDataFileReader::ps_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftList CVatsimDataFileReader::getAircraft() const
|
CSimulatedAircraftList CVatsimDataFileReader::getAircraft() const
|
||||||
{
|
{
|
||||||
QReadLocker rl(&this->m_lock);
|
QReadLocker rl(&this->m_lock);
|
||||||
return this->m_aircraft;
|
return this->m_aircraft;
|
||||||
@@ -70,7 +71,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
CUserList CVatsimDataFileReader::getPilotsForCallsigns(const CCallsignSet &callsigns)
|
CUserList CVatsimDataFileReader::getPilotsForCallsigns(const CCallsignSet &callsigns)
|
||||||
{
|
{
|
||||||
return this->getAircraft().findByCallsigns(callsigns).transform(Predicates::MemberTransform(&CAircraft::getPilot));
|
return this->getAircraft().findByCallsigns(callsigns).transform(Predicates::MemberTransform(&CSimulatedAircraft::getPilot));
|
||||||
}
|
}
|
||||||
|
|
||||||
CUserList CVatsimDataFileReader::getPilotsForCallsign(const CCallsign &callsign)
|
CUserList CVatsimDataFileReader::getPilotsForCallsign(const CCallsign &callsign)
|
||||||
@@ -79,10 +80,16 @@ namespace BlackCore
|
|||||||
return this->getPilotsForCallsigns(callsigns);
|
return this->getPilotsForCallsigns(callsigns);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftIcaoData CVatsimDataFileReader::getIcaoInfo(const CCallsign &callsign)
|
CAirlineIcaoCode CVatsimDataFileReader::getAirlineIcaoCode(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
CAircraft aircraft = this->getAircraft().findFirstByCallsign(callsign);
|
CSimulatedAircraft aircraft = this->getAircraft().findFirstByCallsign(callsign);
|
||||||
return aircraft.getIcaoInfo();
|
return aircraft.getAirlineIcaoCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
CAircraftIcaoCode CVatsimDataFileReader::getAircraftIcaoCode(const CCallsign &callsign)
|
||||||
|
{
|
||||||
|
CSimulatedAircraft aircraft = this->getAircraft().findFirstByCallsign(callsign);
|
||||||
|
return aircraft.getAircraftIcaoCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
CVoiceCapabilities CVatsimDataFileReader::getVoiceCapabilityForCallsign(const CCallsign &callsign)
|
CVoiceCapabilities CVatsimDataFileReader::getVoiceCapabilityForCallsign(const CCallsign &callsign)
|
||||||
@@ -98,7 +105,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVatsimDataFileReader::updateWithVatsimDataFileData(CAircraft &aircraftToBeUdpated) const
|
void CVatsimDataFileReader::updateWithVatsimDataFileData(CSimulatedAircraft &aircraftToBeUdpated) const
|
||||||
{
|
{
|
||||||
this->getAircraft().updateWithVatsimDataFileData(aircraftToBeUdpated);
|
this->getAircraft().updateWithVatsimDataFileData(aircraftToBeUdpated);
|
||||||
}
|
}
|
||||||
@@ -187,7 +194,7 @@ namespace BlackCore
|
|||||||
CServerList voiceServers;
|
CServerList voiceServers;
|
||||||
CServerList fsdServers;
|
CServerList fsdServers;
|
||||||
CAtcStationList atcStations;
|
CAtcStationList atcStations;
|
||||||
CAircraftList aircraft;
|
CSimulatedAircraftList aircraft;
|
||||||
QMap<CCallsign, CVoiceCapabilities> voiceCapabilities;
|
QMap<CCallsign, CVoiceCapabilities> voiceCapabilities;
|
||||||
QDateTime updateTimestampFromFile;
|
QDateTime updateTimestampFromFile;
|
||||||
|
|
||||||
@@ -258,7 +265,7 @@ namespace BlackCore
|
|||||||
double groundspeed = clientPartsMap["groundspeed"].toDouble();
|
double groundspeed = clientPartsMap["groundspeed"].toDouble();
|
||||||
CAircraftSituation situation(position, altitude);
|
CAircraftSituation situation(position, altitude);
|
||||||
situation.setGroundspeed(CSpeed(groundspeed, CSpeedUnit::kts()));
|
situation.setGroundspeed(CSpeed(groundspeed, CSpeedUnit::kts()));
|
||||||
CAircraft currentAircraft(user.getCallsign().getStringAsSet(), user, situation);
|
CSimulatedAircraft currentAircraft(user.getCallsign().getStringAsSet(), user, situation);
|
||||||
|
|
||||||
QString aircraftIcaoCode = clientPartsMap["planned_aircraft"];
|
QString aircraftIcaoCode = clientPartsMap["planned_aircraft"];
|
||||||
if (!aircraftIcaoCode.isEmpty())
|
if (!aircraftIcaoCode.isEmpty())
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
#include "blackcoreexport.h"
|
#include "blackcoreexport.h"
|
||||||
#include "blackmisc/threadedreader.h"
|
#include "blackmisc/threadedreader.h"
|
||||||
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
#include "blackmisc/aviation/atcstationlist.h"
|
#include "blackmisc/aviation/atcstationlist.h"
|
||||||
#include "blackmisc/aviation/aircraftlist.h"
|
#include "blackmisc/aviation/callsignset.h"
|
||||||
#include "blackmisc/network/serverlist.h"
|
#include "blackmisc/network/serverlist.h"
|
||||||
#include "blackmisc/network/userlist.h"
|
#include "blackmisc/network/userlist.h"
|
||||||
#include "blackmisc/network/voicecapabilities.h"
|
#include "blackmisc/network/voicecapabilities.h"
|
||||||
#include "blackmisc/aviation/callsignset.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@@ -39,7 +39,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Get aircraft
|
//! Get aircraft
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Aviation::CAircraftList getAircraft() const;
|
BlackMisc::Simulation::CSimulatedAircraftList getAircraft() const;
|
||||||
|
|
||||||
//! Get ATC station
|
//! Get ATC station
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -85,9 +85,13 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Network::CUserList getPilotsForCallsign(const BlackMisc::Aviation::CCallsign &callsign);
|
BlackMisc::Network::CUserList getPilotsForCallsign(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! ICAO info for callsign
|
//! Aircraft ICAO info for callsign
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Aviation::CAircraftIcaoData getIcaoInfo(const BlackMisc::Aviation::CCallsign &callsign);
|
BlackMisc::Aviation::CAircraftIcaoCode getAircraftIcaoCode(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
|
//! Airline ICAO info for callsign
|
||||||
|
//! \threadsafe
|
||||||
|
BlackMisc::Aviation::CAirlineIcaoCode getAirlineIcaoCode(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! Voice capability for callsign
|
//! Voice capability for callsign
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -95,11 +99,15 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Update aircraft with VATSIM aircraft data from data file
|
//! Update aircraft with VATSIM aircraft data from data file
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
void updateWithVatsimDataFileData(BlackMisc::Aviation::CAircraft &aircraftToBeUdpated) const;
|
void updateWithVatsimDataFileData(BlackMisc::Simulation::CSimulatedAircraft &aircraftToBeUdpated) const;
|
||||||
|
|
||||||
//! Start reading in own thread
|
//! Start reading in own thread
|
||||||
void readInBackgroundThread();
|
void readInBackgroundThread();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! Data have been read
|
||||||
|
void dataRead(int lines);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Data have been read, parse VATSIM file
|
//! Data have been read, parse VATSIM file
|
||||||
void ps_parseVatsimFile(QNetworkReply *nwReply);
|
void ps_parseVatsimFile(QNetworkReply *nwReply);
|
||||||
@@ -111,10 +119,10 @@ namespace BlackCore
|
|||||||
QNetworkAccessManager *m_networkManager = nullptr;
|
QNetworkAccessManager *m_networkManager = nullptr;
|
||||||
QStringList m_serviceUrls; //!< URL of the service
|
QStringList m_serviceUrls; //!< URL of the service
|
||||||
int m_currentUrlIndex;
|
int m_currentUrlIndex;
|
||||||
BlackMisc::Network::CServerList m_voiceServers;
|
BlackMisc::Network::CServerList m_voiceServers;
|
||||||
BlackMisc::Network::CServerList m_fsdServers;
|
BlackMisc::Network::CServerList m_fsdServers;
|
||||||
BlackMisc::Aviation::CAtcStationList m_atcStations;
|
BlackMisc::Aviation::CAtcStationList m_atcStations;
|
||||||
BlackMisc::Aviation::CAircraftList m_aircraft;
|
BlackMisc::Simulation::CSimulatedAircraftList m_aircraft;
|
||||||
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Network::CVoiceCapabilities> m_voiceCapabilities;
|
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Network::CVoiceCapabilities> m_voiceCapabilities;
|
||||||
|
|
||||||
//! Split line and assign values to their corresponding attribute names
|
//! Split line and assign values to their corresponding attribute names
|
||||||
@@ -133,9 +141,6 @@ namespace BlackCore
|
|||||||
//! Get current section
|
//! Get current section
|
||||||
static Section currentLineToSection(const QString ¤tLine);
|
static Section currentLineToSection(const QString ¤tLine);
|
||||||
|
|
||||||
signals:
|
|
||||||
//! Data have been read
|
|
||||||
void dataRead(int lines);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user