diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2013-12-16 16:02:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-20 09:06:10 +0100 |
commit | 94f862e2786c5e9b558ae6ab6f524842949c0953 (patch) | |
tree | 8905bcdae7592fb1ca26ea43e3330b03b62dbede /src/bluetooth/qbluetoothlocaldevice_bluez.cpp | |
parent | f661b7fbb19d845b23450c57127020ee86df578d (diff) |
Use QLoggingCategory to categorize the various debug output streams
Task-number: QTBUG-32253
Change-Id: I193162407d0fc7eca83689e31f03e1641a494ab0
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_bluez.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp index 62df930a..c4601947 100644 --- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ - -#include <QDBusContext> +#include <QtCore/QLoggingCategory> +#include <QtDBus/QDBusContext> #include "qbluetoothlocaldevice.h" #include "qbluetoothaddress.h" @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ) + static const QLatin1String agentPath("/qt/agent"); QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) : @@ -194,7 +196,7 @@ static inline OrgBluezDeviceInterface *getDevice(const QBluetoothAddress &addres QDBusPendingReply<QDBusObjectPath> reply = d_ptr->adapter->FindDevice(address.toString()); reply.waitForFinished(); if(reply.isError()){ - qWarning() << Q_FUNC_INFO << "reply failed" << reply.error(); + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "reply failed" << reply.error(); return 0; } @@ -230,7 +232,7 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai if(!res){ QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError)); - qWarning() << "Failed to register agent"; + qCWarning(QT_BT_BLUEZ) << "Failed to register agent"; return; } } @@ -245,7 +247,7 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai QDBusPendingReply<> deviceReply = device->SetProperty(QLatin1String("Trusted"), QDBusVariant(true)); deviceReply.waitForFinished(); if(deviceReply.isError()){ - qWarning() << Q_FUNC_INFO << "reply failed" << deviceReply.error(); + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "reply failed" << deviceReply.error(); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError)); return; @@ -264,7 +266,7 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai QDBusPendingReply<> deviceReply = device->SetProperty(QLatin1String("Trusted"), QDBusVariant(false)); deviceReply.waitForFinished(); if(deviceReply.isError()){ - qWarning() << Q_FUNC_INFO << "reply failed" << deviceReply.error(); + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "reply failed" << deviceReply.error(); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError)); return; @@ -283,14 +285,14 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), d_ptr, SLOT(pairingCompleted(QDBusPendingCallWatcher*))); if(reply.isError()) - qWarning() << Q_FUNC_INFO << reply.error() << d_ptr->agent_path; + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << reply.error() << d_ptr->agent_path; } } else if(pairing == Unpaired) { QDBusPendingReply<QDBusObjectPath> reply = this->d_ptr->adapter->FindDevice(address.toString()); reply.waitForFinished(); if(reply.isError()) { - qWarning() << Q_FUNC_INFO << "failed to find device" << reply.error(); + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to find device" << reply.error(); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError)); return; @@ -298,7 +300,7 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai QDBusPendingReply<> removeReply = this->d_ptr->adapter->RemoveDevice(reply.value()); removeReply.waitForFinished(); if(removeReply.isError()){ - qWarning() << Q_FUNC_INFO << "failed to remove device" << removeReply.error(); + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to remove device" << removeReply.error(); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError)); } else { @@ -437,7 +439,7 @@ QString QBluetoothLocalDevicePrivate::RequestPinCode(const QDBusObjectPath &in0) { Q_UNUSED(in0) Q_Q(QBluetoothLocalDevice); - //qDebug() << Q_FUNC_INFO << in0.path(); + qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << in0.path(); // seeded in constructor, 6 digit pin QString pin = QString::fromLatin1("%1").arg(qrand()&1000000); pin = QString::fromLatin1("%1").arg(pin, 6, QLatin1Char('0')); @@ -452,7 +454,7 @@ void QBluetoothLocalDevicePrivate::pairingCompleted(QDBusPendingCallWatcher *wat QDBusPendingReply<> reply = *watcher; if(reply.isError()) { - qWarning() << Q_FUNC_INFO << "failed to create pairing" << reply.error(); + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to create pairing" << reply.error(); emit q->error(QBluetoothLocalDevice::PairingError); delete watcher; return; @@ -461,7 +463,7 @@ void QBluetoothLocalDevicePrivate::pairingCompleted(QDBusPendingCallWatcher *wat QDBusPendingReply<QDBusObjectPath> findReply = adapter->FindDevice(address.toString()); findReply.waitForFinished(); if(findReply.isError()) { - qWarning() << Q_FUNC_INFO << "failed to find device" << findReply.error(); + qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to find device" << findReply.error(); emit q->error(QBluetoothLocalDevice::PairingError); delete watcher; return; @@ -487,19 +489,19 @@ void QBluetoothLocalDevicePrivate::Authorize(const QDBusObjectPath &in0, const Q Q_UNUSED(in0) Q_UNUSED(in1) //TODO implement this - //qDebug() << "Got authorize for" << in0.path() << in1; + qCDebug(QT_BT_BLUEZ) << "Got authorize for" << in0.path() << in1; } void QBluetoothLocalDevicePrivate::Cancel() { //TODO implement this - //qDebug() << Q_FUNC_INFO; + qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO; } void QBluetoothLocalDevicePrivate::Release() { //TODO implement this - //qDebug() << Q_FUNC_INFO; + qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO; } @@ -507,7 +509,7 @@ void QBluetoothLocalDevicePrivate::ConfirmModeChange(const QString &in0) { Q_UNUSED(in0) //TODO implement this - //qDebug() << Q_FUNC_INFO << in0; + qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << in0; } void QBluetoothLocalDevicePrivate::DisplayPasskey(const QDBusObjectPath &in0, uint in1, uchar in2) @@ -516,13 +518,13 @@ void QBluetoothLocalDevicePrivate::DisplayPasskey(const QDBusObjectPath &in0, ui Q_UNUSED(in1) Q_UNUSED(in2) //TODO implement this - //qDebug() << Q_FUNC_INFO << in0.path() << in1 << in2; + qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << in0.path() << in1 << in2; } uint QBluetoothLocalDevicePrivate::RequestPasskey(const QDBusObjectPath &in0) { Q_UNUSED(in0); - //qDebug() << Q_FUNC_INFO; + qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO; return qrand()&0x1000000; } @@ -541,7 +543,7 @@ void QBluetoothLocalDevicePrivate::PropertyChanged(QString property, QDBusVarian QDBusPendingReply<QVariantMap> reply = adapter->GetProperties(); reply.waitForFinished(); if (reply.isError()){ - qWarning() << "Failed to get bluetooth properties for mode change"; + qCWarning(QT_BT_BLUEZ) << "Failed to get bluetooth properties for mode change"; return; } |