mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
refactor: remove outdated code for FSC
This commit is contained in:
@@ -170,8 +170,6 @@ add_library(core SHARED
|
|||||||
fsd/pong.h
|
fsd/pong.h
|
||||||
fsd/rehost.cpp
|
fsd/rehost.cpp
|
||||||
fsd/rehost.h
|
fsd/rehost.h
|
||||||
fsd/revbclientparts.cpp
|
|
||||||
fsd/revbclientparts.h
|
|
||||||
fsd/serializer.cpp
|
fsd/serializer.cpp
|
||||||
fsd/serializer.h
|
fsd/serializer.h
|
||||||
fsd/servererror.cpp
|
fsd/servererror.cpp
|
||||||
|
|||||||
@@ -90,8 +90,6 @@ namespace swift::core
|
|||||||
connect(m_fsdClient, &CFSDClient::serverResponseReceived, this, &CAirspaceMonitor::onServerReplyReceived);
|
connect(m_fsdClient, &CFSDClient::serverResponseReceived, this, &CAirspaceMonitor::onServerReplyReceived);
|
||||||
connect(m_fsdClient, &CFSDClient::aircraftConfigReceived, this, &CAirspaceMonitor::onAircraftConfigReceived);
|
connect(m_fsdClient, &CFSDClient::aircraftConfigReceived, this, &CAirspaceMonitor::onAircraftConfigReceived);
|
||||||
connect(m_fsdClient, &CFSDClient::connectionStatusChanged, this, &CAirspaceMonitor::onConnectionStatusChanged);
|
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");
|
Q_ASSERT_X(sApp && sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing data reader");
|
||||||
|
|
||||||
@@ -546,13 +544,19 @@ namespace swift::core
|
|||||||
|
|
||||||
void CAirspaceMonitor::sendReadyForModelMatching(const CCallsign &callsign, MatchingReadinessFlag rf)
|
void CAirspaceMonitor::sendReadyForModelMatching(const CCallsign &callsign, MatchingReadinessFlag rf)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "missing callsign");
|
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "missing callsign");
|
||||||
|
|
||||||
// TODO TZ remove when testing is done
|
// TODO TZ remove when testing is done
|
||||||
CLogMessage(this).info(u"CAirspaceMonitor::sendReadyForModelMatching "
|
// CLogMessage(this).info(u"CAirspaceMonitor::sendReadyForModelMatching "
|
||||||
u"callsign %1 Flag %2 ")
|
// u"callsign %1 Flag %2 ")
|
||||||
<< callsign << rf;
|
// << callsign << rf;
|
||||||
|
|
||||||
|
CStatusMessageList reverseLookupMessages;
|
||||||
|
CCallsign::addLogDetailsToList(&reverseLookupMessages, callsign,
|
||||||
|
QStringLiteral("CAirspaceMonitor::sendReadyForModelMatching Flag: %1").arg(rf),
|
||||||
|
CAirspaceMonitor::getLogCategories());
|
||||||
// TODO remove
|
// TODO remove
|
||||||
|
|
||||||
// set flag and init ts
|
// set flag and init ts
|
||||||
@@ -674,6 +678,14 @@ namespace swift::core
|
|||||||
|
|
||||||
// normally we should never get here
|
// normally we should never get here
|
||||||
CLogMessage(this).info(u"Verified '%1' again, has ICAO codes, ready for matching!") << callsign;
|
CLogMessage(this).info(u"Verified '%1' again, has ICAO codes, ready for matching!") << callsign;
|
||||||
|
|
||||||
|
// TODO TZ remove when testing is done
|
||||||
|
CStatusMessageList reverseLookupMessages;
|
||||||
|
CCallsign::addLogDetailsToList(&reverseLookupMessages, callsign,
|
||||||
|
QStringLiteral("CAirspaceMonitor::verifyReceivedIcaoData"),
|
||||||
|
CAirspaceMonitor::getLogCategories());
|
||||||
|
// end TZ remove
|
||||||
|
|
||||||
this->sendReadyForModelMatching(callsign, Verified);
|
this->sendReadyForModelMatching(callsign, Verified);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,7 +849,7 @@ namespace swift::core
|
|||||||
usedModelString.clear();
|
usedModelString.clear();
|
||||||
CCallsign::addLogDetailsToList(
|
CCallsign::addLogDetailsToList(
|
||||||
pReverseLookupMessages, callsign,
|
pReverseLookupMessages, callsign,
|
||||||
QStringLiteral("FsInn modelstring '%1' ignored because of setuo").arg(modelString));
|
QStringLiteral("FsInn modelstring '%1' ignored because of setup").arg(modelString));
|
||||||
}
|
}
|
||||||
else if (!CAircraftMatcher::isKnownModelString(modelString, callsign, pReverseLookupMessages))
|
else if (!CAircraftMatcher::isKnownModelString(modelString, callsign, pReverseLookupMessages))
|
||||||
{
|
{
|
||||||
@@ -1481,70 +1493,6 @@ namespace swift::core
|
|||||||
this->updateAircraftInRange(callsign, vm);
|
this->updateAircraftInRange(callsign, vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO TZ I think, we can remove this method in future, as we have now longer IVAO supported protocols
|
|
||||||
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,
|
void CAirspaceMonitor::onAircraftConfigReceived(const CCallsign &callsign, const QJsonObject &jsonObject,
|
||||||
qint64 currentOffsetMs)
|
qint64 currentOffsetMs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -473,8 +473,6 @@ namespace swift::core
|
|||||||
const QString &aircraftIcao, const QString &airlineIcao);
|
const QString &aircraftIcao, const QString &airlineIcao);
|
||||||
void onConnectionStatusChanged(swift::misc::network::CConnectionStatus oldStatus,
|
void onConnectionStatusChanged(swift::misc::network::CConnectionStatus oldStatus,
|
||||||
swift::misc::network::CConnectionStatus newStatus);
|
swift::misc::network::CConnectionStatus newStatus);
|
||||||
void onRevBAircraftConfigReceived(const swift::misc::aviation::CCallsign &callsign, const QString &config,
|
|
||||||
qint64 currentOffsetMs);
|
|
||||||
};
|
};
|
||||||
} // namespace swift::core
|
} // namespace swift::core
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include "core/fsd/planeinformationfsinn.h"
|
#include "core/fsd/planeinformationfsinn.h"
|
||||||
#include "core/fsd/pong.h"
|
#include "core/fsd/pong.h"
|
||||||
#include "core/fsd/rehost.h"
|
#include "core/fsd/rehost.h"
|
||||||
#include "core/fsd/revbclientparts.h"
|
|
||||||
#include "core/fsd/serializer.h"
|
#include "core/fsd/serializer.h"
|
||||||
#include "core/fsd/servererror.h"
|
#include "core/fsd/servererror.h"
|
||||||
#include "core/fsd/textmessage.h"
|
#include "core/fsd/textmessage.h"
|
||||||
@@ -1078,16 +1077,6 @@ namespace swift::core::fsd
|
|||||||
|
|
||||||
// Euroscope
|
// Euroscope
|
||||||
m_messageTypeMapping["SIMDATA"] = MessageType::EuroscopeSimData;
|
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)
|
void CFSDClient::handleAtcDataUpdate(const QStringList &tokens)
|
||||||
@@ -1620,23 +1609,6 @@ namespace swift::core::fsd
|
|||||||
if (serverError.isFatalError()) { disconnectFromServer(); }
|
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)
|
void CFSDClient::handleRehost(const QStringList &tokens)
|
||||||
{
|
{
|
||||||
const Rehost rehost = Rehost::fromTokens(tokens);
|
const Rehost rehost = Rehost::fromTokens(tokens);
|
||||||
@@ -2280,9 +2252,7 @@ namespace swift::core::fsd
|
|||||||
case MessageType::AddPilot:
|
case MessageType::AddPilot:
|
||||||
case MessageType::ServerHeartbeat:
|
case MessageType::ServerHeartbeat:
|
||||||
case MessageType::ProController:
|
case MessageType::ProController:
|
||||||
case MessageType::ClientIdentification:
|
case MessageType::ClientIdentification: break;
|
||||||
case MessageType::RegistrationInfo:
|
|
||||||
case MessageType::RevBPilotDescription: break;
|
|
||||||
|
|
||||||
// handled ones
|
// handled ones
|
||||||
case MessageType::AtcDataUpdate: handleAtcDataUpdate(tokens); break;
|
case MessageType::AtcDataUpdate: handleAtcDataUpdate(tokens); break;
|
||||||
@@ -2305,7 +2275,6 @@ namespace swift::core::fsd
|
|||||||
case MessageType::ServerError: handleServerError(tokens); break;
|
case MessageType::ServerError: handleServerError(tokens); break;
|
||||||
case MessageType::TextMessage: handleTextMessage(tokens); break;
|
case MessageType::TextMessage: handleTextMessage(tokens); break;
|
||||||
case MessageType::PilotClientCom: handleCustomPilotPacket(tokens); break;
|
case MessageType::PilotClientCom: handleCustomPilotPacket(tokens); break;
|
||||||
case MessageType::RevBClientParts: handleRevBClientPartsPacket(tokens); break;
|
|
||||||
case MessageType::VisualPilotDataUpdate:
|
case MessageType::VisualPilotDataUpdate:
|
||||||
case MessageType::VisualPilotDataPeriodic:
|
case MessageType::VisualPilotDataPeriodic:
|
||||||
case MessageType::VisualPilotDataStopped: handleVisualPilotDataUpdate(tokens, messageType); break;
|
case MessageType::VisualPilotDataStopped: handleVisualPilotDataUpdate(tokens, messageType); break;
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ namespace swift::core::fsd
|
|||||||
void planeInformationFsinnReceived(const swift::misc::aviation::CCallsign &callsign,
|
void planeInformationFsinnReceived(const swift::misc::aviation::CCallsign &callsign,
|
||||||
const QString &airlineIcaoDesignator, const QString &aircraftDesignator,
|
const QString &airlineIcaoDesignator, const QString &aircraftDesignator,
|
||||||
const QString &combinedAircraftType, const QString &modelString);
|
const QString &combinedAircraftType, const QString &modelString);
|
||||||
void revbAircraftConfigReceived(const QString &sender, const QString &config, qint64 currentOffsetTimeMs);
|
|
||||||
void muteRequestReceived(bool mute);
|
void muteRequestReceived(bool mute);
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
@@ -474,7 +474,6 @@ namespace swift::core::fsd
|
|||||||
#ifdef SWIFT_VATSIM_SUPPORT
|
#ifdef SWIFT_VATSIM_SUPPORT
|
||||||
void handleFsdIdentification(const QStringList &tokens);
|
void handleFsdIdentification(const QStringList &tokens);
|
||||||
#endif
|
#endif
|
||||||
void handleRevBClientPartsPacket(const QStringList &tokens);
|
|
||||||
void handleRehost(const QStringList &tokens);
|
void handleRehost(const QStringList &tokens);
|
||||||
void handleMute(const QStringList &tokens);
|
void handleMute(const QStringList &tokens);
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,8 @@ enum class MessageType
|
|||||||
Pong,
|
Pong,
|
||||||
ServerError,
|
ServerError,
|
||||||
ServerHeartbeat,
|
ServerHeartbeat,
|
||||||
RegistrationInfo, // IVAO only
|
|
||||||
TextMessage,
|
TextMessage,
|
||||||
PilotClientCom,
|
PilotClientCom,
|
||||||
RevBClientParts, // IVAO only
|
|
||||||
RevBPilotDescription, // -PD IVAO only not handled in swift
|
|
||||||
Rehost,
|
Rehost,
|
||||||
Mute,
|
Mute,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,39 +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() {}
|
|
||||||
|
|
||||||
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 RevBClientParts(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();
|
|
||||||
};
|
|
||||||
|
|
||||||
//! 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