diff --git a/src/plugins/simulator/xplane/xbus_service_proxy.cpp b/src/plugins/simulator/xplane/xbus_service_proxy.cpp index c47ce3eae..108d5cd3a 100644 --- a/src/plugins/simulator/xplane/xbus_service_proxy.cpp +++ b/src/plugins/simulator/xplane/xbus_service_proxy.cpp @@ -122,5 +122,70 @@ namespace BlackSimPlugin return m_dbusInterface->callDBusRet(QLatin1String("getTrueHeading")); } + int CXBusServiceProxy::getCom1Active() const + { + return m_dbusInterface->callDBusRet(QLatin1String("getCom1Active")); + } + + int CXBusServiceProxy::getCom1Standby() const + { + return m_dbusInterface->callDBusRet(QLatin1String("getCom1Standby")); + } + + int CXBusServiceProxy::getCom2Active() const + { + return m_dbusInterface->callDBusRet(QLatin1String("getCom2Active")); + } + + int CXBusServiceProxy::getCom2Standby() const + { + return m_dbusInterface->callDBusRet(QLatin1String("getCom2Standby")); + } + + int CXBusServiceProxy::getTransponderCode() const + { + return m_dbusInterface->callDBusRet(QLatin1String("getTransponderCode")); + } + + int CXBusServiceProxy::getTransponderMode() const + { + return m_dbusInterface->callDBusRet(QLatin1String("getTransponderMode")); + } + + bool CXBusServiceProxy::getTransponderIdent() const + { + return m_dbusInterface->callDBusRet(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); + } + } } \ No newline at end of file diff --git a/src/plugins/simulator/xplane/xbus_service_proxy.h b/src/plugins/simulator/xplane/xbus_service_proxy.h index b3179bf16..c7b54f0f4 100644 --- a/src/plugins/simulator/xplane/xbus_service_proxy.h +++ b/src/plugins/simulator/xplane/xbus_service_proxy.h @@ -111,6 +111,45 @@ namespace BlackSimPlugin //! \copydoc XBus::CService::getTrueHeading 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); }; } diff --git a/src/xbus/service.h b/src/xbus/service.h index 470f0b09f..bb2e1f35c 100644 --- a/src/xbus/service.h +++ b/src/xbus/service.h @@ -107,6 +107,45 @@ namespace XBus //! Get aircraft true heading in degrees 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: StringDataRef m_liveryPath; StringDataRef m_icao; @@ -120,6 +159,13 @@ namespace XBus DataRef m_pitch; DataRef m_roll; DataRef m_heading; + DataRef m_com1Active; + DataRef m_com1Standby; + DataRef m_com2Active; + DataRef m_com2Standby; + DataRef m_xpdrCode; + DataRef m_xpdrMode; + DataRef m_xpdrIdent; }; }