diff --git a/src/Network/Swift/service.cpp b/src/Network/Swift/service.cpp index 8b1f28b50..0b8ee3ca9 100644 --- a/src/Network/Swift/service.cpp +++ b/src/Network/Swift/service.cpp @@ -68,6 +68,7 @@ CService::CService() gearDeployRatioNode = fgGetNode("/gear/gear/position-norm"); speedBrakeDeployRatioNode = fgGetNode("/surface-positions/speedbrake-pos-norm"); aircraftNameNode = fgGetNode("/sim/aircraft"); + groundElevation = fgGetNode("/position/ground-elev-m"); SG_LOG(SG_NETWORK, SG_INFO, "FGSwiftBus Service initialized"); } @@ -298,6 +299,11 @@ double CService::getSpeedBrakeRatio() const return speedBrakeDeployRatioNode->getFloatValue(); } +double CService::getGroundElevation() const +{ + return groundElevation->getDoubleValue(); +} + std::string CService::getAircraftModelFilename() const { std::string modelFileName = getAircraftName(); @@ -482,6 +488,10 @@ DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage& message_) queueDBusCall([=]() { sendDBusReply(sender, serial, getPressAlt()); }); + } else if (message.getMethodName() == "getGroundElevation") { + queueDBusCall([=]() { + sendDBusReply(sender, serial, getGroundElevation()); + }); } else if (message.getMethodName() == "setCom1ActiveKhz") { maybeSendEmptyDBusReply(wantsReply, sender, serial); int frequency = 0; diff --git a/src/Network/Swift/service.h b/src/Network/Swift/service.h index 1d7e9df02..eb0d71e6c 100644 --- a/src/Network/Swift/service.h +++ b/src/Network/Swift/service.h @@ -193,6 +193,9 @@ public: //! Get the ratio how much the speedbrakes surfaces are extended (0.0 is fully retracted, and 1.0 is fully extended) double getSpeedBrakeRatio() const; + //! Get ground elevation at aircraft current position + double getGroundElevation() const; + //! Perform generic processing int process(); @@ -233,6 +236,7 @@ private: SGPropertyNode* flapsDeployRatioNode; SGPropertyNode* gearDeployRatioNode; SGPropertyNode* speedBrakeDeployRatioNode; + SGPropertyNode* groundElevation; //SGPropertyNode* numberEnginesNode; //SGPropertyNode* engineN1PercentageNode; SGPropertyNode* aircraftNameNode;