diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2017-02-15 10:04:02 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2017-02-16 13:35:53 +0000 |
commit | 70d32b0ef01d7fd445c8173b8d0a19e8831e4609 (patch) | |
tree | 28a2c276515dbcd08ff8502822483ebc627df8dd /tradeshow | |
parent | 7053af71846706006ec58afbb829291909726c7a (diff) |
iot-sensortag: BluetoothDevice: Remove unused members
Change-Id: I6b3467541950df284f37d3b823c9fdfb535593ce
Reviewed-by: Titta Heikkala <titta.heikkala@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'tradeshow')
-rw-r--r-- | tradeshow/iot-sensortag/bluetoothdevice.cpp | 23 | ||||
-rw-r--r-- | tradeshow/iot-sensortag/bluetoothdevice.h | 7 |
2 files changed, 4 insertions, 26 deletions
diff --git a/tradeshow/iot-sensortag/bluetoothdevice.cpp b/tradeshow/iot-sensortag/bluetoothdevice.cpp index 2ae28ef..83a2091 100644 --- a/tradeshow/iot-sensortag/bluetoothdevice.cpp +++ b/tradeshow/iot-sensortag/bluetoothdevice.cpp @@ -74,15 +74,13 @@ typedef struct { } movement_data_t; BluetoothDevice::BluetoothDevice() - : discoveryAgent(0) - , controller(0) + : controller(0) , irTemperatureService(0) , baroService(0) , humidityService(0) , lightService(0) , motionService(0) , m_deviceState(DeviceState::Disconnected) - , randomAddress(false) { lastMilliseconds = QDateTime::currentMSecsSinceEpoch(); statusUpdated("Device created"); @@ -96,7 +94,6 @@ BluetoothDevice::BluetoothDevice(const QBluetoothDeviceInfo &d) BluetoothDevice::~BluetoothDevice() { - delete discoveryAgent; delete controller; } QString BluetoothDevice::getAddress() const @@ -117,15 +114,8 @@ QString BluetoothDevice::getName() const void BluetoothDevice::scanServices() { - statusUpdated("(Connecting to device...)"); - - if (controller && m_previousAddress != getAddress()) { - controller->disconnectFromDevice(); - delete controller; - controller = 0; - } - if (!controller) { + statusUpdated("(Connecting to device...)"); // Connecting signals and slots for connecting to LE services. controller = new QLowEnergyController(m_deviceInfo); connect(controller, SIGNAL(connected()), @@ -138,13 +128,10 @@ void BluetoothDevice::scanServices() this, SLOT(addLowEnergyService(QBluetoothUuid))); connect(controller, SIGNAL(discoveryFinished()), this, SLOT(serviceScanDone())); - } - if (randomAddress) - controller->setRemoteAddressType(QLowEnergyController::RandomAddress); - else controller->setRemoteAddressType(QLowEnergyController::PublicAddress); - controller->connectToDevice(); + controller->connectToDevice(); + } } void BluetoothDevice::addLowEnergyService(const QBluetoothUuid &serviceUuid) @@ -222,8 +209,6 @@ void BluetoothDevice::serviceScanDone() if (!motionService) qCDebug(boot2QtDemos) << "Motion service not found."; - - attitudeChangeInterval.restart(); } void BluetoothDevice::temperatureDetailsDiscovered(QLowEnergyService::ServiceState newstate) diff --git a/tradeshow/iot-sensortag/bluetoothdevice.h b/tradeshow/iot-sensortag/bluetoothdevice.h index e6137e8..2c4b1d1 100644 --- a/tradeshow/iot-sensortag/bluetoothdevice.h +++ b/tradeshow/iot-sensortag/bluetoothdevice.h @@ -104,8 +104,6 @@ class BluetoothDevice: public QObject Q_PROPERTY(QString deviceAddress READ getAddress CONSTANT) Q_PROPERTY(DeviceState state READ state NOTIFY stateChanged) - Q_PROPERTY(bool useRandomAddress MEMBER randomAddress NOTIFY randomAddressChanged) - public: enum DeviceState {Disconnected = 0, Scanning, Connected, Error}; Q_ENUM(DeviceState) @@ -122,7 +120,6 @@ public: signals: void updateChanged(); void stateChanged(); - void randomAddressChanged(); void temperatureChanged(double ambientTemperature, double objectTemperature); void barometerChanged(double temperature, double barometer); void humidityChanged(double humidity); @@ -171,8 +168,6 @@ private: double convertIrTemperatureAPIReadingToCelsius(quint16 rawReading); bool isDeviceReady() const; - QBluetoothDeviceDiscoveryAgent *discoveryAgent; - QString m_previousAddress; QLowEnergyController *controller; QLowEnergyService* irTemperatureService; QLowEnergyService* baroService; @@ -185,8 +180,6 @@ private: bool m_humidityMeasurementStarted; bool m_lightIntensityMeasurementStarted; bool m_motionMeasurementStarted; - bool randomAddress; - QElapsedTimer attitudeChangeInterval; quint64 lastMilliseconds; QBluetoothDeviceInfo m_deviceInfo; |