refs #268 added XBus::CService methods to get and set radios and transponder

This commit is contained in:
Mathew Sutcliffe
2014-06-15 18:44:53 +01:00
parent 4ebb03bd0d
commit b21adbe498
3 changed files with 150 additions and 0 deletions

View File

@@ -122,5 +122,70 @@ namespace BlackSimPlugin
return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueHeading")); return m_dbusInterface->callDBusRet<double>(QLatin1String("getTrueHeading"));
} }
int CXBusServiceProxy::getCom1Active() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1Active"));
}
int CXBusServiceProxy::getCom1Standby() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom1Standby"));
}
int CXBusServiceProxy::getCom2Active() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2Active"));
}
int CXBusServiceProxy::getCom2Standby() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getCom2Standby"));
}
int CXBusServiceProxy::getTransponderCode() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderCode"));
}
int CXBusServiceProxy::getTransponderMode() const
{
return m_dbusInterface->callDBusRet<int>(QLatin1String("getTransponderMode"));
}
bool CXBusServiceProxy::getTransponderIdent() const
{
return m_dbusInterface->callDBusRet<bool>(QLatin1String("getTransponderIdent"));
}
void CXBusServiceProxy::setCom1Active(int freq)
{
m_dbusInterface->callDBus(QLatin1String("setCom1Active"), freq);
}
void CXBusServiceProxy::setCom1Standby(int freq)
{
m_dbusInterface->callDBus(QLatin1String("setCom1Standby"), freq);
}
void CXBusServiceProxy::setCom2Active(int freq)
{
m_dbusInterface->callDBus(QLatin1String("setCom2Active"), freq);
}
void CXBusServiceProxy::setCom2Standby(int freq)
{
m_dbusInterface->callDBus(QLatin1String("setCom2Standby"), freq);
}
void CXBusServiceProxy::setTransponderCode(int code)
{
m_dbusInterface->callDBus(QLatin1String("setTransponderCode"), code);
}
void CXBusServiceProxy::setTransponderMode(int mode)
{
m_dbusInterface->callDBus(QLatin1String("setTransponderMode"), mode);
}
} }
} }

View File

@@ -111,6 +111,45 @@ namespace BlackSimPlugin
//! \copydoc XBus::CService::getTrueHeading //! \copydoc XBus::CService::getTrueHeading
double getTrueHeading() const; double getTrueHeading() const;
//! \copydoc XBus::CService::getCom1Active
int getCom1Active() const;
//! \copydoc XBus::CService::getCom1Standby
int getCom1Standby() const;
//! \copydoc XBus::CService::getCom2Active
int getCom2Active() const;
//! \copydoc XBus::CService::getCom2Standby
int getCom2Standby() const;
//! \copydoc XBus::CService::getTransponderCode
int getTransponderCode() const;
//! \copydoc XBus::CService::getTransponderMode
int getTransponderMode() const;
//! \copydoc XBus::CService::getTransponderIdent
bool getTransponderIdent() const;
//! \copydoc XBus::CService::setCom1Active
void setCom1Active(int freq);
//! \copydoc XBus::CService::setCom1Standby
void setCom1Standby(int freq);
//! \copydoc XBus::CService::setCom2Active
void setCom2Active(int freq);
//! \copydoc XBus::CService::setCom2Standby
void setCom2Standby(int freq);
//! \copydoc XBus::CService::setTransponderCode
void setTransponderCode(int code);
//! \copydoc XBus::CService::setTransponderMode
void setTransponderMode(int mode);
}; };
} }

View File

@@ -107,6 +107,45 @@ namespace XBus
//! Get aircraft true heading in degrees //! Get aircraft true heading in degrees
double getTrueHeading() const { return m_heading.get(); } double getTrueHeading() const { return m_heading.get(); }
//! Get the current COM1 active frequency in kHz
int getCom1Active() const { return m_com1Active.get() * 10; }
//! Get the current COM1 standby frequency in kHz
int getCom1Standby() const { return m_com1Standby.get() * 10; }
//! Get the current COM2 active frequency in kHz
int getCom2Active() const { return m_com2Active.get() * 10; }
//! Get the current COM2 standby frequency in kHz
int getCom2Standby() const { return m_com2Standby.get() * 10; }
//! Get the current transponder code in decimal
int getTransponderCode() const { return m_xpdrCode.get(); }
//! Get the current transponder mode (depends on the aircraft, 0 and 1 usually mean standby, >1 active)
int getTransponderMode() const { return m_xpdrMode.get(); }
//! Get whether we are currently squawking ident
bool getTransponderIdent() const { return m_xpdrIdent.get(); }
//! Set the current COM1 active frequency in kHz
void setCom1Active(int freq) { m_com1Active.set(freq / 10); }
//! Set the current COM1 standby frequency in kHz
void setCom1Standby(int freq) { m_com1Standby.set(freq / 10); }
//! Set the current COM2 active frequency in kHz
void setCom2Active(int freq) { m_com2Active.set(freq / 10); }
//! Set the current COM2 standby frequency in kHz
void setCom2Standby(int freq) { m_com2Standby.set(freq / 10); }
//! Set the current transponder code in decimal
void setTransponderCode(int code) { m_xpdrCode.set(code); }
//! 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); }
private: private:
StringDataRef<xplane::data::sim::aircraft::view::acf_livery_path> m_liveryPath; StringDataRef<xplane::data::sim::aircraft::view::acf_livery_path> m_liveryPath;
StringDataRef<xplane::data::sim::aircraft::view::acf_ICAO> m_icao; StringDataRef<xplane::data::sim::aircraft::view::acf_ICAO> m_icao;
@@ -120,6 +159,13 @@ namespace XBus
DataRef<xplane::data::sim::flightmodel::position::theta> m_pitch; DataRef<xplane::data::sim::flightmodel::position::theta> m_pitch;
DataRef<xplane::data::sim::flightmodel::position::phi> m_roll; DataRef<xplane::data::sim::flightmodel::position::phi> m_roll;
DataRef<xplane::data::sim::flightmodel::position::psi> m_heading; DataRef<xplane::data::sim::flightmodel::position::psi> m_heading;
DataRef<xplane::data::sim::cockpit::radios::com1_freq_hz> m_com1Active;
DataRef<xplane::data::sim::cockpit::radios::com1_stdby_freq_hz> m_com1Standby;
DataRef<xplane::data::sim::cockpit::radios::com2_freq_hz> m_com2Active;
DataRef<xplane::data::sim::cockpit::radios::com2_stdby_freq_hz> m_com2Standby;
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_id> m_xpdrIdent;
}; };
} }