From ff7db27cd16ac5d7d842392fca074c43e30eb3f8 Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Tue, 30 Apr 2019 10:03:20 +0200 Subject: [PATCH] swift: Add version number check --- src/Network/Swift/service.cpp | 10 ++++++++++ src/Network/Swift/service.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/Network/Swift/service.cpp b/src/Network/Swift/service.cpp index b03f1bd82..1adb6b17c 100644 --- a/src/Network/Swift/service.cpp +++ b/src/Network/Swift/service.cpp @@ -49,6 +49,12 @@ const std::string& CService::ObjectPath() return s; } +// Static method +std::string CService::getVersionNumber() +{ + return fgGetString("/sim/version/flightgear"); +} + void CService::addTextMessage(const std::string& text) { if (text.empty()) { return; } @@ -320,6 +326,10 @@ DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage& message_) reply.appendArgument(pressAlt); sendDBusMessage(reply); }); + } else if (message.getMethodName() == "getVersionNumber") { + queueDBusCall([=]() { + sendDBusReply(sender, serial, getVersionNumber()); + }); } else if (message.getMethodName() == "getAircraftModelPath") { queueDBusCall([=]() { sendDBusReply(sender, serial, getAircraftModelPath()); diff --git a/src/Network/Swift/service.h b/src/Network/Swift/service.h index 27381b3c7..a8747e810 100644 --- a/src/Network/Swift/service.h +++ b/src/Network/Swift/service.h @@ -64,6 +64,9 @@ public: //! DBus object path static const std::string& ObjectPath(); + //! Getting flightgear version + static std::string getVersionNumber(); + ////! Add a text message to the on-screen display, with RGB components in the range [0,1] void addTextMessage(const std::string& text);