diff --git a/src/core/airspacemonitor.cpp b/src/core/airspacemonitor.cpp
index afc0af21e..bd350fb8f 100644
--- a/src/core/airspacemonitor.cpp
+++ b/src/core/airspacemonitor.cpp
@@ -551,8 +551,8 @@ namespace swift::core
// TODO TZ remove when testing is done
CLogMessage(this).info(u"CAirspaceMonitor::sendReadyForModelMatching "
- u"callsign %1 ")
- << callsign;
+ u"callsign %1 Flag %2 ")
+ << callsign << rf;
// TODO remove
// set flag and init ts
@@ -1212,17 +1212,7 @@ namespace swift::core
const CSimulatedAircraft aircraft = this->getAircraftInRangeForCallsign(callsign);
if (aircraft.hasValidCallsign())
{
- // TODO TZ at this point we have a poblem if the model has no DB key yet (msfs2024 liveries)
- // only if we do not have a DB model yet
- // int testType = aircraft.getModelType();1
- CLogMessage(this).info(u"CAirspaceMonitor::addOrUpdateAircraftInRange CHECK:"
- u"aircraft.getModelType %1 "
- u"callsign %2 "
- u"aircraftIcao %3 "
- u"incomming modelType %4 ")
- << aircraft.getModelType() << callsign.toQString() << aircraftIcao << modelType;
-
- // we do not change manually assigned models
+ // we do not change manually assigned models (msfs2024)
if (!aircraft.getModel().hasValidDbKey() && aircraft.getModelType() != CAircraftModel::TypeManuallySet)
{
@@ -1491,6 +1481,7 @@ namespace swift::core
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)
{
diff --git a/src/core/context/contextnetworkimpl.cpp b/src/core/context/contextnetworkimpl.cpp
index 63ac22a40..894b2f468 100644
--- a/src/core/context/contextnetworkimpl.cpp
+++ b/src/core/context/contextnetworkimpl.cpp
@@ -1142,10 +1142,6 @@ namespace swift::core::context
if (c)
{
const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
- // TODO TZ
- CLogMessage(this).info(u"CContextNetwork::updateAircraftModel model.getModelString %1 model.getModelLivery "
- u"%2 model.getModelType %3 aircraft.getModelType '%4'")
- << model.getModelString() << model.getModelLivery() << model.getModelType() << aircraft.getModelType();
Q_ASSERT_X(!aircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "missing callsign");
emit this->changedRemoteAircraftModel(aircraft, originator); // update aircraft model
diff --git a/src/core/simulator.cpp b/src/core/simulator.cpp
index 7af290c34..69bef852f 100644
--- a/src/core/simulator.cpp
+++ b/src/core/simulator.cpp
@@ -981,15 +981,6 @@ namespace swift::core
bool ISimulator::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft)
{
if (this->isShuttingDown()) { return false; }
-
- // TODO TZ remove after testing
- CLogMessage(this).info(u"ISimulator::changeRemoteAircraftEnabled CHECK:"
- u"aircraft.getModelType %1 "
- u"aircraft.getModelString %2 "
- u"aircraft.getLiveryString %3 ")
- << aircraft.getModelType() << aircraft.getModelString() << aircraft.getLiveryString();
- ;
-
return aircraft.isEnabled() ? this->physicallyAddRemoteAircraft(aircraft) :
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
}
diff --git a/src/gui/components/logincomponent.cpp b/src/gui/components/logincomponent.cpp
index 507c3c10a..d57c0350f 100644
--- a/src/gui/components/logincomponent.cpp
+++ b/src/gui/components/logincomponent.cpp
@@ -41,7 +41,7 @@
#include "misc/logmessage.h"
#include "misc/network/connectionstatus.h"
#include "misc/network/entityflags.h"
-// TODO TZ remove afte testing
+// TODO TZ remove after testing. it is in another branch already
#include "misc/network/server.h"
// TODO TZ end remove afte testing
#include "misc/network/serverlist.h"
@@ -301,7 +301,7 @@ namespace swift::gui::components
{
if (!m_updatePilotOnServerChanges) { return; }
const bool vatsim = this->isVatsimNetworkTabSelected();
- // TODO TZ remove after testing
+ // TODO TZ remove after testing. it is on another branch already
// const CUser user = vatsim ? this->getCurrentVatsimServer().getUser() : server.getUser();
const CUser user =
server.getServerType() != CServer::FSDServer ? this->getCurrentVatsimServer().getUser() : server.getUser();
diff --git a/src/gui/components/mappingcomponent.cpp b/src/gui/components/mappingcomponent.cpp
index 6ee3695e4..ef92d35e5 100644
--- a/src/gui/components/mappingcomponent.cpp
+++ b/src/gui/components/mappingcomponent.cpp
@@ -370,12 +370,6 @@ namespace swift::gui::components
{
const CAircraftModelList models = sGui->getIContextSimulator()->getModelSetModelsStartingWith(modelString);
- // TODO TZ DEBUG only for testing
- const CStatusMessage msg = CStatusMessage(this).validationInfo(u"Found: %1 models for %2")
- << models.size() << modelString;
- this->showOverlayMessage(msg, OverlayMessageMs);
- // END testing
-
if (models.isEmpty())
{
const CStatusMessage msg = CStatusMessage(this).validationError(u"No model for title: '%1'")
diff --git a/src/gui/editors/aircraftpartsform.cpp b/src/gui/editors/aircraftpartsform.cpp
index bbaae9615..09559ba24 100644
--- a/src/gui/editors/aircraftpartsform.cpp
+++ b/src/gui/editors/aircraftpartsform.cpp
@@ -100,6 +100,9 @@ namespace swift::gui::editors
ui->cb_AircraftPartsLightsBeacon->setChecked(on);
ui->cb_AircraftPartsLightsNav->setChecked(on);
ui->cb_AircraftPartsLightsLogo->setChecked(on);
+ ui->cb_AircraftPartsLightsWing->setChecked(on);
+ ui->cb_AircraftPartsLightsRecognition->setChecked(on);
+ ui->cb_AircraftPartsLightsCabin->setChecked(on);
}
void CAircraftPartsForm::setAllEngines()
@@ -115,10 +118,13 @@ namespace swift::gui::editors
aviation::CAircraftParts CAircraftPartsForm::guiToAircraftParts() const
{
+ // added new values for lights and engines here
const CAircraftLights lights(
ui->cb_AircraftPartsLightsStrobe->isChecked(), ui->cb_AircraftPartsLightsLanding->isChecked(),
ui->cb_AircraftPartsLightsTaxi->isChecked(), ui->cb_AircraftPartsLightsBeacon->isChecked(),
- ui->cb_AircraftPartsLightsNav->isChecked(), ui->cb_AircraftPartsLightsLogo->isChecked());
+ ui->cb_AircraftPartsLightsNav->isChecked(), ui->cb_AircraftPartsLightsLogo->isChecked(),
+ ui->cb_AircraftPartsLightsRecognition->isChecked(), ui->cb_AircraftPartsLightsCabin->isChecked(),
+ ui->cb_AircraftPartsLightsWing->isChecked());
const CAircraftEngineList engines(
{ ui->cb_AircraftPartsEngine1->isChecked(), ui->cb_AircraftPartsEngine2->isChecked(),
ui->cb_AircraftPartsEngine3->isChecked(), ui->cb_AircraftPartsEngine4->isChecked(),
@@ -143,6 +149,7 @@ namespace swift::gui::editors
ui->cb_AircraftPartsLightsNav->setChecked(lights.isNavOn());
ui->cb_AircraftPartsLightsStrobe->setChecked(lights.isStrobeOn());
ui->cb_AircraftPartsLightsTaxi->setChecked(lights.isTaxiOn());
+ ui->cb_AircraftPartsLightsWing->setChecked(lights.isWingOn());
const CAircraftEngineList engines = parts.getEngines();
ui->cb_AircraftPartsEngine1->setChecked(engines.isEngineOn(1));
diff --git a/src/gui/editors/aircraftpartsform.ui b/src/gui/editors/aircraftpartsform.ui
index ee86bbb11..9d28ebb74 100644
--- a/src/gui/editors/aircraftpartsform.ui
+++ b/src/gui/editors/aircraftpartsform.ui
@@ -32,7 +32,7 @@
3
- -
+
-
Strobe
@@ -70,7 +70,31 @@
- -
+
+
-
+
+
+ Wing
+
+
+
+ -
+
+
+ Recognition
+
+
+
+ -
+
+
+ Cabin
+
+
+
+
+
+ -
Nav
@@ -91,7 +115,7 @@
- -
+
-
Beacon
@@ -140,7 +164,7 @@
- -
+
-
Logo
diff --git a/src/gui/models/aircraftmodellistmodel.cpp b/src/gui/models/aircraftmodellistmodel.cpp
index ababff5a8..346f77a46 100644
--- a/src/gui/models/aircraftmodellistmodel.cpp
+++ b/src/gui/models/aircraftmodellistmodel.cpp
@@ -36,7 +36,6 @@ namespace swift::gui::models
(void)QT_TRANSLATE_NOOP("CAircraftModelListModel", "model");
}
- // TODO TZ check if some columns can be hidden automatically for different sims
void CAircraftModelListModel::setAircraftModelMode(CAircraftModelListModel::AircraftModelMode mode)
{
if (m_mode == mode) { return; }
diff --git a/src/misc/CMakeLists.txt b/src/misc/CMakeLists.txt
index 74c38efe9..709444022 100644
--- a/src/misc/CMakeLists.txt
+++ b/src/misc/CMakeLists.txt
@@ -535,6 +535,8 @@ add_library(misc SHARED
simulation/flightgear/flightgearutil.h
simulation/msfs2024/aircraftmodelloadermsfs2024.cpp
simulation/msfs2024/aircraftmodelloadermsfs2024.h
+ simulation/msfs2024/simconnectutilities.cpp
+ simulation/msfs2024/simconnectutilities.h
simulation/fscommon/aircraftcfgentries.cpp
simulation/fscommon/aircraftcfgentries.h
simulation/fscommon/aircraftcfgentrieslist.cpp
@@ -681,7 +683,7 @@ add_library(misc SHARED
weather/windlayer.h
weather/windlayerlist.cpp
weather/windlayerlist.h
-)
+ )
if(APPLE)
target_sources(misc PRIVATE
diff --git a/src/misc/aviation/aircraftlights.cpp b/src/misc/aviation/aircraftlights.cpp
index cab9cd0a3..288600901 100644
--- a/src/misc/aviation/aircraftlights.cpp
+++ b/src/misc/aviation/aircraftlights.cpp
@@ -20,17 +20,23 @@ namespace swift::misc::aviation
CAircraftLights::CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn,
bool recognition, bool cabin)
: m_strobeOn(strobeOn), m_landingOn(landingOn), m_taxiOn(taxiOn), m_beaconOn(beaconOn), m_navOn(navOn),
- m_logoOn(logoOn), m_recognition(recognition), m_cabin(cabin)
+ m_logoOn(logoOn), m_recognitionOn(recognition), m_cabinOn(cabin)
+ {}
+
+ CAircraftLights::CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn,
+ bool recognition, bool cabin, bool wing)
+ : m_strobeOn(strobeOn), m_landingOn(landingOn), m_taxiOn(taxiOn), m_beaconOn(beaconOn), m_navOn(navOn),
+ m_logoOn(logoOn), m_recognitionOn(recognition), m_cabinOn(cabin), m_wingOn(wing)
{}
CAircraftLights CAircraftLights::allLightsOn()
{
- return CAircraftLights { true, true, true, true, true, true, true, true };
+ return CAircraftLights { true, true, true, true, true, true, true, true, true };
}
CAircraftLights CAircraftLights::allLightsOff()
{
- return CAircraftLights { false, false, false, false, false, false, false, false };
+ return CAircraftLights { false, false, false, false, false, false, false, false, false };
}
QString CAircraftLights::convertToQString(bool i18n) const
@@ -39,7 +45,8 @@ namespace swift::misc::aviation
const QString s = u"strobe: " % boolToYesNo(m_strobeOn) % u" landing: " % boolToYesNo(m_landingOn) %
u" taxi: " % boolToYesNo(m_taxiOn) % u" beacon: " % boolToYesNo(m_beaconOn) % u" nav: " %
boolToYesNo(m_navOn) % u" logo: " % boolToYesNo(m_logoOn) % u" recognition: " %
- boolToYesNo(m_recognition) % u" cabin: " % boolToYesNo(m_cabin);
+ boolToYesNo(m_recognitionOn) % u" cabin: " % boolToYesNo(m_cabinOn) % u" cabin: " %
+ boolToYesNo(m_wingOn);
return s;
}
@@ -57,8 +64,9 @@ namespace swift::misc::aviation
case IndexNav: return QVariant::fromValue(m_navOn);
case IndexStrobe: return QVariant::fromValue(m_strobeOn);
case IndexTaxi: return QVariant::fromValue(m_taxiOn);
- case IndexRecognition: return QVariant::fromValue(m_recognition);
- case IndexCabin: return QVariant::fromValue(m_cabin);
+ case IndexRecognition: return QVariant::fromValue(m_recognitionOn);
+ case IndexCabin: return QVariant::fromValue(m_cabinOn);
+ case IndexWing: return QVariant::fromValue(m_wingOn);
default: return CValueObject::propertyByIndex(index);
}
}
@@ -81,8 +89,9 @@ namespace swift::misc::aviation
case IndexNav: m_navOn = variant.toBool(); break;
case IndexStrobe: m_strobeOn = variant.toBool(); break;
case IndexTaxi: m_taxiOn = variant.toBool(); break;
- case IndexCabin: m_cabin = variant.toBool(); break;
- case IndexRecognition: m_recognition = variant.toBool(); break;
+ case IndexCabin: m_cabinOn = variant.toBool(); break;
+ case IndexRecognition: m_recognitionOn = variant.toBool(); break;
+ case IndexWing: m_wingOn = variant.toBool(); break;
default: CValueObject::setPropertyByIndex(index, variant); break;
}
}
@@ -99,8 +108,9 @@ namespace swift::misc::aviation
case IndexNav: return Compare::compare(m_navOn, compareValue.isNavOn());
case IndexStrobe: return Compare::compare(m_strobeOn, compareValue.isStrobeOn());
case IndexTaxi: return Compare::compare(m_taxiOn, compareValue.isTaxiOn());
- case IndexCabin: return Compare::compare(m_cabin, compareValue.isCabinOn());
- case IndexRecognition: return Compare::compare(m_recognition, compareValue.isRecognitionOn());
+ case IndexCabin: return Compare::compare(m_cabinOn, compareValue.isCabinOn());
+ case IndexRecognition: return Compare::compare(m_recognitionOn, compareValue.isRecognitionOn());
+ case IndexWing: return Compare::compare(m_wingOn, compareValue.isWingOn());
default: break;
}
return 0;
@@ -114,8 +124,9 @@ namespace swift::misc::aviation
m_navOn = true;
m_strobeOn = true;
m_taxiOn = true;
- m_cabin = true;
- m_recognition = true;
+ m_cabinOn = true;
+ m_recognitionOn = true;
+ m_wingOn = true;
}
void CAircraftLights::setAllOff()
@@ -126,7 +137,8 @@ namespace swift::misc::aviation
m_navOn = false;
m_strobeOn = false;
m_taxiOn = false;
- m_recognition = false;
- m_cabin = false;
+ m_recognitionOn = false;
+ m_cabinOn = false;
+ m_wingOn = false;
}
} // namespace swift::misc::aviation
diff --git a/src/misc/aviation/aircraftlights.h b/src/misc/aviation/aircraftlights.h
index 846ce3df0..e1740fef5 100644
--- a/src/misc/aviation/aircraftlights.h
+++ b/src/misc/aviation/aircraftlights.h
@@ -33,7 +33,8 @@ namespace swift::misc::aviation
IndexNav,
IndexLogo,
IndexRecognition,
- IndexCabin
+ IndexCabin,
+ IndexWing,
};
//! Default constructor
@@ -49,6 +50,10 @@ namespace swift::misc::aviation
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn,
bool recognition, bool cabin);
+ //! Constructor
+ CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn,
+ bool recognitionOn, bool cabin, bool wingOn);
+
//! Strobes lights on?
bool isStrobeOn() const { return m_strobeOn; }
@@ -86,16 +91,22 @@ namespace swift::misc::aviation
void setLogoOn(bool on) { m_logoOn = on; }
//! Recognition lights on?
- bool isRecognitionOn() const { return m_recognition; }
+ bool isRecognitionOn() const { return m_recognitionOn; }
//! Set recognition lights
- void setRecognitionOn(bool on) { m_recognition = on; }
+ void setRecognitionOn(bool on) { m_recognitionOn = on; }
//! Cabin lights on?
- bool isCabinOn() const { return m_cabin; }
+ bool isCabinOn() const { return m_cabinOn; }
//! Set cabin lights
- void setCabinOn(bool on) { m_cabin = on; }
+ void setCabinOn(bool on) { m_cabinOn = on; }
+
+ //! Wing light on?
+ bool isWingOn() const { return m_wingOn; }
+
+ //! Set wing lights
+ void setWingOn(bool on) { m_wingOn = on; }
//! All on
void setAllOn();
@@ -135,9 +146,11 @@ namespace swift::misc::aviation
bool m_beaconOn = false;
bool m_navOn = false;
bool m_logoOn = false;
- bool m_recognition = false; //!< not supported by aircraft config (VATSIM)
- bool m_cabin = false; //!< not supported by aircraft config (VATSIM)
+ bool m_recognitionOn = false; //!< not supported by aircraft config (VATSIM)
+ bool m_cabinOn = false; //!< not supported by aircraft config (VATSIM)
+ bool m_wingOn = false; //!< not supported by aircraft config (VATSIM)
+ // TODO TZ check if disabled lights can be activated. for testing we keep them enabled in JSON
SWIFT_METACLASS(
CAircraftLights,
SWIFT_METAMEMBER(isNull, 0, DisabledForJson), // disable since JSON is used for network
@@ -147,8 +160,12 @@ namespace swift::misc::aviation
SWIFT_METAMEMBER_NAMED(beaconOn, "beacon_on"),
SWIFT_METAMEMBER_NAMED(navOn, "nav_on"),
SWIFT_METAMEMBER_NAMED(logoOn, "logo_on"),
- SWIFT_METAMEMBER(recognition, 0, DisabledForJson), // disable since JSON is used for network
- SWIFT_METAMEMBER(cabin, 0, DisabledForJson) // disable since JSON is used for network
+ SWIFT_METAMEMBER_NAMED(recognitionOn,"recognition_on"),
+ SWIFT_METAMEMBER_NAMED(cabinOn, "cabin_on"),
+ SWIFT_METAMEMBER_NAMED(wingOn, "wing_on")
+ //SWIFT_METAMEMBER(recognitionOn, 0, DisabledForJson), // disable since JSON is used for network
+ //SWIFT_METAMEMBER(cabinOn, 0, DisabledForJson), // disable since JSON is used for network
+ //SWIFT_METAMEMBER(wingOn, 0, DisabledForJson) // disable since JSON is used for network
);
};
} // namespace swift::misc::aviation
diff --git a/src/misc/simulation/aircraftmodelloader.cpp b/src/misc/simulation/aircraftmodelloader.cpp
index e25b9743e..820475d48 100644
--- a/src/misc/simulation/aircraftmodelloader.cpp
+++ b/src/misc/simulation/aircraftmodelloader.cpp
@@ -131,7 +131,7 @@ namespace swift::misc::simulation
return;
}
- // TODO TZ
+ // TODO TZ 2024: skip loading for MSFS2024?
QStringList modelDirs = { "", "" };
// if (simulator.isMSFS2024())
//{
diff --git a/src/misc/simulation/msfs2024/aircraftmodelloadermsfs2024.cpp b/src/misc/simulation/msfs2024/aircraftmodelloadermsfs2024.cpp
index 07ee7fc60..2e9035d88 100644
--- a/src/misc/simulation/msfs2024/aircraftmodelloadermsfs2024.cpp
+++ b/src/misc/simulation/msfs2024/aircraftmodelloadermsfs2024.cpp
@@ -58,7 +58,7 @@ namespace swift::misc::simulation::msfs2024
// TODO TZ Implement model queries via SimConnect if possible
// misc shut not include simconnect headers or plugins directly
-
+ // still no idea how to do that
const CSimulatorInfo simulatorInfo = CSimulatorInfo::msfs2024();
allModels =
CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getSynchronizedCachedModels(simulatorInfo);
@@ -83,7 +83,7 @@ namespace swift::misc::simulation::msfs2024
if (m_parserWorker && !m_parserWorker->isFinished()) { return; }
emit this->diskLoadingStarted(simulator, mode);
- // TODO TZ simplify, we don't need directories
+ // TODO TZ need help: simplify, we don't need directories in this->performParsing for MSFS2024
m_parserWorker = CWorker::fromTask(this, "CAircraftModelLoaderMsfs2024::performParsing",
[this, modelDirs, excludedDirectoryPatterns, modelConsolidation]() {
auto models = this->performParsing();
diff --git a/src/misc/simulation/msfs2024/simconnectutilities.cpp b/src/misc/simulation/msfs2024/simconnectutilities.cpp
new file mode 100644
index 000000000..c4cc398c3
--- /dev/null
+++ b/src/misc/simulation/msfs2024/simconnectutilities.cpp
@@ -0,0 +1,75 @@
+// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
+// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
+
+#include "misc/simulation/msfs2024/simconnectutilities.h"
+
+#include
+#include
+#include
+#include
+
+#include "misc/stringutils.h"
+
+using namespace swift::misc;
+using namespace swift::misc::aviation;
+
+namespace swift::misc::simulation::msfs2024
+{
+ CSimConnectUtilities::CSimConnectUtilities() {}
+
+ QString CSimConnectUtilities::resolveEnumToString(const DWORD id, const char *enumName)
+ {
+ const int i = CSimConnectUtilities::staticMetaObject.indexOfEnumerator(enumName);
+ if (i < 0) { return QStringLiteral("No enumerator for %1").arg(enumName); }
+ const QMetaEnum m = CSimConnectUtilities::staticMetaObject.enumerator(i);
+ const char *k = m.valueToKey(static_cast(id));
+ return (k) ? QLatin1String(k) : QStringLiteral("Id '%1' not found for %2").arg(id).arg(enumName);
+ }
+
+ QString CSimConnectUtilities::simConnectExceptionToString(const DWORD id)
+ {
+ return CSimConnectUtilities::resolveEnumToString(id, "SIMCONNECT_EXCEPTION");
+ }
+
+ QString CSimConnectUtilities::simConnectSurfaceTypeToString(const DWORD type, bool beautify)
+ {
+ QString sf = CSimConnectUtilities::resolveEnumToString(type, "SIMCONNECT_SURFACE");
+ return beautify ? sf.replace('_', ' ') : sf;
+ }
+
+ QString CSimConnectUtilities::simConnectReceiveIdToString(DWORD type)
+ {
+ const QString ri = CSimConnectUtilities::resolveEnumToString(type, "SIMCONNECT_RECV_ID");
+ return ri;
+ }
+
+ int CSimConnectUtilities::lightsToLightStates(const CAircraftLights &lights)
+ {
+ int lightMask = 0;
+ if (lights.isBeaconOn()) { lightMask |= Beacon; }
+ if (lights.isLandingOn()) { lightMask |= Landing; }
+ if (lights.isLogoOn()) { lightMask |= Logo; }
+ if (lights.isNavOn()) { lightMask |= Nav; }
+ if (lights.isStrobeOn()) { lightMask |= Strobe; }
+ if (lights.isTaxiOn()) { lightMask |= Taxi; }
+ return lightMask;
+ }
+
+ void CSimConnectUtilities::registerMetadata()
+ {
+ qRegisterMetaType();
+ qRegisterMetaType();
+ }
+
+ CWinDllUtils::DLLInfo CSimConnectUtilities::simConnectDllInfo()
+ {
+ const QList modules = CWinDllUtils::getModules(-1, "simconnect");
+ if (modules.isEmpty())
+ {
+ CWinDllUtils::DLLInfo info;
+ info.errorMsg = "No SimConnect.dll loaded";
+ return info;
+ }
+ return CWinDllUtils::getDllInfo(modules.first().executable);
+ }
+} // namespace swift::misc::simulation::msfs2024
diff --git a/src/misc/simulation/msfs2024/simconnectutilities.h b/src/misc/simulation/msfs2024/simconnectutilities.h
new file mode 100644
index 000000000..f2c2cbb95
--- /dev/null
+++ b/src/misc/simulation/msfs2024/simconnectutilities.h
@@ -0,0 +1,204 @@
+// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
+// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
+
+//! \file
+
+#ifndef SWIFT_MISC_SIMULATION_MSFS2024_SIMCONNECTUTILITIES_H
+#define SWIFT_MISC_SIMULATION_MSFS2024_SIMCONNECTUTILITIES_H
+
+#include
+#include
+#include
+#include
+
+#include "misc/aviation/aircraftlights.h"
+#include "misc/simulation/simulatorinfo.h"
+#include "misc/swiftmiscexport.h"
+#include "misc/windllutils.h"
+
+// Apart from the below definitions, the following code is OS independent,
+// though it does not make sense to be used on non WIN machines.
+// But it allows such parts to compile on all platforms.
+#ifdef Q_OS_WIN
+# ifndef NOMINMAX
+# define NOMINMAX
+# endif
+# include
+#else
+using DWORD = unsigned long; //!< Fake Windows DWORD
+#endif
+
+namespace swift::misc::simulation::msfs2024
+{
+ //! Utilities for SimConnect
+ //! \remark not using the simconnect.h headers as Misc classes are not driver aware
+ class SWIFT_MISC_EXPORT CSimConnectUtilities : public QObject
+ {
+ Q_OBJECT
+
+ public:
+ //! Resolve SimConnect exception (based on Qt metadata).
+ //! \param id enum element
+ //! \return enum element's name
+ static QString simConnectExceptionToString(const DWORD id);
+
+ //! Resolve SimConnect surface (based on Qt metadata).
+ //! \param type enum element
+ //! \param beautify remove "_"
+ static QString simConnectSurfaceTypeToString(const DWORD type, bool beautify = true);
+
+ //! SimConnect surfaces.
+ //! \sa http://msdn.microsoft.com/en-us/library/cc526981.aspx#AircraftFlightInstrumentationData
+ enum SIMCONNECT_SURFACE
+ {
+ Concrete,
+ Grass,
+ Water,
+ Grass_bumpy,
+ Asphalt,
+ Short_grass,
+ Long_grass,
+ Hard_turf,
+ Snow,
+ Ice,
+ Urban,
+ Forest,
+ Dirt,
+ Coral,
+ Gravel,
+ Oil_treated,
+ Steel_mats,
+ Bituminus,
+ Brick,
+ Macadam,
+ Planks,
+ Sand,
+ Shale,
+ Tarmac,
+ Wright_flyer_track
+ };
+ Q_ENUM(SIMCONNECT_SURFACE)
+
+ //! SimConnect exceptions.
+ enum SIMCONNECT_EXCEPTION
+ {
+ SIMCONNECT_EXCEPTION_NONE,
+ SIMCONNECT_EXCEPTION_ERROR,
+ SIMCONNECT_EXCEPTION_SIZE_MISMATCH,
+ SIMCONNECT_EXCEPTION_UNRECOGNIZED_ID,
+ SIMCONNECT_EXCEPTION_UNOPENED,
+ SIMCONNECT_EXCEPTION_VERSION_MISMATCH,
+ SIMCONNECT_EXCEPTION_TOO_MANY_GROUPS,
+ SIMCONNECT_EXCEPTION_NAME_UNRECOGNIZED,
+ SIMCONNECT_EXCEPTION_TOO_MANY_EVENT_NAMES,
+ SIMCONNECT_EXCEPTION_EVENT_ID_DUPLICATE,
+ SIMCONNECT_EXCEPTION_TOO_MANY_MAPS,
+ SIMCONNECT_EXCEPTION_TOO_MANY_OBJECTS,
+ SIMCONNECT_EXCEPTION_TOO_MANY_REQUESTS,
+ SIMCONNECT_EXCEPTION_WEATHER_INVALID_PORT,
+ SIMCONNECT_EXCEPTION_WEATHER_INVALID_METAR,
+ SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_GET_OBSERVATION,
+ SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_CREATE_STATION,
+ SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_REMOVE_STATION,
+ SIMCONNECT_EXCEPTION_INVALID_DATA_TYPE,
+ SIMCONNECT_EXCEPTION_INVALID_DATA_SIZE,
+ SIMCONNECT_EXCEPTION_DATA_ERROR,
+ SIMCONNECT_EXCEPTION_INVALID_ARRAY,
+ SIMCONNECT_EXCEPTION_CREATE_OBJECT_FAILED,
+ SIMCONNECT_EXCEPTION_LOAD_FLIGHTPLAN_FAILED,
+ SIMCONNECT_EXCEPTION_OPERATION_INVALID_FOR_OBJECT_TYPE,
+ SIMCONNECT_EXCEPTION_ILLEGAL_OPERATION,
+ SIMCONNECT_EXCEPTION_ALREADY_SUBSCRIBED,
+ SIMCONNECT_EXCEPTION_INVALID_ENUM,
+ SIMCONNECT_EXCEPTION_DEFINITION_ERROR,
+ SIMCONNECT_EXCEPTION_DUPLICATE_ID,
+ SIMCONNECT_EXCEPTION_DATUM_ID,
+ SIMCONNECT_EXCEPTION_OUT_OF_BOUNDS,
+ SIMCONNECT_EXCEPTION_ALREADY_CREATED,
+ SIMCONNECT_EXCEPTION_OBJECT_OUTSIDE_REALITY_BUBBLE,
+ SIMCONNECT_EXCEPTION_OBJECT_CONTAINER,
+ SIMCONNECT_EXCEPTION_OBJECT_AI,
+ SIMCONNECT_EXCEPTION_OBJECT_ATC,
+ SIMCONNECT_EXCEPTION_OBJECT_SCHEDULE
+ };
+ Q_ENUM(SIMCONNECT_EXCEPTION)
+
+ //! Lights for FSX/P3D "LIGHT ON STATES"
+ //! \sa http://www.prepar3d.com/SDKv2/LearningCenter/utilities/variables/simulation_variables.html
+ enum LIGHT_STATES
+ {
+ Nav = 0x0001,
+ Beacon = 0x0002,
+ Landing = 0x0004,
+ Taxi = 0x0008,
+ Strobe = 0x0010,
+ Panel = 0x0020,
+ Recognition = 0x0040,
+ Wing = 0x0080,
+ Logo = 0x0100,
+ Cabin = 0x0200
+ };
+
+ //! Receive IDs for SimConnect
+ enum SIMCONNECT_RECV_ID
+ {
+ SIMCONNECT_RECV_ID_NULL,
+ SIMCONNECT_RECV_ID_EXCEPTION,
+ SIMCONNECT_RECV_ID_OPEN,
+ SIMCONNECT_RECV_ID_QUIT,
+ SIMCONNECT_RECV_ID_EVENT,
+ SIMCONNECT_RECV_ID_EVENT_OBJECT_ADDREMOVE,
+ SIMCONNECT_RECV_ID_EVENT_FILENAME,
+ SIMCONNECT_RECV_ID_EVENT_FRAME,
+ SIMCONNECT_RECV_ID_SIMOBJECT_DATA,
+ SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE,
+ SIMCONNECT_RECV_ID_WEATHER_OBSERVATION,
+ SIMCONNECT_RECV_ID_CLOUD_STATE,
+ SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID,
+ SIMCONNECT_RECV_ID_RESERVED_KEY,
+ SIMCONNECT_RECV_ID_CUSTOM_ACTION,
+ SIMCONNECT_RECV_ID_SYSTEM_STATE,
+ SIMCONNECT_RECV_ID_CLIENT_DATA,
+ SIMCONNECT_RECV_ID_EVENT_WEATHER_MODE,
+ SIMCONNECT_RECV_ID_AIRPORT_LIST,
+ SIMCONNECT_RECV_ID_VOR_LIST,
+ SIMCONNECT_RECV_ID_NDB_LIST,
+ SIMCONNECT_RECV_ID_WAYPOINT_LIST,
+ SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SERVER_STARTED,
+ SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_CLIENT_STARTED,
+ SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SESSION_ENDED,
+ SIMCONNECT_RECV_ID_EVENT_RACE_END,
+ SIMCONNECT_RECV_ID_EVENT_RACE_LAP,
+ };
+ Q_ENUM(SIMCONNECT_RECV_ID)
+
+ //! Receive id to string
+ static QString simConnectReceiveIdToString(DWORD type);
+
+ //! Lights to states
+ static int lightsToLightStates(const aviation::CAircraftLights &lights);
+
+ //! Get info about SimConnect DLL
+ static swift::misc::CWinDllUtils::DLLInfo simConnectDllInfo();
+
+ //! Register metadata
+ static void registerMetadata();
+
+ private:
+ //!
+ //! Resolve enum value to its cleartext (based on Qt metadata).
+ //! \param id enum element
+ //! \param enumName name of the resolved enum
+ //! \return enum element's name
+ static QString resolveEnumToString(const DWORD id, const char *enumName);
+
+ //! Hidden constructor
+ CSimConnectUtilities();
+ };
+} // namespace swift::misc::simulation::msfs2024
+
+Q_DECLARE_METATYPE(swift::misc::simulation::msfs2024::CSimConnectUtilities::SIMCONNECT_EXCEPTION)
+Q_DECLARE_METATYPE(swift::misc::simulation::msfs2024::CSimConnectUtilities::SIMCONNECT_SURFACE)
+Q_DECLARE_METATYPE(swift::misc::simulation::msfs2024::CSimConnectUtilities::SIMCONNECT_RECV_ID)
+
+#endif // SWIFT_MISC_SIMULATION_MSFS2024_SIMCONNECTUTILITIES_H
diff --git a/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.cpp b/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.cpp
index 933e5c00f..bb0841c79 100644
--- a/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.cpp
+++ b/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.cpp
@@ -130,6 +130,13 @@ namespace swift::simplugin::msfs2024common
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT NAV", "Bool");
hr +=
SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT LOGO", "Bool");
+ hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT RECOGNITION",
+ "Bool");
+ hr +=
+ SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT CABIN", "Bool");
+ hr +=
+ SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT WING", "Bool");
+
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "TRANSPONDER CODE:1",
nullptr);
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
@@ -171,6 +178,11 @@ namespace swift::simplugin::msfs2024common
"GENERAL ENG COMBUSTION:3", "Bool");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
"GENERAL ENG COMBUSTION:4", "Bool");
+ hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
+ "GENERAL ENG COMBUSTION:5", "Bool");
+ hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
+ "GENERAL ENG COMBUSTION:6", "Bool");
+
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "VELOCITY WORLD X",
"Feet per second");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "VELOCITY WORLD Y",
@@ -236,6 +248,10 @@ namespace swift::simplugin::msfs2024common
"GENERAL ENG COMBUSTION:3", "Bool");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftPartsWithoutLights,
"GENERAL ENG COMBUSTION:4", "Bool");
+ hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftPartsWithoutLights,
+ "GENERAL ENG COMBUSTION:5", "Bool");
+ hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftPartsWithoutLights,
+ "GENERAL ENG COMBUSTION:6", "Bool");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraftTitle, "TITLE",
nullptr, SIMCONNECT_DATATYPE_STRING256);
@@ -255,12 +271,12 @@ namespace swift::simplugin::msfs2024common
"Bool");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights,
"LIGHT LOGO", "Bool");
- hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights, "LIGHT NAV",
- "Bool");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights,
"LIGHT RECOGNITION", "Bool");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights,
"LIGHT CABIN", "Bool");
+ hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights,
+ "LIGHT WING", "Bool");
if (isFailure(hr))
{
@@ -473,11 +489,12 @@ namespace swift::simplugin::msfs2024common
{
return std::tie(flapsLeadingEdgeLeftPercent, flapsLeadingEdgeRightPercent, flapsTrailingEdgeLeftPercent,
flapsTrailingEdgeRightPercent, gearHandlePosition, spoilersHandlePosition, engine1Combustion,
- engine2Combustion, engine3Combustion, engine4Combustion) ==
+ engine2Combustion, engine3Combustion, engine4Combustion, engine5Combustion,
+ engine6Combustion) ==
std::tie(rhs.flapsLeadingEdgeLeftPercent, rhs.flapsLeadingEdgeRightPercent,
rhs.flapsTrailingEdgeLeftPercent, rhs.flapsTrailingEdgeRightPercent, rhs.gearHandlePosition,
rhs.spoilersHandlePosition, rhs.engine1Combustion, rhs.engine2Combustion, rhs.engine3Combustion,
- rhs.engine4Combustion);
+ rhs.engine4Combustion, rhs.engine5Combustion, rhs.engine6Combustion);
}
void DataDefinitionRemoteAircraftPartsWithoutLights::setAllEngines(bool on)
@@ -486,6 +503,8 @@ namespace swift::simplugin::msfs2024common
engine2Combustion = on ? 1 : 0;
engine3Combustion = on ? 1 : 0;
engine4Combustion = on ? 1 : 0;
+ engine5Combustion = on ? 1 : 0;
+ engine6Combustion = on ? 1 : 0;
}
void DataDefinitionRemoteAircraftPartsWithoutLights::setEngine(int number1based, bool on)
@@ -497,6 +516,8 @@ namespace swift::simplugin::msfs2024common
case 2: engine2Combustion = v; break;
case 3: engine3Combustion = v; break;
case 4: engine4Combustion = v; break;
+ case 5: engine5Combustion = v; break;
+ case 6: engine6Combustion = v; break;
default: break;
}
}
@@ -523,6 +544,8 @@ namespace swift::simplugin::msfs2024common
engine2Combustion = -1;
engine3Combustion = -1;
engine4Combustion = -1;
+ engine5Combustion = -1;
+ engine6Combustion = -1;
}
void DataDefinitionRemoteAircraftPartsWithoutLights::initFromParts(const CAircraftParts &parts)
@@ -544,7 +567,7 @@ namespace swift::simplugin::msfs2024common
CAircraftLights DataDefinitionRemoteAircraftLights::toLights() const
{
return CAircraftLights(dtb(lightStrobe), dtb(lightLanding), dtb(lightTaxi), dtb(lightBeacon), dtb(lightNav),
- dtb(lightLogo), dtb(lightRecognition), dtb(lightCabin));
+ dtb(lightLogo), dtb(lightRecognition), dtb(lightCabin), dtb(lightWing));
}
QString DataDefinitionClientAreaSb::toQString() const
diff --git a/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.h b/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.h
index 2503ea69a..c1d1e730e 100644
--- a/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.h
+++ b/src/plugins/simulator/msfs2024/simconnectdatadefinitionmsfs2024.h
@@ -47,7 +47,10 @@ namespace swift::simplugin::msfs2024common
double lightBeacon; //!< Is beacon light on?
double lightNav; //!< Is nav light on?
double lightLogo; //!< Is logo light on?
- // 18
+ double lightRecognition;
+ double lightCabin; //!< Is cabin light on?
+ double lightWing; //!< Is wing light on?
+ // 21
double transponderCode; //!< Transponder Code
double com1ActiveMHz; //!< COM1 active frequency
double com2ActiveMHz; //!< COM2 active frequency
@@ -60,26 +63,28 @@ namespace swift::simplugin::msfs2024common
double comTest2; //!< COM2 test
double comStatus1; //!< COM1 status
double comStatus2; //!< COM2 status
- // 30
+ // 33
double flapsHandlePosition; //!< Flaps handle position in percent
double spoilersHandlePosition; //!< Spoilers out? (flag)
double gearHandlePosition; //!< Gear handle position (flag)
- // 33
+ // 36
double numberOfEngines; //!< Number of engines
double engine1Combustion; //!< Engine 1 combustion flag
double engine2Combustion; //!< Engine 2 combustion flag
double engine3Combustion; //!< Engine 3 combustion flag
double engine4Combustion; //!< Engine 4 combustion flag
- // 38
+ double engine5Combustion; //!< Engine 5 combustion flag
+ double engine6Combustion; //!< Engine 6 combustion flag
+ // 43
double velocityWorldX; //!< Velocity World X
double velocityWorldY; //!< Velocity World Y
double velocityWorldZ; //!< Velocity World Z
double rotationVelocityBodyX; //!< Rotation Velocity Body X
double rotationVelocityBodyY; //!< Rotation Velocity Body Y
double rotationVelocityBodyZ; //!< Rotation Velocity Body Z
- // 44
+ // 49
double altitudeCalibratedFt; //!< Altitude without temperature effect (ft, FS2020)
- // 45
+ // 50
};
//! Data struct of aircraft position
@@ -159,6 +164,8 @@ namespace swift::simplugin::msfs2024common
double engine2Combustion; //!< Engine 2 combustion flag
double engine3Combustion; //!< Engine 3 combustion flag
double engine4Combustion; //!< Engine 4 combustion flag
+ double engine5Combustion; //!< Engine 5 combustion flag
+ double engine6Combustion; //!< Engine 6 combustion flag
//! Ctor
DataDefinitionRemoteAircraftPartsWithoutLights();
@@ -199,7 +206,7 @@ namespace swift::simplugin::msfs2024common
double lightLogo; //!< Is logo light on?
double lightRecognition; //!< Is recognition light on
double lightCabin; //!< Is cabin light on
-
+ double lightWing; //!< Is cabin light on
//! Convert to lights
swift::misc::aviation::CAircraftLights toLights() const;
};
diff --git a/src/plugins/simulator/msfs2024/simulatormsfs2024.cpp b/src/plugins/simulator/msfs2024/simulatormsfs2024.cpp
index f0e0477d7..10ff7061c 100644
--- a/src/plugins/simulator/msfs2024/simulatormsfs2024.cpp
+++ b/src/plugins/simulator/msfs2024/simulatormsfs2024.cpp
@@ -22,7 +22,7 @@ namespace swift::simplugin::msfs2024
IClientProvider *clientProvider, QObject *parent)
: CSimulatorMsfs2024(info, ownAircraftProvider, remoteAircraftProvider, clientProvider, parent)
{
- this->setDefaultModel({ "A320neo V2", CAircraftModel::TypeModelMatchingDefaultModel,
+ this->setDefaultModel({ "A320NEO V2", CAircraftModel::TypeModelMatchingDefaultModel,
"Airbus A320 default model", CAircraftIcaoCode("A320", "L2J") });
}
diff --git a/src/plugins/simulator/msfs2024/simulatormsfs2024common.cpp b/src/plugins/simulator/msfs2024/simulatormsfs2024common.cpp
index 2a76dbc2e..6385e5376 100644
--- a/src/plugins/simulator/msfs2024/simulatormsfs2024common.cpp
+++ b/src/plugins/simulator/msfs2024/simulatormsfs2024common.cpp
@@ -37,8 +37,8 @@
#include "misc/simulation/fscommon/aircraftcfgparser.h"
#include "misc/simulation/fscommon/bcdconversions.h"
#include "misc/simulation/fscommon/fscommonutil.h"
-#include "misc/simulation/fsx/simconnectutilities.h"
#include "misc/simulation/interpolation/interpolatormulti.h"
+#include "misc/simulation/msfs2024/simconnectutilities.h"
#include "misc/simulation/settings/simulatorsettings.h"
#include "misc/simulation/simulatorplugininfo.h"
#include "misc/statusmessagelist.h"
@@ -56,8 +56,7 @@ using namespace swift::misc::math;
using namespace swift::misc::simulation;
using namespace swift::misc::simulation::data;
using namespace swift::misc::simulation::fscommon;
-using namespace swift::misc::simulation::fsx;
-// using namespace swift::misc::simulation::msfs2024;
+using namespace swift::misc::simulation::msfs2024;
using namespace swift::misc::simulation::settings;
using namespace swift::core;
using namespace swift::core::db;
@@ -362,7 +361,6 @@ namespace swift::simplugin::msfs2024common
sSimmobjectLoadedState.bLoadStarted = true;
CLogMessage(this).info(u"Start loading SimObjects and liverys from simulator");
- // TODO TZ a message should be displayed here because the gui freezes during loading large amounts of data
const CStatusMessage m = CStatusMessage(this, CStatusMessage::SeverityInfo,
u"Start loading SimObjects and liverys from simulator");
}
@@ -399,9 +397,6 @@ namespace swift::simplugin::msfs2024common
void CSimulatorMsfs2024::setSimObjectAndLiveries()
{
- // TODO TZ a message should be displayed here because the gui freezes during loading
- // better: move to the background (e.g., use CWorker::fromTask(...)), avoid GUI freeze.
-
CLogMessage(this).info(u"%1 SimObjects and Liveries in vSimObjectsAndLiveries")
<< vSimObjectsAndLiveries.size();
@@ -410,7 +405,7 @@ namespace swift::simplugin::msfs2024common
return QVariant(); // void-Result
});
- // TODO TZ where to place this message better?
+ // TODO TZ need help: Where can a message be placed indicating that loading is complete?
worker->then(this, [=] { CLogMessage(this).info(u"SimObjects and Liveries in vSimObjectsAndLiveries ready"); });
}
@@ -567,7 +562,7 @@ namespace swift::simplugin::msfs2024common
CLogMessage(this).info(u"%1 SimObjects and Liveries in DbModelList") << NewSet.size();
- // TODO TZ only for debugging
+ // TODO TZ can used only for debugging
// int cstoremodels = writeSimObjectsAndLiveriesToFile(NewSet);
}
}
@@ -676,17 +671,18 @@ namespace swift::simplugin::msfs2024common
this->sendRemoteAircraftPartsToSimulator(simObject, parts);
u++;
}
- if (!situation.isNull())
- {
- SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(situation, true);
- const bool traceSendId = this->isTracingSendId();
- const HRESULT hr = this->logAndTraceSendId(
- SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftSetPosition,
- static_cast(simObject.getObjectId()), 0, 0,
- sizeof(SIMCONNECT_DATA_INITPOSITION), &position),
- traceSendId, simObject, "Failed to set position", Q_FUNC_INFO, "SimConnect_SetDataOnSimObject");
- if (hr == S_OK) { u++; }
- }
+ // TODO TZ check: The function call destroys the configured simulation.
+ // if (!situation.isNull())
+ //{
+ // SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToPosition(situation, true);
+ // const bool traceSendId = this->isTracingSendId();
+ // const HRESULT hr = this->logAndTraceSendId(
+ // SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftSetPosition,
+ // static_cast(simObject.getObjectId()), 0, 0,
+ // sizeof(SIMCONNECT_DATA_INITPOSITION), &position),
+ // traceSendId, simObject, "Failed to set position", Q_FUNC_INFO, "SimConnect_SetDataOnSimObject");
+ // if (hr == S_OK) { u++; }
+ //}
return u > 0;
}
@@ -860,12 +856,14 @@ namespace swift::simplugin::msfs2024common
return m_simConnectObjects.removeByOtherSimObject(trace.simObject);
}
+ // TODO TZ check if nessesary in MSFS2024
void CSimulatorMsfs2024::removeCamera(CSimConnectObject &simObject)
{
// not in FSX
Q_UNUSED(simObject)
}
+ // TODO TZ check if nessesary in MSFS2024
void CSimulatorMsfs2024::removeObserver(CSimConnectObject &simObject)
{
// not in FSX
@@ -883,7 +881,7 @@ namespace swift::simplugin::msfs2024common
static const QString format("hh:mm:ss.zzz");
const QString untilString = QDateTime::fromMSecsSinceEpoch(traceUntil).toString(format);
- CLogMessage(this).info(u"Triggered FSX/P3D auto trace until %1") << untilString;
+ CLogMessage(this).info(u"Triggered MSFS2024 auto trace until %1") << untilString;
const QPointer myself(this);
QTimer::singleShot(traceTimeMs * 1.2, this, [=] {
// triggered by mself (ts check), otherwise ignore
@@ -914,13 +912,13 @@ namespace swift::simplugin::msfs2024common
if (simulatorOwnAircraft.pitchDeg < -90.0 || simulatorOwnAircraft.pitchDeg >= 90.0)
{
- CLogMessage(this).warning(u"FSX: Pitch value (own aircraft) out of limits: %1")
+ CLogMessage(this).warning(u"MSFS2024: Pitch value (own aircraft) out of limits: %1")
<< simulatorOwnAircraft.pitchDeg;
}
CAircraftSituation aircraftSituation;
aircraftSituation.setMSecsSinceEpoch(ts);
aircraftSituation.setPosition(position);
- // MSFS has inverted pitch and bank angles
+ // MSFS2024 has inverted pitch and bank angles
aircraftSituation.setPitch(CAngle(-simulatorOwnAircraft.pitchDeg, CAngleUnit::deg()));
aircraftSituation.setBank(CAngle(-simulatorOwnAircraft.bankDeg, CAngleUnit::deg()));
aircraftSituation.setHeading(CHeading(simulatorOwnAircraft.trueHeadingDeg, CHeading::True, CAngleUnit::deg()));
@@ -946,13 +944,18 @@ namespace swift::simplugin::msfs2024common
const CAircraftLights lights(dtb(simulatorOwnAircraft.lightStrobe), dtb(simulatorOwnAircraft.lightLanding),
dtb(simulatorOwnAircraft.lightTaxi), dtb(simulatorOwnAircraft.lightBeacon),
- dtb(simulatorOwnAircraft.lightNav), dtb(simulatorOwnAircraft.lightLogo));
+ dtb(simulatorOwnAircraft.lightNav), dtb(simulatorOwnAircraft.lightLogo),
+ dtb(simulatorOwnAircraft.lightRecognition), dtb(simulatorOwnAircraft.lightCabin),
+ dtb(simulatorOwnAircraft.lightWing)
+
+ );
CAircraftEngineList engines;
- const QList helperList { dtb(simulatorOwnAircraft.engine1Combustion),
- dtb(simulatorOwnAircraft.engine2Combustion),
- dtb(simulatorOwnAircraft.engine3Combustion),
- dtb(simulatorOwnAircraft.engine4Combustion) };
+ const QList helperList {
+ dtb(simulatorOwnAircraft.engine1Combustion), dtb(simulatorOwnAircraft.engine2Combustion),
+ dtb(simulatorOwnAircraft.engine3Combustion), dtb(simulatorOwnAircraft.engine4Combustion),
+ dtb(simulatorOwnAircraft.engine5Combustion), dtb(simulatorOwnAircraft.engine6Combustion)
+ };
for (int index = 0; index < simulatorOwnAircraft.numberOfEngines; ++index)
{
@@ -1057,7 +1060,7 @@ namespace swift::simplugin::msfs2024common
}
else { --m_skipCockpitUpdateCycles; }
- // TODO TZ check if we need to update terrain probes
+ // TODO TZ check this entire function for msfs2024
// slower updates
if (m_ownAircraftUpdateCycles % 10 == 0)
{
@@ -1165,7 +1168,6 @@ namespace swift::simplugin::msfs2024common
CSimConnectObject &so = m_simConnectObjects[cs];
if (so.isPendingRemoved()) { return; }
- // TODO TZ verify model and livery
QString combinedModelstring =
QString::fromUtf8(remoteAircraftModel.title) + " " + QString::fromUtf8(remoteAircraftModel.livery);
const QString modelString(combinedModelstring.trimmed());
@@ -1943,7 +1945,7 @@ namespace swift::simplugin::msfs2024common
// TODO TZ handle underflow properly
CStatusMessage underflowStatus;
const SIMCONNECT_DATA_INITPOSITION initialPosition =
- CSimulatorMsfs2024::aircraftSituationToFsxPosition(initialSituation, sendGround, true, &underflowStatus);
+ CSimulatorMsfs2024::aircraftSituationToPosition(initialSituation, sendGround, true, &underflowStatus);
QString modelString(newRemoteAircraft.getShortModelString());
const QString modelLiveryString(newRemoteAircraft.getLiveryString());
@@ -1968,12 +1970,12 @@ namespace swift::simplugin::msfs2024common
correspondingSimObject.getType() == CSimConnectObject::AircraftNonAtc)
{
CStatusMessage(this).warning(
- u"Model '%1' for '%2' failed %1 time(s) before, using AICreateSimulatedObject now")
- << newRemoteAircraft.getModelString() << callsign.toQString();
+ u"Model '%1' for '%2' failed %3 time(s) before, using SimConnect_AICreateSimulatedObject_EX1 now")
+ << newRemoteAircraft.getModelString() << callsign.toQString()
+ << correspondingSimObject.getAddingExceptions();
- hr = SimConnect_AICreateNonATCAircraft_EX1(m_hSimConnect, modelStringBa.constData(),
- modelLiveryBa.constData(), csBa.constData(), initialPosition,
- requestId);
+ hr = SimConnect_AICreateSimulatedObject_EX1(m_hSimConnect, modelStringBa.constData(),
+ modelLiveryBa.constData(), initialPosition, requestId);
type = CSimConnectObject::AircraftSimulatedObject;
}
@@ -2121,7 +2123,7 @@ namespace swift::simplugin::msfs2024common
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, SystemEventFlightLoaded, "FlightLoaded");
if (isFailure(hr))
{
- CLogMessage(this).error(u"FSX plugin error: %1") << "SimConnect_SubscribeToSystemEvent failed";
+ CLogMessage(this).error(u"MSFS2024 plugin error: %1") << "SimConnect_SubscribeToSystemEvent failed";
return hr;
}
@@ -2147,31 +2149,34 @@ namespace swift::simplugin::msfs2024common
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventSetTimeZuluHours, "ZULU_HOURS_SET");
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventSetTimeZuluMinutes, "ZULU_MINUTES_SET");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLandingLightsOff, "LANDING_LIGHTS_OFF");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLandinglightsOn, "LANDING_LIGHTS_ON");
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLandingLightsOff, "LANDING_LIGHTS_OFF");
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLandinglightsOn, "LANDING_LIGHTS_ON");
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLandingLightsSet, "LANDING_LIGHTS_SET");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLandingLightsToggle, "LANDING_LIGHTS_TOGGLE");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventPanelLightsOff, "PANEL_LIGHTS_OFF");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventPanelLightsOn, "PANEL_LIGHTS_ON");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventPanelLightsSet, "PANEL_LIGHTS_SET");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesOff, "STROBES_OFF");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesOn, "STROBES_ON");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesSet, "STROBES_SET");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesToggle, "STROBES_TOGGLE");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventToggleBeaconLights, "TOGGLE_BEACON_LIGHTS");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventToggleCabinLights, "TOGGLE_CABIN_LIGHTS");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventToggleLogoLights, "TOGGLE_LOGO_LIGHTS");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventToggleNavLights, "TOGGLE_NAV_LIGHTS");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventToggleRecognitionLights,
- "TOGGLE_RECOGNITION_LIGHTS");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventToggleTaxiLights, "TOGGLE_TAXI_LIGHTS");
- hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventToggleWingLights, "TOGGLE_WING_LIGHTS");
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLandingLightsToggle, "LANDING_LIGHTS_TOGGLE");
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventPanelLightsOff, "PANEL_LIGHTS_OFF");
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventPanelLightsOn, "PANEL_LIGHTS_ON");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventPanelLightsSet, "PANEL_LIGHTS_SET");
+
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesOff, "STROBES_OFF");
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesOn, "STROBES_ON");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesSet, "STROBES_SET");
+ // hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventStrobesToggle, "STROBES_TOGGLE");
+
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventBeaconLightsSet, "BEACON_LIGHTS_SET");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventCabinLightsSet, "CABIN_LIGHTS_SET");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventLogoLightsSet, "LOGO_LIGHTS_SET");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventNavLightsSet, "NAV_LIGHTS_SET");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventRecognitionLightsSet, "RECOGNITION_LIGHTS_SET");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventTaxiLightsSet, "TAXI_LIGHTS_SET");
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventWingLightsSet, "WING_LIGHTS_SET");
+
+ hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventGearSet, "GEAR_SET");
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventFlapsSet, "FLAPS_SET");
if (isFailure(hr))
{
- CLogMessage(this).error(u"FSX plugin error: %1") << "SimConnect_MapClientEventToSimEvent failed";
+ CLogMessage(this).error(u"MSFS2024 plugin error: %1") << "SimConnect_MapClientEventToSimEvent failed";
return hr;
}
@@ -2201,7 +2206,7 @@ namespace swift::simplugin::msfs2024common
HRESULT hr = this->initEvents();
if (isFailure(hr))
{
- CLogMessage(this).error(u"FSX plugin: initEvents failed");
+ CLogMessage(this).error(u"MSFS2024 plugin: initEvents failed");
return hr;
}
@@ -2209,7 +2214,7 @@ namespace swift::simplugin::msfs2024common
hr += this->initDataDefinitionsWhenConnected();
if (isFailure(hr))
{
- CLogMessage(this).error(u"FSX plugin: initDataDefinitionsWhenConnected failed");
+ CLogMessage(this).error(u"MSFS2024 plugin: initDataDefinitionsWhenConnected failed");
return hr;
}
@@ -2218,7 +2223,7 @@ namespace swift::simplugin::msfs2024common
void CSimulatorMsfs2024::updateRemoteAircraft()
{
- static_assert(sizeof(DataDefinitionRemoteAircraftPartsWithoutLights) == sizeof(double) * 10,
+ static_assert(sizeof(DataDefinitionRemoteAircraftPartsWithoutLights) == sizeof(double) * 12,
"DataDefinitionRemoteAircraftPartsWithoutLights has an incorrect size.");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
@@ -2283,7 +2288,7 @@ namespace swift::simplugin::msfs2024common
situation.setAltitude({ situation.getAltitude() + m_altitudeDelta * altitudeDeltaWeight,
situation.getAltitude().getReferenceDatum() });
- SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(situation, sendGround);
+ SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToPosition(situation, sendGround);
const HRESULT hr = this->logAndTraceSendId(
SimConnect_SetDataOnSimObject(m_hSimConnect,
CSimConnectDefinitions::DataRemoteAircraftSetPosition,
@@ -2371,28 +2376,81 @@ namespace swift::simplugin::msfs2024common
SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
traceId, simObject, "Failed so set flaps", Q_FUNC_INFO, "SimConnect_TransmitClientEvent::EventFlapsSet");
- // lights we can set directly
const HRESULT hr3 = this->logAndTraceSendId(
+ SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventGearSet, parts.isFixedGearDown() ? 1.0 : 0.0,
+ SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed so set gears", Q_FUNC_INFO, "SimConnect_TransmitClientEvent::EventGearSet");
+
+ const CAircraftLights lightsIsState = simObject.getCurrentLightsInSimulator();
+ if (lights == lightsIsState) { return isOk(hr1, hr2, hr3); }
+
+ // lights we can set directly
+ const HRESULT hr4 = this->logAndTraceSendId(
SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventLandingLightsSet,
lights.isLandingOn() ? 1.0 : 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
traceId, simObject, "Failed so set landing lights", Q_FUNC_INFO,
"SimConnect_TransmitClientEvent::EventLandingLightsSet");
- const HRESULT hr4 =
+ const HRESULT hr5 =
this->logAndTraceSendId(SimConnect_TransmitClientEvent(
m_hSimConnect, objectId, EventStrobesSet, lights.isStrobeOn() ? 1.0 : 0.0,
SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
traceId, simObject, "Failed to set strobe lights", Q_FUNC_INFO,
"SimConnect_TransmitClientEvent::EventStrobesSet");
- // lights we need to toggle
- // (potential risk with quickly changing values that we accidentally toggle back, also we need the light
- // state before we can toggle)
- this->sendToggledLightsToSimulator(simObject, lights);
+ const HRESULT hr6 =
+ this->logAndTraceSendId(SimConnect_TransmitClientEvent(
+ m_hSimConnect, objectId, EventTaxiLightsSet, lights.isTaxiOn() ? 1.0 : 0.0,
+ SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed to set taxi lights", Q_FUNC_INFO,
+ "SimConnect_TransmitClientEvent::EventTaxiLightsSet");
+
+ const HRESULT hr7 =
+ this->logAndTraceSendId(SimConnect_TransmitClientEvent(
+ m_hSimConnect, objectId, EventNavLightsSet, lights.isNavOn() ? 1.0 : 0.0,
+ SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed to set nav lights", Q_FUNC_INFO,
+ "SimConnect_TransmitClientEvent::EventNavLightsSet");
+
+ const HRESULT hr8 =
+ this->logAndTraceSendId(SimConnect_TransmitClientEvent(
+ m_hSimConnect, objectId, EventLogoLightsSet, lights.isLogoOn() ? 1.0 : 0.0,
+ SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed to set logo lights", Q_FUNC_INFO,
+ "SimConnect_TransmitClientEvent::EventLogoLightsSet");
+
+ const HRESULT hr9 = this->logAndTraceSendId(
+ SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventRecognitionLightsSet,
+ lights.isRecognitionOn() ? 1.0 : 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed to set recognitione lights", Q_FUNC_INFO,
+ "SimConnect_TransmitClientEvent::EventRecognitionLightsSet");
+
+ const HRESULT hr10 =
+ this->logAndTraceSendId(SimConnect_TransmitClientEvent(
+ m_hSimConnect, objectId, EventCabinLightsSet, lights.isCabinOn() ? 1.0 : 0.0,
+ SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed to set cabin lights", Q_FUNC_INFO,
+ "SimConnect_TransmitClientEvent::EventCabinLightsSet");
+
+ const HRESULT hr11 =
+ this->logAndTraceSendId(SimConnect_TransmitClientEvent(
+ m_hSimConnect, objectId, EventBeaconLightsSet, lights.isBeaconOn() ? 1.0 : 0.0,
+ SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed to set beacon lights", Q_FUNC_INFO,
+ "SimConnect_TransmitClientEvent::EventBeaconLightsSet");
+
+ const HRESULT hr12 =
+ this->logAndTraceSendId(SimConnect_TransmitClientEvent(
+ m_hSimConnect, objectId, EventWingLightsSet, lights.isWingOn() ? 1.0 : 0.0,
+ SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ traceId, simObject, "Failed to set wing lights", Q_FUNC_INFO,
+ "SimConnect_TransmitClientEvent::EventWingLightsSet");
// done
- return isOk(hr1, hr2, hr3, hr4);
+ return isOk(hr1, hr2, hr3, (hr4 & hr5 & hr6 & hr7 & hr8 & hr9 & hr10 & hr11 & hr12));
}
bool CSimulatorMsfs2024::sendRemoteAircraftAtcDataToSimulator(const CSimConnectObject &simObject)
@@ -2423,104 +2481,107 @@ namespace swift::simplugin::msfs2024common
return isOk(hr);
}
- void CSimulatorMsfs2024::sendToggledLightsToSimulator(const CSimConnectObject &simObj,
- const CAircraftLights &lightsWanted, bool force)
- {
- if (!simObj.isReadyToSend()) { return; } // stale
+ // TODO TZ under investigation, toggling lights seems to be unreliable. The settings mentioned above can be used
+ // directly. void CSimulatorMsfs2024::sendToggledLightsToSimulator(const CSimConnectObject &simObj,
+ // const CAircraftLights &lightsWanted, bool force)
+ //{
+ // if (!simObj.isReadyToSend()) { return; } // stale
- const CAircraftLights lightsIsState = simObj.getCurrentLightsInSimulator();
- if (lightsWanted == lightsIsState) { return; }
- if (!force && lightsWanted == simObj.getLightsAsSent()) { return; }
- const CCallsign callsign(simObj.getCallsign());
+ // const CAircraftLights lightsIsState = simObj.getCurrentLightsInSimulator();
+ // if (lightsWanted == lightsIsState) { return; }
+ // if (!force && lightsWanted == simObj.getLightsAsSent()) { return; }
+ // const CCallsign callsign(simObj.getCallsign());
- // Update data
- if (m_simConnectObjects.contains(callsign))
- {
- CSimConnectObject &simObjToUpdate = m_simConnectObjects[callsign];
- simObjToUpdate.setLightsAsSent(lightsWanted);
- }
+ // // Update data
+ // if (m_simConnectObjects.contains(callsign))
+ // {
+ // CSimConnectObject &simObjToUpdate = m_simConnectObjects[callsign];
+ // simObjToUpdate.setLightsAsSent(lightsWanted);
+ // }
- // state available, then I can toggle
- if (!lightsIsState.isNull())
- {
- const DWORD objectId = simObj.getObjectId();
- const bool trace = this->isTracingSendId();
+ // // state available, then I can toggle
+ // if (!lightsIsState.isNull())
+ // {
+ // const DWORD objectId = simObj.getObjectId();
+ // const bool trace = this->isTracingSendId();
- if (lightsWanted.isTaxiOn() != lightsIsState.isTaxiOn())
- {
- this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleTaxiLights,
- 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
- SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
- trace, simObj, "Toggle taxi lights", Q_FUNC_INFO, "EventToggleTaxiLights");
- }
- if (lightsWanted.isNavOn() != lightsIsState.isNavOn())
- {
- this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleNavLights,
- 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
- SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
- trace, simObj, "Toggle nav.lights", Q_FUNC_INFO, "EventToggleNavLights");
- }
- if (lightsWanted.isBeaconOn() != lightsIsState.isBeaconOn())
- {
- this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleBeaconLights,
- 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
- SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
- trace, simObj, "Toggle becon lights", Q_FUNC_INFO, "EventToggleBeaconLights");
- }
- if (lightsWanted.isLogoOn() != lightsIsState.isLogoOn())
- {
- this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleLogoLights,
- 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
- SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
- trace, simObj, "Toggle logo lights", Q_FUNC_INFO, "EventToggleLogoLights");
- }
- if (lightsWanted.isRecognitionOn() != lightsIsState.isRecognitionOn())
- {
- this->logAndTraceSendId(
- SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleRecognitionLights, 0.0,
- SIMCONNECT_GROUP_PRIORITY_HIGHEST,
- SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
- trace, simObj, "Toggle recognition lights", Q_FUNC_INFO, "EventToggleRecognitionLights");
- }
- if (lightsWanted.isCabinOn() != lightsIsState.isCabinOn())
- {
- this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleCabinLights,
- 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
- SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
- trace, simObj, "Toggle cabin lights", Q_FUNC_INFO, "EventToggleCabinLights");
- }
- return;
- }
+ // if (lightsWanted.isTaxiOn() != lightsIsState.isTaxiOn())
+ // {
+ // this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleTaxiLights,
+ // 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ // trace, simObj, "Toggle taxi lights", Q_FUNC_INFO, "EventToggleTaxiLights");
+ // }
+ // if (lightsWanted.isNavOn() != lightsIsState.isNavOn())
+ // {
+ // this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleNavLights,
+ // 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ // trace, simObj, "Toggle nav.lights", Q_FUNC_INFO, "EventToggleNavLights");
+ // }
+ // if (lightsWanted.isBeaconOn() != lightsIsState.isBeaconOn())
+ // {
+ // this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId,
+ // EventToggleBeaconLights,
+ // 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ // trace, simObj, "Toggle becon lights", Q_FUNC_INFO, "EventToggleBeaconLights");
+ // }
+ // if (lightsWanted.isLogoOn() != lightsIsState.isLogoOn())
+ // {
+ // this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleLogoLights,
+ // 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ // trace, simObj, "Toggle logo lights", Q_FUNC_INFO, "EventToggleLogoLights");
+ // }
+ // if (lightsWanted.isRecognitionOn() != lightsIsState.isRecognitionOn())
+ // {
+ // this->logAndTraceSendId(
+ // SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventToggleRecognitionLights, 0.0,
+ // SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ // trace, simObj, "Toggle recognition lights", Q_FUNC_INFO, "EventToggleRecognitionLights");
+ // }
+ // if (lightsWanted.isCabinOn() != lightsIsState.isCabinOn())
+ // {
+ // this->logAndTraceSendId(SimConnect_TransmitClientEvent(m_hSimConnect, objectId,
+ // EventToggleCabinLights,
+ // 0.0, SIMCONNECT_GROUP_PRIORITY_HIGHEST,
+ // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
+ // trace, simObj, "Toggle cabin lights", Q_FUNC_INFO, "EventToggleCabinLights");
+ // }
+ // return;
+ // }
- // missing lights info from simulator so far
- if (this->showDebugLogMessage())
- {
- this->debugLogMessage(Q_FUNC_INFO, QStringLiteral("Missing light state in simulator for '%1', model '%2'")
- .arg(callsign.asString(), simObj.getAircraftModelString()));
- }
+ // // missing lights info from simulator so far
+ // if (this->showDebugLogMessage())
+ // {
+ // this->debugLogMessage(Q_FUNC_INFO, QStringLiteral("Missing light state in simulator for '%1', model '%2'")
+ // .arg(callsign.asString(), simObj.getAircraftModelString()));
+ // }
- const QPointer myself(this);
- QTimer::singleShot(DeferResendingLights, this, [=] {
- if (!myself) { return; }
- if (!m_simConnectObjects.contains(callsign)) { return; }
- const CSimConnectObject currentSimObject = m_simConnectObjects[callsign];
- if (!currentSimObject.isReadyToSend()) { return; } // stale
- if (lightsWanted != currentSimObject.getLightsAsSent())
- {
- return;
- } // changed in between, so another call sendToggledLightsToSimulator is pending
- if (this->showDebugLogMessage())
- {
- this->debugLogMessage(Q_FUNC_INFO, QStringLiteral("Resending light state for '%1', model '%2'")
- .arg(callsign.asString(), simObj.getAircraftModelString()));
- }
- this->sendToggledLightsToSimulator(currentSimObject, lightsWanted, true);
- });
- }
+ // const QPointer myself(this);
+ // QTimer::singleShot(DeferResendingLights, this, [=] {
+ // if (!myself) { return; }
+ // if (!m_simConnectObjects.contains(callsign)) { return; }
+ // const CSimConnectObject currentSimObject = m_simConnectObjects[callsign];
+ // if (!currentSimObject.isReadyToSend()) { return; } // stale
+ // if (lightsWanted != currentSimObject.getLightsAsSent())
+ // {
+ // return;
+ // } // changed in between, so another call sendToggledLightsToSimulator is pending
+ // if (this->showDebugLogMessage())
+ // {
+ // this->debugLogMessage(Q_FUNC_INFO, QStringLiteral("Resending light state for '%1', model '%2'")
+ // .arg(callsign.asString(), simObj.getAircraftModelString()));
+ // }
+ // this->sendToggledLightsToSimulator(currentSimObject, lightsWanted, true);
+ // });
+ //}
SIMCONNECT_DATA_INITPOSITION
- CSimulatorMsfs2024::aircraftSituationToFsxPosition(const CAircraftSituation &situation, bool sendGnd,
- bool forceUnderflowDetection, CStatusMessage *details)
+ CSimulatorMsfs2024::aircraftSituationToPosition(const CAircraftSituation &situation, bool sendGnd,
+ bool forceUnderflowDetection, CStatusMessage *details)
{
Q_ASSERT_X(!situation.isGeodeticHeightNull(), Q_FUNC_INFO, "Missing height (altitude)");
Q_ASSERT_X(!situation.isPositionNull(), Q_FUNC_INFO, "Missing position");
@@ -2583,7 +2644,7 @@ namespace swift::simplugin::msfs2024common
// crosscheck
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
- SWIFT_VERIFY_X(isValidFsxPosition(position), Q_FUNC_INFO, "Invalid FSX pos.");
+ SWIFT_VERIFY_X(isValidFsxPosition(position), Q_FUNC_INFO, "Invalid MSFS2024 pos.");
}
return position;
@@ -3091,24 +3152,7 @@ namespace swift::simplugin::msfs2024common
const QString connectedSimName = m_simulatorName.toLower().trimmed();
if (connectedSimName.isEmpty()) { return false; }
- if (pluginSim.isP3D())
- {
- // P3D drivers only works with P3D
- return connectedSimName.contains("lockheed") || connectedSimName.contains("martin") ||
- connectedSimName.contains("p3d") || connectedSimName.contains("prepar");
- }
- else if (pluginSim.isFSX())
- {
- // FSX drivers only works with FSX
- return connectedSimName.contains("fsx") || connectedSimName.contains("microsoft") ||
- connectedSimName.contains("simulator x");
- }
- else if (pluginSim.isMSFS())
- {
- // MSFS 2020 drivers only works with MSFS
- return connectedSimName.contains("kittyhawk");
- }
- else if (pluginSim.isMSFS2024())
+ if (pluginSim.isMSFS2024())
{
// MSFS2024 drivers only works with MSFS2024
return connectedSimName.contains("sunrise");
diff --git a/src/plugins/simulator/msfs2024/simulatormsfs2024common.h b/src/plugins/simulator/msfs2024/simulatormsfs2024common.h
index 760c62992..a54d34001 100644
--- a/src/plugins/simulator/msfs2024/simulatormsfs2024common.h
+++ b/src/plugins/simulator/msfs2024/simulatormsfs2024common.h
@@ -68,26 +68,27 @@ namespace swift::simplugin::msfs2024common
EventSetTimeZuluHours,
EventSetTimeZuluMinutes,
// ------------ lights -------------
- EventLandingLightsOff,
- EventLandinglightsOn,
+ // EventLandingLightsOff,
+ // EventLandinglightsOn,
EventLandingLightsSet,
- EventLandingLightsToggle,
- EventPanelLightsOff,
- EventPanelLightsOn,
+ // EventLandingLightsToggle,
+ // EventPanelLightsOff,
+ // EventPanelLightsOn,
EventPanelLightsSet,
- EventStrobesOff,
- EventStrobesOn,
+ // EventStrobesOff,
+ // EventStrobesOn,
EventStrobesSet,
- EventStrobesToggle,
- EventToggleBeaconLights,
- EventToggleCabinLights,
- EventToggleLogoLights,
- EventToggleNavLights,
- EventToggleRecognitionLights,
- EventToggleTaxiLights,
- EventToggleWingLights,
+ // EventStrobesToggle,
+ EventBeaconLightsSet,
+ EventCabinLightsSet,
+ EventLogoLightsSet,
+ EventNavLightsSet,
+ EventRecognitionLightsSet,
+ EventTaxiLightsSet,
+ EventWingLightsSet,
// ------------- flaps -------------
EventFlapsSet,
+ EventGearSet,
// ---------- end marker -----------
EventFSXEndMarker
};
@@ -337,9 +338,9 @@ namespace swift::simplugin::msfs2024common
//! Format conversion
//! \note must be valid situation
static SIMCONNECT_DATA_INITPOSITION
- aircraftSituationToFsxPosition(const swift::misc::aviation::CAircraftSituation &situation, bool sendGnd = true,
- bool forceUnderflowDetection = false,
- swift::misc::CStatusMessage *details = nullptr);
+ aircraftSituationToPosition(const swift::misc::aviation::CAircraftSituation &situation, bool sendGnd = true,
+ bool forceUnderflowDetection = false,
+ swift::misc::CStatusMessage *details = nullptr);
//! Format conversion
//! \note must be valid situation
@@ -474,9 +475,9 @@ namespace swift::simplugin::msfs2024common
//! Send lights to simulator (those which have to be toggled)
//! \remark challenge here is that I can only sent those value if I have already obtained the current light
//! state from simulator \param force send lights even if they appear to be the same
- void sendToggledLightsToSimulator(const CSimConnectObject &simObject,
- const swift::misc::aviation::CAircraftLights &lightsWanted,
- bool force = false);
+ // void sendToggledLightsToSimulator(const CSimConnectObject &simObject,
+ // const swift::misc::aviation::CAircraftLights &lightsWanted,
+ // bool force = false);
//! Call CSimulatorFsxCommon::updateRemoteAircraftFromSimulator asynchronously
//! \remark do not to send SimConnect data in event loop
diff --git a/src/plugins/simulator/msfs2024/simulatormsfs2024simconnectproc.cpp b/src/plugins/simulator/msfs2024/simulatormsfs2024simconnectproc.cpp
index 45e338812..c245cfd74 100644
--- a/src/plugins/simulator/msfs2024/simulatormsfs2024simconnectproc.cpp
+++ b/src/plugins/simulator/msfs2024/simulatormsfs2024simconnectproc.cpp
@@ -281,7 +281,7 @@ namespace swift::simplugin::msfs2024common
{
case CSimConnectDefinitions::RequestOwnAircraft:
{
- static_assert(sizeof(DataDefinitionOwnAircraft) == 45 * sizeof(double),
+ static_assert(sizeof(DataDefinitionOwnAircraft) == 50 * sizeof(double),
"DataDefinitionOwnAircraft has an incorrect size.");
const DataDefinitionOwnAircraft *ownAircaft =
reinterpret_cast(&pObjData->dwData);
@@ -333,7 +333,7 @@ namespace swift::simplugin::msfs2024common
} // model
else if (subRequest == CSimConnectDefinitions::SimObjectLights)
{
- static_assert(sizeof(DataDefinitionRemoteAircraftLights) == 8 * sizeof(double),
+ static_assert(sizeof(DataDefinitionRemoteAircraftLights) == 9 * sizeof(double),
"DataDefinitionRemoteAircraftLights has an incorrect size.");
const DataDefinitionRemoteAircraftLights *remoteAircraftLights =
reinterpret_cast(&pObjData->dwData);
@@ -374,11 +374,6 @@ namespace swift::simplugin::msfs2024common
(SIMCONNECT_RECV_ENUMERATE_SIMOBJECT_AND_LIVERY_LIST *)pData;
switch (msg->dwRequestID)
{
- // case CSimConnectDefinitions::REQUEST_ALL:
- // case CSimConnectDefinitions::REQUEST_USER:
- // case CSimConnectDefinitions::REQUEST_BOAT:
- // case CSimConnectDefinitions::REQUEST_GROUND:
- // case CSimConnectDefinitions::REQUEST_ANIMAL:
case CSimConnectDefinitions::REQUEST_AIRPLANE:
case CSimConnectDefinitions::REQUEST_HELICOPTER:
case CSimConnectDefinitions::REQUEST_HOT_AIR: simulatorMsfs2024->CacheSimObjectAndLiveries(msg); break;
diff --git a/src/swiftdata/swiftdataapplication.cpp b/src/swiftdata/swiftdataapplication.cpp
index 699f12ff1..8fb5b6a87 100644
--- a/src/swiftdata/swiftdataapplication.cpp
+++ b/src/swiftdata/swiftdataapplication.cpp
@@ -23,7 +23,6 @@ CSwiftDataApplication::CSwiftDataApplication()
// this->addAudioOptions();
}
-// TODO TZ remove commented code after testing
CStatusMessageList CSwiftDataApplication::startHookIn()
{
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Not yet parsed cmd line arguments");
@@ -33,59 +32,15 @@ CStatusMessageList CSwiftDataApplication::startHookIn()
this->isParserOptionSet(m_cmdFacadeMode) ? this->getParserValue(m_cmdFacadeMode) : QString();
CoreModes::CoreMode coreMode = CoreModes::stringToCoreMode(coreModeStr);
- //// Valid combination?
- // if (!coreModeStr.isEmpty())
- //{
- // if (coreMode == CoreModes::Standalone && !dBusAddress.isEmpty())
- // {
- // const CStatusMessage m =
- // CStatusMessage(this, CLogCategories::validation()).error(u"Inconsistent pair DBus: '%1' and core:
- // '%2'")
- // << dBusAddress << coreModeStr;
- // return CStatusMessageList(m);
- // }
- // }
-
- //// Implicit configuration
CStatusMessageList msgs;
- // if (!dBusAddress.isEmpty() && coreModeStr.isEmpty())
- //{
- // coreMode = CoreModes::Distributed; // default
- // const CStatusMessage m =
- // CStatusMessage(this, CLogCategories::validation()).info(u"No DBus address, setting core mode: '%1'")
- // << CoreModes::coreModeToString(coreMode);
- // msgs.push_back(m);
- // }
- // else if (dBusAddress.isEmpty() && coreMode == CoreModes::Distributed)
- //{
- // dBusAddress = CDBusServer::sessionBusAddress(); // a possible default
- // const CStatusMessage m =
- // CStatusMessage(this, CLogCategories::validation()).info(u"Setting DBus address to '%1'") << dBusAddress;
- // msgs.push_back(m);
- // }
CCoreFacadeConfig runtimeConfig = coreModeToCoreFacadeConfig(coreMode, dBusAddress);
const CStatusMessageList contextMsgs = this->initContextsAndStartCoreFacade(runtimeConfig);
- // const CStatusMessageList contextMsgs = { CStatusMessage(this, CLogCategories::validation()).info(u"TEST") };
msgs.push_back(contextMsgs);
return contextMsgs;
}
-bool CSwiftDataApplication::parsingHookIn()
-{
- // Parse core relevant arguments
- // const QString dBusAddress(this->getCmdDBusAddressValue());
- // if (!dBusAddress.isEmpty())
- //{
- // // check if reachable
- // if (!CDBusServer::isDBusAvailable(dBusAddress))
- // {
- // this->cmdLineErrorMessage("DBus error", "DBus server at '" + dBusAddress + "' can not be reached");
- // return false;
- // }
- // }
- return CGuiApplication::parsingHookIn();
-}
+bool CSwiftDataApplication::parsingHookIn() { return CGuiApplication::parsingHookIn(); }
CSwiftDataApplication *CSwiftDataApplication::instance()
{