diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2017-02-14 14:02:06 +0100 |
---|---|---|
committer | Kari Hautamäki <kari.hautamaki@qt.io> | 2017-02-14 14:06:50 +0000 |
commit | 261d5018ac2990acc4739895e29f86c8d94b62a5 (patch) | |
tree | 0d833baa77705d1afe1ffe2161c2d0ebff1a240e | |
parent | cc73478e1ff48a6e469d3856c552e7a5e3d5023d (diff) |
iot-sensortag: Remove m_characteristics
m_characteristics and related functions and signals
are not used anywhere so they can be removed.
Change-Id: I0e5e0808be4b308687a806ea43492c251d9122f8
Reviewed-by: Kari Hautamäki <kari.hautamaki@qt.io>
-rw-r--r-- | tradeshow/iot-sensortag/bluetoothdevice.cpp | 39 | ||||
-rw-r--r-- | tradeshow/iot-sensortag/bluetoothdevice.h | 6 |
2 files changed, 0 insertions, 45 deletions
diff --git a/tradeshow/iot-sensortag/bluetoothdevice.cpp b/tradeshow/iot-sensortag/bluetoothdevice.cpp index ba9aa55..4fe7ea7 100644 --- a/tradeshow/iot-sensortag/bluetoothdevice.cpp +++ b/tradeshow/iot-sensortag/bluetoothdevice.cpp @@ -100,8 +100,6 @@ BluetoothDevice::~BluetoothDevice() { delete discoveryAgent; delete controller; - qDeleteAll(m_characteristics); - m_characteristics.clear(); } QString BluetoothDevice::getAddress() const { @@ -119,17 +117,8 @@ QString BluetoothDevice::getName() const return m_deviceInfo.name(); } -QVariant BluetoothDevice::getCharacteristics() -{ - return QVariant::fromValue(m_characteristics); -} - void BluetoothDevice::scanServices() { - qDeleteAll(m_characteristics); - m_characteristics.clear(); - emit characteristicsUpdated(); - statusUpdated("(Connecting to device...)"); if (controller && m_previousAddress != getAddress()) { @@ -589,34 +578,6 @@ void BluetoothDevice::deviceDisconnected() setState(BluetoothDevice::Disconnected); } -void BluetoothDevice::serviceDetailsDiscovered(QLowEnergyService::ServiceState newState) -{ - if (newState != QLowEnergyService::ServiceDiscovered) { - // do not hang in "Scanning for characteristics" mode forever - // in case the service discovery failed - // We have to queue the signal up to give UI time to even enter - // the above mode - if (newState != QLowEnergyService::DiscoveringServices) { - QMetaObject::invokeMethod(this, "characteristicsUpdated", - Qt::QueuedConnection); - } - return; - } - - QLowEnergyService *service = qobject_cast<QLowEnergyService *>(sender()); - if (!service) - return; - - - const QList<QLowEnergyCharacteristic> chars = service->characteristics(); - foreach (const QLowEnergyCharacteristic &ch, chars) { - CharacteristicInfo *cInfo = new CharacteristicInfo(ch); - m_characteristics.append(cInfo); - } - - emit characteristicsUpdated(); -} - BluetoothDevice::DeviceState BluetoothDevice::state() const { return m_deviceState; diff --git a/tradeshow/iot-sensortag/bluetoothdevice.h b/tradeshow/iot-sensortag/bluetoothdevice.h index a988b6b..c093006 100644 --- a/tradeshow/iot-sensortag/bluetoothdevice.h +++ b/tradeshow/iot-sensortag/bluetoothdevice.h @@ -104,7 +104,6 @@ class BluetoothDevice: public QObject Q_PROPERTY(QString deviceAddress READ getAddress CONSTANT) Q_PROPERTY(DeviceState state READ state NOTIFY stateChanged) - Q_PROPERTY(QVariant characteristicList READ getCharacteristics NOTIFY characteristicsUpdated) Q_PROPERTY(bool useRandomAddress MEMBER randomAddress NOTIFY randomAddressChanged) public: @@ -118,11 +117,9 @@ public: QString getAddress() const; QString getName() const; - QVariant getCharacteristics(); DeviceState state() const; signals: - void characteristicsUpdated(); void updateChanged(); void stateChanged(); void randomAddressChanged(); @@ -151,8 +148,6 @@ private slots: void deviceDisconnected(); // QLowEnergyService related - void serviceDetailsDiscovered(QLowEnergyService::ServiceState newState); - void characteristicsRead(const QLowEnergyCharacteristic &info, const QByteArray &value); @@ -168,7 +163,6 @@ private: double convertIrTemperatureAPIReadingToCelsius(quint16 rawReading); QBluetoothDeviceDiscoveryAgent *discoveryAgent; - QList<QObject*> m_characteristics; QString m_previousAddress; QLowEnergyController *controller; QLowEnergyService* irTemperatureService; |