added dbus system config
authorKevron Rees <tripzero.kev@gmail.com>
Sun, 18 May 2014 01:12:57 +0000 (18:12 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Sun, 18 May 2014 01:12:57 +0000 (18:12 -0700)
plugins/bluetooth/CMakeLists.txt
plugins/bluetooth/ambbt.conf [new file with mode: 0644]
plugins/bluetooth/bluetoothplugin.cpp

index 5000a2b..5a05038 100644 (file)
@@ -23,6 +23,8 @@ set_target_properties(bluetoothplugin PROPERTIES PREFIX "")
 target_link_libraries(bluetoothplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib  amb-plugins-common -L${CMAKE_CURRENT_BINARY_DIR}/plugins/common ${link_libraries} ${gio_LIBRARIES} ${QT_LIBRARIES})
 
 install(TARGETS bluetoothplugin LIBRARY DESTINATION lib/automotive-message-broker)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ambbt.conf DESTINATION /etc/dbus-1/system.d )
+
 
 add_executable(testAmbBt "testAmbBt.cpp")
 target_link_libraries(testAmbBt ${link_libraries} amb -L${CMAKE_CURRENT_BINARY_DIR}/lib amb-plugins-common -L${CMAKE_CURRENT_BINARY_DIR}/plugins/common ${QT_LIBRARIES})
diff --git a/plugins/bluetooth/ambbt.conf b/plugins/bluetooth/ambbt.conf
new file mode 100644 (file)
index 0000000..eeaa2c7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <policy context="default">
+    <allow own="org.automotive.message.broker.bluetooth"/>
+    <allow send_destination="org.automotive.message.broker.bluetooth"/>
+
+
+    <allow send_interface="org.bluez.Profile1"
+        send_path="/org/bluez/spp" />
+
+  </policy>
+
+</busconfig>
index 0791316..5c1679c 100644 (file)
@@ -38,7 +38,11 @@ BluetoothSinkPlugin::BluetoothSinkPlugin(AbstractRoutingEngine* re, map<string,
 {
        new BtProfileAdaptor(this);
 
-       QDBusConnection::systemBus().registerObject("/org/bluez/spp", this);
+       if(!QDBusConnection::systemBus().registerService("org.automotive.message.broker.bluetooth"))
+               DebugOut(DebugOut::Error)<<"Failed to register DBus service name: "<<QDBusConnection::systemBus().lastError().message().toStdString()<<endl;
+
+       if(!QDBusConnection::systemBus().registerObject("/org/bluez/spp", this))
+               DebugOut(DebugOut::Error)<<"Failed to register DBus object"<<endl;
 
        QDBusInterface profileManagerIface("org.bluez", "/org/bluez", "org.bluez.ProfileManager1", QDBusConnection::systemBus());