1
0
Fork 0

swift: COM volume support

This commit is contained in:
Lars Toenning 2021-09-03 14:13:06 +02:00 committed by James Turner
parent c50fe8de07
commit f00d843c8f
2 changed files with 26 additions and 0 deletions

View file

@ -69,6 +69,8 @@ CService::CService()
m_rollRateNode = fgGetNode("/orientation/roll-rate-degps", true); m_rollRateNode = fgGetNode("/orientation/roll-rate-degps", true);
m_pichRateNode = fgGetNode("/orientation/pitch-rate-degps", true); m_pichRateNode = fgGetNode("/orientation/pitch-rate-degps", true);
m_yawRateNode = fgGetNode("/orientation/yaw-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"); 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; 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; static const char* introspection_service = DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE;
DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage& message_) DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage& message_)
@ -604,6 +617,14 @@ DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage& message_)
queueDBusCall([=]() { queueDBusCall([=]() {
sendDBusReply(sender, serial, getSpeedBrakeRatio()); 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 { } else {
// Unknown message. Tell DBus that we cannot handle it // Unknown message. Tell DBus that we cannot handle it
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

View file

@ -214,6 +214,9 @@ public:
//! Get yaw rate in rad/sec //! Get yaw rate in rad/sec
double getYawRate() const; double getYawRate() const;
double getCom1Volume() const;
double getCom2Volume() const;
//! Perform generic processing //! Perform generic processing
int process(); int process();
@ -263,6 +266,8 @@ private:
SGPropertyNode_ptr m_rollRateNode; SGPropertyNode_ptr m_rollRateNode;
SGPropertyNode_ptr m_pichRateNode; SGPropertyNode_ptr m_pichRateNode;
SGPropertyNode_ptr m_yawRateNode; SGPropertyNode_ptr m_yawRateNode;
SGPropertyNode_ptr m_com1VolumeNode;
SGPropertyNode_ptr m_com2VolumeNode;
}; };