summaryrefslogtreecommitdiffstats
path: root/tradeshow/iot-sensortag
diff options
context:
space:
mode:
Diffstat (limited to 'tradeshow/iot-sensortag')
-rw-r--r--tradeshow/iot-sensortag/bluetoothdevice.cpp23
-rw-r--r--tradeshow/iot-sensortag/bluetoothdevice.h7
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;