1
0
Fork 0

[swift] Sending ground elevation

This commit is contained in:
Lars Toenning 2020-01-19 19:18:48 +01:00 committed by James Turner
parent cab6581d3d
commit 0423472f74
2 changed files with 14 additions and 0 deletions

View file

@ -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;

View file

@ -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;