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