[Kde-hardware-devel] KDE/kdelibs/solid/solid

Friedrich W. H. Kossebau kossebau at kde.org
Thu Feb 25 02:02:15 CET 2010


SVN commit 1095786 by kossebau:

added: new Solid backend for UPnP devices like MediaServers and Gateways (initial code dump, prealpha, but should be crashfree)

First additional backend, now that Kevin made it already possible,
beating the Bluetooth metalworkers :) (Kevin knows how to motivate).

Reuses the UPnP controlpoint code from the network:/ kio-slave
(duplicating the code for now, will be resolved later)

needs Coherence v0.6.5 at least (with D-Bus service file, some packages miss this, e.g. the default OpenSUSE one)

CCMAIL:kde-hardware-devel at kde.org


 M  +16 -0     CMakeLists.txt  
 A             backends/kupnp (directory)  
 A             backends/kupnp/kupnpdevice.cpp   [License: LGPL]
 A             backends/kupnp/kupnpdevice.h   [License: LGPL]
 A             backends/kupnp/kupnpdeviceinterface.cpp   [License: LGPL]
 A             backends/kupnp/kupnpdeviceinterface.h   [License: LGPL]
 A             backends/kupnp/kupnpmanager.cpp   [License: LGPL]
 A             backends/kupnp/kupnpmanager.h   [License: LGPL]
 A             backends/kupnp/kupnpstorageaccess.cpp   [License: LGPL]
 A             backends/kupnp/kupnpstorageaccess.h   [License: LGPL]
 A             backends/kupnp/lib (directory)   trunk/KDE/kdebase/runtime/kioslave/network/kupnp/lib#1095584
 M  +6 -4      backends/kupnp/lib/devicebrowser.cpp  
 M  +2 -2      backends/kupnp/lib/devicebrowser.h  
 M  +17 -17    backends/kupnp/lib/devicebrowser_p.cpp  
 M  +3 -0      backends/kupnp/lib/upnp_export.h  
 M  +3 -1      managerbase.cpp  


--- trunk/KDE/kdelibs/solid/solid/CMakeLists.txt #1095785:1095786
@@ -122,6 +122,22 @@
 )
 
 if(NOT WIN32 AND NOT APPLE)
+   message(STATUS "-- Building Solid KUPnP backend." )
+   set(solid_LIB_SRCS ${solid_LIB_SRCS}
+
+   backends/kupnp/lib/service.cpp
+   backends/kupnp/lib/device.cpp
+   backends/kupnp/lib/devicebrowser_p.cpp
+   backends/kupnp/lib/devicebrowser.cpp
+   backends/kupnp/kupnpstorageaccess.cpp
+   backends/kupnp/kupnpdeviceinterface.cpp
+   backends/kupnp/kupnpdevice.cpp
+   backends/kupnp/kupnpmanager.cpp
+
+   )
+
+   qt4_add_dbus_interface( solid_LIB_SRCS  backends/kupnp/lib/org.Coherence.xml coherence_interface )
+
    message(STATUS "-- Building Solid HAL backend." )
    set(solid_LIB_SRCS ${solid_LIB_SRCS}
 
--- trunk/KDE/kdelibs/solid/solid/backends/kupnp/lib/devicebrowser.cpp #1095584:1095786
@@ -27,13 +27,15 @@
 namespace UPnP
 {
 
-DeviceBrowser::DeviceBrowser( const QStringList& deviceTypes )
-  : d( new DeviceBrowserPrivate(this,deviceTypes) )
+DeviceBrowser::DeviceBrowser( const QStringList& deviceTypes, QObject* parent )
+  : QObject( parent ),
+    d( new DeviceBrowserPrivate(this,deviceTypes) )
 {
     d->init();
 }
-DeviceBrowser::DeviceBrowser( const QString& deviceType )
-  : d( new DeviceBrowserPrivate(this,deviceType) )
+DeviceBrowser::DeviceBrowser( const QString& deviceType, QObject* parent )
+  : QObject( parent ),
+    d( new DeviceBrowserPrivate(this,deviceType) )
 {
     d->init();
 }
--- trunk/KDE/kdelibs/solid/solid/backends/kupnp/lib/devicebrowser.h #1095584:1095786
@@ -45,8 +45,8 @@
   friend class DeviceBrowserPrivate;
 
   public:
-    explicit DeviceBrowser( const QStringList& deviceTypes = QStringList() );
-    explicit DeviceBrowser( const QString& deviceType );
+    explicit DeviceBrowser( const QStringList& deviceTypes = QStringList(), QObject* parent = 0 );
+    explicit DeviceBrowser( const QString& deviceType, QObject* parent = 0 );
 
     virtual ~DeviceBrowser();
 
--- trunk/KDE/kdelibs/solid/solid/backends/kupnp/lib/devicebrowser_p.cpp #1095584:1095786
@@ -29,7 +29,7 @@
 // Qt
 #include <QtDBus/QDBusArgument>
 
-#include <KDebug>
+#include <QtCore/QDebug>
 
 namespace UPnP
 {
@@ -52,12 +52,12 @@
 
         if( requiredCoherenceVersion[i] > versionPart )
         {
-kDebug() << "Coherence version" << coherenceVersionString << "is not ok,"
-         << requiredCoherenceVersionString << "required.";
+qDebug() << "Coherence version" << coherenceVersionString << "is not ok,"
+         << requiredCoherenceVersionString << "required." << endl;
             return false;
         }
     }
-kDebug() << "Coherence version" << coherenceVersionString << "is ok.";
+qDebug() << "Coherence version" << coherenceVersionString << "is ok.";
 
     return true;
 }
@@ -136,11 +136,11 @@
             if( variant.canConvert<QString>())
             {
                 const QString value = variant.value<QString>();
-kDebug() << "  " << key << value;
+qDebug() << "  " << key << value;
             }
             else
             {
-kDebug() << "  " << key << "-not argument string-";
+qDebug() << "  " << key << "-not argument string-";
             }
         }
         dBusArgument.endMapEntry();
