mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
refs #328 Read aircraft parts from simulators
This commit is contained in:
committed by
Klaus Basan
parent
58ae34d2e6
commit
bcc79ddeee
@@ -106,6 +106,17 @@ namespace BlackSimPlugin
|
|||||||
qint32 groundAltitudeRaw;
|
qint32 groundAltitudeRaw;
|
||||||
qint64 latitudeRaw;
|
qint64 latitudeRaw;
|
||||||
qint64 longitudeRaw;
|
qint64 longitudeRaw;
|
||||||
|
qint16 lightsRaw;
|
||||||
|
qint16 onGroundRaw;
|
||||||
|
qint32 flapsControlRaw;
|
||||||
|
qint32 gearControlRaw;
|
||||||
|
qint32 spoilersControlRaw;
|
||||||
|
qint16 numberOfEngines;
|
||||||
|
qint16 engine1CombustionFlag;
|
||||||
|
qint16 engine2CombustionFlag;
|
||||||
|
qint16 engine3CombustionFlag;
|
||||||
|
qint16 engine4CombustionFlag;
|
||||||
|
|
||||||
|
|
||||||
// http://www.projectmagenta.com/all-fsuipc-offsets/
|
// http://www.projectmagenta.com/all-fsuipc-offsets/
|
||||||
// https://www.ivao.aero/softdev/ivap/fsuipc_sdk.asp
|
// https://www.ivao.aero/softdev/ivap/fsuipc_sdk.asp
|
||||||
@@ -142,6 +153,20 @@ namespace BlackSimPlugin
|
|||||||
// model name
|
// model name
|
||||||
FSUIPC_Read(0x3d00, 256, &modelNameRaw, &dwResult) &&
|
FSUIPC_Read(0x3d00, 256, &modelNameRaw, &dwResult) &&
|
||||||
|
|
||||||
|
// aircraft parts
|
||||||
|
FSUIPC_Read(0x0D0C, 2, &lightsRaw, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x0366, 2, &onGroundRaw, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x0BDC, 4, &flapsControlRaw, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x0BE8, 4, &gearControlRaw, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x0BD0, 4, &spoilersControlRaw, &dwResult) &&
|
||||||
|
|
||||||
|
// engines
|
||||||
|
FSUIPC_Read(0x0AEC, 2, &numberOfEngines, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x0894, 2, &engine1CombustionFlag, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x092C, 2, &engine2CombustionFlag, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x09C4, 2, &engine3CombustionFlag, &dwResult) &&
|
||||||
|
FSUIPC_Read(0x0A5C, 2, &engine4CombustionFlag, &dwResult) &&
|
||||||
|
|
||||||
// If we wanted other reads/writes at the same time, we could put them here
|
// If we wanted other reads/writes at the same time, we could put them here
|
||||||
FSUIPC_Process(&dwResult))
|
FSUIPC_Process(&dwResult))
|
||||||
{
|
{
|
||||||
@@ -212,6 +237,24 @@ namespace BlackSimPlugin
|
|||||||
situation.setGroundspeed(groundspeed);
|
situation.setGroundspeed(groundspeed);
|
||||||
situation.setAltitude(altitude);
|
situation.setAltitude(altitude);
|
||||||
aircraft.setSituation(situation);
|
aircraft.setSituation(situation);
|
||||||
|
|
||||||
|
CAircraftLights lights (lightsRaw & (1 << 4), lightsRaw & (1 << 2), lightsRaw & (1 << 3), lightsRaw & (1 << 1),
|
||||||
|
lightsRaw & (1 << 0), lightsRaw & (1 << 8));
|
||||||
|
|
||||||
|
QList<bool> helperList { engine1CombustionFlag != 0, engine2CombustionFlag != 0,
|
||||||
|
engine3CombustionFlag != 0, engine4CombustionFlag != 0 };
|
||||||
|
|
||||||
|
CAircraftEngineList engines;
|
||||||
|
for (int index = 0; index < numberOfEngines; ++index)
|
||||||
|
{
|
||||||
|
engines.push_back(CAircraftEngine(index + 1, helperList.at(index)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CAircraftParts parts (lights, gearControlRaw == 16383, flapsControlRaw * 100 / 16383,
|
||||||
|
spoilersControlRaw == 16383, engines, onGroundRaw == 1);
|
||||||
|
|
||||||
|
aircraft.setParts(parts);
|
||||||
|
|
||||||
}
|
}
|
||||||
return read;
|
return read;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,11 +41,26 @@ namespace BlackSimPlugin
|
|||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "Plane Bank Degrees", "Degrees");
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "Plane Bank Degrees", "Degrees");
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "GROUND VELOCITY", "knots");
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "GROUND VELOCITY", "knots");
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "SIM ON GROUND", "bool");
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "SIM ON GROUND", "bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT STROBE", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT LANDING", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT TAXI", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT BEACON", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT NAV", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "LIGHT LOGO", "Bool");
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "TRANSPONDER CODE:1", NULL);
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "TRANSPONDER CODE:1", NULL);
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM ACTIVE FREQUENCY:1", "MHz");
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM ACTIVE FREQUENCY:1", "MHz");
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM ACTIVE FREQUENCY:2", "MHz");
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM ACTIVE FREQUENCY:2", "MHz");
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM STANDBY FREQUENCY:1", "MHz");
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM STANDBY FREQUENCY:1", "MHz");
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM STANDBY FREQUENCY:2", "MHz");
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "COM STANDBY FREQUENCY:2", "MHz");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "FLAPS HANDLE PERCENT", "Percent Over 100");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "SPOILERS HANDLE POSITION", "Percent Over 100");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "GEAR HANDLE POSITION", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "NUMBER OF ENGINES", "Number");
|
||||||
|
// Simconnect supports index 1 - 4
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "GENERAL ENG COMBUSTION:1", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "GENERAL ENG COMBUSTION:2", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "GENERAL ENG COMBUSTION:3", "Bool");
|
||||||
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft, "GENERAL ENG COMBUSTION:4", "Bool");
|
||||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraftTitle, "TITLE", NULL, SIMCONNECT_DATATYPE_STRING256);
|
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraftTitle, "TITLE", NULL, SIMCONNECT_DATATYPE_STRING256);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,11 +39,29 @@ namespace BlackSimPlugin
|
|||||||
double bank; //!< Bank
|
double bank; //!< Bank
|
||||||
double velocity; //!< Ground velocity
|
double velocity; //!< Ground velocity
|
||||||
double simOnGround; //!< Is aircraft on ground?
|
double simOnGround; //!< Is aircraft on ground?
|
||||||
|
|
||||||
|
double lightStrobe; //!< Is strobe light on?
|
||||||
|
double lightLanding; //!< Is landing light on?
|
||||||
|
double lightTaxi; //!< Is taxi light on?
|
||||||
|
double lightBeacon; //!< Is beacon light on?
|
||||||
|
double lightNav; //!< Is nav light on?
|
||||||
|
double lightLogo; //!< Is logo light on?
|
||||||
|
|
||||||
double transponderCode; //!< Transponder Code
|
double transponderCode; //!< Transponder Code
|
||||||
double com1ActiveMHz; //!< COM1 active frequency
|
double com1ActiveMHz; //!< COM1 active frequency
|
||||||
double com2ActiveMHz; //!< COM2 active frequency
|
double com2ActiveMHz; //!< COM2 active frequency
|
||||||
double com1StandbyMHz; //!< COM1 standby frequency
|
double com1StandbyMHz; //!< COM1 standby frequency
|
||||||
double com2StandbyMHz; //!< COM1 standby frequency
|
double com2StandbyMHz; //!< COM1 standby frequency
|
||||||
|
|
||||||
|
double flapsHandlePosition; //!< Flaps handle position in percent
|
||||||
|
double spoilersHandlePosition; //!< Spoilers out?
|
||||||
|
double gearHandlePosition; //!< Gear handle position
|
||||||
|
|
||||||
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Data struct of aircraft position
|
//! Data struct of aircraft position
|
||||||
|
|||||||
@@ -369,6 +369,30 @@ namespace BlackSimPlugin
|
|||||||
aircraftSituation.setAltitude(CAltitude(simulatorOwnAircraft.altitude, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
|
aircraftSituation.setAltitude(CAltitude(simulatorOwnAircraft.altitude, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
|
||||||
ownAircraft().setSituation(aircraftSituation);
|
ownAircraft().setSituation(aircraftSituation);
|
||||||
|
|
||||||
|
CAircraftLights lights ( simulatorOwnAircraft.lightStrobe,
|
||||||
|
simulatorOwnAircraft.lightLanding,
|
||||||
|
simulatorOwnAircraft.lightTaxi,
|
||||||
|
simulatorOwnAircraft.lightBeacon,
|
||||||
|
simulatorOwnAircraft.lightNav,
|
||||||
|
simulatorOwnAircraft.lightLogo );
|
||||||
|
|
||||||
|
QList<bool> helperList { simulatorOwnAircraft.engine1Combustion != 0, simulatorOwnAircraft.engine2Combustion != 0,
|
||||||
|
simulatorOwnAircraft.engine3Combustion != 0, simulatorOwnAircraft.engine4Combustion != 0 };
|
||||||
|
|
||||||
|
CAircraftEngineList engines;
|
||||||
|
for (int index = 0; index < simulatorOwnAircraft.numberOfEngines; ++index)
|
||||||
|
{
|
||||||
|
engines.push_back(CAircraftEngine(index + 1, helperList.at(index)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CAircraftParts parts ( lights, simulatorOwnAircraft.gearHandlePosition,
|
||||||
|
simulatorOwnAircraft.flapsHandlePosition * 100,
|
||||||
|
simulatorOwnAircraft.spoilersHandlePosition,
|
||||||
|
engines,
|
||||||
|
simulatorOwnAircraft.simOnGround );
|
||||||
|
|
||||||
|
ownAircraft().setParts(parts);
|
||||||
|
|
||||||
CComSystem com1 = ownAircraft().getCom1System(); // set defaults
|
CComSystem com1 = ownAircraft().getCom1System(); // set defaults
|
||||||
CComSystem com2 = ownAircraft().getCom2System();
|
CComSystem com2 = ownAircraft().getCom2System();
|
||||||
CTransponder transponder = ownAircraft().getTransponder();
|
CTransponder transponder = ownAircraft().getTransponder();
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
case CSimConnectDefinitions::RequestOwnAircraft:
|
case CSimConnectDefinitions::RequestOwnAircraft:
|
||||||
{
|
{
|
||||||
|
static_assert(sizeof(DataDefinitionOwnAircraft) == 27 * sizeof(double), "DataDefinitionOwnAircraft has an incorrect size.");
|
||||||
DataDefinitionOwnAircraft *ownAircaft;
|
DataDefinitionOwnAircraft *ownAircaft;
|
||||||
ownAircaft = (DataDefinitionOwnAircraft *)&pObjData->dwData;
|
ownAircaft = (DataDefinitionOwnAircraft *)&pObjData->dwData;
|
||||||
simulatorFsx->updateOwnAircraftFromSimulator(*ownAircaft);
|
simulatorFsx->updateOwnAircraftFromSimulator(*ownAircaft);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ namespace BlackSimPlugin
|
|||||||
m_service->getTransponderCodeAsync(&m_xplaneData.xpdrCode);
|
m_service->getTransponderCodeAsync(&m_xplaneData.xpdrCode);
|
||||||
m_service->getTransponderModeAsync(&m_xplaneData.xpdrMode);
|
m_service->getTransponderModeAsync(&m_xplaneData.xpdrMode);
|
||||||
m_service->getTransponderIdentAsync(&m_xplaneData.xpdrIdent);
|
m_service->getTransponderIdentAsync(&m_xplaneData.xpdrIdent);
|
||||||
|
m_service->getAllWheelsOnGroundAsync(&m_xplaneData.onGroundAll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +76,16 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
m_service->getAircraftModelPathAsync(&m_xplaneData.aircraftModelPath);
|
m_service->getAircraftModelPathAsync(&m_xplaneData.aircraftModelPath);
|
||||||
m_service->getAircraftIcaoCodeAsync(&m_xplaneData.aircraftIcaoCode);
|
m_service->getAircraftIcaoCodeAsync(&m_xplaneData.aircraftIcaoCode);
|
||||||
|
m_service->getBeaconLightsOnAsync(&m_xplaneData.beaconLightsOn);
|
||||||
|
m_service->getLandingLightsOnAsync(&m_xplaneData.landingLightsOn);
|
||||||
|
m_service->getNavLightsOnAsync(&m_xplaneData.navLightsOn);
|
||||||
|
m_service->getStrobeLightsOnAsync(&m_xplaneData.strobeLightsOn);
|
||||||
|
m_service->getTaxiLightsOnAsync(&m_xplaneData.taxiLightsOn);
|
||||||
|
m_service->getFlapsDeployRatioAsync(&m_xplaneData.flapsReployRatio);
|
||||||
|
m_service->getGearDeployRatioAsync(&m_xplaneData.gearReployRatio);
|
||||||
|
m_service->getEngineN1PercentageAsync(&m_xplaneData.enginesN1Percentage);
|
||||||
|
m_service->getSpeedBrakeRatioAsync(&m_xplaneData.speedBrakeRatio);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +220,22 @@ namespace BlackSimPlugin
|
|||||||
ac.setCom1System(Aviation::CComSystem::getCom1System({ m_xplaneData.com1Active, CFrequencyUnit::kHz() }, { m_xplaneData.com1Standby, CFrequencyUnit::kHz() }));
|
ac.setCom1System(Aviation::CComSystem::getCom1System({ m_xplaneData.com1Active, CFrequencyUnit::kHz() }, { m_xplaneData.com1Standby, CFrequencyUnit::kHz() }));
|
||||||
ac.setCom2System(Aviation::CComSystem::getCom2System({ m_xplaneData.com2Active, CFrequencyUnit::kHz() }, { m_xplaneData.com2Standby, CFrequencyUnit::kHz() }));
|
ac.setCom2System(Aviation::CComSystem::getCom2System({ m_xplaneData.com2Active, CFrequencyUnit::kHz() }, { m_xplaneData.com2Standby, CFrequencyUnit::kHz() }));
|
||||||
ac.setTransponder(Aviation::CTransponder::getStandardTransponder(m_xplaneData.xpdrCode, xpdrMode(m_xplaneData.xpdrMode, m_xplaneData.xpdrIdent)));
|
ac.setTransponder(Aviation::CTransponder::getStandardTransponder(m_xplaneData.xpdrCode, xpdrMode(m_xplaneData.xpdrMode, m_xplaneData.xpdrIdent)));
|
||||||
|
|
||||||
|
CAircraftEngineList engines;
|
||||||
|
|
||||||
|
for (int engineNumber = 0; engineNumber < m_xplaneData.enginesN1Percentage.size(); ++engineNumber)
|
||||||
|
{
|
||||||
|
// Engine number start counting at 1
|
||||||
|
// We consider the engine running when N1 is bigger than 5 %
|
||||||
|
CAircraftEngine engine {engineNumber + 1, m_xplaneData.enginesN1Percentage.at(engineNumber) > 5.0};
|
||||||
|
engines.push_back(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
Aviation::CAircraftParts parts { { m_xplaneData.strobeLightsOn, m_xplaneData.landingLightsOn, m_xplaneData.taxiLightsOn,
|
||||||
|
m_xplaneData.beaconLightsOn, m_xplaneData.navLightsOn, false },
|
||||||
|
{ m_xplaneData.gearReployRatio > 0 }, { static_cast<int>(m_xplaneData.flapsReployRatio * 100) },
|
||||||
|
{ m_xplaneData.speedBrakeRatio > 0.5 }, engines, { m_xplaneData.onGroundAll } };
|
||||||
|
ac.setParts(parts);
|
||||||
return ac;
|
return ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ namespace BlackSimPlugin
|
|||||||
double pitch;
|
double pitch;
|
||||||
double roll;
|
double roll;
|
||||||
double trueHeading;
|
double trueHeading;
|
||||||
|
bool onGroundAll;
|
||||||
int com1Active;
|
int com1Active;
|
||||||
int com1Standby;
|
int com1Standby;
|
||||||
int com2Active;
|
int com2Active;
|
||||||
@@ -141,11 +142,22 @@ namespace BlackSimPlugin
|
|||||||
int xpdrCode;
|
int xpdrCode;
|
||||||
int xpdrMode;
|
int xpdrMode;
|
||||||
bool xpdrIdent;
|
bool xpdrIdent;
|
||||||
|
bool beaconLightsOn;
|
||||||
|
bool landingLightsOn;
|
||||||
|
bool navLightsOn;
|
||||||
|
bool strobeLightsOn;
|
||||||
|
bool taxiLightsOn;
|
||||||
|
double flapsReployRatio;
|
||||||
|
double gearReployRatio;
|
||||||
|
QList<double> enginesN1Percentage;
|
||||||
|
double speedBrakeRatio;
|
||||||
} m_xplaneData;
|
} m_xplaneData;
|
||||||
|
|
||||||
void resetData()
|
void resetData()
|
||||||
{
|
{
|
||||||
m_xplaneData = { "", "", 0, 0, 0, 0, 0, 0, 0, 122800, 122800, 122800, 122800, 2000, 0, false };
|
m_xplaneData = { "", "", 0, 0, 0, 0, 0, 0, 0, false, 122800, 122800, 122800, 122800, 2000, 0, false, false, false, false,
|
||||||
|
false, false, 0, 0, {}, false};
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -282,6 +282,58 @@ namespace BlackSimPlugin
|
|||||||
m_dbusInterface->callDBusAsync(QLatin1String("getTransponderIdent"), setterCallback(o_ident));
|
m_dbusInterface->callDBusAsync(QLatin1String("getTransponderIdent"), setterCallback(o_ident));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CXBusServiceProxy::getBeaconLightsOn() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<bool>(QLatin1String("getBeaconLightsOn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getBeaconLightsOnAsync(bool *o_beaconLightsOn)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getBeaconLightsOn"), setterCallback(o_beaconLightsOn));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CXBusServiceProxy::getLandingLightsOn() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<bool>(QLatin1String("getLandingLightsOn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getLandingLightsOnAsync(bool *o_landingLightsOn)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getLandingLightsOn"), setterCallback(o_landingLightsOn));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CXBusServiceProxy::getNavLightsOn() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<bool>(QLatin1String("getNavLightsOn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getNavLightsOnAsync(bool *o_navLightsOn)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getNavLightsOn"), setterCallback(o_navLightsOn));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CXBusServiceProxy::getStrobeLightsOn() const
|
||||||
|
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<bool>(QLatin1String("getStrobeLightsOn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getStrobeLightsOnAsync(bool *o_strobeLightsOn)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getStrobeLightsOn"), setterCallback(o_strobeLightsOn));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CXBusServiceProxy::getTaxiLightsOn() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTaxiLightsOn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getTaxiLightsOnAsync(bool *o_taxiLightsOn)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getTaxiLightsOn"), setterCallback(o_taxiLightsOn));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CXBusServiceProxy::setCom1Active(int freq)
|
void CXBusServiceProxy::setCom1Active(int freq)
|
||||||
{
|
{
|
||||||
m_dbusInterface->callDBus(QLatin1String("setCom1Active"), freq);
|
m_dbusInterface->callDBus(QLatin1String("setCom1Active"), freq);
|
||||||
@@ -311,6 +363,54 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
m_dbusInterface->callDBus(QLatin1String("setTransponderMode"), mode);
|
m_dbusInterface->callDBus(QLatin1String("setTransponderMode"), mode);
|
||||||
}
|
}
|
||||||
|
double CXBusServiceProxy::getFlapsDeployRatio() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<double>(QLatin1String("getFlapsDeployRatio"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getFlapsDeployRatioAsync(double *o_flapsDeployRatio)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getFlapsDeployRatio"), setterCallback(o_flapsDeployRatio));
|
||||||
|
}
|
||||||
|
|
||||||
|
double CXBusServiceProxy::getGearDeployRatio() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<double>(QLatin1String("getGearDeployRatio"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getGearDeployRatioAsync(double *o_gearDeployRatio)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getGearDeployRatio"), setterCallback(o_gearDeployRatio));
|
||||||
|
}
|
||||||
|
|
||||||
|
int CXBusServiceProxy::getNumberOfEngines() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<int>(QLatin1String("getNumberOfEngines"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getNumberOfEnginesAsync(double *o_numberOfEngines)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getNumberOfEngines"), setterCallback(o_numberOfEngines));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<double> CXBusServiceProxy::getEngineN1Percentage() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<QList<double>>(QLatin1String("getEngineN1Percentage"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getEngineN1PercentageAsync(QList<double> *o_engineN1Percentage)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getEngineN1Percentage"), setterCallback(o_engineN1Percentage));
|
||||||
|
}
|
||||||
|
|
||||||
|
double CXBusServiceProxy::getSpeedBrakeRatio() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<double>(QLatin1String("getSpeedBrakeRatio"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXBusServiceProxy::getSpeedBrakeRatioAsync(double *o_speedBrakeRatio)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,6 +249,37 @@ namespace BlackSimPlugin
|
|||||||
void getTransponderIdentAsync(bool *o_ident);
|
void getTransponderIdentAsync(bool *o_ident);
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getLandingLightsOn
|
||||||
|
//! @{
|
||||||
|
bool getBeaconLightsOn() const;
|
||||||
|
void getBeaconLightsOnAsync(bool *o_beaconLightsOn);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getLandingLightsOn
|
||||||
|
//! @{
|
||||||
|
bool getLandingLightsOn() const;
|
||||||
|
void getLandingLightsOnAsync(bool *o_landingLightsOn);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getNavLightsOn
|
||||||
|
//! @{
|
||||||
|
bool getNavLightsOn() const;
|
||||||
|
void getNavLightsOnAsync(bool *o_navLightsOn);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getStrobeLightsOn
|
||||||
|
//! @{
|
||||||
|
bool getStrobeLightsOn() const;
|
||||||
|
void getStrobeLightsOnAsync(bool *o_strobeLightsOn);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getTaxiLightsOn
|
||||||
|
|
||||||
|
//! @{
|
||||||
|
bool getTaxiLightsOn() const;
|
||||||
|
void getTaxiLightsOnAsync(bool *o_taxiLightsOn);
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! \copydoc XBus::CService::setCom1Active
|
//! \copydoc XBus::CService::setCom1Active
|
||||||
void setCom1Active(int freq);
|
void setCom1Active(int freq);
|
||||||
|
|
||||||
@@ -266,6 +297,39 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
//! \copydoc XBus::CService::setTransponderMode
|
//! \copydoc XBus::CService::setTransponderMode
|
||||||
void setTransponderMode(int mode);
|
void setTransponderMode(int mode);
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getFlapsDeployRatio
|
||||||
|
|
||||||
|
//! @{
|
||||||
|
double getFlapsDeployRatio() const;
|
||||||
|
void getFlapsDeployRatioAsync(double *o_flapsDeployRatio);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getGearDeployRatio
|
||||||
|
//! @{
|
||||||
|
double getGearDeployRatio() const;
|
||||||
|
void getGearDeployRatioAsync(double *o_gearDeployRatio);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getNumberOfEngines
|
||||||
|
|
||||||
|
//! @{
|
||||||
|
int getNumberOfEngines() const;
|
||||||
|
void getNumberOfEnginesAsync(double *o_numberOfEngines);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getEngineN1Percentage
|
||||||
|
//! @{
|
||||||
|
QList<double> getEngineN1Percentage() const;
|
||||||
|
void getEngineN1PercentageAsync(QList<double> *o_engineN1Percentage);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XBus::CService::getSpeedBrakeRatio
|
||||||
|
//! @{
|
||||||
|
double getSpeedBrakeRatio() const;
|
||||||
|
void getSpeedBrakeRatioAsync(double *o_speedBrakeRatio);
|
||||||
|
//! @}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,21 @@ namespace XBus
|
|||||||
//! Get whether we are currently squawking ident
|
//! Get whether we are currently squawking ident
|
||||||
bool getTransponderIdent() const { return m_xpdrIdent.get(); }
|
bool getTransponderIdent() const { return m_xpdrIdent.get(); }
|
||||||
|
|
||||||
|
//! Get whether beacon lights are on
|
||||||
|
bool getBeaconLightsOn() const { return m_beaconLightsOn.get(); }
|
||||||
|
|
||||||
|
//! Get whether landing lights are on
|
||||||
|
bool getLandingLightsOn() const { return m_landingLightsOn.get(); }
|
||||||
|
|
||||||
|
//! Get whether nav lights are on
|
||||||
|
bool getNavLightsOn() const { return m_navLightsOn.get(); }
|
||||||
|
|
||||||
|
//! Get whether strobe lights are on
|
||||||
|
bool getStrobeLightsOn() const { return m_strobeLightsOn.get(); }
|
||||||
|
|
||||||
|
//! Get whether taxi lights are on
|
||||||
|
bool getTaxiLightsOn() const { return m_taxiLightsOn.get(); }
|
||||||
|
|
||||||
//! Set the current COM1 active frequency in kHz
|
//! Set the current COM1 active frequency in kHz
|
||||||
void setCom1Active(int freq) { m_com1Active.set(freq / 10); }
|
void setCom1Active(int freq) { m_com1Active.set(freq / 10); }
|
||||||
|
|
||||||
@@ -173,6 +188,28 @@ namespace XBus
|
|||||||
//! Set the current transponder mode (depends on the aircraft, 0 and 1 usually mean standby, >1 active)
|
//! Set the current transponder mode (depends on the aircraft, 0 and 1 usually mean standby, >1 active)
|
||||||
void setTransponderMode(int mode) { m_xpdrMode.set(mode); }
|
void setTransponderMode(int mode) { m_xpdrMode.set(mode); }
|
||||||
|
|
||||||
|
//! Get flaps deploy ratio, where 0.0 is flaps fully retracted, and 1.0 is flaps fully extended.
|
||||||
|
double getFlapsDeployRatio() const { return m_flapsReployRatio.get(); }
|
||||||
|
|
||||||
|
//! Get gear deploy ratio, where 0 is up and 1 is down
|
||||||
|
double getGearDeployRatio() const { return m_gearReployRatio.get(); }
|
||||||
|
|
||||||
|
//! Get the number of engines of current aircraft
|
||||||
|
int getNumberOfEngines() const { return m_numberOfEngines.get(); }
|
||||||
|
|
||||||
|
//! Get the N1 speed as percent of max (per engine)
|
||||||
|
QList<double> getEngineN1Percentage() const
|
||||||
|
{
|
||||||
|
QList<double> list;
|
||||||
|
for (int engineNumber = 0; engineNumber < getNumberOfEngines(); ++engineNumber)
|
||||||
|
list.append(m_enginesN1Percentage.getAt(engineNumber));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Get the ratio how much the speedbrakes surfaces are extended (0.0 is fully retracted, and 1.0 is fully extended)
|
||||||
|
double getSpeedBrakeRatio() const { return m_speedBrakeRatio.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackMisc::Geo::CGeodesicGrid<128, XPLMNavRef> m_airports;
|
BlackMisc::Geo::CGeodesicGrid<128, XPLMNavRef> m_airports;
|
||||||
QTimer *m_airportUpdater = nullptr;
|
QTimer *m_airportUpdater = nullptr;
|
||||||
@@ -199,6 +236,16 @@ namespace XBus
|
|||||||
DataRef<xplane::data::sim::cockpit::radios::transponder_code> m_xpdrCode;
|
DataRef<xplane::data::sim::cockpit::radios::transponder_code> m_xpdrCode;
|
||||||
DataRef<xplane::data::sim::cockpit::radios::transponder_mode> m_xpdrMode;
|
DataRef<xplane::data::sim::cockpit::radios::transponder_mode> m_xpdrMode;
|
||||||
DataRef<xplane::data::sim::cockpit::radios::transponder_id> m_xpdrIdent;
|
DataRef<xplane::data::sim::cockpit::radios::transponder_id> m_xpdrIdent;
|
||||||
|
DataRef<xplane::data::sim::cockpit::electrical::beacon_lights_on> m_beaconLightsOn;
|
||||||
|
DataRef<xplane::data::sim::cockpit::electrical::landing_lights_on> m_landingLightsOn;
|
||||||
|
DataRef<xplane::data::sim::cockpit::electrical::nav_lights_on> m_navLightsOn;
|
||||||
|
DataRef<xplane::data::sim::cockpit::electrical::strobe_lights_on> m_strobeLightsOn;
|
||||||
|
DataRef<xplane::data::sim::cockpit::electrical::taxi_light_on> m_taxiLightsOn;
|
||||||
|
DataRef<xplane::data::sim::flightmodel2::controls::flap_handle_deploy_ratio> m_flapsReployRatio;
|
||||||
|
DataRef<xplane::data::sim::flightmodel2::gear::deploy_ratio> m_gearReployRatio;
|
||||||
|
DataRef<xplane::data::sim::aircraft::engine::acf_num_engines> m_numberOfEngines;
|
||||||
|
ArrayDataRef<xplane::data::sim::flightmodel::engine::ENGN_N1_> m_enginesN1Percentage;
|
||||||
|
DataRef<xplane::data::sim::flightmodel2::controls::speedbrake_ratio> m_speedBrakeRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user