[Kde-hardware-devel] KDE/kdebase/workspace/solid

Juan González Aguilera kde_devel at opsiland.info
Wed Aug 22 14:47:42 CEST 2007


SVN commit 703402 by jaguilera:

Added a couple features to bluetooth at solid/control. They are the
needed elements to handle remote device authentication (pairing) and
local service usage authorization. 

Please review.

CCMAIL:kde-hardware-devel at kde.org


 M  +2 -0      bluez/CMakeLists.txt  
 M  +15 -0     bluez/bluez-bluetoothmanager.cpp  
 M  +2 -1      bluez/bluez-bluetoothmanager.h  
 A             bluez/bluez-bluetoothsecurity.cpp   [License: LGPL (v2)]
 A             bluez/bluez-bluetoothsecurity.h   [License: LGPL (v2)]
 A             bluez/bluez-bluetoothsecurityadaptor.cpp   [License: LGPL (v2)]
 A             bluez/bluez-bluetoothsecurityadaptor.h   [License: LGPL (v2)]
 M  +1 -0      control/backends/fakebluetooth/CMakeLists.txt  
 M  +4 -0      control/backends/fakebluetooth/fakebluetoothmanager.cpp  
 M  +2 -1      control/backends/fakebluetooth/fakebluetoothmanager.h  
 A             control/backends/fakebluetooth/fakebluetoothsecurity.cpp   [License: LGPL (v2)]
 A             control/backends/fakebluetooth/fakebluetoothsecurity.h   [License: LGPL (v2)]
 M  +2 -1      control/solid/control/CMakeLists.txt  
 M  +15 -0     control/solid/control/bluetoothmanager.cpp  
 M  +7 -1      control/solid/control/bluetoothmanager.h  
 A             control/solid/control/bluetoothsecurity.cpp   [License: LGPL (v2)]
 A             control/solid/control/bluetoothsecurity.h   [License: LGPL (v2)]
 M  +2 -1      control/solid/control/ifaces/CMakeLists.txt  
 M  +1 -0      control/solid/control/ifaces/bluetoothmanager.cpp  
 M  +6 -1      control/solid/control/ifaces/bluetoothmanager.h  
 A             control/solid/control/ifaces/bluetoothsecurity.cpp   [License: LGPL (v2)]
 A             control/solid/control/ifaces/bluetoothsecurity.h   [License: LGPL (v2)]


--- trunk/KDE/kdebase/workspace/solid/bluez/CMakeLists.txt #703401:703402
@@ -8,6 +8,8 @@
 	bluez-bluetoothinterface.cpp
 	bluez-bluetoothinputdevice.cpp
 	bluez-bluetoothremotedevice.cpp
+	bluez-bluetoothsecurity.cpp
+	bluez-bluetoothsecurityadaptor.cpp
 )
 
 
--- trunk/KDE/kdebase/workspace/solid/bluez/bluez-bluetoothmanager.cpp #703401:703402
@@ -26,6 +26,8 @@
 #include "bluez-bluetoothinterface.h"
 #include "bluez-bluetoothinputdevice.h"
 #include "bluez-bluetoothmanager.h"
+#include "bluez-bluetoothsecurity.h"
+#include "bluez-bluetoothsecurityadaptor.h"
 #include "bluezcalljob.h"
 
 class BluezBluetoothManagerPrivate
@@ -185,5 +187,18 @@
     emit inputDeviceRemoved(path);
 }
 
+Solid::Control::Ifaces::BluetoothSecurity *BluezBluetoothManager::security(const QString &interface)
+{
+    BluezBluetoothSecurity *out;
+    if (interface.isEmpty()) {
+        out = new BluezBluetoothSecurity(this);
+    } else {
+        out = new BluezBluetoothSecurity(interface,this);
+    }
+    new BluezBluetoothSecurityAdaptor(out);
+    return out;
+}
 
 #include "bluez-bluetoothmanager.moc"
+
+
--- trunk/KDE/kdebase/workspace/solid/bluez/bluez-bluetoothmanager.h #703401:703402
@@ -31,6 +31,7 @@
 
 #include <solid/control/ifaces/bluetoothmanager.h>
 
+class BluezBluetoothSecurity;
 class BluezBluetoothManagerPrivate;
 class KDE_EXPORT BluezBluetoothManager : public Solid::Control::Ifaces::BluetoothManager
 {
@@ -46,7 +47,7 @@
 
     QObject * createBluetoothInputDevice(const QString &);
     KJob *setupInputDevice(const QString &);
-
+    Solid::Control::Ifaces::BluetoothSecurity* security(const QString &interface);
 public Q_SLOTS:
     void removeInputDevice(const QString &);
 
--- trunk/KDE/kdebase/workspace/solid/control/backends/fakebluetooth/CMakeLists.txt #703401:703402
@@ -8,6 +8,7 @@
    fakebluetoothmanager.cpp
    fakebluetoothremotedevice.cpp
    fakebluetoothinputdevice.cpp
+   fakebluetoothsecurity.cpp
 )
 
 
--- trunk/KDE/kdebase/workspace/solid/control/backends/fakebluetooth/fakebluetoothmanager.cpp #703401:703402
@@ -207,6 +207,10 @@
     // TODO
     return NULL;
 }
