summaryrefslogtreecommitdiffstats
path: root/tradeshow/iot-sensortag/bluetoothdevice.h
diff options
context:
space:
mode:
authorOtto Ryynänen <otto.ryynanen@qt.io>2017-01-30 16:30:13 +0200
committerKari Hautamäki <kari.hautamaki@qt.io>2017-01-31 11:15:58 +0000
commit4a7c0e5841b2bb69ddaef2c9620c443934d194ee (patch)
tree0997ae3fdb9de74ace3d140724b96fe1fdde386d /tradeshow/iot-sensortag/bluetoothdevice.h
parent632e35db6d6ef6bf15891e486da983aabfb740b3 (diff)
SensorTag changed to broadcasting mode form read-resp mode
Sensortag now sends data according to set intervals and app only listens to signals. Timers removed as they are no longer needed. Both ambient and object temperature read and converted properly. Cloud data updated with dedicated abient and object temperatures. Version is now 1.1 (backwards compatible). Mock data reflects to reality better. Change-Id: I6a0325a513c1a054322f18e68d2b15c474db3ee5 Reviewed-by: Kari Hautamäki <kari.hautamaki@qt.io>
Diffstat (limited to 'tradeshow/iot-sensortag/bluetoothdevice.h')
-rw-r--r--tradeshow/iot-sensortag/bluetoothdevice.h28
1 files changed, 3 insertions, 25 deletions
diff --git a/tradeshow/iot-sensortag/bluetoothdevice.h b/tradeshow/iot-sensortag/bluetoothdevice.h
index 58f17c3..26ad814 100644
--- a/tradeshow/iot-sensortag/bluetoothdevice.h
+++ b/tradeshow/iot-sensortag/bluetoothdevice.h
@@ -95,19 +95,6 @@ typedef enum CharacteristicType {
lightCharacteristic
} CharacteristicType;
-class QueueData {
-public:
- CharacteristicType typeToSend;
- bool alreadySent;
- QueueData(CharacteristicType characteristic) {
- typeToSend = characteristic;
- alreadySent = false;
- }
-
-private:
- QueueData() {}
-};
-
class SensorTagDataProvider;
class BluetoothDevice: public QObject
@@ -142,7 +129,7 @@ signals:
void updateChanged();
void stateChanged();
void randomAddressChanged();
- void temperatureChanged(double temperature);
+ void temperatureChanged(double ambientTemperature, double objectTemperature);
void barometerChanged(double temperature, double barometer);
void humidityChanged(double humidity);
void lightIntensityChanged(double intensity);
@@ -151,7 +138,6 @@ signals:
public slots:
void scanServices();
- void startTimers();
void connectToService(const QString &uuid);
void disconnectFromDevice();
void temperatureDetailsDiscovered(QLowEnergyService::ServiceState newstate);
@@ -171,9 +157,6 @@ private slots:
// QLowEnergyService related
void serviceDetailsDiscovered(QLowEnergyService::ServiceState newState);
- void slowTimerExpired();
- void mediumTimerExpired();
- void rapidTimerExpired();
void characteristicsRead(const QLowEnergyCharacteristic &info,
const QByteArray &value);
@@ -181,14 +164,12 @@ private:
void setState(DeviceState state);
private:
- bool isNotInQueue(const CharacteristicType characteristic);
- void queueReadRequest(CharacteristicType characteristicToRead);
- void sendFirstFromQueue();
void irTemperatureReceived(const QByteArray &value);
void barometerReceived(const QByteArray &value);
void humidityReceived(const QByteArray &value);
void lightIntensityReceived(const QByteArray &value);
void motionReceived(const QByteArray &value);
+ double convertIrTemperatureAPIReadingToCelsius(quint16 rawReading);
QBluetoothDeviceDiscoveryAgent *discoveryAgent;
QList<QObject*> m_services;
@@ -207,11 +188,8 @@ private:
bool m_lightIntensityMeasurementStarted;
bool m_motionMeasurementStarted;
bool randomAddress;
- QTimer* slowTimer;
- QTimer* mediumTimer;
- QTimer* rapidTimer;
QElapsedTimer attitudeChangeInterval;
- QVector<QueueData*> readRequestQueue;
+ quint64 lastMilliseconds;
QBluetoothDeviceInfo m_deviceInfo;