diff --git a/libbuteosyncfw/common/TransportTracker.cpp b/libbuteosyncfw/common/TransportTracker.cpp index 35097ec..566d5dd 100644 --- a/libbuteosyncfw/common/TransportTracker.cpp +++ b/libbuteosyncfw/common/TransportTracker.cpp @@ -32,6 +32,8 @@ #include #include +#include + using namespace Buteo; TransportTracker::TransportTracker(QObject *aParent) : @@ -65,16 +67,19 @@ TransportTracker::TransportTracker(QObject *aParent) : #endif // BT - // Set the bluetooth state - iTransportStates[Sync::CONNECTIVITY_BT] = btConnectivityStatus(); - if (!iSystemBus.connect("org.bluez", - "", - "org.bluez.Adapter", - "PropertyChanged", - this, - SLOT(onBtStateChanged(QString, QDBusVariant)))) + // Initialize BluezQt + btManager = new BluezQt::Manager(this); + if (btManager != 0) { + BluezQt::InitManagerJob *initJob = btManager->init(); + initJob->start(); + connect(initJob, &BluezQt::InitManagerJob::result, + this, &TransportTracker::initBluez5ManagerJobResult/*, + Qt::QueuedConnection*/); + LOG_DEBUG("BT manager init started"); + } + else { - LOG_WARNING("Unable to connect to system bus for org.bluez.Adapter"); + LOG_CRITICAL("BT manager init failed"); } // Internet @@ -86,7 +91,8 @@ TransportTracker::TransportTracker(QObject *aParent) : iInternet->isOnline(); connect(iInternet, SIGNAL(statusChanged(bool, Sync::InternetConnectionType)), - SLOT(onInternetStateChanged(bool, Sync::InternetConnectionType)) /*, Qt::QueuedConnection*/); + SLOT(onInternetStateChanged(bool, Sync::InternetConnectionType)) /*, + Qt::QueuedConnection*/); } else { @@ -97,6 +103,7 @@ TransportTracker::TransportTracker(QObject *aParent) : TransportTracker::~TransportTracker() { FUNCTION_CALL_TRACE; + } bool TransportTracker::isConnectivityAvailable(Sync::ConnectivityType aType) const @@ -116,16 +123,14 @@ void TransportTracker::onUsbStateChanged(bool aConnected) updateState(Sync::CONNECTIVITY_USB, aConnected); } -void TransportTracker::onBtStateChanged(QString aKey, QDBusVariant aValue) +void TransportTracker::onBtStateChanged(bool aValue) { FUNCTION_CALL_TRACE; - if (aKey == "Powered") - { - bool btPowered = aValue.variant().toBool(); - LOG_DEBUG("BT power state " << btPowered); - updateState(Sync::CONNECTIVITY_BT, btPowered); - } + LOG_DEBUG("BT state changed (sent update in 5sec):" << aValue); +// If BT was enabled or disabled give the framework 5sec +// to complete before updating the BT state + QTimer::singleShot(5000, this, SLOT(onBtStateChangedUpdateState())); } void TransportTracker::onInternetStateChanged(bool aConnected, Sync::InternetConnectionType aType) @@ -142,13 +147,14 @@ void TransportTracker::updateState(Sync::ConnectivityType aType, { FUNCTION_CALL_TRACE; - bool oldState = false; { QMutexLocker locker(&iMutex); oldState = iTransportStates[aType]; iTransportStates[aType] = aState; } + LOG_DEBUG("Connection state old:" << oldState); + LOG_DEBUG("Connection state new:" << aState); if(oldState != aState) { if (aType != Sync::CONNECTIVITY_INTERNET) @@ -158,57 +164,64 @@ void TransportTracker::updateState(Sync::ConnectivityType aType, } } -bool TransportTracker::btConnectivityStatus() +void TransportTracker::onBtStateChangedUpdateState() { FUNCTION_CALL_TRACE; - bool btOn = false; - QDBusMessage methodCallMsg = QDBusMessage::createMethodCall("org.bluez", - "/", - "org.bluez.Manager", - "DefaultAdapter"); - - QDBusMessage reply = iSystemBus.call(methodCallMsg); - if (reply.type() == QDBusMessage::ErrorMessage) + bool state = false; + if (btManager && btManager->isOperational()) { + BluezQt::AdapterPtr defaultAdapter = btManager->usableAdapter(); + if (defaultAdapter) + { + state = defaultAdapter->isPowered(); + LOG_DEBUG("BT default adapter path: " << defaultAdapter->ubi()); + LOG_DEBUG("BT default adapter name: " << defaultAdapter->name()); + } + } + else { - LOG_WARNING("This device does not have a BT adapter"); - return btOn; + LOG_CRITICAL("BT manager is not working"); } + LOG_DEBUG("BT state:" << state); + updateState(Sync::CONNECTIVITY_BT, state); +} - QList adapterList = reply.arguments(); - // We will take the first adapter in the list - QString adapterPath = qdbus_cast(adapterList.at(0)).path(); +void TransportTracker::initBluez5ManagerJobResult(BluezQt::InitManagerJob* job) { - if (!adapterPath.isEmpty() || !adapterPath.isNull()) - { - // Retrive the properties of the adapter and check for "Powered" key - methodCallMsg = QDBusMessage::createMethodCall("org.bluez", - adapterPath, - "org.bluez.Adapter", - "GetProperties"); - reply = iSystemBus.call(methodCallMsg); - if (reply.type() == QDBusMessage::ErrorMessage) - { - LOG_WARNING("Error in retrieving bluetooth properties"); - return btOn; - } + FUNCTION_CALL_TRACE; - QDBusArgument arg = reply.arguments().at(0).value(); - if (arg.currentType() == QDBusArgument::MapType) - { - // Scan through the dict returned and check for "Powered" entry - QMap dict = qdbus_cast >(arg); - QMap::iterator iter; - for(iter = dict.begin(); iter != dict.end(); ++iter) - { - if (iter.key() == "Powered") - { - btOn = iter.value().toBool(); - LOG_DEBUG ("Bluetooth powered on? " << btOn); - break; - } - } - } + if (job->error()) { + LOG_CRITICAL("BT manager init error: " << job->errorText()); + return; + } + + // @todo do we need this + Q_ASSERT(job->manager() == btManager); + + // Make sure to update msyncd when bluetoothd starts + connect(btManager, &BluezQt::Manager::operationalChanged, + this, &TransportTracker::onBtStateChanged); + connect(btManager, &BluezQt::Manager::bluetoothOperationalChanged, + this, &TransportTracker::onBtStateChanged); + connect(btManager, &BluezQt::Manager::bluetoothBlockedChanged, + this, &TransportTracker::onBtStateChanged); + + bool isBlocked = btManager->isBluetoothBlocked(); + if (!btManager->isOperational() || isBlocked) { + if (isBlocked) + LOG_WARNING("BT manager started (adapter is blocked)"); + else + LOG_CRITICAL("BT manager started (not operational)"); + return; + } + + BluezQt::AdapterPtr defaultAdapter = btManager->usableAdapter(); + if (!defaultAdapter) + { + LOG_WARNING("BT manager initialized but no usable adapter found"); + return; } - return btOn; + // Update bluetooth state + updateState(Sync::CONNECTIVITY_BT, defaultAdapter->isPowered()); + LOG_DEBUG ("BT manager init done"); } diff --git a/libbuteosyncfw/common/TransportTracker.h b/libbuteosyncfw/common/TransportTracker.h index f43155d..d68300a 100644 --- a/libbuteosyncfw/common/TransportTracker.h +++ b/libbuteosyncfw/common/TransportTracker.h @@ -31,37 +31,40 @@ #include #include -namespace Buteo { +#include +#include + +namespace Buteo +{ class USBModedProxy; class NetworkManager; - /*! \brief Class for tracking transport states * * USB state is tracked with HAL, BT with Context Framework and Internet states with Buteo::NetworkManager. */ -class TransportTracker : public QObject +class TransportTracker: public QObject { - Q_OBJECT + Q_OBJECT public: - /*! \brief Constructor - * - * @param aParent Parent object - */ - TransportTracker(QObject *aParent = 0); + /*! \brief Constructor + * + * @param aParent Parent object + */ + TransportTracker(QObject *aParent = 0); - //! \brief Destructor - virtual ~TransportTracker(); + //! \brief Destructor + virtual ~TransportTracker(); - /*! \brief Checks the state of the given connectivity type - * - * @param aType Connectivity type - * @return True if available, false if not - */ - bool isConnectivityAvailable(Sync::ConnectivityType aType) const; + /*! \brief Checks the state of the given connectivity type + * + * @param aType Connectivity type + * @return True if available, false if not + */ + bool isConnectivityAvailable(Sync::ConnectivityType aType) const; signals: @@ -70,7 +73,7 @@ signals: * @param aType Connectivity type whose state has changed * @param aState New state. True if available, false if not. */ - void connectivityStateChanged(Sync::ConnectivityType aType, bool aState); + void connectivityStateChanged(Sync::ConnectivityType aType, bool aState); /*! \brief Signal emitted when a n/w state changes * @@ -89,11 +92,27 @@ signals: private slots: - void onUsbStateChanged(bool aConnected); + void onUsbStateChanged(bool aConnected); - void onBtStateChanged(QString aKey, QDBusVariant aValue); + /*! \brief Slot onBtStateChanged to update BT state + * \param bool aValue + */ + void onBtStateChanged(bool aValue); - void onInternetStateChanged(bool aConnected, Sync::InternetConnectionType aType); + /*! \brief Process the result of the onInternetStateChanged signal + * \param bool aConnected + * \param Sync::InternetConnectionType aType + */ + void onInternetStateChanged(bool aConnected, + Sync::InternetConnectionType aType); + + /*! \brief Slot onBtStateChangedUpdateState to update state after 5sec + */ + void onBtStateChangedUpdateState(); + + /*! \brief Process the result of the initBluez5ManagerJob signal + */ + void initBluez5ManagerJobResult(BluezQt::InitManagerJob*/*job*/); private: @@ -104,22 +123,22 @@ private: NetworkManager *iInternet; QDBusConnection iSystemBus; + BluezQt::Manager *btManager; + mutable QMutex iMutex; - /*! \brief updates the state of the given connectivity type to input value - * - * @param aType Connectivity type - * @param aState Connectivity State - */ - void updateState(Sync::ConnectivityType aType, bool aState); + /*! \brief updates the state of the given connectivity type to input value + * + * @param aType Connectivity type + * @param aState Connectivity State + */ + void updateState(Sync::ConnectivityType aType, bool aState); #ifdef SYNCFW_UNIT_TESTS friend class TransportTrackerTest; friend class SynchronizerTest; #endif - bool btConnectivityStatus(); - }; } diff --git a/libbuteosyncfw/libbuteosyncfw.pro b/libbuteosyncfw/libbuteosyncfw.pro index ca1422b..1814ccd 100644 --- a/libbuteosyncfw/libbuteosyncfw.pro +++ b/libbuteosyncfw/libbuteosyncfw.pro @@ -10,11 +10,17 @@ VER_PAT = 0 QT += sql xml dbus network QT -= gui +unix { + QT_CONFIG -= no-pkg-config + CONFIG += link_pkgconfig + PKGCONFIG += KF5BluezQt +} + CONFIG += dll \ create_pc \ create_prl -#DEFINES += BUTEO_ENABLE_DEBUG +DEFINES += BUTEO_ENABLE_DEBUG # Input HEADERS += common/Logger.h \ diff --git a/libbuteosyncfw/profile/BtHelper.cpp b/libbuteosyncfw/profile/BtHelper.cpp index 47269a4..cedb2a4 100644 --- a/libbuteosyncfw/profile/BtHelper.cpp +++ b/libbuteosyncfw/profile/BtHelper.cpp @@ -24,134 +24,164 @@ #include #include "BtHelper.h" +#include const QString BT::BLUEZ_DEST = "org.bluez"; -const QString BT::BLUEZ_MANAGER_INTERFACE = "org.bluez.Manager"; -const QString BT::BLUEZ_ADAPTER_INTERFACE = "org.bluez.Adapter"; -const QString BT::BLUEZ_DEVICE_INTERFACE = "org.bluez.Device"; -const QString BT::GET_DEFAULT_ADAPTER = "DefaultAdapter"; -const QString BT::FIND_DEVICE = "FindDevice"; -const QString BT::DISCOVERSERVICES = "DiscoverServices"; -const QString BT::GETPROPERTIES = "GetProperties"; +const QString BT::DBUS_PROPERTIES_INTERFACE = "org.freedesktop.DBus.Properties"; +const QString BT::GETPROPERTIES = "GetAll"; BtHelper::BtHelper(const QString& deviceAddress, QObject* parent) : QObject(parent) { - m_deviceAddress = deviceAddress; + m_deviceAddress = deviceAddress; + + btManager = new BluezQt::Manager(this); + if (btManager != 0) { + BluezQt::InitManagerJob *initJob = btManager->init(); + initJob->start(); + connect(initJob, &BluezQt::InitManagerJob::result, + this, &BtHelper::initBluez5ManagerJobResult/*, + Qt::QueuedConnection*/); + LOG_DEBUG("BtHelper::BtHelper manager init started"); + } + else + { + LOG_CRITICAL("BtHelper::BtHelper manager start failed"); + } } BtHelper::~BtHelper() { - LOG_DEBUG (""); + FUNCTION_CALL_TRACE; + LOG_DEBUG ("BtHelper::~BtHelper()"); } +void BtHelper::initBluez5ManagerJobResult(BluezQt::InitManagerJob* job) { + FUNCTION_CALL_TRACE; + if (job->error()) { + LOG_CRITICAL("BtHelper manager init error: " << job->errorText()); + return; + } + + // @todo do we need notifications on operational status? + // Make sure to update BtHelper when bluetoothd starts +// connect(btManager, &BluezQt::Manager::operationalChanged, +// this, &BtHelper::onBtStateChanged); +// connect(btManager, &BluezQt::Manager::bluetoothOperationalChanged, +// this, &BtHelper::onBtStateChanged); + + if (!btManager->isOperational() || btManager->isBluetoothBlocked()) { + if (btManager->isBluetoothBlocked()) + LOG_WARNING("BtHelper manager init failed (adapter is blocked)"); + else + LOG_CRITICAL("BtHelper manager init failed (not operational)"); + return; + } + + BluezQt::DevicePtr dev = btManager->deviceForAddress(m_deviceAddress); + if (!dev) + { + LOG_WARNING("BtHelper manager device query failed for addr: " << m_deviceAddress); + return; + } + BluezQt::AdapterPtr adapter = dev->adapter(); + if (!adapter) + { + LOG_WARNING("BtHelper manager init done but no usable adapter found"); + return; + } + LOG_DEBUG("BtHelper adapter path: " << adapter->ubi()); + LOG_DEBUG("BtHelper adapter name: " << adapter->name()); +} bool BtHelper::isServiceSupported (const QList& servicesList, const QString& serviceUUID) { - LOG_DEBUG ("isServiceSupported"); - foreach (QString service, servicesList) { - //LOG_DEBUG ("Record : " << service); - if (service.contains(serviceUUID)){ - LOG_DEBUG ("Service found " << serviceUUID); - return true; - } - } - return false; + FUNCTION_CALL_TRACE; + + if (!btManager->isOperational()) + { + LOG_WARNING("BtHelper::isServiceSupported: manager is not working properly"); + return false; + } + foreach (QString service, servicesList) { + LOG_DEBUG ("Record : " << service); + if (service.contains(serviceUUID)){ + LOG_DEBUG ("Service found " << serviceUUID); + return true; + } + } + return false; } QString BtHelper::getDefaultAdapterPath() { - LOG_DEBUG ("getDefaultAdapterPath"); - - QDBusInterface managerInterface( BT::BLUEZ_DEST, "/", - BT::BLUEZ_MANAGER_INTERFACE, - QDBusConnection::systemBus() ); + FUNCTION_CALL_TRACE; - if( !managerInterface.isValid() ) { - LOG_DEBUG ("Manager interface is invalid"); - return QString(); + if (!btManager->isOperational()) + { + LOG_WARNING("BtHelper::getDefaultAdapterPath: manager is not working properly"); + return false; } - QDBusReply pathReply = managerInterface.call(BT::GET_DEFAULT_ADAPTER); - - if( !pathReply.isValid() ) { - LOG_DEBUG ("Not able to get the adapter path"); + BluezQt::DevicePtr dev = btManager->deviceForAddress(m_deviceAddress); + BluezQt::AdapterPtr defaultAdapter = dev->adapter(); + if ( ! defaultAdapter ) return QString(); - } - return pathReply.value().path(); + + return defaultAdapter->ubi(); } -QString BtHelper::getDevicePath(QString &defaultAdapterPath) +QString BtHelper::getDevicePath() { - if (defaultAdapterPath.isEmpty()) { - LOG_DEBUG ( "Adapter path is empty"); - return QString(); - } - - QDBusInterface adapterInterface(BT::BLUEZ_DEST, defaultAdapterPath, - BT::BLUEZ_ADAPTER_INTERFACE, QDBusConnection::systemBus() ); - if( !adapterInterface.isValid() ) { - LOG_DEBUG ( "Adapter interface is invalid"); - return QString(); + FUNCTION_CALL_TRACE; + + if (!btManager->isOperational()) + { + LOG_WARNING("BtHelper::getDevicePath: manager is not working properly"); + return false; } - QDBusReply pathReply = adapterInterface.call(BT::FIND_DEVICE, m_deviceAddress ); + BluezQt::DevicePtr dev = btManager->deviceForAddress(m_deviceAddress); - if( !pathReply.isValid() ) { - LOG_DEBUG ( "Not able to find the BT device"); + if (!dev) return QString(); - } - return pathReply.value().path(); + return dev->ubi(); } bool BtHelper::getServiceRecords(QList& servicesList) { - LOG_DEBUG ( "getServiceRecords()"); + FUNCTION_CALL_TRACE; - QString defaultAdapterPath = getDefaultAdapterPath(); - LOG_DEBUG ( "Adapter path = " << defaultAdapterPath) ; - - QString devicePath = getDevicePath(defaultAdapterPath); - if (devicePath.isEmpty()) - return false; - LOG_DEBUG ( "Device path =" << devicePath); - - QDBusInterface deviceInterface(BT::BLUEZ_DEST, devicePath, - BT::BLUEZ_DEVICE_INTERFACE, - QDBusConnection::systemBus() ); - if( deviceInterface.isValid() == false ) { - LOG_DEBUG ("Device interface is not valid"); + if (!btManager->isOperational()) + { + LOG_WARNING("BtHelper::getServiceRecords: manager is not working properly"); return false; } - QDBusMessage message = deviceInterface.call(BT::DISCOVERSERVICES, QString()); - QDBusArgument reply = QDBusReply(message).value(); - QMap mapVal; - reply >> mapVal; - servicesList = mapVal.values(); + BluezQt::DevicePtr dev = btManager->deviceForAddress(m_deviceAddress); + servicesList = dev->uuids(); + if (servicesList.size() > 0) return true; return false; } -QMap BtHelper::getDeviceProperties() +QVariantMap BtHelper::getDeviceProperties() { - LOG_DEBUG ( "getDeviceProperties"); + FUNCTION_CALL_TRACE; - QMap mapVal; - QString defaultAdapterPath = getDefaultAdapterPath(); - LOG_DEBUG ( "Adapter path = " << defaultAdapterPath) ; + QVariantMap mapVal; - QString devicePath = getDevicePath(defaultAdapterPath); + QString devicePath = getDevicePath(); if (devicePath.isEmpty()) return mapVal; LOG_DEBUG ( "Device path =" << devicePath); QDBusInterface deviceInterface(BT::BLUEZ_DEST, devicePath, - BT::BLUEZ_DEVICE_INTERFACE, + BT::DBUS_PROPERTIES_INTERFACE, QDBusConnection::systemBus() ); if( deviceInterface.isValid() == false ) { LOG_DEBUG ("Device interface is not valid"); @@ -160,6 +190,6 @@ QMap BtHelper::getDeviceProperties() QDBusMessage message = deviceInterface.call(BT::GETPROPERTIES); QDBusArgument reply = QDBusReply(message).value(); - reply >> mapVal; + reply >> mapVal; return mapVal; } diff --git a/libbuteosyncfw/profile/BtHelper.h b/libbuteosyncfw/profile/BtHelper.h index 819be11..e40e538 100644 --- a/libbuteosyncfw/profile/BtHelper.h +++ b/libbuteosyncfw/profile/BtHelper.h @@ -28,25 +28,17 @@ #include #include +#include +#include +#include + /*! \brief Strings used for DBus communication with bluetooth daemon are grouped using this structure. */ struct BT { /// Destination for Dbus command to bluez static const QString BLUEZ_DEST; - /// Bluez manager interface name - static const QString BLUEZ_MANAGER_INTERFACE; - /// Bluez adapter interface name - static const QString BLUEZ_ADAPTER_INTERFACE; - /// Bluez Device interface name - static const QString BLUEZ_DEVICE_INTERFACE; - /// Method name for retrieving default adapter - static const QString GET_DEFAULT_ADAPTER; - /// Method name for finding the device - static const QString FIND_DEVICE; - /// Method name for discovering services - static const QString DISCOVERSERVICES; - /// Method name for discovering services + static const QString DBUS_PROPERTIES_INTERFACE; static const QString GETPROPERTIES; }; @@ -58,6 +50,7 @@ class BtHelper : public QObject private: QString m_deviceAddress; + BluezQt::Manager *btManager; // Private methods @@ -66,12 +59,14 @@ private: QString getDefaultAdapterPath(); /*! \brief Fetches the device path - * \param defaultAdapterPath Default adapter path */ - QString getDevicePath(QString& defaultAdapterPath); - /* \brief Open the serial port and get file descriptor for the port. - * \return File descriptor if opening port was success, otherwise -1 - */ + QString getDevicePath(); + +private slots: + /*! \brief Process the result of the initManagerJob + */ + void initBluez5ManagerJobResult(BluezQt::InitManagerJob*/*job*/); + public: /*! \brief Constructor. * \param deviceAddess Bluetooth address of remote device @@ -95,7 +90,7 @@ public: /*! \brief To find remote device BT properties. */ - QMap getDeviceProperties(); + QVariantMap getDeviceProperties(); }; #endif // BTHELPER_H diff --git a/msyncd/msyncd-app.pro b/msyncd/msyncd-app.pro index a8e08ec..50d1914 100644 --- a/msyncd/msyncd-app.pro +++ b/msyncd/msyncd-app.pro @@ -18,7 +18,7 @@ INCLUDEPATH += . \ ../libbuteosyncfw/profile -PKGCONFIG += dbus-1 libsignon-qt5 accounts-qt5 Qt5SystemInfo +PKGCONFIG += dbus-1 libsignon-qt5 accounts-qt5 Qt5SystemInfo KF5BluezQt LIBS += -lbuteosyncfw5 packagesExist(qt5-boostable) { DEFINES += HAS_BOOSTER diff --git a/msyncd/msyncd-lib.pro b/msyncd/msyncd-lib.pro index 7cf681d..633e575 100644 --- a/msyncd/msyncd-lib.pro +++ b/msyncd/msyncd-lib.pro @@ -18,9 +18,10 @@ INCLUDEPATH += . \ ../libbuteosyncfw/common \ ../libbuteosyncfw/profile +DEFINES += BUTEO_ENABLE_DEBUG PKGCONFIG += dbus-1 gio-2.0 libsignon-qt5 accounts-qt5 Qt5SystemInfo -PKGCONFIG += mce-qt5 +PKGCONFIG += mce-qt5 KF5BluezQt LIBS += -lbuteosyncfw5 packagesExist(qt5-boostable) { DEFINES += HAS_BOOSTER diff --git a/rpm/buteo-syncfw-qt5.spec b/rpm/buteo-syncfw-qt5.spec index 83b4f9d..1dbdf64 100644 --- a/rpm/buteo-syncfw-qt5.spec +++ b/rpm/buteo-syncfw-qt5.spec @@ -20,12 +20,14 @@ BuildRequires: pkgconfig(libiphb) BuildRequires: pkgconfig(qt5-boostable) BuildRequires: pkgconfig(keepalive) BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(KF5BluezQt) BuildRequires: pkgconfig(mce-qt5) >= 1.1.0 BuildRequires: oneshot BuildRequires: doxygen Requires: mapplauncherd-qt5 Requires: oneshot Requires: glib2 +Requires: kf5bluezqt-bluez5 >= 5.24 Requires: libmce-qt5 >= 1.1.0 %{_oneshot_requires_post} diff --git a/unittests/tests/msyncdtests/TransportTrackerTest/TransportTrackerTest.cpp b/unittests/tests/msyncdtests/TransportTrackerTest/TransportTrackerTest.cpp index 0c37b4c..7fcb221 100644 --- a/unittests/tests/msyncdtests/TransportTrackerTest/TransportTrackerTest.cpp +++ b/unittests/tests/msyncdtests/TransportTrackerTest/TransportTrackerTest.cpp @@ -102,7 +102,7 @@ void TransportTrackerTest :: testStateChanged() // change BT state and verify bool btCurrentState = iTransportTracker->isConnectivityAvailable(Sync::CONNECTIVITY_BT); - iTransportTracker->onBtStateChanged("Powered", QDBusVariant(QVariant(!btCurrentState))); + iTransportTracker->onBtStateChanged(!btCurrentState); QCOMPARE(iTransportTracker->isConnectivityAvailable(Sync::CONNECTIVITY_BT), !btCurrentState); QCOMPARE(connectivityStateSpy.count(), 1); diff --git a/unittests/tests/tests_common.pri b/unittests/tests/tests_common.pri index 35f4d11..127cd81 100644 --- a/unittests/tests/tests_common.pri +++ b/unittests/tests/tests_common.pri @@ -16,7 +16,7 @@ QT -= gui CONFIG += link_pkgconfig link_prl -PKGCONFIG += dbus-1 Qt5SystemInfo +PKGCONFIG += dbus-1 Qt5SystemInfo KF5BluezQt LIBS += -lgcov