+Solid::Control::Ifaces::BluetoothSecurity *FakeBluetoothManager::security(const QString &/*interface*/)
+{
+    return NULL;
+}
 
 void FakeBluetoothManager::removeInputDevice(const QString  & /*ubi */)
 {
--- trunk/KDE/kdebase/workspace/solid/control/backends/fakebluetooth/fakebluetoothmanager.h #703401:703402
@@ -29,6 +29,7 @@
 #include <solid/control/ifaces/bluetoothmanager.h>
 #include "fakebluetoothinterface.h"
 #include "fakebluetoothinputdevice.h"
+#include "fakebluetoothsecurity.h"
 
 class QDomElement;
 
@@ -47,7 +48,7 @@
     QStringList bluetoothInputDevices() const;
     FakeBluetoothInputDevice *createBluetoothInputDevice(const QString &ubi);
     KJob *setupInputDevice(const QString &ubi);
-
+    Solid::Control::Ifaces::BluetoothSecurity * security(const QString &interface);
 public Q_SLOTS:
     void removeInputDevice(const QString  & ubi);
 
--- trunk/KDE/kdebase/workspace/solid/control/solid/control/CMakeLists.txt #703401:703402
@@ -15,6 +15,7 @@
    bluetoothmanager.cpp
    bluetoothremotedevice.cpp
    bluetoothinputdevice.cpp
+   bluetoothsecurity.cpp
    networking.cpp
 )
 
@@ -34,6 +35,6 @@
 install( FILES solidpowermanager.desktop solidnetworkmanager.desktop solidbluetoothmanager.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}  )
 install( FILES powermanager.h networkmanager.h networkinterface.h network.h wirelessnetwork.h
     authentication.h bluetoothmanager.h bluetoothinterface.h bluetoothremotedevice.h
-    bluetoothinputdevice.h singletondefs.h networking.h solid_control_export.h DESTINATION 
+    bluetoothinputdevice.h bluetoothsecurity.h singletondefs.h networking.h solid_control_export.h DESTINATION 
 ${INCLUDE_INSTALL_DIR}/solid/control)
 
--- trunk/KDE/kdebase/workspace/solid/control/solid/control/bluetoothmanager.cpp #703401:703402
@@ -27,13 +27,17 @@
 #include "ifaces/bluetoothmanager.h"
 #include "ifaces/bluetoothinterface.h"
 #include "ifaces/bluetoothinputdevice.h"
+#include "ifaces/bluetoothsecurity.h"
 
 #include "../soliddefs_p.h"
 #include "managerbase_p.h"
 
 #include "bluetoothinterface.h"
 #include "bluetoothmanager.h"
+#include "bluetoothsecurity.h"
 
+#include <kdebug.h>
+
 namespace Solid
 {
 namespace Control
@@ -187,6 +191,16 @@
     return list;
 }
 
+Solid::Control::BluetoothSecurity *Solid::Control::BluetoothManager::security(const QString &interface)
+{
+    Ifaces::BluetoothManager *backendManager = qobject_cast<Ifaces::BluetoothManager*>(d->managerBackend());
+    if (backendManager!=0) {
+        Ifaces::BluetoothSecurity *backendSecurity = backendManager->security(interface);
+        return new Solid::Control::BluetoothSecurity(backendSecurity);
+    }
+    return 0;
+}
+
 void Solid::Control::BluetoothManager::removeInputDevice(const QString &ubi)
 {
     SOLID_CALL(Ifaces::BluetoothManager *, d->managerBackend(), removeInputDevice(ubi));
@@ -335,4 +349,5 @@
     }
 }
 
+
 #include "bluetoothmanager.moc"
--- trunk/KDE/kdebase/workspace/solid/control/solid/control/bluetoothmanager.h #703401:703402
@@ -39,10 +39,11 @@
 {
 namespace Ifaces
 {
-class BluetoothManager;
+    class BluetoothManager;
 }
 
 class BluetoothInterface;
+class BluetoothSecurity;
 
 typedef QList<BluetoothInterface> BluetoothInterfaceList;
 typedef QList<BluetoothInputDevice> BluetoothInputDeviceList;
@@ -118,6 +119,11 @@
      */
     KJob *setupInputDevice(const QString &ubi);
 
+    /**
+     * Gets an instance of BluetoothSecurity to handle pairing/authorization requests
+     */
+    BluetoothSecurity *security(const QString &interface = QString());
+
 public Q_SLOTS:
     /**
      * Remove the configuraiton of a bluetooth input device.
--- trunk/KDE/kdebase/workspace/solid/control/solid/control/ifaces/CMakeLists.txt #703401:703402
@@ -12,7 +12,8 @@
    bluetoothremotedevice.cpp
    bluetoothinputdevice.cpp
    bluetoothinterface.cpp
-   bluetoothmanager.cpp )
+   bluetoothmanager.cpp
+   bluetoothsecurity.cpp )
 
 
 kde4_add_library(solidcontrolifaces SHARED ${solidcontrolifaces_LIB_SRCS})
--- trunk/KDE/kdebase/workspace/solid/control/solid/control/ifaces/bluetoothmanager.cpp #703401:703402
@@ -20,6 +20,7 @@
 */
 
 #include "bluetoothmanager.h"
+#include "bluetoothsecurity.h"
 
 Solid::Control::Ifaces::BluetoothManager::BluetoothManager(QObject * parent) : QObject(parent)
 {}
--- trunk/KDE/kdebase/workspace/solid/control/solid/control/ifaces/bluetoothmanager.h #703401:703402
@@ -33,6 +33,7 @@
 {
 namespace Ifaces
 {
+class BluetoothSecurity;
 /**
  * This class specifies the interface a backend will have to implement in
  * order to be used in the system.
@@ -102,8 +103,12 @@
      * @returns job handling of the operation.
      */
     virtual KJob *setupInputDevice(const QString &ubi) = 0;
+    
+    /**
+     * Gets an instance of BluetoothSecurity to handle pairing/authorization requests
+     */
+    virtual Solid::Control::Ifaces::BluetoothSecurity* security(const QString &interface) = 0;
 
-
 public Q_SLOTS:
     /**
      * Remove the configuraiton of a bluetooth input device.


More information about the Kde-hardware-devel mailing list