mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
refactor: Remove outdated and unused IVAO FSD packets
This commit is contained in:
@@ -170,8 +170,6 @@ add_library(core SHARED
|
||||
fsd/pong.h
|
||||
fsd/rehost.cpp
|
||||
fsd/rehost.h
|
||||
fsd/revbclientparts.cpp
|
||||
fsd/revbclientparts.h
|
||||
fsd/serializer.cpp
|
||||
fsd/serializer.h
|
||||
fsd/servererror.cpp
|
||||
|
||||
@@ -90,8 +90,6 @@ namespace swift::core
|
||||
connect(m_fsdClient, &CFSDClient::serverResponseReceived, this, &CAirspaceMonitor::onServerReplyReceived);
|
||||
connect(m_fsdClient, &CFSDClient::aircraftConfigReceived, this, &CAirspaceMonitor::onAircraftConfigReceived);
|
||||
connect(m_fsdClient, &CFSDClient::connectionStatusChanged, this, &CAirspaceMonitor::onConnectionStatusChanged);
|
||||
connect(m_fsdClient, &CFSDClient::revbAircraftConfigReceived, this,
|
||||
&CAirspaceMonitor::onRevBAircraftConfigReceived);
|
||||
|
||||
Q_ASSERT_X(sApp && sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing data reader");
|
||||
|
||||
@@ -1439,69 +1437,6 @@ namespace swift::core
|
||||
this->updateAircraftInRange(callsign, vm);
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::onRevBAircraftConfigReceived(const CCallsign &callsign, const QString &config,
|
||||
qint64 currentOffsetMs)
|
||||
{
|
||||
|
||||
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||
SWIFT_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
||||
if (callsign.isEmpty()) { return; }
|
||||
|
||||
unsigned long pp = 0;
|
||||
bool ok {};
|
||||
pp = config.toULong(&ok, 10);
|
||||
|
||||
bool gear = (pp & 1U);
|
||||
bool landLight = (pp & 2U);
|
||||
bool navLight = (pp & 4U);
|
||||
bool strobeLight = (pp & 8U);
|
||||
bool beaconLight = (pp & 16U);
|
||||
bool taxiLight = (pp & 32U);
|
||||
bool engine1Running = (pp & 64U);
|
||||
bool engine2Running = (pp & 128U);
|
||||
bool engine3Running = (pp & 256U);
|
||||
bool engine4Running = (pp & 512U);
|
||||
|
||||
// CLogMessage(this).info(u"taxiLight %1 landLight %2 beaconLight %3 strobeLight %4 gear %5") << taxiLight <<
|
||||
// landLight << beaconLight << strobeLight << gear; CLogMessage(this).info(u"engine1Running %1 engine2Running %2
|
||||
// engine3Running %3 engine4Running %4") << engine1Running << engine2Running << engine3Running <<
|
||||
// engine4Running;
|
||||
|
||||
CAircraftParts aircraftparts;
|
||||
aircraftparts.setGearDown(gear);
|
||||
|
||||
CAircraftLights lights;
|
||||
lights.setStrobeOn(strobeLight);
|
||||
lights.setLandingOn(landLight);
|
||||
lights.setTaxiOn(taxiLight);
|
||||
lights.setBeaconOn(beaconLight);
|
||||
lights.setNavOn(navLight);
|
||||
aircraftparts.setLights(lights);
|
||||
|
||||
CAircraftEngineList engines;
|
||||
engines.initEngines(4, false);
|
||||
engines.setEngineOn(1, engine1Running);
|
||||
engines.setEngineOn(2, engine2Running);
|
||||
engines.setEngineOn(3, engine3Running);
|
||||
engines.setEngineOn(4, engine4Running);
|
||||
aircraftparts.setEngines(engines);
|
||||
|
||||
// make sure in any case right time and correct details
|
||||
aircraftparts.setCurrentUtcTime();
|
||||
aircraftparts.setTimeOffsetMs(currentOffsetMs);
|
||||
aircraftparts.setPartsDetails(CAircraftParts::FSDAircraftParts);
|
||||
|
||||
// store parts
|
||||
this->storeAircraftParts(callsign, aircraftparts, true);
|
||||
|
||||
// update client capability
|
||||
CClient client = this->getClientOrDefaultForCallsign(callsign);
|
||||
client.setUserCallsign(callsign); // make valid by setting a callsign
|
||||
if (client.hasCapability(CClient::FsdWithAircraftConfig)) { return; }
|
||||
client.addCapability(CClient::FsdWithAircraftConfig);
|
||||
this->setOtherClient(client);
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::onAircraftConfigReceived(const CCallsign &callsign, const QJsonObject &jsonObject,
|
||||
qint64 currentOffsetMs)
|
||||
{
|
||||
|
||||
@@ -473,8 +473,6 @@ namespace swift::core
|
||||
const QString &aircraftIcao, const QString &airlineIcao);
|
||||
void onConnectionStatusChanged(swift::misc::network::CConnectionStatus oldStatus,
|
||||
swift::misc::network::CConnectionStatus newStatus);
|
||||
void onRevBAircraftConfigReceived(const swift::misc::aviation::CCallsign &callsign, const QString &config,
|
||||
qint64 currentOffsetMs);
|
||||
};
|
||||
} // namespace swift::core
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "core/fsd/planeinformationfsinn.h"
|
||||
#include "core/fsd/pong.h"
|
||||
#include "core/fsd/rehost.h"
|
||||
#include "core/fsd/revbclientparts.h"
|
||||
#include "core/fsd/serializer.h"
|
||||
#include "core/fsd/servererror.h"
|
||||
#include "core/fsd/textmessage.h"
|
||||
@@ -1078,16 +1077,6 @@ namespace swift::core::fsd
|
||||
|
||||
// Euroscope
|
||||
m_messageTypeMapping["SIMDATA"] = MessageType::EuroscopeSimData;
|
||||
|
||||
// IVAO only
|
||||
// Ref: https://github.com/DemonRem/X-IvAP/blob/1b0a14880532a0f5c8fe84be44e462c6892a5596/src/XIvAp/FSDprotocol.h
|
||||
m_messageTypeMapping["!R"] = MessageType::RegistrationInfo;
|
||||
m_messageTypeMapping["-MD"] = MessageType::RevBClientParts;
|
||||
m_messageTypeMapping["-PD"] = MessageType::RevBPilotDescription; // not handled, to avoid error messages
|
||||
|
||||
// IVAO parts
|
||||
// https://discordapp.com/channels/539048679160676382/695961646992195644/707915838845485187
|
||||
// https://github.com/swift-project/pilotclient/wiki/Knowledgebase-Simulation:-IVAO-parts
|
||||
}
|
||||
|
||||
void CFSDClient::handleAtcDataUpdate(const QStringList &tokens)
|
||||
@@ -1620,23 +1609,6 @@ namespace swift::core::fsd
|
||||
if (serverError.isFatalError()) { disconnectFromServer(); }
|
||||
}
|
||||
|
||||
void CFSDClient::handleRevBClientPartsPacket(const QStringList &tokens)
|
||||
{
|
||||
CLogMessage(this).debug(u"handleRevBClientPartsPacket");
|
||||
|
||||
const RevBClientParts RevBClientParts = RevBClientParts::fromTokens(tokens);
|
||||
const CCallsign callsign(RevBClientParts.sender(), CCallsign::Aircraft);
|
||||
|
||||
const bool inRange = isAircraftInRange(callsign);
|
||||
|
||||
if (!inRange) { return; } // sort out all broadcasts we DO NOT NEED
|
||||
if (!getSetupForServer().receiveAircraftParts()) { return; }
|
||||
|
||||
const qint64 offsetTimeMs = currentOffsetTime(callsign);
|
||||
emit revbAircraftConfigReceived(RevBClientParts.sender(), RevBClientParts.m_partsval1, offsetTimeMs);
|
||||
CLogMessage(this).debug(u"Set Config at %1 ") << offsetTimeMs;
|
||||
}
|
||||
|
||||
void CFSDClient::handleRehost(const QStringList &tokens)
|
||||
{
|
||||
const Rehost rehost = Rehost::fromTokens(tokens);
|
||||
@@ -2283,9 +2255,7 @@ namespace swift::core::fsd
|
||||
case MessageType::AddPilot:
|
||||
case MessageType::ServerHeartbeat:
|
||||
case MessageType::ProController:
|
||||
case MessageType::ClientIdentification:
|
||||
case MessageType::RegistrationInfo:
|
||||
case MessageType::RevBPilotDescription: break;
|
||||
case MessageType::ClientIdentification: break;
|
||||
|
||||
// handled ones
|
||||
case MessageType::AtcDataUpdate: handleAtcDataUpdate(tokens); break;
|
||||
@@ -2308,7 +2278,6 @@ namespace swift::core::fsd
|
||||
case MessageType::ServerError: handleServerError(tokens); break;
|
||||
case MessageType::TextMessage: handleTextMessage(tokens); break;
|
||||
case MessageType::PilotClientCom: handleCustomPilotPacket(tokens); break;
|
||||
case MessageType::RevBClientParts: handleRevBClientPartsPacket(tokens); break;
|
||||
case MessageType::VisualPilotDataUpdate:
|
||||
case MessageType::VisualPilotDataPeriodic:
|
||||
case MessageType::VisualPilotDataStopped: handleVisualPilotDataUpdate(tokens, messageType); break;
|
||||
|
||||
@@ -313,7 +313,6 @@ namespace swift::core::fsd
|
||||
void planeInformationFsinnReceived(const swift::misc::aviation::CCallsign &callsign,
|
||||
const QString &airlineIcaoDesignator, const QString &aircraftDesignator,
|
||||
const QString &combinedAircraftType, const QString &modelString);
|
||||
void revbAircraftConfigReceived(const QString &sender, const QString &config, qint64 currentOffsetTimeMs);
|
||||
void muteRequestReceived(bool mute);
|
||||
|
||||
//! @}
|
||||
@@ -474,7 +473,6 @@ namespace swift::core::fsd
|
||||
#ifdef SWIFT_VATSIM_SUPPORT
|
||||
void handleFsdIdentification(const QStringList &tokens);
|
||||
#endif
|
||||
void handleRevBClientPartsPacket(const QStringList &tokens);
|
||||
void handleRehost(const QStringList &tokens);
|
||||
void handleMute(const QStringList &tokens);
|
||||
|
||||
|
||||
@@ -42,11 +42,8 @@ enum class MessageType
|
||||
Pong,
|
||||
ServerError,
|
||||
ServerHeartbeat,
|
||||
RegistrationInfo, // IVAO only
|
||||
TextMessage,
|
||||
PilotClientCom,
|
||||
RevBClientParts, // IVAO only
|
||||
RevBPilotDescription, // -PD IVAO only not handled in swift
|
||||
Rehost,
|
||||
Mute,
|
||||
};
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2020 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "core/fsd/revbclientparts.h"
|
||||
|
||||
#include "core/fsd/serializer.h"
|
||||
#include "misc/logmessage.h"
|
||||
|
||||
namespace swift::core::fsd
|
||||
{
|
||||
RevBClientParts::RevBClientParts(const QString &sender, const QString &partsval1, const QString &partsval2,
|
||||
const QString &partsval3)
|
||||
: MessageBase(sender), m_partsval1(partsval1), m_partsval2(partsval2), m_partsval3(partsval3)
|
||||
|
||||
{}
|
||||
|
||||
QStringList RevBClientParts::toTokens() const
|
||||
{
|
||||
QStringList tokens;
|
||||
tokens.push_back(m_sender);
|
||||
tokens.push_back(m_partsval1);
|
||||
tokens.push_back(m_partsval2);
|
||||
tokens.push_back(m_partsval3);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
RevBClientParts RevBClientParts::fromTokens(const QStringList &tokens)
|
||||
{
|
||||
if (tokens.size() < 4)
|
||||
{
|
||||
swift::misc::CLogMessage(static_cast<RevBClientParts *>(nullptr)).debug(u"Wrong number of arguments.");
|
||||
return {};
|
||||
}
|
||||
return { tokens[0], tokens[1], tokens[2], tokens[3] };
|
||||
}
|
||||
|
||||
} // namespace swift::core::fsd
|
||||
@@ -1,58 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2020 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFT_CORE_FSD_REVBCLIENTPARTS_H
|
||||
#define SWIFT_CORE_FSD_REVBCLIENTPARTS_H
|
||||
|
||||
#include "core/fsd/enums.h"
|
||||
#include "core/fsd/messagebase.h"
|
||||
|
||||
namespace swift::core::fsd
|
||||
{
|
||||
//! This packet is used to translate client’s parts from RevB IVAO -MD.
|
||||
//! -MDMDN0104:262396:262396:262396
|
||||
//!
|
||||
class SWIFT_CORE_EXPORT RevBClientParts : public MessageBase
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
RevBClientParts(const QString &sender, const QString &partsval1, const QString &partsval2,
|
||||
const QString &partsval3);
|
||||
|
||||
//! Message converted to tokens
|
||||
QStringList toTokens() const;
|
||||
|
||||
//! Construct from tokens
|
||||
static RevBClientParts fromTokens(const QStringList &tokens);
|
||||
|
||||
//! PDU identifier
|
||||
static QString pdu() { return "-MD"; }
|
||||
|
||||
//! @{
|
||||
//! Properties
|
||||
ClientQueryType m_queryType = ClientQueryType::Unknown;
|
||||
QStringList m_queryData;
|
||||
QString m_partsval1;
|
||||
QString m_partsval2;
|
||||
QString m_partsval3;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
RevBClientParts() = default;
|
||||
};
|
||||
|
||||
//! Equal to operator
|
||||
inline bool operator==(const RevBClientParts &lhs, const RevBClientParts &rhs)
|
||||
{
|
||||
return lhs.sender() == rhs.sender() && lhs.m_partsval1 == rhs.m_partsval1 &&
|
||||
lhs.m_partsval2 == rhs.m_partsval2 && lhs.m_partsval3 == rhs.m_partsval3;
|
||||
}
|
||||
|
||||
//! Not equal to operator
|
||||
inline bool operator!=(const RevBClientParts &lhs, const RevBClientParts &rhs) { return !(lhs == rhs); }
|
||||
|
||||
} // namespace swift::core::fsd
|
||||
|
||||
#endif // SWIFT_CORE_FSD_REVBCLIENTPARTS_H
|
||||
Reference in New Issue
Block a user