refs #328 Read aircraft parts from simulators

This commit is contained in:
Roland Winklmeier
2015-02-07 21:32:48 +01:00
committed by Klaus Basan
parent 58ae34d2e6
commit bcc79ddeee
10 changed files with 353 additions and 2 deletions

View File

@@ -66,6 +66,7 @@ namespace BlackSimPlugin
m_service->getTransponderCodeAsync(&m_xplaneData.xpdrCode);
m_service->getTransponderModeAsync(&m_xplaneData.xpdrMode);
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->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.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)));
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;
}

View File

@@ -134,6 +134,7 @@ namespace BlackSimPlugin
double pitch;
double roll;
double trueHeading;
bool onGroundAll;
int com1Active;
int com1Standby;
int com2Active;
@@ -141,11 +142,22 @@ namespace BlackSimPlugin
int xpdrCode;
int xpdrMode;
bool xpdrIdent;
bool beaconLightsOn;
bool landingLightsOn;
bool navLightsOn;
bool strobeLightsOn;
bool taxiLightsOn;
double flapsReployRatio;
double gearReployRatio;
QList<double> enginesN1Percentage;
double speedBrakeRatio;
} m_xplaneData;
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};
}
};

View File

@@ -282,6 +282,58 @@ namespace BlackSimPlugin
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)
{
m_dbusInterface->callDBus(QLatin1String("setCom1Active"), freq);
@@ -311,6 +363,54 @@ namespace BlackSimPlugin
{
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));
}
}
}
}

View File

@@ -249,6 +249,37 @@ namespace BlackSimPlugin
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
void setCom1Active(int freq);
@@ -266,6 +297,39 @@ namespace BlackSimPlugin
//! \copydoc XBus::CService::setTransponderMode
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);
//! @}
};
}