diff --git a/src/plugins/simulator/xplane/xswiftbusserviceproxy.cpp b/src/plugins/simulator/xplane/xswiftbusserviceproxy.cpp index 0ee4a745a..599912589 100644 --- a/src/plugins/simulator/xplane/xswiftbusserviceproxy.cpp +++ b/src/plugins/simulator/xplane/xswiftbusserviceproxy.cpp @@ -39,6 +39,11 @@ namespace BlackSimPlugin } } + QString CXSwiftBusServiceProxy::getVersionNumber() + { + return m_dbusInterface->callDBusRet(QLatin1String("getVersionNumber")); + } + void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData) { QPointer myself(this); diff --git a/src/plugins/simulator/xplane/xswiftbusserviceproxy.h b/src/plugins/simulator/xplane/xswiftbusserviceproxy.h index d770caaf1..864676660 100644 --- a/src/plugins/simulator/xplane/xswiftbusserviceproxy.h +++ b/src/plugins/simulator/xplane/xswiftbusserviceproxy.h @@ -96,6 +96,9 @@ namespace BlackSimPlugin void airportsInRangeUpdated(const QStringList &icaoCodes, const QStringList &names, const QList &lats, const QList &lons, const QList &alts); public slots: + //! Get XSwiftBus version number + QString getVersionNumber(); + //! Get own aircraft situation data void getOwnAircraftSituationData(XPlaneData *o_xplaneData); diff --git a/src/xswiftbus/org.swift_project.xswiftbus.service.xml b/src/xswiftbus/org.swift_project.xswiftbus.service.xml index 47b409db2..2da8e498b 100644 --- a/src/xswiftbus/org.swift_project.xswiftbus.service.xml +++ b/src/xswiftbus/org.swift_project.xswiftbus.service.xml @@ -1,5 +1,8 @@ R"( + + + diff --git a/src/xswiftbus/service.cpp b/src/xswiftbus/service.cpp index 81cbcba01..3f032eabc 100644 --- a/src/xswiftbus/service.cpp +++ b/src/xswiftbus/service.cpp @@ -207,7 +207,14 @@ namespace XSwiftBus } else if (message.getInterfaceName() == XSWIFTBUS_SERVICE_INTERFACENAME) { - if (message.getMethodName() == "addTextMessage") + if (message.getMethodName() == "getVersionNumber") + { + queueDBusCall([ = ]() + { + sendDBusReply(sender, serial, getVersionNumber()); + }); + } + else if (message.getMethodName() == "addTextMessage") { maybeSendEmptyDBusReply(wantsReply, sender, serial); std::string text; diff --git a/src/xswiftbus/service.h b/src/xswiftbus/service.h index 37fc7a122..cbffa05c8 100644 --- a/src/xswiftbus/service.h +++ b/src/xswiftbus/service.h @@ -61,6 +61,9 @@ namespace XSwiftBus //! Called by XPluginReceiveMessage when the model changes. void onAircraftModelChanged(); + //! Returns the XSwiftBus version number + std::string getVersionNumber() const { return XSWIFTBUS_VERSION; } + //! Add a text message to the on-screen display, with RGB components in the range [0,1] void addTextMessage(const std::string &text, double red, double green, double blue); diff --git a/src/xswiftbus/xswiftbus.pro b/src/xswiftbus/xswiftbus.pro index 7a09f5656..87cd9cf9a 100644 --- a/src/xswiftbus/xswiftbus.pro +++ b/src/xswiftbus/xswiftbus.pro @@ -72,6 +72,8 @@ DEFINES += XPLM210=1 DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\" DEFINES += XPMP_CLIENT_LONGNAME=\\\"xswiftbus\\\" +DEFINES += XSWIFTBUS_VERSION=\\\"$${BLACK_VERSION}\\\" + # X-Plane plugins must follow a prescribed filename and directory structure. TARGET_EXT = .xpl win32:TARGET = win