@@ -150,22 +150,22 @@
     const QString& udn = devicePrivate->udn();
     if( udn.isEmpty() )
     {
-kDebug()<<"No udn found!";
+qDebug()<<"No udn found!";
         devicePrivate->setInvalid();
     }
     else if( mDevices.contains(udn) )
     {
-kDebug()<<"Already inserted:"<<udn<<"!";
+qDebug()<<"Already inserted:"<<udn<<"!";
         devicePrivate->setInvalid();
     }
     else if( ! mBrowsedDeviceTypes.isEmpty() && ! mBrowsedDeviceTypes.contains(devicePrivate->type()) )
     {
-kDebug()<<"Not interested in:"<<devicePrivate->type();
+qDebug()<<"Not interested in:"<<devicePrivate->type();
         devicePrivate->setInvalid();
     }
     else
     {
-kDebug()<<"Adding: "<<device.displayName()<<udn;
+qDebug()<<"Adding: "<<device.displayName()<<udn;
         mDevices[udn] = device;
 
         if( ! parentUdn.isEmpty() )
@@ -187,7 +187,7 @@
 
 void DeviceBrowserPrivate::init()
 {
-kDebug() << "Connecting to Coherence...";
+qDebug() << "Connecting to Coherence...";
 
     // TODO: or use system bus?
     mCoherence = new org::Coherence( "org.Coherence", "/org/Coherence", QDBusConnection::sessionBus()/*systemBus*/, q );
@@ -196,7 +196,7 @@
     versionReply.waitForFinished();
     if( versionReply.isError() )
     {
-kDebug()<< versionReply.error();
+qDebug()<< versionReply.error();
         return;
     }
 
@@ -216,11 +216,11 @@
     devicesReply.waitForFinished();
     if( devicesReply.isError() )
     {
-kDebug()<< devicesReply.error();
+qDebug()<< devicesReply.error();
         return;
     }
 
-kDebug()<< "Current devices...";
+qDebug()<< "Current devices...";
     QVariantList devicesReplyValue = devicesReply.value();
     foreach( const QVariant& devicesReplyValueItem, devicesReplyValue )
     {
@@ -228,7 +228,7 @@
         const QDBusArgument dBusArgument = variant.value<QDBusArgument>();
         addDevice( dBusArgument );
     }
-kDebug()<<"That's all.";
+qDebug()<<"That's all.";
 }
 
 QList<Device> DeviceBrowserPrivate::devices() const
@@ -267,11 +267,11 @@
     {
         Device device = it.value();
         mDevices.erase( it );
-kDebug() << "Removing"<<device.displayName();
+qDebug() << "Removing"<<device.displayName();
         emit q->deviceRemoved( device );
     }
     else
-kDebug() << "Not found in device list:"<<udn;
+qDebug() << "Not found in device list:"<<udn;
 }
 
 
--- trunk/KDE/kdelibs/solid/solid/backends/kupnp/lib/upnp_export.h #1095584:1095786
@@ -23,6 +23,7 @@
 #ifndef UPNP_EXPORT_H
 #define UPNP_EXPORT_H
 
+#if 0
 // KDE
 #include <kdemacros.h>
 
@@ -41,4 +42,6 @@
 #  define KUPNP_EXPORT_DEPRECATED KDE_DEPRECATED KUPNP_EXPORT
 # endif
 #endif
+#define KUPNP_EXPORT
 
+#endif
--- trunk/KDE/kdelibs/solid/solid/managerbase.cpp #1095785:1095786
@@ -27,6 +27,7 @@
 #include "backends/iokit/iokitmanager.h"
 #elif defined (Q_OS_UNIX)
 #include "backends/hal/halmanager.h"
+#include "backends/kupnp/kupnpmanager.h"
 #elif defined (_MSC_VER) // TODO: mingw
 #include "backends/wmi/wmimanager.h"
 #endif
@@ -50,7 +51,8 @@
 #        if defined (Q_OS_MAC)
             m_backends << new Solid::Backends::IOKit::IOKitManager(0);
 #        elif defined (Q_OS_UNIX)
-            m_backends << new Solid::Backends::Hal::HalManager(0);
+            m_backends << new Solid::Backends::Hal::HalManager(0)
+                       << new Solid::Backends::KUPnP::KUPnPManager(0);
 #        elif defined (_MSC_VER) // TODO: mingw
             m_backends << new Solid::Backends::Wmi::WmiManager(0);
 #        endif


More information about the Kde-hardware-devel mailing list