diff --git a/src/Network/Swift/service.cpp b/src/Network/Swift/service.cpp index b93d4a063..ac636d32b 100644 --- a/src/Network/Swift/service.cpp +++ b/src/Network/Swift/service.cpp @@ -69,6 +69,8 @@ CService::CService() m_rollRateNode = fgGetNode("/orientation/roll-rate-degps", true); m_pichRateNode = fgGetNode("/orientation/pitch-rate-degps", true); m_yawRateNode = fgGetNode("/orientation/yaw-rate-degps", true); + m_com1VolumeNode = fgGetNode("/instrumentation/comm/volume", true); + m_com2VolumeNode = fgGetNode("/instrumentation/comm[1]/volume", true); SG_LOG(SG_NETWORK, SG_INFO, "FGSwiftBus Service initialized"); } @@ -352,6 +354,17 @@ double CService::getYawRate() const return m_yawRateNode->getDoubleValue() * SG_DEGREES_TO_RADIANS; } +double CService::getCom1Volume() const +{ + return m_com1VolumeNode->getDoubleValue(); +} + +double CService::getCom2Volume() const +{ + return m_com2VolumeNode->getDoubleValue(); +} + + static const char* introspection_service = DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE; DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage& message_) @@ -604,6 +617,14 @@ DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage& message_) queueDBusCall([=]() { sendDBusReply(sender, serial, getSpeedBrakeRatio()); }); + } else if (message.getMethodName() == "getCom1Volume") { + queueDBusCall([=]() { + sendDBusReply(sender, serial, getCom1Volume()); + }); + } else if (message.getMethodName() == "getCom2Volume") { + queueDBusCall([=]() { + sendDBusReply(sender, serial, getCom2Volume()); + }); } else { // Unknown message. Tell DBus that we cannot handle it return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; diff --git a/src/Network/Swift/service.h b/src/Network/Swift/service.h index 32df58a83..b57160ee7 100644 --- a/src/Network/Swift/service.h +++ b/src/Network/Swift/service.h @@ -214,6 +214,9 @@ public: //! Get yaw rate in rad/sec double getYawRate() const; + double getCom1Volume() const; + double getCom2Volume() const; + //! Perform generic processing int process(); @@ -263,6 +266,8 @@ private: SGPropertyNode_ptr m_rollRateNode; SGPropertyNode_ptr m_pichRateNode; SGPropertyNode_ptr m_yawRateNode; + SGPropertyNode_ptr m_com1VolumeNode; + SGPropertyNode_ptr m_com2VolumeNode; };