summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-06-02 10:58:01 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-04 13:41:27 +0200
commitf7ce1949efa1c916141972cc037841c881c945e2 (patch)
tree4cace8aff6c1e2986868dea9f42562e2d58336dc
parent622288ecb7d194b8c3ca08effc3315e1734c251e (diff)
Cleanup of BTLE classes
There are a lot of unused internal variables and helper functions which are left-overs from the last code rearrangement. Change-Id: I48d6e6aa015dea628d2467141ea1e44814d228c0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r--src/bluetooth/qlowenergycharacteristicinfo.cpp8
-rw-r--r--src/bluetooth/qlowenergycharacteristicinfo.h1
-rw-r--r--src/bluetooth/qlowenergycharacteristicinfo_bluez.cpp7
-rw-r--r--src/bluetooth/qlowenergycharacteristicinfo_p.h14
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp10
-rw-r--r--src/bluetooth/qlowenergycontroller_qnx.cpp14
-rw-r--r--src/bluetooth/qlowenergydescriptorinfo.cpp12
-rw-r--r--src/bluetooth/qlowenergydescriptorinfo.h1
-rw-r--r--src/bluetooth/qlowenergydescriptorinfo_p.h1
-rw-r--r--src/bluetooth/qlowenergyprocess_bluez.cpp8
-rw-r--r--src/bluetooth/qlowenergyprocess_p.h2
11 files changed, 4 insertions, 74 deletions
diff --git a/src/bluetooth/qlowenergycharacteristicinfo.cpp b/src/bluetooth/qlowenergycharacteristicinfo.cpp
index 66994131..506f6d1c 100644
--- a/src/bluetooth/qlowenergycharacteristicinfo.cpp
+++ b/src/bluetooth/qlowenergycharacteristicinfo.cpp
@@ -211,14 +211,6 @@ QBluetoothUuid QLowEnergyCharacteristicInfo::uuid() const
}
/*!
- Returns the properties value of the gatt characteristic.
-*/
-QVariantMap QLowEnergyCharacteristicInfo::properties() const
-{
- return d_ptr->properties;
-}
-
-/*!
Returns permissions of the gatt characteristic.
*/
int QLowEnergyCharacteristicInfo::permissions() const
diff --git a/src/bluetooth/qlowenergycharacteristicinfo.h b/src/bluetooth/qlowenergycharacteristicinfo.h
index ea6750cb..dd1820ae 100644
--- a/src/bluetooth/qlowenergycharacteristicinfo.h
+++ b/src/bluetooth/qlowenergycharacteristicinfo.h
@@ -85,7 +85,6 @@ public:
QByteArray value() const;
int permissions() const; //TODO should be of Type QLowEnergyCharacteristicInfo::Property
- QVariantMap properties() const;
QString handle() const; //TODO should be int
bool isNotificationCharacteristic() const;
diff --git a/src/bluetooth/qlowenergycharacteristicinfo_bluez.cpp b/src/bluetooth/qlowenergycharacteristicinfo_bluez.cpp
index 8a9707bc..5010ffa3 100644
--- a/src/bluetooth/qlowenergycharacteristicinfo_bluez.cpp
+++ b/src/bluetooth/qlowenergycharacteristicinfo_bluez.cpp
@@ -41,7 +41,6 @@
#include "qlowenergycharacteristicinfo.h"
#include "qlowenergycharacteristicinfo_p.h"
-#include "bluez/characteristic_p.h"
#include "qlowenergyprocess_p.h"
#include <QtDBus/QDBusPendingCallWatcher>
@@ -55,16 +54,12 @@
QT_BEGIN_NAMESPACE
QLowEnergyCharacteristicInfoPrivate::QLowEnergyCharacteristicInfoPrivate()
- : permission(0), notification (false), handle(QStringLiteral("0x0000")),
- properties(QVariantMap()), characteristic(0), m_signalConnected(false)
+ : permission(0), notification (false), handle(QStringLiteral("0x0000"))
{
- process = process->instance();
- t=0;
}
QLowEnergyCharacteristicInfoPrivate::~QLowEnergyCharacteristicInfoPrivate()
{
- delete characteristic;
}
diff --git a/src/bluetooth/qlowenergycharacteristicinfo_p.h b/src/bluetooth/qlowenergycharacteristicinfo_p.h
index c0fe7025..74085d36 100644
--- a/src/bluetooth/qlowenergycharacteristicinfo_p.h
+++ b/src/bluetooth/qlowenergycharacteristicinfo_p.h
@@ -55,7 +55,6 @@
#include <btapi/btle.h>
#endif
#ifdef QT_BLUEZ_BLUETOOTH
-class OrgBluezCharacteristicInterface;
QT_FORWARD_DECLARE_CLASS(QLowEnergyProcess);
#endif
@@ -76,28 +75,15 @@ public:
int permission;
bool notification;
QString handle;
- QString notificationHandle;
int instance;
- QVariantMap properties;
- QString errorString;
QList<QLowEnergyDescriptorInfo> descriptorsList;
#ifdef QT_QNX_BLUETOOTH
bt_gatt_characteristic_t characteristic;
int characteristicMtu;
bt_gatt_char_prop_mask characteristicProperties;
#endif
-#ifdef QT_BLUEZ_BLUETOOTH
- QString path;
- int t;
- QString startingHandle;
-#endif
private:
-#ifdef QT_BLUEZ_BLUETOOTH
- OrgBluezCharacteristicInterface *characteristic;
- QLowEnergyProcess *process;
- bool m_signalConnected;
-#endif
};
QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
index bebce1cf..48bb5d88 100644
--- a/src/bluetooth/qlowenergycontroller_bluez.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
@@ -193,16 +193,10 @@ void QLowEnergyControllerPrivate::_q_replyReceived(const QString &reply)
charHandleId <= m_leServices.at(i).d_ptr->endingHandle.toUShort(0,0))
{
const QBluetoothUuid charUuid(handleDetails.at(10));
- QVariantMap map;
QLowEnergyCharacteristicInfo charInfo(charUuid);
charInfo.d_ptr->handle = charHandle;
- charInfo.d_ptr->startingHandle = handleDetails.at(1);
charInfo.d_ptr->permission = handleDetails.at(4).toUShort(0,0);
- map[QStringLiteral("uuid")] = charUuid.toString();
- map[QStringLiteral("handle")] = charHandle;
- map[QStringLiteral("permission")] = charInfo.d_ptr->permission;
- charInfo.d_ptr->properties = map;
if (!(charInfo.d_ptr->permission & QLowEnergyCharacteristicInfo::Read))
qCDebug(QT_BT_BLUEZ) << "GATT characteristic: Read not permitted: " << charInfo.d_ptr->uuid;
else
@@ -267,7 +261,6 @@ void QLowEnergyControllerPrivate::_q_replyReceived(const QString &reply)
qCDebug(QT_BT_BLUEZ) << handleId << h << chars.handle() << chars.handle().toUShort(0,0);
if (h > chars.handle().toUShort(0,0) && h < charsNext.handle().toUShort(0,0)) {
- chars.d_ptr->notificationHandle = handleId;
chars.d_ptr->notification = true;
QLowEnergyDescriptorInfo descriptor(
service.d_ptr->characteristicList[j].uuid(),
@@ -281,7 +274,7 @@ void QLowEnergyControllerPrivate::_q_replyReceived(const QString &reply)
service.d_ptr->characteristicList[j].d_ptr->descriptorsList.append(descriptor);
qCDebug(QT_BT_BLUEZ) << "Notification characteristic set."
<< chars.d_ptr->handle
- << chars.d_ptr->notificationHandle;
+ << handleId;
}
}
if (!lastStep) {
@@ -310,7 +303,6 @@ void QLowEnergyControllerPrivate::_q_replyReceived(const QString &reply)
for (int s = 4 ; s< row.size(); s++)
notificationValue += row.at(s);
m_leServices.at(j).characteristics().at(k).d_ptr->value = notificationValue.toUtf8();
- m_leServices.at(j).characteristics().at(k).d_ptr->properties[QStringLiteral("value")] = notificationValue.toUtf8();
emit q_ptr->valueChanged(m_leServices.at(j).characteristics().at(k));
}
}
diff --git a/src/bluetooth/qlowenergycontroller_qnx.cpp b/src/bluetooth/qlowenergycontroller_qnx.cpp
index 8fd687bb..079f67be 100644
--- a/src/bluetooth/qlowenergycontroller_qnx.cpp
+++ b/src/bluetooth/qlowenergycontroller_qnx.cpp
@@ -186,16 +186,11 @@ void QLowEnergyControllerPrivate::serviceConnected(const char *bdaddr, const cha
} else {
characteristicUuid = QBluetoothUuid(charUuid.toUShort(0,0));
}
- QVariantMap map;
QLowEnergyCharacteristicInfo characteristicInfo(characteristicUuid);
characteristicInfo.d_ptr->handle = handleUuid;
characteristicInfo.d_ptr->instance = instance;
characteristicInfo.d_ptr->characteristic = allCharacteristicList[i];
characteristicInfo.d_ptr->permission = allCharacteristicList[i].properties;
- map[QStringLiteral("uuid")] = characteristicUuid.toString();
- map[QStringLiteral("handle")] = handleUuid;
- map[QStringLiteral("permission")] = characteristicInfo.d_ptr->permission;
- characteristicInfo.d_ptr->properties = map;
p->readDescriptors(characteristicInfo);
p->readValue(characteristicInfo);
//Subscribe only once since it is static function
@@ -590,11 +585,6 @@ void QLowEnergyControllerPrivate::readDescriptors(QLowEnergyCharacteristicInfo &
}
for (int i = 0; i < count; i++) {
- QVariantMap map;
-
- map[QStringLiteral("uuid")] = QString::fromLatin1(descriptorList[i].uuid);
-
- map[QStringLiteral("handle")] = descriptorList[i].handle;
QString descHanlde;
descHanlde.setNum(descriptorList[i].handle);
QString descriptorUuid(descriptorList[i].uuid);
@@ -618,9 +608,6 @@ void QLowEnergyControllerPrivate::readDescriptors(QLowEnergyCharacteristicInfo &
}
descriptor.d_ptr->instance = characteristic.d_ptr->instance;
- map[QStringLiteral("value")] = descriptor.d_ptr->m_value;
- descriptor.d_ptr->m_properties = map;
- //TODO what are these properties? Bluez doesn't have these atm
characteristic.d_ptr->descriptorsList.append(descriptor);
}
@@ -660,7 +647,6 @@ void QLowEnergyControllerPrivate::readValue(QLowEnergyCharacteristicInfo &charac
hexadecimal.setNum(characteristicBuffer[j], 16);
characteristic.d_ptr->value.append(hexadecimal.toLatin1());
}
- characteristic.d_ptr->properties["value"] = characteristic.d_ptr->value;
}
}
diff --git a/src/bluetooth/qlowenergydescriptorinfo.cpp b/src/bluetooth/qlowenergydescriptorinfo.cpp
index 05f66a15..70be3e22 100644
--- a/src/bluetooth/qlowenergydescriptorinfo.cpp
+++ b/src/bluetooth/qlowenergydescriptorinfo.cpp
@@ -75,8 +75,8 @@ QString parseDescriptorUuid(const QBluetoothUuid &uuid)
return name;
}
-QLowEnergyDescriptorInfoPrivate::QLowEnergyDescriptorInfoPrivate(const QBluetoothUuid &uuid, const QString &handle):
- m_value(QByteArray()), m_uuid(uuid), m_handle(handle), m_properties(QVariantMap()), m_name(QStringLiteral(""))
+QLowEnergyDescriptorInfoPrivate::QLowEnergyDescriptorInfoPrivate(const QBluetoothUuid &uuid, const QString &handle)
+ : m_uuid(uuid), m_handle(handle)
{
#ifdef QT_QNX_BLUETOOTH
instance = -1;
@@ -156,14 +156,6 @@ QByteArray QLowEnergyDescriptorInfo::value() const
}
/*!
- Returns the properties of the descriptor.
-*/
-QVariantMap QLowEnergyDescriptorInfo::properties() const
-{
- return d_ptr->m_properties;
-}
-
-/*!
Returns the name of the descriptor.
*/
QString QLowEnergyDescriptorInfo::name() const
diff --git a/src/bluetooth/qlowenergydescriptorinfo.h b/src/bluetooth/qlowenergydescriptorinfo.h
index de33ffac..4b768d01 100644
--- a/src/bluetooth/qlowenergydescriptorinfo.h
+++ b/src/bluetooth/qlowenergydescriptorinfo.h
@@ -66,7 +66,6 @@ public:
QBluetoothUuid uuid() const;
QString handle() const;
- QVariantMap properties() const;
QString name() const;
QBluetoothUuid::CharacteristicDescriptor type() const;
diff --git a/src/bluetooth/qlowenergydescriptorinfo_p.h b/src/bluetooth/qlowenergydescriptorinfo_p.h
index ff3b0f53..29c000ff 100644
--- a/src/bluetooth/qlowenergydescriptorinfo_p.h
+++ b/src/bluetooth/qlowenergydescriptorinfo_p.h
@@ -55,7 +55,6 @@ public:
QByteArray m_value;
QBluetoothUuid m_uuid;
QString m_handle;
- QVariantMap m_properties;
QString m_name;
QBluetoothUuid::CharacteristicDescriptor m_type;
#ifdef QT_QNX_BLUETOOTH
diff --git a/src/bluetooth/qlowenergyprocess_bluez.cpp b/src/bluetooth/qlowenergyprocess_bluez.cpp
index 72cb0c46..dc556ed3 100644
--- a/src/bluetooth/qlowenergyprocess_bluez.cpp
+++ b/src/bluetooth/qlowenergyprocess_bluez.cpp
@@ -79,14 +79,6 @@ QLowEnergyProcess *QLowEnergyProcess::instance()
}
/*!
- Returns the QProcess that this class is using.
-*/
-QProcess *QLowEnergyProcess::getProcess()
-{
- return m_process;
-}
-
-/*!
Slot that emits a signal replySend. This slot is connected with QProcess signal
and it is called whenever something comes to output.
*/
diff --git a/src/bluetooth/qlowenergyprocess_p.h b/src/bluetooth/qlowenergyprocess_p.h
index eaea0a68..0c63bc46 100644
--- a/src/bluetooth/qlowenergyprocess_p.h
+++ b/src/bluetooth/qlowenergyprocess_p.h
@@ -69,8 +69,6 @@ public:
void addPointer(QLowEnergyControllerPrivate* classPointer);
#endif
#ifdef QT_BLUEZ_BLUETOOTH
- QProcess *getProcess();
-
void startCommand(const QString &command);
void executeCommand(const QString &command);
void endProcess();