From 02edbc0f8320472ac0cabe0c41a6b930f3cc2134 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 18 Feb 2014 08:27:19 +0100 Subject: Remove remaining QBBBluetoothDebug statements Change-Id: I5c8fae0b6546cb1e6907566f3f95b26cdf1ded11 Reviewed-by: Nedim Hadzic Reviewed-by: Alex Blasche --- .../qbluetoothservicediscoveryagent_qnx.cpp | 4 +- src/bluetooth/qlowenergycharacteristicinfo_qnx.cpp | 41 ++++++++------- src/bluetooth/qlowenergyserviceinfo_qnx.cpp | 59 ++++++++++++---------- 3 files changed, 55 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp index 5ef4ed49..056cb4de 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp @@ -351,7 +351,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd) QString lowEnergyUuid(next_service); lowEnergyUuid = QStringLiteral("0x") + lowEnergyUuid; - qBBBluetoothDebug() << "LE Service: " << lowEnergyUuid << next_service; + qCDebug(QT_BT_QNX) << "LE Service: " << lowEnergyUuid << next_service; QBluetoothUuid leUuid; //In case of UUIDs that are id development phase (e.g. Texas Instruments SenstorTag LE Device) @@ -364,7 +364,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd) QLowEnergyServiceInfo lowEnergyService(leUuid); lowEnergyService.setDevice(discoveredDevices.at(0)); - qBBBluetoothDebug() << "Adding Low Energy service" << lowEnergyService.uuid(); + qCDebug(QT_BT_QNX) << "Adding Low Energy service" << lowEnergyService.uuid(); q_ptr->serviceDiscovered(lowEnergyService); } diff --git a/src/bluetooth/qlowenergycharacteristicinfo_qnx.cpp b/src/bluetooth/qlowenergycharacteristicinfo_qnx.cpp index f5de6b5d..5abe6296 100644 --- a/src/bluetooth/qlowenergycharacteristicinfo_qnx.cpp +++ b/src/bluetooth/qlowenergycharacteristicinfo_qnx.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include #include "qlowenergycharacteristicinfo_p.h" #include #include @@ -52,6 +53,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(QT_BT_QNX) + int hexValue(char inChar) { if (isxdigit(inChar)) { @@ -105,9 +108,9 @@ void QLowEnergyCharacteristicInfoPrivate::serviceNotification(int instance, shor return; QPointer *ClassPointer = static_cast *>(userData); QLowEnergyServiceInfoPrivate *p = ClassPointer->data(); - qBBBluetoothDebug() << "---------------------------------------------------"; - qBBBluetoothDebug() << "[Notification] received (service uuid, handle, value, instance):" << p->uuid << handle << val << instance; - qBBBluetoothDebug() << "---------------------------------------------------"; + qCDebug(QT_BT_QNX) << "---------------------------------------------------"; + qCDebug(QT_BT_QNX) << "[Notification] received (service uuid, handle, value, instance):" << p->uuid << handle << val << instance; + qCDebug(QT_BT_QNX) << "---------------------------------------------------"; //Check if the notification from wanted characteristic bool current = false; QLowEnergyCharacteristicInfo chars; @@ -131,19 +134,19 @@ void QLowEnergyCharacteristicInfoPrivate::serviceNotification(int instance, shor } if (!current) - qBBBluetoothDebug() << "Notificiation received and does not belong to this characteristic."; + qCDebug(QT_BT_QNX) << "Notificiation received and does not belong to this characteristic."; } bool QLowEnergyCharacteristicInfoPrivate::enableNotification() { if (instance == -1) { - qBBBluetoothDebug() << " GATT service not connected "; + qCDebug(QT_BT_QNX) << " GATT service not connected "; errorString = QStringLiteral("Service is not connected"); emit error(uuid); return false; } if ( (permission & QLowEnergyCharacteristicInfo::Notify) == 0) { - qBBBluetoothDebug() << "Notification changes not allowed"; + qCDebug(QT_BT_QNX) << "Notification changes not allowed"; errorString = QStringLiteral("This characteristic does not support notifications."); emit error(uuid); return false; @@ -151,12 +154,12 @@ bool QLowEnergyCharacteristicInfoPrivate::enableNotification() int rc = bt_gatt_enable_notify(instance, &characteristic, 1); if (rc != 0) { - qBBBluetoothDebug() << "bt_gatt_enable_notify errno=" << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "bt_gatt_enable_notify errno=" << errno << strerror(errno); errorString = QString::fromLatin1(strerror(errno)); emit error(uuid); return false; } else { - qBBBluetoothDebug() << "bt_gatt_enable_notify was presumably OK"; + qCDebug(QT_BT_QNX) << "bt_gatt_enable_notify was presumably OK"; return true; } } @@ -167,7 +170,7 @@ void QLowEnergyCharacteristicInfoPrivate::setValue(const QByteArray &wantedValue const int characteristicLen = wantedValue.size(); uint8_t *characteristicBuffer = (uint8_t *)alloca(characteristicLen / 2 + 1); if (!characteristicBuffer) { - qBBBluetoothDebug() << "GATT characteristic: Not enough memory"; + qCDebug(QT_BT_QNX) << "GATT characteristic: Not enough memory"; errorString = QStringLiteral("Not enough memory."); emit error(uuid); bt_gatt_disconnect_instance(instance); @@ -181,7 +184,7 @@ void QLowEnergyCharacteristicInfoPrivate::setValue(const QByteArray &wantedValue byteCount = bt_gatt_write_value(instance, handle.toUShort(), 0, characteristicBuffer, (consumed / 2)); if (byteCount < 0) { - qBBBluetoothDebug() << "Unable to write characteristic value: " << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "Unable to write characteristic value: " << errno << strerror(errno); errorString = QStringLiteral("Unable to write characteristic value: ") + QString::fromLatin1(strerror(errno)); emit error(uuid); } @@ -201,9 +204,9 @@ void QLowEnergyCharacteristicInfoPrivate::disableNotification() { int rc = bt_gatt_enable_notify(instance, &characteristic, 0); if (rc != 0) - qBBBluetoothDebug() << "bt_gatt_enable_notify errno=" << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "bt_gatt_enable_notify errno=" << errno << strerror(errno); else - qBBBluetoothDebug() << "bt_gatt_enable_notify was presumably OK"; + qCDebug(QT_BT_QNX) << "bt_gatt_enable_notify was presumably OK"; } @@ -222,7 +225,7 @@ void QLowEnergyCharacteristicInfoPrivate::readDescriptors() if (count > 0) { descriptorList = (bt_gatt_descriptor_t*)alloca(count * sizeof(bt_gatt_descriptor_t)); if (!descriptorList) { - qBBBluetoothDebug() <<"GATT descriptors: Not enough memory"; + qCDebug(QT_BT_QNX) <<"GATT descriptors: Not enough memory"; bt_gatt_disconnect_instance(instance); return; } @@ -238,7 +241,7 @@ void QLowEnergyCharacteristicInfoPrivate::readDescriptors() } if (count == -1) { - qBBBluetoothDebug() << "GATT descriptors failed: %1 (%2)" << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "GATT descriptors failed: %1 (%2)" << errno << strerror(errno); bt_gatt_disconnect_instance(instance); return; } @@ -247,7 +250,7 @@ void QLowEnergyCharacteristicInfoPrivate::readDescriptors() uint8_t *descriptorBuffer = (uint8_t *)alloca(characteristicMtu); if (!descriptorBuffer) { - qBBBluetoothDebug() <<"GATT descriptors: Not enough memory"; + qCDebug(QT_BT_QNX) <<"GATT descriptors: Not enough memory"; bt_gatt_disconnect_instance(instance); return; } @@ -269,7 +272,7 @@ void QLowEnergyCharacteristicInfoPrivate::readDescriptors() for (int offset = 0; more; offset += byteCount) { byteCount = bt_gatt_read_value(instance, descriptorList[i].handle, offset, descriptorBuffer, characteristicMtu, &more); if (byteCount < 0) { - qBBBluetoothDebug() << "Unable to read descriptor value:"<< errno<< strerror(errno); + qCDebug(QT_BT_QNX) << "Unable to read descriptor value:"<< errno<< strerror(errno); break; } descriptor.d_ptr->m_value = QByteArray(); @@ -291,13 +294,13 @@ void QLowEnergyCharacteristicInfoPrivate::readDescriptors() void QLowEnergyCharacteristicInfoPrivate::readValue() { if ((permission & QLowEnergyCharacteristicInfo::Read) == 0) { - qBBBluetoothDebug() << "GATT characteristic: Read not permitted"; + qCDebug(QT_BT_QNX) << "GATT characteristic: Read not permitted"; return; } uint8_t *characteristicBuffer = (uint8_t *)alloca(characteristicMtu); if (!characteristicBuffer) { - qBBBluetoothDebug() << "GATT characteristic: Not enough memory"; + qCDebug(QT_BT_QNX) << "GATT characteristic: Not enough memory"; bt_gatt_disconnect_instance(instance); return; } @@ -309,7 +312,7 @@ void QLowEnergyCharacteristicInfoPrivate::readValue() for (int offset = 0; more; offset += byteCount) { byteCount = bt_gatt_read_value(instance, handle.toUShort(), offset, characteristicBuffer, characteristicMtu, &more); if (byteCount < 0) { - qBBBluetoothDebug() << "Unable to read characteristic value: " << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "Unable to read characteristic value: " << errno << strerror(errno); break; } value = QByteArray(); diff --git a/src/bluetooth/qlowenergyserviceinfo_qnx.cpp b/src/bluetooth/qlowenergyserviceinfo_qnx.cpp index c33b6da2..5ab214de 100644 --- a/src/bluetooth/qlowenergyserviceinfo_qnx.cpp +++ b/src/bluetooth/qlowenergyserviceinfo_qnx.cpp @@ -40,6 +40,7 @@ ** ****************************************************************************/ +#include #include "qlowenergyserviceinfo_p.h" #include "qlowenergycharacteristicinfo.h" #include "qlowenergycharacteristicinfo_p.h" @@ -54,6 +55,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(QT_BT_QNX) + void QLowEnergyServiceInfoPrivate::serviceConnected(const char *bdaddr, const char *service, int instance, int err, short unsigned int connInt, short unsigned int latency, short unsigned int superTimeout, void *userData) { Q_UNUSED(latency); @@ -61,13 +64,13 @@ void QLowEnergyServiceInfoPrivate::serviceConnected(const char *bdaddr, const ch Q_UNUSED(superTimeout); QPointer *classPointer = static_cast *>(userData); QLowEnergyServiceInfoPrivate *p = classPointer->data(); - qBBBluetoothDebug() << "---------------------------------------------------"; - qBBBluetoothDebug() << "[SERVICE: Connected] (service uuid, instance):" << p->uuid << instance; - qBBBluetoothDebug() << "[SERVICE: Connected] Device address: " << bdaddr; - qBBBluetoothDebug() << "[SERVICE: Connected] Device service: " << service; - qBBBluetoothDebug() << "[SERVICE: Connected] Possible error: " << err; + qCDebug(QT_BT_QNX) << "---------------------------------------------------"; + qCDebug(QT_BT_QNX) << "[SERVICE: Connected] (service uuid, instance):" << p->uuid << instance; + qCDebug(QT_BT_QNX) << "[SERVICE: Connected] Device address: " << bdaddr; + qCDebug(QT_BT_QNX) << "[SERVICE: Connected] Device service: " << service; + qCDebug(QT_BT_QNX) << "[SERVICE: Connected] Possible error: " << err; if (err != 0) { - qBBBluetoothDebug() << "An error occurred in service connected callback: " << strerror(err); + qCDebug(QT_BT_QNX) << "An error occurred in service connected callback: " << strerror(err); p->errorString = QString::fromLatin1(strerror(err)); p->error(p->uuid); } @@ -75,7 +78,7 @@ void QLowEnergyServiceInfoPrivate::serviceConnected(const char *bdaddr, const ch bt_gatt_characteristic_t* data; data = (bt_gatt_characteristic_t*) malloc(sizeof(bt_gatt_characteristic_t)); if (0 == data) { - qBBBluetoothDebug() << "[SERVICE: Connected] GATT characteristics: Not enough memory"; + qCDebug(QT_BT_QNX) << "[SERVICE: Connected] GATT characteristics: Not enough memory"; bt_gatt_disconnect_instance(instance); p->errorString = QStringLiteral("GATT characteristics: Not enough memory"); p->error(p->uuid); @@ -85,12 +88,12 @@ void QLowEnergyServiceInfoPrivate::serviceConnected(const char *bdaddr, const ch int num_characteristics = bt_gatt_characteristics_count(instance); if (num_characteristics > -1) { - qBBBluetoothDebug() << "Characteristics number: "<< num_characteristics; + qCDebug(QT_BT_QNX) << "Characteristics number: "<< num_characteristics; bt_gatt_characteristic_t *allCharacteristicList; allCharacteristicList = (bt_gatt_characteristic_t*) malloc(num_characteristics * sizeof(bt_gatt_characteristic_t)); if (0 == allCharacteristicList) { - qBBBluetoothDebug() <<" GATT characteristics: Not enough memory"; + qCDebug(QT_BT_QNX) <<" GATT characteristics: Not enough memory"; bt_gatt_disconnect_instance(instance); p->errorString = QStringLiteral("GATT characteristics: Not enough memory"); p->error(p->uuid); @@ -107,7 +110,7 @@ void QLowEnergyServiceInfoPrivate::serviceConnected(const char *bdaddr, const ch int characteristicListSize = number; for (int i = 0; i < characteristicListSize; i++) { - qBBBluetoothDebug() << "Characteristic: uuid,handle,value_handle, properties:" << allCharacteristicList[i].uuid << "," << allCharacteristicList[i].handle << "," << allCharacteristicList[i].value_handle << ", " << allCharacteristicList[i].properties; + qCDebug(QT_BT_QNX) << "Characteristic: uuid,handle,value_handle, properties:" << allCharacteristicList[i].uuid << "," << allCharacteristicList[i].handle << "," << allCharacteristicList[i].value_handle << ", " << allCharacteristicList[i].properties; QString charUuid = QString::fromLatin1(allCharacteristicList[i].uuid); QString handleUuid; handleUuid.setNum(allCharacteristicList[i].value_handle); @@ -135,12 +138,12 @@ void QLowEnergyServiceInfoPrivate::serviceConnected(const char *bdaddr, const ch if (sub == false) { int rc = bt_gatt_reg_notifications(instance, &(characteristicInfo.d_ptr->serviceNotification)); if (rc != 0) { - qBBBluetoothDebug() << "[SERVICE: Connected] bt_gatt_reg_notifications failed." << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "[SERVICE: Connected] bt_gatt_reg_notifications failed." << errno << strerror(errno); p->errorString = QString::fromLatin1(strerror(errno)); p->error(p->uuid); } else - qBBBluetoothDebug() << "[SERVICE: Connected] bt_gatt_reg_notifications was presumably OK"; + qCDebug(QT_BT_QNX) << "[SERVICE: Connected] bt_gatt_reg_notifications was presumably OK"; sub = true; } p->characteristicList.append(characteristicInfo); @@ -156,9 +159,9 @@ void QLowEnergyServiceInfoPrivate::serviceConnected(const char *bdaddr, const ch } p->connected = true; - qBBBluetoothDebug() << p; + qCDebug(QT_BT_QNX) << p; emit p->connectedToService(p->uuid); - qBBBluetoothDebug() << "---------------------------------------------------------------------------------"; + qCDebug(QT_BT_QNX) << "---------------------------------------------------------------------------------"; } void QLowEnergyServiceInfoPrivate::serviceUpdate(const char *bdaddr, int instance, short unsigned int connInt, short unsigned int latency, short unsigned int superTimeout, void *userData) @@ -167,10 +170,10 @@ void QLowEnergyServiceInfoPrivate::serviceUpdate(const char *bdaddr, int instanc Q_UNUSED(connInt); Q_UNUSED(superTimeout); Q_UNUSED(userData); - qBBBluetoothDebug() << "---------------------------------------------------"; - qBBBluetoothDebug() << "[SERVICE: Update] (instance):" << instance; - qBBBluetoothDebug() << "[SERVICE: Update] Device address: " << bdaddr; - qBBBluetoothDebug() << "---------------------------------------------------"; + qCDebug(QT_BT_QNX) << "---------------------------------------------------"; + qCDebug(QT_BT_QNX) << "[SERVICE: Update] (instance):" << instance; + qCDebug(QT_BT_QNX) << "[SERVICE: Update] Device address: " << bdaddr; + qCDebug(QT_BT_QNX) << "---------------------------------------------------"; } void QLowEnergyServiceInfoPrivate::serviceDisconnected(const char *bdaddr, const char *service, int instance, int reason, void *userData) @@ -178,10 +181,10 @@ void QLowEnergyServiceInfoPrivate::serviceDisconnected(const char *bdaddr, const QPointer *classPointer = static_cast *>(userData); QLowEnergyServiceInfoPrivate *p = classPointer->data(); emit p->disconnectedFromService(p->uuid); - qBBBluetoothDebug() << "---------------------------------------------------"; - qBBBluetoothDebug() << "[SERVICE: Disconnect] (service, instance, reason):" << service << instance << reason; - qBBBluetoothDebug() << "[SERVICE: Disconnect] Device address: " << bdaddr; - qBBBluetoothDebug() << "---------------------------------------------------"; + qCDebug(QT_BT_QNX) << "---------------------------------------------------"; + qCDebug(QT_BT_QNX) << "[SERVICE: Disconnect] (service, instance, reason):" << service << instance << reason; + qCDebug(QT_BT_QNX) << "[SERVICE: Disconnect] Device address: " << bdaddr; + qCDebug(QT_BT_QNX) << "---------------------------------------------------"; delete p; delete classPointer; } @@ -203,7 +206,7 @@ void QLowEnergyServiceInfoPrivate::registerServiceWatcher() errno=0; process = process->instance(); if (!process->isConnected()) { - qBBBluetoothDebug() << "[INIT] Init problem." << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "[INIT] Init problem." << errno << strerror(errno); errorString = QStringLiteral("Initialization of device falied. ") + QString::fromLatin1(strerror(errno)); emit error(uuid); return; @@ -211,7 +214,7 @@ void QLowEnergyServiceInfoPrivate::registerServiceWatcher() errno=0; if (bt_gatt_init(&gatt_callbacks) < 0) { - qBBBluetoothDebug() << "[INIT] GAT Init problem." << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "[INIT] GAT Init problem." << errno << strerror(errno); errorString = QStringLiteral("Callbacks initialization failed. ") + QString::fromLatin1(strerror(errno)); emit error(uuid); return; @@ -234,11 +237,11 @@ void QLowEnergyServiceInfoPrivate::registerServiceWatcher() conParm.latency = 0; conParm.superTimeout = 50; if (bt_gatt_connect_service(deviceInfo.address().toString().toLocal8Bit().constData(), serviceUuid.toLocal8Bit().constData(), 0, &conParm, classPointer) < 0) { - qBBBluetoothDebug() << "[SERVICE] Connection to service failed." << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "[SERVICE] Connection to service failed." << errno << strerror(errno); errorString = QStringLiteral("[SERVICE] Connection to service failed.") + QString::fromLatin1(strerror(errno)); emit error(uuid); } - qBBBluetoothDebug() << "errno after connect: " << errno; + qCDebug(QT_BT_QNX) << "errno after connect: " << errno; } void QLowEnergyServiceInfoPrivate::unregisterServiceWatcher() @@ -249,11 +252,11 @@ void QLowEnergyServiceInfoPrivate::unregisterServiceWatcher() else serviceUuid = QStringLiteral("0x") + serviceUuid[4] + serviceUuid[5] + serviceUuid[6] + serviceUuid[7]; if (bt_gatt_disconnect_service(deviceInfo.address().toString().toLocal8Bit().constData(), serviceUuid.toLocal8Bit().constData()) < 0) { - qBBBluetoothDebug() << "[SERVICE] Disconnect service request failed. " << errno << strerror(errno); + qCDebug(QT_BT_QNX) << "[SERVICE] Disconnect service request failed. " << errno << strerror(errno); emit error(uuid); } else { emit disconnectedFromService(uuid); - qBBBluetoothDebug() << "[SERVICE] Disconnected from service OK."; + qCDebug(QT_BT_QNX) << "[SERVICE] Disconnected from service OK."; } } -- cgit v1.2.3