diff --git a/src/blackcore/dbus_server.cpp b/src/blackcore/dbus_server.cpp index fa8624976..26f60f450 100644 --- a/src/blackcore/dbus_server.cpp +++ b/src/blackcore/dbus_server.cpp @@ -13,7 +13,7 @@ namespace BlackCore { - const QString CDBusServer::ServiceName = QString(BLACKCORE_DBUSERVER_SERVICENAME); + const QString CDBusServer::ServiceName = QString(BLACKCORE_RUNTIME_SERVICENAME); /* * Constructor @@ -21,7 +21,7 @@ namespace BlackCore * see http://download.froglogic.com/public/qt5-squishcoco-report/QtBase/source_241_preprocessed.html * DBus config: http://dbus.freedesktop.org/doc/dbus-daemon.1.html */ - CDBusServer::CDBusServer(const QString &address, QObject *parent) : + CDBusServer::CDBusServer(const QString &service, const QString &address, QObject *parent) : QObject(parent), m_busServer(CDBusServer::isQtDBusAddress(address) ? address : "tcp:host=127.0.0.1,port=45000", // "unix:tmpdir=/tmp", parent), m_serverMode(CDBusServer::SERVERMODE_P2P) { @@ -34,7 +34,7 @@ namespace BlackCore // we use a session bus connection instead of a real P2P connection this->m_serverMode = CDBusServer::SERVERMODE_SESSIONBUS; QDBusConnection con = QDBusConnection::sessionBus(); - if (!con.registerService(CDBusServer::ServiceName)) + if (!con.registerService(service)) { qCritical() << con.lastError().message(); qFatal("Cannot register DBus service, server started? dbus-daemon.exe --session --address=tcp:host=192.168.0.133,port=45000"); @@ -46,7 +46,7 @@ namespace BlackCore // we use a system bus connection instead of a real P2P connection this->m_serverMode = CDBusServer::SERVERMODE_SYSTEMBUS; QDBusConnection con = QDBusConnection::systemBus(); - if (!con.registerService(CDBusServer::ServiceName)) + if (!con.registerService(service)) { qCritical() << con.lastError().message(); qFatal("Cannot register DBus service, server started? dbus-daemon.exe --system --address=tcp:host=192.168.0.133,port=45000"); diff --git a/src/blackcore/dbus_server.h b/src/blackcore/dbus_server.h index d1e6447f6..24f01e61c 100644 --- a/src/blackcore/dbus_server.h +++ b/src/blackcore/dbus_server.h @@ -14,7 +14,7 @@ #include #include -#define BLACKCORE_DBUSERVER_SERVICENAME "org.vatsim.pilotClient" +#define BLACKCORE_RUNTIME_SERVICENAME "net.vatsim.pilotClient" namespace BlackCore @@ -27,7 +27,7 @@ namespace BlackCore class CDBusServer : public QObject { Q_OBJECT - Q_CLASSINFO("D-Bus Interface", BLACKCORE_DBUSERVER_SERVICENAME) + Q_CLASSINFO("D-Bus Interface", BLACKCORE_RUNTIME_SERVICENAME) public: //! \brief Service name of DBus serve @@ -61,10 +61,13 @@ namespace BlackCore } public: - //! Constructor + //! Construct a server for the BlackCore runtime //! \remarks We are using address and not ServerMode, as on some systems we need to pass in some specific configuration string //! \sa QDBusServer - CDBusServer(const QString &address, QObject *parent = nullptr); + CDBusServer(const QString &address, QObject *parent = nullptr) : CDBusServer(CDBusServer::ServiceName, address, parent) {} + + //! Construct a server for some arbitrary service + CDBusServer(const QString &service, const QString &address, QObject *parent = nullptr); //!! Adds a QObject to be exposed to DBus void addObject(const QString &name, QObject *object); diff --git a/src/plugins/simulator/xplane/xbus_service_proxy.cpp b/src/plugins/simulator/xplane/xbus_service_proxy.cpp index 990599afa..240075b02 100644 --- a/src/plugins/simulator/xplane/xbus_service_proxy.cpp +++ b/src/plugins/simulator/xplane/xbus_service_proxy.cpp @@ -7,6 +7,8 @@ #include "blackcore/dbus_server.h" #include +#define XBUS_SERVICE_SERVICENAME "net.vatsim.xbus" + namespace BlackSimPlugin { namespace XPlane @@ -14,7 +16,7 @@ namespace BlackSimPlugin CXBusServiceProxy::CXBusServiceProxy(QDBusConnection &connection, QObject *parent, bool dummy) : QObject(parent) { - m_dbusInterface = new BlackMisc::CGenericDBusInterface(BlackCore::CDBusServer::ServiceName, ObjectPath(), InterfaceName(), connection, this); + m_dbusInterface = new BlackMisc::CGenericDBusInterface(XBUS_SERVICE_SERVICENAME, ObjectPath(), InterfaceName(), connection, this); if (! dummy) { relaySignals(); } } diff --git a/src/plugins/simulator/xplane/xbus_service_proxy.h b/src/plugins/simulator/xplane/xbus_service_proxy.h index 1f74d8f73..0b06d3bd6 100644 --- a/src/plugins/simulator/xplane/xbus_service_proxy.h +++ b/src/plugins/simulator/xplane/xbus_service_proxy.h @@ -10,10 +10,10 @@ #include "blackmisc/genericdbusinterface.h" -//! \private -#define XBUS_SERVICE_INTERFACENAME "net.vatsim.PilotClient.XBus" -//! \private -#define XBUS_SERVICE_OBJECTPATH "/XBus" +//! \cond PRIVATE +#define XBUS_SERVICE_INTERFACENAME "net.vatsim.xbus.service" +#define XBUS_SERVICE_OBJECTPATH "/xbus" +//! \endcond namespace BlackSimPlugin { diff --git a/src/xbus/plugin.cpp b/src/xbus/plugin.cpp index a45a1bed6..f136f38ff 100644 --- a/src/xbus/plugin.cpp +++ b/src/xbus/plugin.cpp @@ -5,6 +5,8 @@ #include "plugin.h" +#define XBUS_SERVICE_SERVICENAME "net.vatsim.xbus" + namespace XBus { @@ -21,7 +23,7 @@ namespace XBus Q_ASSERT(! m_server); for (auto &item : m_startServerMenuItems) { item.setEnabled(false); } - m_server = new BlackCore::CDBusServer(address, this); + m_server = new BlackCore::CDBusServer(XBUS_SERVICE_SERVICENAME, address, this); m_service = new CService(this); m_server->addObject(CService::ObjectPath(), m_service); } diff --git a/src/xbus/service.h b/src/xbus/service.h index d700c67af..712058e10 100644 --- a/src/xbus/service.h +++ b/src/xbus/service.h @@ -11,10 +11,10 @@ #include "datarefs.h" #include -//! \private -#define XBUS_SERVICE_INTERFACENAME "net.vatsim.PilotClient.XBus" -//! \private -#define XBUS_SERVICE_OBJECTPATH "/XBus" +//! \cond PRIVATE +#define XBUS_SERVICE_INTERFACENAME "net.vatsim.xbus.service" +#define XBUS_SERVICE_OBJECTPATH "/xbus" +//! \endcond namespace XBus {