[bluemonkey] - added exportObject method to dbus module
authorKevron Rees <kevron.m.rees@intel.com>
Fri, 23 Jan 2015 18:50:58 +0000 (10:50 -0800)
committerKevron Rees <kevron.m.rees@intel.com>
Fri, 23 Jan 2015 18:51:04 +0000 (10:51 -0800)
plugins/bluemonkey/bmdbus.cpp
plugins/bluemonkey/bmdbus.h

index 8f26c7f..cbe624c 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "bmdbus.h"
 
+#include <debugout.h>
+
 #include <QDBusInterface>
 #include <QDBusConnection>
 
@@ -38,3 +40,17 @@ QObject *BMDBus::createInterface(const QString &service, const QString &path, co
 {
        return new QDBusInterface(service, path, interface, bus == Session ? QDBusConnection::sessionBus() : QDBusConnection::systemBus(), this);
 }
+
+
+bool BMDBus::exportObject(const QString &path, const QString &interface, BMDBus::Connection bus, QObject * object)
+{
+       QDBusConnection con = bus == Session ? QDBusConnection::sessionBus( ): QDBusConnection::systemBus();
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
+       con.registerObject(path, interface, object, QDBusConnection::ExportAllContents);
+#else
+       DebugOut(DebugOut::Warning) << ___FUNCTION___ << " interface is ignored in qt 5.4 and lower" << endl;
+       con.registerObject(path, object, QDBusConnection::ExportAllContents);
+#endif
+
+}
index 903963c..7b4dbeb 100644 (file)
@@ -39,6 +39,8 @@ public Q_SLOTS:
 
        QObject* createInterface(const QString & service, const QString & path, const QString & interface, Connection bus);
 
+       bool exportObject(const QString & path, const QString & interface, Connection bus, QObject *obj);
+
 private: ///methods: