mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
fixup! refactor(msfs): Request transponder data with OwnAircraftData
This commit is contained in:
@@ -81,6 +81,7 @@ namespace swift::simplugin::fsxcommon
|
||||
hr += initRemoteAircraftSimDataSet(hSimConnect);
|
||||
hr += initSimulatorEnvironment(hSimConnect);
|
||||
hr += initSbDataArea(hSimConnect);
|
||||
if (simInfo.isMSFS() || simInfo.isMSFS2024()) { hr += initMSFSTransponder(hSimConnect); }
|
||||
return hr;
|
||||
}
|
||||
|
||||
@@ -409,6 +410,21 @@ namespace swift::simplugin::fsxcommon
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CSimConnectDefinitions::initMSFSTransponder(const HANDLE hSimConnect)
|
||||
{
|
||||
HRESULT hr = s_ok();
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataTransponderModeMSFS,
|
||||
"TRANSPONDER STATE:1", "Enum");
|
||||
|
||||
if (isFailure(hr))
|
||||
{
|
||||
CLogMessage(static_cast<CSimConnectDefinitions *>(nullptr))
|
||||
.error(u"SimConnect error: MSFS transponder data definitions %1")
|
||||
<< hr;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
DataDefinitionRemoteAircraftPartsWithoutLights::DataDefinitionRemoteAircraftPartsWithoutLights()
|
||||
{
|
||||
this->resetToInvalid();
|
||||
|
||||
@@ -249,6 +249,13 @@ namespace swift::simplugin::fsxcommon
|
||||
QString toQString() const;
|
||||
};
|
||||
|
||||
//! Data structure for MSFS transponder mode information
|
||||
struct DataDefinitionMSFSTransponderMode
|
||||
{
|
||||
double transponderMode = 1; //!< transponder state simvar
|
||||
};
|
||||
|
||||
|
||||
//! Client areas
|
||||
enum ClientAreaId
|
||||
{
|
||||
@@ -272,6 +279,7 @@ namespace swift::simplugin::fsxcommon
|
||||
DataRemoteAircraftModelData, //!< model data eventually used and reported back from simulator
|
||||
DataRemoteAircraftSetData, //!< set model data such as airline
|
||||
DataSimEnvironment,
|
||||
DataTransponderModeMSFS,
|
||||
DataClientAreaSb, //!< whole SB area, see http://squawkbox.ca/doc/sdk/fsuipc.php
|
||||
DataClientAreaSbIdent, //!< SB ident single value 0x7b93/19
|
||||
DataClientAreaSbStandby, //!< SB standby 0x7b91/17
|
||||
@@ -333,6 +341,9 @@ namespace swift::simplugin::fsxcommon
|
||||
|
||||
//! Initialize the SB data are
|
||||
static HRESULT initSbDataArea(const HANDLE hSimConnect);
|
||||
|
||||
//! Initialize data definition for MSFS transponder
|
||||
static HRESULT initMSFSTransponder(const HANDLE hSimConnect);
|
||||
};
|
||||
} // namespace swift::simplugin::fsxcommon
|
||||
|
||||
|
||||
@@ -204,7 +204,6 @@ namespace swift::simplugin::fsxcommon
|
||||
{
|
||||
DataDefinitionMSFSTransponderMode t;
|
||||
t.transponderMode = (newTransponder.isInStandby() ? 1 : 4);
|
||||
t.ident = newTransponder.isIdentifying();
|
||||
|
||||
HRESULT hr = s_ok();
|
||||
|
||||
@@ -684,8 +683,8 @@ namespace swift::simplugin::fsxcommon
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::setTransponderMode(
|
||||
swift::misc::aviation::CTransponder &transponder,
|
||||
const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft)
|
||||
[[maybe_unused]] swift::misc::aviation::CTransponder &transponder,
|
||||
[[maybe_unused]] const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft)
|
||||
{ /* Do not modify the transponder mode by default. Only MSFS allows to read it from SimVars */ }
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user