Hello community, here is the log from the commit of package libbluedevil for openSUSE:Factory checked in at 2013-04-07 14:22:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libbluedevil (Old) and /work/SRC/openSUSE:Factory/.libbluedevil.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libbluedevil", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/libbluedevil/libbluedevil.changes 2012-05-08 06:45:59.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libbluedevil.new/libbluedevil.changes 2013-04-07 14:22:54.000000000 +0200 @@ -1,0 +2,7 @@ +Fri Mar 29 16:16:50 UTC 2013 - [email protected] + +- Update to version 1.9.3 + * Do a better job knowing if there is an usable adapter + * Further improvements for kde#314356 + +------------------------------------------------------------------- Old: ---- libbluedevil-1.9.2.tar.bz2 New: ---- libbluedevil-1.9.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libbluedevil.spec ++++++ --- /var/tmp/diff_new_pack.uxj6me/_old 2013-04-07 14:22:55.000000000 +0200 +++ /var/tmp/diff_new_pack.uxj6me/_new 2013-04-07 14:22:55.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package libbluedevil # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2010 Raymond Wooninck <[email protected]> # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: libbluedevil -Version: 1.9.2 +Version: 1.9.3 Release: 0 Summary: Qt Bluetooth client library License: LGPL-2.0+ ++++++ libbluedevil-1.9.2.tar.bz2 -> libbluedevil-1.9.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libbluedevil-1.9.2/bluedevil/bluedevildevice.cpp new/libbluedevil-1.9.3/bluedevil/bluedevildevice.cpp --- old/libbluedevil-1.9.2/bluedevil/bluedevildevice.cpp 2012-04-26 05:28:30.000000000 +0200 +++ new/libbluedevil-1.9.3/bluedevil/bluedevildevice.cpp 2013-03-24 18:12:47.000000000 +0100 @@ -94,6 +94,7 @@ QString m_alias; bool m_legacyPairing; bool m_propertiesFetched; + bool m_deviceCreated; bool m_registrationOnBusRejected; // used for avoid trying to register this device more // than one time on the bus. @@ -115,6 +116,7 @@ , m_blocked(false) , m_legacyPairing(legacyPairing) , m_propertiesFetched(false) + , m_deviceCreated(false) , m_registrationOnBusRejected(false) , m_q(q) { @@ -140,6 +142,7 @@ } if (m_registrationOnBusRejected) { + m_deviceCreated = false; return false; } @@ -152,6 +155,7 @@ devicePath = m_adapter->createDevice(m_address); if (devicePath.isEmpty()) { m_registrationOnBusRejected = true; + m_deviceCreated = false; return false; } } @@ -168,7 +172,14 @@ connect(m_bluezDeviceInterface, SIGNAL(PropertyChanged(QString,QDBusVariant)), m_q, SLOT(_k_propertyChanged(QString,QDBusVariant))); - const QVariantMap data = m_bluezDeviceInterface->GetProperties().value(); + QDBusPendingReply <QVariantMap > rep = m_bluezDeviceInterface->GetProperties(); + rep.waitForFinished(); + + if (rep.isError() || !rep.isValid()) { + return false; + } + + const QVariantMap data = rep.value(); m_paired = data["Paired"].toBool(); m_connected = data["Connected"].toBool(); m_trusted = data["Trusted"].toBool(); @@ -186,6 +197,7 @@ m_adapter->addDeviceWithUBI(devicePath, m_q); } + m_deviceCreated = true; return true; } @@ -409,6 +421,12 @@ return d->m_blocked; } +bool Device::isReady() +{ + ENSURE_PROPERTIES_FETCHED + return d->m_deviceCreated; +} + bool Device::registerDevice() { const bool res = d->_k_ensureDeviceCreated(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libbluedevil-1.9.2/bluedevil/bluedevildevice.h new/libbluedevil-1.9.3/bluedevil/bluedevildevice.h --- old/libbluedevil-1.9.2/bluedevil/bluedevildevice.h 2012-04-26 05:28:30.000000000 +0200 +++ new/libbluedevil-1.9.3/bluedevil/bluedevildevice.h 2013-03-24 18:12:47.000000000 +0100 @@ -251,6 +251,12 @@ */ bool isBlocked(); + /** + * @return Whether the device is ready to be used or note + * + * @note If the given device address or path is incorrect this will stay false. + */ + bool isReady(); public Q_SLOTS: /** * It is not mandatory to call to this method. If you are just retrieving some information that diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libbluedevil-1.9.2/bluedevil/bluedevilmanager.cpp new/libbluedevil-1.9.3/bluedevil/bluedevilmanager.cpp --- old/libbluedevil-1.9.2/bluedevil/bluedevilmanager.cpp 2012-04-26 05:28:30.000000000 +0200 +++ new/libbluedevil-1.9.3/bluedevil/bluedevilmanager.cpp 2013-03-24 18:12:47.000000000 +0100 @@ -40,11 +40,13 @@ ~Private(); void initialize(); + void clean(); Adapter *findUsableAdapter(); void _k_adapterAdded(const QDBusObjectPath &objectPath); void _k_adapterRemoved(const QDBusObjectPath &objectPath); void _k_defaultAdapterChanged(const QDBusObjectPath &objectPath); + void _k_adapterPoweredChanged(bool powered); void _k_propertyChanged(const QString &property, const QDBusVariant &value); void _k_bluezServiceRegistered(); @@ -69,9 +71,9 @@ if (QDBusConnection::systemBus().isConnected()) { QDBusReply<bool> reply = QDBusConnection::systemBus().interface()->isServiceRegistered("org.bluez"); - if (reply.isValid()) { - m_bluezServiceRunning = reply.value(); - } + if (reply.isValid()) { + m_bluezServiceRunning = reply.value(); + } } } @@ -100,23 +102,46 @@ defaultAdapterPath = reply.value().path(); if (!defaultAdapterPath.isEmpty()) { m_defaultAdapter = new Adapter(defaultAdapterPath, m_q); + connect(m_defaultAdapter, SIGNAL(poweredChanged(bool)), m_q, SLOT(_k_adapterPoweredChanged(bool))); m_adaptersHash.insert(defaultAdapterPath, m_defaultAdapter); + emit m_q->defaultAdapterChanged(m_defaultAdapter); } } const QVariantMap properties = m_bluezManagerInterface->GetProperties().value(); const QList<QDBusObjectPath> adapters = qdbus_cast<QList<QDBusObjectPath> >(properties["Adapters"].value<QDBusArgument>()); - if (adapters.count() == 1) { - return; - } - Q_FOREACH (const QDBusObjectPath &path, adapters) { - if (path.path() != defaultAdapterPath) { - Adapter *const adapter = new Adapter(path.path(), m_q); - m_adaptersHash.insert(path.path(), adapter); + if (adapters.count() > 1) { + Q_FOREACH (const QDBusObjectPath &path, adapters) { + if (path.path() != defaultAdapterPath) { + Adapter *const adapter = new Adapter(path.path(), m_q); + connect(adapter, SIGNAL(poweredChanged(bool)), m_q, SLOT(_k_adapterPoweredChanged(bool))); + m_adaptersHash.insert(path.path(), adapter); + } } } + + m_usableAdapter = findUsableAdapter(); + emit m_q->usableAdapterChanged(m_usableAdapter); } } +void Manager::Private::clean() +{ + qDebug() << "Private::clean"; + delete m_bluezManagerInterface; + QHashIterator<QString, Adapter*> i(m_adaptersHash); + while (i.hasNext()) { + i.next(); + Adapter *adapter = m_adaptersHash.take(i.key()); + emit m_q->adapterRemoved(adapter); + delete adapter; + } + + m_usableAdapter = 0; + m_defaultAdapter = 0; + + emit m_q->usableAdapterChanged(0); + emit m_q->defaultAdapterChanged(0); +} Adapter *Manager::Private::findUsableAdapter() { Adapter *const defAdapter = m_q->defaultAdapter(); @@ -137,9 +162,12 @@ { qDebug() << "Added: " << objectPath.path(); Adapter *const adapter = new Adapter(objectPath.path(), m_q); + connect(adapter, SIGNAL(poweredChanged(bool)), m_q, SLOT(_k_adapterPoweredChanged(bool))); + m_adaptersHash.insert(objectPath.path(), adapter); if (!m_defaultAdapter) { m_defaultAdapter = adapter; + emit m_q->defaultAdapterChanged(m_defaultAdapter); } if (!m_usableAdapter || !m_usableAdapter->isPowered()) { Adapter *const oldUsableAdapter = m_usableAdapter; @@ -183,12 +211,35 @@ Adapter *adapter = m_adaptersHash[objectPath.path()]; if (!adapter) { adapter = new Adapter(objectPath.path(), m_q); + connect(adapter, SIGNAL(poweredChanged(bool)), m_q, SLOT(_k_adapterPoweredChanged(bool))); m_adaptersHash.insert(objectPath.path(), adapter); } m_defaultAdapter = adapter; emit m_q->defaultAdapterChanged(adapter); } +void Manager::Private::_k_adapterPoweredChanged(bool powered) +{ + Adapter *adapter = qobject_cast< Adapter* >(m_q->sender()); + if (!adapter) { + qWarning("adapterPoweredChanged was called from a null adapter"); + return; + } + + if (m_usableAdapter && adapter != m_usableAdapter) { + return;//The modified adapter is not the usable one, ignore the event (we do not care) + } + + if (m_defaultAdapter && !powered) { + m_defaultAdapter = 0; + emit m_q->usableAdapterChanged(0); + return; + } + + m_defaultAdapter = adapter; + emit m_q->usableAdapterChanged(m_defaultAdapter); +} + void Manager::Private::_k_propertyChanged(const QString &property, const QDBusVariant &value) { Q_UNUSED(property) @@ -198,28 +249,13 @@ void Manager::Private::_k_bluezServiceRegistered() { m_bluezServiceRunning = true; - if (!m_bluezManagerInterface) { - initialize(); - } + initialize(); } void Manager::Private::_k_bluezServiceUnregistered() { - QHashIterator<QString, Adapter*> i(m_adaptersHash); - while (i.hasNext()) { - i.next(); - Adapter *adapter = m_adaptersHash.take(i.key()); - emit m_q->adapterRemoved(adapter); - delete adapter; - } - - m_usableAdapter = 0; - m_defaultAdapter = 0; - - emit m_q->usableAdapterChanged(0); - emit m_q->defaultAdapterChanged(0); - m_bluezServiceRunning = false; + clean(); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -267,6 +303,7 @@ const QString adapterPath = d->m_bluezManagerInterface->DefaultAdapter().value().path(); if (!adapterPath.isEmpty()) { d->m_defaultAdapter = new Adapter(adapterPath, const_cast<Manager*>(this)); + connect(d->m_defaultAdapter, SIGNAL(poweredChanged(bool)), SLOT(_k_adapterPoweredChanged(bool))); d->m_adaptersHash.insert(adapterPath, d->m_defaultAdapter); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libbluedevil-1.9.2/bluedevil/bluedevilmanager.h new/libbluedevil-1.9.3/bluedevil/bluedevilmanager.h --- old/libbluedevil-1.9.2/bluedevil/bluedevilmanager.h 2012-04-26 05:28:30.000000000 +0200 +++ new/libbluedevil-1.9.3/bluedevil/bluedevilmanager.h 2013-03-24 18:12:47.000000000 +0100 @@ -152,6 +152,7 @@ Q_PRIVATE_SLOT(d, void _k_adapterAdded(QDBusObjectPath)) Q_PRIVATE_SLOT(d, void _k_adapterRemoved(QDBusObjectPath)) Q_PRIVATE_SLOT(d, void _k_defaultAdapterChanged(QDBusObjectPath)) + Q_PRIVATE_SLOT(d, void _k_adapterPoweredChanged(bool powered)); Q_PRIVATE_SLOT(d, void _k_propertyChanged(QString,QDBusVariant)) Q_PRIVATE_SLOT(d, void _k_bluezServiceRegistered()) Q_PRIVATE_SLOT(d, void _k_bluezServiceUnregistered()) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
