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