mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Network VATLIB refactoring
* use qit64 for timestamp related integers * use valueInteger for PQ integer values (rounding)
This commit is contained in:
@@ -955,10 +955,10 @@ namespace BlackCore
|
|||||||
this->updateAircraftInRange(callsign, vm);
|
this->updateAircraftInRange(callsign, vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAirspaceMonitor::onAircraftConfigReceived(const CCallsign &callsign, const QJsonObject &jsonObject, int currentOffset)
|
void CAirspaceMonitor::onAircraftConfigReceived(const CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
||||||
this->storeAircraftParts(callsign, jsonObject, currentOffset);
|
this->storeAircraftParts(callsign, jsonObject, currentOffsetMs);
|
||||||
|
|
||||||
// update client capability
|
// update client capability
|
||||||
CClient client = this->getClientOrDefaultForCallsign(callsign);
|
CClient client = this->getClientOrDefaultForCallsign(callsign);
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ namespace BlackCore
|
|||||||
void onReceivedAtcBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
|
void onReceivedAtcBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
|
||||||
void onReadUnchangedAtcBookings();
|
void onReadUnchangedAtcBookings();
|
||||||
void onReceivedVatsimDataFile();
|
void onReceivedVatsimDataFile();
|
||||||
void onAircraftConfigReceived(const BlackMisc::Aviation::CCallsign &callsign, const QJsonObject &jsonObject, int currentOffset);
|
void onAircraftConfigReceived(const BlackMisc::Aviation::CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs);
|
||||||
void onAircraftInterimUpdateReceived(const BlackMisc::Aviation::CAircraftSituation &situation);
|
void onAircraftInterimUpdateReceived(const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus);
|
void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ namespace BlackCore
|
|||||||
/*!
|
/*!
|
||||||
* We received an aircraft config packet.
|
* We received an aircraft config packet.
|
||||||
*/
|
*/
|
||||||
void aircraftConfigPacketReceived(const BlackMisc::Aviation::CCallsign &callsign, const QJsonObject &incremental, int currentOffsetTime);
|
void aircraftConfigPacketReceived(const BlackMisc::Aviation::CCallsign &callsign, const QJsonObject &incremental, qint64 currentOffsetTimeMs);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* We received a raw message for debugging purposes
|
* We received a raw message for debugging purposes
|
||||||
|
|||||||
@@ -209,14 +209,14 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// Normal / Stealth mode
|
// Normal / Stealth mode
|
||||||
VatPilotPosition pos;
|
VatPilotPosition pos;
|
||||||
pos.altitudePressure = myAircraft.getPressureAltitude().value(CLengthUnit::ft());
|
pos.altitudePressure = myAircraft.getPressureAltitude().valueInteger(CLengthUnit::ft());
|
||||||
pos.altitudeTrue = myAircraft.getAltitude().value(CLengthUnit::ft());
|
pos.altitudeTrue = myAircraft.getAltitude().valueInteger(CLengthUnit::ft());
|
||||||
pos.heading = myAircraft.getHeading().value(CAngleUnit::deg());
|
pos.heading = myAircraft.getHeading().value(CAngleUnit::deg());
|
||||||
pos.pitch = myAircraft.getPitch().value(CAngleUnit::deg());
|
pos.pitch = myAircraft.getPitch().value(CAngleUnit::deg());
|
||||||
pos.bank = myAircraft.getBank().value(CAngleUnit::deg());
|
pos.bank = myAircraft.getBank().value(CAngleUnit::deg());
|
||||||
pos.latitude = myAircraft.latitude().value(CAngleUnit::deg());
|
pos.latitude = myAircraft.latitude().value(CAngleUnit::deg());
|
||||||
pos.longitude = myAircraft.longitude().value(CAngleUnit::deg());
|
pos.longitude = myAircraft.longitude().value(CAngleUnit::deg());
|
||||||
pos.groundSpeed = myAircraft.getGroundSpeed().value(CSpeedUnit::kts());
|
pos.groundSpeed = myAircraft.getGroundSpeed().valueInteger(CSpeedUnit::kts());
|
||||||
pos.rating = vatPilotRatingUnknown;
|
pos.rating = vatPilotRatingUnknown;
|
||||||
pos.transponderCode = static_cast<qint16>(myAircraft.getTransponderCode());
|
pos.transponderCode = static_cast<qint16>(myAircraft.getTransponderCode());
|
||||||
pos.transponderMode = vatTransponderModeStandby;
|
pos.transponderMode = vatTransponderModeStandby;
|
||||||
@@ -240,7 +240,7 @@ namespace BlackCore
|
|||||||
if (m_loginMode == LoginNormal)
|
if (m_loginMode == LoginNormal)
|
||||||
{
|
{
|
||||||
VatInterimPilotPosition pos;
|
VatInterimPilotPosition pos;
|
||||||
pos.altitudeTrue = myAircraft.getAltitude().value(CLengthUnit::ft());
|
pos.altitudeTrue = myAircraft.getAltitude().valueInteger(CLengthUnit::ft());
|
||||||
pos.heading = myAircraft.getHeading().value(CAngleUnit::deg());
|
pos.heading = myAircraft.getHeading().value(CAngleUnit::deg());
|
||||||
pos.pitch = myAircraft.getPitch().value(CAngleUnit::deg());
|
pos.pitch = myAircraft.getPitch().value(CAngleUnit::deg());
|
||||||
pos.bank = myAircraft.getBank().value(CAngleUnit::deg());
|
pos.bank = myAircraft.getBank().value(CAngleUnit::deg());
|
||||||
@@ -535,8 +535,8 @@ namespace BlackCore
|
|||||||
// if this is really required, I need to group by message
|
// if this is really required, I need to group by message
|
||||||
// currently I send individual messages
|
// currently I send individual messages
|
||||||
freqsVec.clear();
|
freqsVec.clear();
|
||||||
freqsVec.push_back(message.getFrequency().valueRounded(CFrequencyUnit::kHz(), 0));
|
freqsVec.push_back(message.getFrequency().valueInteger(CFrequencyUnit::kHz()));
|
||||||
Vat_SendRadioMessage(m_net.data(), freqsVec.data(), freqsVec.size(), toFSD(message.getMessage()));
|
Vat_SendRadioMessage(m_net.data(), freqsVec.data(), static_cast<unsigned int>(freqsVec.size()), toFSD(message.getMessage()));
|
||||||
emit this->textMessageSent(message);
|
emit this->textMessageSent(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -637,7 +637,7 @@ namespace BlackCore
|
|||||||
vatlibFP.fuelMins = timeParts[CTime::Minutes];
|
vatlibFP.fuelMins = timeParts[CTime::Minutes];
|
||||||
vatlibFP.remarks = remarksTemp = toFSD(remarks);
|
vatlibFP.remarks = remarksTemp = toFSD(remarks);
|
||||||
vatlibFP.route = routeTemp = toFSD(route);
|
vatlibFP.route = routeTemp = toFSD(route);
|
||||||
vatlibFP.trueCruisingSpeed = flightPlan.getCruiseTrueAirspeed().valueRounded(CSpeedUnit::kts());
|
vatlibFP.trueCruisingSpeed = flightPlan.getCruiseTrueAirspeed().valueInteger(CSpeedUnit::kts());
|
||||||
switch (flightPlan.getFlightRules())
|
switch (flightPlan.getFlightRules())
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -906,7 +906,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! we set a dynamically updating offset time here
|
//! we set a dynamically updating offset time here
|
||||||
situation.setCurrentUtcTime();
|
situation.setCurrentUtcTime();
|
||||||
const int offsetMs = self->receivedPositionFixTsAndGetOffsetTime(situation.getCallsign(), situation.getMSecsSinceEpoch());
|
const qint64 offsetMs = self->receivedPositionFixTsAndGetOffsetTime(situation.getCallsign(), situation.getMSecsSinceEpoch());
|
||||||
situation.setTimeOffsetMs(offsetMs);
|
situation.setTimeOffsetMs(offsetMs);
|
||||||
|
|
||||||
CTransponder::TransponderMode mode = CTransponder::StateStandby;
|
CTransponder::TransponderMode mode = CTransponder::StateStandby;
|
||||||
@@ -964,7 +964,7 @@ namespace BlackCore
|
|||||||
const QJsonObject config = doc.object().value("config").toObject();
|
const QJsonObject config = doc.object().value("config").toObject();
|
||||||
if (config.empty()) { return; }
|
if (config.empty()) { return; }
|
||||||
|
|
||||||
const int offsetTimeMs = self->currentOffsetTime(callsign);
|
const qint64 offsetTimeMs = self->currentOffsetTime(callsign);
|
||||||
emit self->aircraftConfigPacketReceived(callsign, config, offsetTimeMs);
|
emit self->aircraftConfigPacketReceived(callsign, config, offsetTimeMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1253,7 +1253,7 @@ namespace BlackCore
|
|||||||
auto *self = cbvar_cast(cbvar);
|
auto *self = cbvar_cast(cbvar);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case vatClientQueryFreq: emit self->frequencyReplyReceived(self->fromFSD(callsign), CFrequency(self->fromFSD(data).toFloat(), CFrequencyUnit::MHz())); break;
|
case vatClientQueryFreq: emit self->frequencyReplyReceived(self->fromFSD(callsign), CFrequency(self->fromFSD(data).toDouble(), CFrequencyUnit::MHz())); break;
|
||||||
case vatClientQueryServer: emit self->serverReplyReceived(self->fromFSD(callsign), self->fromFSD(data)); break;
|
case vatClientQueryServer: emit self->serverReplyReceived(self->fromFSD(callsign), self->fromFSD(data)); break;
|
||||||
case vatClientQueryAtc: emit self->atcReplyReceived(CCallsign(self->fromFSD(data2), CCallsign::Atc), *data == 'Y'); break;
|
case vatClientQueryAtc: emit self->atcReplyReceived(CCallsign(self->fromFSD(data2), CCallsign::Atc), *data == 'Y'); break;
|
||||||
case vatClientQueryName: emit self->realNameReplyReceived(self->fromFSD(callsign), self->fromFSD(data)); break;
|
case vatClientQueryName: emit self->realNameReplyReceived(self->fromFSD(callsign), self->fromFSD(data)); break;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace BlackCore
|
|||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CNetworkVatlib();
|
virtual ~CNetworkVatlib() override;
|
||||||
|
|
||||||
//! \copydoc INetwork::getLibraryInfo
|
//! \copydoc INetwork::getLibraryInfo
|
||||||
const QString &getLibraryInfo(bool detailed) const override;
|
const QString &getLibraryInfo(bool detailed) const override;
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ namespace BlackMisc
|
|||||||
emit this->addedAircraftParts(callsign, parts);
|
emit this->addedAircraftParts(callsign, parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRemoteAircraftProvider::storeAircraftParts(const CCallsign &callsign, const QJsonObject &jsonObject, int currentOffset)
|
void CRemoteAircraftProvider::storeAircraftParts(const CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs)
|
||||||
{
|
{
|
||||||
const CSimulatedAircraft remoteAircraft(this->getAircraftInRangeForCallsign(callsign));
|
const CSimulatedAircraft remoteAircraft(this->getAircraftInRangeForCallsign(callsign));
|
||||||
const bool isFull = jsonObject.value(CAircraftParts::attributeNameIsFullJson()).toBool();
|
const bool isFull = jsonObject.value(CAircraftParts::attributeNameIsFullJson()).toBool();
|
||||||
@@ -400,7 +400,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
// make sure in any case right time and correct details
|
// make sure in any case right time and correct details
|
||||||
parts.setCurrentUtcTime();
|
parts.setCurrentUtcTime();
|
||||||
parts.setTimeOffsetMs(currentOffset);
|
parts.setTimeOffsetMs(currentOffsetMs);
|
||||||
parts.setPartsDetails(CAircraftParts::FSDAircraftParts);
|
parts.setPartsDetails(CAircraftParts::FSDAircraftParts);
|
||||||
|
|
||||||
// store part history (parts always absolute)
|
// store part history (parts always absolute)
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
//! @{
|
//! @{
|
||||||
void storeAircraftParts(const Aviation::CCallsign &callsign, const Aviation::CAircraftParts &parts, bool removeOutdated);
|
void storeAircraftParts(const Aviation::CCallsign &callsign, const Aviation::CAircraftParts &parts, bool removeOutdated);
|
||||||
void storeAircraftParts(const Aviation::CCallsign &callsign, const QJsonObject &jsonObject, int currentOffset);
|
void storeAircraftParts(const Aviation::CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs);
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Guess situation "on ground" and update model's CG if applicable
|
//! Guess situation "on ground" and update model's CG if applicable
|
||||||
|
|||||||
Reference in New Issue
Block a user