[XSwiftBus] Add getVersionNumber to DBus API

This allows to get the version number of XSwiftBus itself. It maintains the same version as swift (e.g. 0.8.7 without the time stamp) and can be used to compare it for compatibility reasons.

ref T394
This commit is contained in:
Roland Rossgotterer
2018-11-22 11:53:33 +01:00
committed by Klaus Basan
parent e959075a56
commit 55c2e2e559
6 changed files with 24 additions and 1 deletions

View File

@@ -39,6 +39,11 @@ namespace BlackSimPlugin
} }
} }
QString CXSwiftBusServiceProxy::getVersionNumber()
{
return m_dbusInterface->callDBusRet<QString>(QLatin1String("getVersionNumber"));
}
void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData) void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData)
{ {
QPointer<CXSwiftBusServiceProxy> myself(this); QPointer<CXSwiftBusServiceProxy> myself(this);

View File

@@ -96,6 +96,9 @@ namespace BlackSimPlugin
void airportsInRangeUpdated(const QStringList &icaoCodes, const QStringList &names, const QList<double> &lats, const QList<double> &lons, const QList<double> &alts); void airportsInRangeUpdated(const QStringList &icaoCodes, const QStringList &names, const QList<double> &lats, const QList<double> &lons, const QList<double> &alts);
public slots: public slots:
//! Get XSwiftBus version number
QString getVersionNumber();
//! Get own aircraft situation data //! Get own aircraft situation data
void getOwnAircraftSituationData(XPlaneData *o_xplaneData); void getOwnAircraftSituationData(XPlaneData *o_xplaneData);

View File

@@ -1,5 +1,8 @@
R"(<node> R"(<node>
<interface name="org.swift_project.xswiftbus.service"> <interface name="org.swift_project.xswiftbus.service">
<method name="getVersionNumber">
<arg type="s" direction="out"/>
</method>
<method name="addTextMessage"> <method name="addTextMessage">
<arg name="text" type="s" direction="in"/> <arg name="text" type="s" direction="in"/>
<arg name="red" type="d" direction="in"/> <arg name="red" type="d" direction="in"/>

View File

@@ -207,7 +207,14 @@ namespace XSwiftBus
} }
else if (message.getInterfaceName() == XSWIFTBUS_SERVICE_INTERFACENAME) 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); maybeSendEmptyDBusReply(wantsReply, sender, serial);
std::string text; std::string text;

View File

@@ -61,6 +61,9 @@ namespace XSwiftBus
//! Called by XPluginReceiveMessage when the model changes. //! Called by XPluginReceiveMessage when the model changes.
void onAircraftModelChanged(); 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] //! 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); void addTextMessage(const std::string &text, double red, double green, double blue);

View File

@@ -72,6 +72,8 @@ DEFINES += XPLM210=1
DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\" DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\"
DEFINES += XPMP_CLIENT_LONGNAME=\\\"xswiftbus\\\" DEFINES += XPMP_CLIENT_LONGNAME=\\\"xswiftbus\\\"
DEFINES += XSWIFTBUS_VERSION=\\\"$${BLACK_VERSION}\\\"
# X-Plane plugins must follow a prescribed filename and directory structure. # X-Plane plugins must follow a prescribed filename and directory structure.
TARGET_EXT = .xpl TARGET_EXT = .xpl
win32:TARGET = win win32:TARGET = win