summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtto Ryynänen <otto.ryynanen@qt.io>2017-01-31 15:17:53 +0200
committerKari Hautamäki <kari.hautamaki@qt.io>2017-02-01 07:54:44 +0000
commit518c73c59a71911b65ae5d3240b22ea9f5878961 (patch)
treecccf04cbcc16bad01a6dbbbffc15bdefecbbc1e7
parent4a7c0e5841b2bb69ddaef2c9620c443934d194ee (diff)
GyroChart and Magnetometerchart grid removal
Removed grids from charts. changed magnetometer chart type. Removed old IR Temp from cloud IF. New signal(s) for Ambient and object temperatures. Change-Id: If9f215f33197ca1dc03b2a55187464fdb7a05cd9 Reviewed-by: Kari Hautamäki <kari.hautamaki@qt.io>
-rw-r--r--tradeshow/iot-sensortag/bluetoothdataprovider.cpp18
-rw-r--r--tradeshow/iot-sensortag/bluetoothdataprovider.h2
-rw-r--r--tradeshow/iot-sensortag/clouddataprovider.cpp11
-rw-r--r--tradeshow/iot-sensortag/cloudupdate.cpp1
-rw-r--r--tradeshow/iot-sensortag/mockdataprovider.cpp6
-rw-r--r--tradeshow/iot-sensortag/resources/base/GyroChart.qml36
-rw-r--r--tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml111
-rw-r--r--tradeshow/iot-sensortag/resources/base/ObjectTemperatureChart.qml2
-rw-r--r--tradeshow/iot-sensortag/resources/base/TemperatureChart.qml2
-rw-r--r--tradeshow/iot-sensortag/sensortagdataprovider.h7
10 files changed, 75 insertions, 121 deletions
diff --git a/tradeshow/iot-sensortag/bluetoothdataprovider.cpp b/tradeshow/iot-sensortag/bluetoothdataprovider.cpp
index c76404f..b84bb84 100644
--- a/tradeshow/iot-sensortag/bluetoothdataprovider.cpp
+++ b/tradeshow/iot-sensortag/bluetoothdataprovider.cpp
@@ -97,13 +97,20 @@ void BluetoothDataProvider::startServiceScan()
void BluetoothDataProvider::temperatureReceived(double newAmbientTemperature, double newObjectTemperature)
{
+ /* NOTE: We emit the signals even if value is unchanged.
+ * Otherwise the scrolling graphs in UI will not scroll.
+ */
irAmbientTemperature = newAmbientTemperature;
+ emit infraredAmbientTemperatureChanged();
irObjectTemperature = newObjectTemperature;
- emit infraredCelsiusTemperatureChanged();
+ emit infraredObjectTemperatureChanged();
}
void BluetoothDataProvider::barometerReceived(double temperature, double barometer)
{
+ /* NOTE: We emit the signals even if value is unchanged.
+ * Otherwise the scrolling graphs in UI will not scroll.
+ */
barometerCelsiusTemperature = temperature;
emit barometerCelsiusTemperatureChanged();
barometerTemperatureAverage = (temperature + m_smaSamples * barometerTemperatureAverage) / (m_smaSamples + 1);
@@ -118,11 +125,17 @@ void BluetoothDataProvider::barometerReceived(double temperature, double baromet
void BluetoothDataProvider::humidityReceived(double humidity)
{
+ /* NOTE: We emit the signals even if value is unchanged.
+ * Otherwise the scrolling graphs in UI will not scroll.
+ */
this->humidity = humidity;
emit relativeHumidityChanged();
}
void BluetoothDataProvider::lightIntensityReceived(double lightIntensity)
{
+ /* NOTE: We emit the signals even if value is unchanged.
+ * Otherwise the scrolling graphs in UI will not scroll.
+ */
lightIntensityLux = lightIntensity;
emit lightIntensityChanged();
}
@@ -136,6 +149,9 @@ float BluetoothDataProvider::countRotationDegrees(double degreesPerSecond, quint
void BluetoothDataProvider::motionReceived(MotionSensorData &data)
{
+ /* NOTE: We emit the signals even if value is unchanged.
+ * Otherwise the scrolling graphs in UI will not scroll.
+ */
gyroscopeX_degPerSec = data.gyroScope_x;
gyroscopeY_degPerSec = data.gyroScope_y;
gyroscopeZ_degPerSec = data.gyroScope_z;
diff --git a/tradeshow/iot-sensortag/bluetoothdataprovider.h b/tradeshow/iot-sensortag/bluetoothdataprovider.h
index f232aae..21db2c6 100644
--- a/tradeshow/iot-sensortag/bluetoothdataprovider.h
+++ b/tradeshow/iot-sensortag/bluetoothdataprovider.h
@@ -83,8 +83,6 @@ public slots:
private:
void updateState();
-
-private:
float countRotationDegrees(double degreesPerSecond, quint64 milliseconds);
BluetoothDevice* activeDevice;
QTimer timer;
diff --git a/tradeshow/iot-sensortag/clouddataprovider.cpp b/tradeshow/iot-sensortag/clouddataprovider.cpp
index f98432d..f4a24aa 100644
--- a/tradeshow/iot-sensortag/clouddataprovider.cpp
+++ b/tradeshow/iot-sensortag/clouddataprovider.cpp
@@ -114,19 +114,18 @@ void CloudDataProvider::parseReceivedText()
const QString headerText(dataList[stringIndex]);
const double doubleValue = QString(dataList[stringIndex+1]).toDouble();
const float floatValue = QString(dataList[stringIndex+1]).toFloat();
+ /* NOTE: We emit the signals even if value is unchanged.
+ * Otherwise the scrolling graphs in UI will not scroll.
+ */
if ("Humid:" == headerText) {
humidity = doubleValue;
emit relativeHumidityChanged();
- } else if ("Temp(IR):" == headerText) {
- // Old object temperature from version 1.0
- irObjectTemperature = doubleValue;
- emit infraredCelsiusTemperatureChanged();
} else if ("Temp(Ambient):" == headerText) {
irAmbientTemperature = doubleValue;
- emit infraredCelsiusTemperatureChanged();
+ emit infraredAmbientTemperatureChanged();
} else if ("Temp(Object):" == headerText) {
irObjectTemperature = doubleValue;
- emit infraredCelsiusTemperatureChanged();
+ emit infraredObjectTemperatureChanged();
} else if ("Light:" == headerText) {
lightIntensityLux = doubleValue;
emit lightIntensityChanged();
diff --git a/tradeshow/iot-sensortag/cloudupdate.cpp b/tradeshow/iot-sensortag/cloudupdate.cpp
index 6ef373c..505b0d3 100644
--- a/tradeshow/iot-sensortag/cloudupdate.cpp
+++ b/tradeshow/iot-sensortag/cloudupdate.cpp
@@ -164,7 +164,6 @@ QString CloudUpdate::buildString() const
exportString += QString("Type:\n%1\n").arg(m_provider->sensorType());
exportString += QString("Version:\n%1\n").arg(m_provider->versionString());
exportString += QString("Humid:\n%1\n").arg(m_provider->getRelativeHumidity(), 0, 'f', ROUNDING_DECIMALS);
- exportString += QString("Temp(IR):\n%1\n").arg(m_provider->getInfraredObjectTemperature(), 0, 'f', ROUNDING_DECIMALS);
exportString += QString("Temp(Ambient):\n%1\n").arg(m_provider->getInfraredAmbientTemperature(), 0, 'f', ROUNDING_DECIMALS);
exportString += QString("Temp(Object):\n%1\n").arg(m_provider->getInfraredObjectTemperature(), 0, 'f', ROUNDING_DECIMALS);
exportString += QString("Light:\n%1\n").arg(m_provider->getLightIntensityLux(), 0, 'f', ROUNDING_DECIMALS);
diff --git a/tradeshow/iot-sensortag/mockdataprovider.cpp b/tradeshow/iot-sensortag/mockdataprovider.cpp
index 3bd841a..ca1ba79 100644
--- a/tradeshow/iot-sensortag/mockdataprovider.cpp
+++ b/tradeshow/iot-sensortag/mockdataprovider.cpp
@@ -107,6 +107,9 @@ void MockDataProvider::setTagType(int tagType)
void MockDataProvider::oneSecondTimerExpired()
{
+ /* Emit the signals even if values are unchanged.
+ * Otherwise the scrolling graphs in UI will not scroll. */
+
// Humidity goes randomly up and down between 20% and 60%
humidity += static_cast<double>((qrand() % 11)-5)/10;
if (humidity > 60)
@@ -124,8 +127,9 @@ void MockDataProvider::oneSecondTimerExpired()
irAmbientTemperature = 38;
if (irAmbientTemperature < 15)
irAmbientTemperature = 15;
+ emit infraredAmbientTemperatureChanged();
irObjectTemperature = irAmbientTemperature + 2;
- emit infraredCelsiusTemperatureChanged();
+ emit infraredObjectTemperatureChanged();
if (qrand() % 2)
barometerCelsiusTemperature -= 0.5;
else
diff --git a/tradeshow/iot-sensortag/resources/base/GyroChart.qml b/tradeshow/iot-sensortag/resources/base/GyroChart.qml
index 37ee21f..91f1911 100644
--- a/tradeshow/iot-sensortag/resources/base/GyroChart.qml
+++ b/tradeshow/iot-sensortag/resources/base/GyroChart.qml
@@ -97,11 +97,11 @@ BaseChart {
anchors.top: parent.top
anchors.bottom: parent.bottom
- anchors.bottomMargin: 8
+ anchors.bottomMargin: 33
anchors.left: parent.left
- anchors.leftMargin: -40
+ anchors.leftMargin: -20
anchors.right: parent.right
- anchors.rightMargin: -28
+ anchors.rightMargin: -15
antialiasing: true
backgroundColor: "transparent"
legend.visible: false
@@ -115,10 +115,8 @@ BaseChart {
min: 0
max: maxGyroReadings + 1
tickCount: 13
- minorTickCount: 1
color: chartColor
- gridLineColor: gridColor
- minorGridLineColor: gridColor
+ visible: false
}
ValueAxis {
@@ -127,32 +125,8 @@ BaseChart {
min: 0
max: 360
tickCount: 11
- minorTickCount: 1
color: chartColor
- gridLineColor: gridColor
- minorGridLineColor: gridColor
- }
-
- Column {
- id: col
-
- property int step: (valueAxisY.max - valueAxisY.min) / (valueAxisY.tickCount - 1)
-
- spacing: -7
-
- y: chartView.plotArea.y - 10
- x: 30
-
- Repeater {
- model: valueAxisY.tickCount
-
- Text {
- text: valueAxisY.max - index * col.step
- horizontalAlignment: Text.AlignRight
- width: 50
- color: textColor
- }
- }
+ visible: false
}
ScatterSeries {
diff --git a/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml b/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml
index 0f18f87..bd60dc6 100644
--- a/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml
+++ b/tradeshow/iot-sensortag/resources/base/MagnetometerChart.qml
@@ -87,27 +87,17 @@ BaseChart {
magneticSeriesIndex++;
}
- Text {
- id: historyLabel
- text: "MAGNETIC FIELD HISTORY"
- color: textColor
- anchors.top: parent.top
- anchors.topMargin: 16
- anchors.left: parent.left
- anchors.leftMargin: chartView.plotArea.x - 40
- }
- ChartView {
+ PolarChartView {
id: chartView
- anchors.top: historyLabel.bottom
- anchors.topMargin: -26
+ anchors.top: parent.top
+ anchors.topMargin: -8
anchors.bottom: parent.bottom
- anchors.bottomMargin: 8
+ anchors.bottomMargin: -10
anchors.left: parent.left
- anchors.leftMargin: -40
+ anchors.leftMargin: -15
anchors.right: parent.right
- anchors.rightMargin: -28
antialiasing: true
backgroundColor: "transparent"
legend.visible: false
@@ -123,45 +113,24 @@ BaseChart {
max: maxNumOfMagnReadings + 1
tickCount: 2
color: chartColor
+ visible: false
}
ValueAxis {
id: valueAxisY
- min: 0
+ min: -1000
max: 1000
color: chartColor
- gridLineColor: "darkgray"
labelsVisible: false
- tickCount: 11
- }
-
- Column {
- id: col
-
- property int step: (valueAxisY.max - valueAxisY.min) / (valueAxisY.tickCount - 1)
-
- spacing: -9
- y: chartView.plotArea.y - 10
- x: 30
-
- Repeater {
- model: valueAxisY.tickCount
-
- Text {
- text: valueAxisY.max - index * col.step
- horizontalAlignment: Text.AlignRight
- width: 50
- color: textColor
- }
- }
+ visible: false
}
SplineSeries {
id: magnSeriesX
axisX: valueAxisX
axisY: valueAxisY
- width: 1
+ width: 2
color: xColor
name: "Magnet X"
}
@@ -169,7 +138,7 @@ BaseChart {
id: magnSeriesY
axisX: valueAxisX
axisY: valueAxisY
- width: 1
+ width: 2
color: yColor
name: "Magnet Y"
}
@@ -177,50 +146,44 @@ BaseChart {
id: magnSeriesZ
axisX: valueAxisX
axisY: valueAxisY
- width: 1
+ width: 2
color: zColor
name: "Magnet Z"
}
}
Text {
- text: "µT"
- anchors.top: xLabelRow.top
- anchors.right: xLabelRow.left
- anchors.rightMargin: 8
- color: textColor
- width: 20
- font.pixelSize: 14
+ id: xLabel
+ anchors.left: parent.left
+ anchors.leftMargin: 20
+ anchors.top: parent.top
+ anchors.topMargin: 20
+ horizontalAlignment: Text.AlignHCenter
+ text: "<font color=\"" + xColor + "\">X<br><font color=\"white\">" + (sensor ? sensor.magnetometerMicroT_xAxis : 0)
+ lineHeight: 0.7
+ width: (magnetHolderRect.width - xLabelRow.x) / 3
}
- Row {
- id: xLabelRow
+ Text {
+ anchors.left: parent.left
+ anchors.leftMargin: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: 28
- anchors.left: historyLabel.left
- anchors.right: parent.right
-
- Text {
- id: xLabel
- horizontalAlignment: Text.AlignHCenter
- text: "<font color=\"" + xColor + "\">X<br><font color=\"white\">" + (sensor ? sensor.magnetometerMicroT_xAxis : 0)
- lineHeight: 0.7
- width: (magnetHolderRect.width - xLabelRow.x) / 3
- }
-
- Text {
- horizontalAlignment: Text.AlignHCenter
- text: "<font color=\"" + yColor + "\">Y<br><font color=\"white\">" + (sensor ? sensor.magnetometerMicroT_yAxis : 0)
- lineHeight: 0.7
- width: xLabel.width
- }
+ horizontalAlignment: Text.AlignHCenter
+ text: "<font color=\"" + yColor + "\">Y<br><font color=\"white\">" + (sensor ? sensor.magnetometerMicroT_yAxis : 0)
+ lineHeight: 0.7
+ width: xLabel.width
+ }
- Text {
- horizontalAlignment: Text.AlignHCenter
- text: "<font color=\"" + zColor + "\">Z<br><font color=\"white\">" + (sensor ? sensor.magnetometerMicroT_zAxis : 0)
- lineHeight: 0.7
- width: xLabel.width
- }
+ Text {
+ anchors.right: parent.right
+ anchors.rightMargin: 20
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 28
+ horizontalAlignment: Text.AlignHCenter
+ text: "<font color=\"" + zColor + "\">Z<br><font color=\"white\">" + (sensor ? sensor.magnetometerMicroT_zAxis : 0)
+ lineHeight: 0.7
+ width: xLabel.width
}
}
}
diff --git a/tradeshow/iot-sensortag/resources/base/ObjectTemperatureChart.qml b/tradeshow/iot-sensortag/resources/base/ObjectTemperatureChart.qml
index 11da845..770684e 100644
--- a/tradeshow/iot-sensortag/resources/base/ObjectTemperatureChart.qml
+++ b/tradeshow/iot-sensortag/resources/base/ObjectTemperatureChart.qml
@@ -68,7 +68,7 @@ BaseChart {
title: qsTr("Object Temperature")
onSensorChanged: if (sensor) {
- sensor.infraredCelsiusTemperatureChanged.connect(updateTemps)
+ sensor.infraredObjectTemperatureChanged.connect(updateTemps)
}
content: Item {
diff --git a/tradeshow/iot-sensortag/resources/base/TemperatureChart.qml b/tradeshow/iot-sensortag/resources/base/TemperatureChart.qml
index 5a98029..27cd094 100644
--- a/tradeshow/iot-sensortag/resources/base/TemperatureChart.qml
+++ b/tradeshow/iot-sensortag/resources/base/TemperatureChart.qml
@@ -68,7 +68,7 @@ BaseChart {
readonly property color chartColor: "#15bdff"
onSensorChanged: if (sensor) {
- sensor.infraredCelsiusTemperatureChanged.connect(contentItem.updateTemperatureGraph)
+ sensor.infraredAmbientTemperatureChanged.connect(contentItem.updateTemperatureGraph)
}
title: qsTr("Ambient Temperature")
diff --git a/tradeshow/iot-sensortag/sensortagdataprovider.h b/tradeshow/iot-sensortag/sensortagdataprovider.h
index 7ee4a0d..30e59e5 100644
--- a/tradeshow/iot-sensortag/sensortagdataprovider.h
+++ b/tradeshow/iot-sensortag/sensortagdataprovider.h
@@ -64,8 +64,8 @@ class SensorTagDataProvider : public QObject
Q_PROPERTY(QString providerId MEMBER m_id CONSTANT)
Q_PROPERTY(QString relativeHumidityString READ getRelativeHumidityString NOTIFY relativeHumidityChanged)
Q_PROPERTY(double relativeHumidity READ getRelativeHumidity NOTIFY relativeHumidityChanged)
- Q_PROPERTY(double infraredAmbientTemperature READ getInfraredAmbientTemperature NOTIFY infraredCelsiusTemperatureChanged)
- Q_PROPERTY(double infraredObjectTemperature READ getInfraredObjectTemperature NOTIFY infraredCelsiusTemperatureChanged)
+ Q_PROPERTY(double infraredAmbientTemperature READ getInfraredAmbientTemperature NOTIFY infraredAmbientTemperatureChanged)
+ Q_PROPERTY(double infraredObjectTemperature READ getInfraredObjectTemperature NOTIFY infraredObjectTemperatureChanged)
Q_PROPERTY(QString lightIntensityLuxString READ getLightIntensityLuxString NOTIFY lightIntensityChanged)
Q_PROPERTY(double lightIntensityLux READ getLightIntensityLux NOTIFY lightIntensityChanged)
Q_PROPERTY(double barometerCelsiusTemperature READ getBarometerCelsiusTemperature NOTIFY barometerCelsiusTemperatureChanged)
@@ -138,7 +138,8 @@ public:
signals:
void stateChanged();
void relativeHumidityChanged();
- void infraredCelsiusTemperatureChanged();
+ void infraredAmbientTemperatureChanged();
+ void infraredObjectTemperatureChanged();
void lightIntensityChanged();
void barometerCelsiusTemperatureChanged();
void barometerCelsiusTemperatureAverageChanged();