summaryrefslogtreecommitdiffstats
path: root/imports/vehicle
diff options
context:
space:
mode:
Diffstat (limited to 'imports/vehicle')
-rwxr-xr-ximports/vehicle/ClimateModel.qml44
-rwxr-xr-ximports/vehicle/FuelModel.qml46
-rwxr-xr-ximports/vehicle/PositionModel.qml33
-rwxr-xr-ximports/vehicle/SpeedModel.qml38
-rwxr-xr-ximports/vehicle/TemperatureModel.qml26
-rwxr-xr-ximports/vehicle/qmldir11
6 files changed, 198 insertions, 0 deletions
diff --git a/imports/vehicle/ClimateModel.qml b/imports/vehicle/ClimateModel.qml
new file mode 100755
index 0000000..9633f16
--- /dev/null
+++ b/imports/vehicle/ClimateModel.qml
@@ -0,0 +1,44 @@
+/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pragma Singleton
+
+import QtQuick 2.0
+import Automotive.ClimateControl 1.0
+
+Item {
+ property real fanStepSize:1/255 //Represents the stepSize for a given Climate control.
+ property alias fanSpeed: fanControl.fanSpeedLevel
+
+ property real temperatureStepSize:1/15 //0== 15c, 15 == 30c
+
+ property alias leftTemp: leftFront.targetTemperature
+ property alias rightTemp: rightFront.targetTemperature
+
+ ClimateControlItem {
+ id:fanControl
+ }
+
+ ClimateControlItem {
+ id: leftFront
+ zone: 9
+ }
+
+ ClimateControlItem {
+ id: rightFront
+ zone: 5
+ }
+
+ function getRangeValue(inputVal,stepSize){
+ if(inputVal > 0){
+ return Math.ceil(inputVal/stepSize);
+ }else{
+ return 0;
+ }
+ }
+
+}
+
diff --git a/imports/vehicle/FuelModel.qml b/imports/vehicle/FuelModel.qml
new file mode 100755
index 0000000..fa064e2
--- /dev/null
+++ b/imports/vehicle/FuelModel.qml
@@ -0,0 +1,46 @@
+/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pragma Singleton
+
+import QtQuick 2.0
+
+Item {
+ property bool metric: false
+
+ function galToL(value) {
+ return (metric ? 3.78541 : 1) * value
+ }
+
+ function mpgToLp100(value) {
+ return metric ? 235.214583571 / value : value
+ }
+
+ property real baseTank: 25
+ property real tankSize: galToL(baseTank)
+ property real level: tankSize * percentage * 0.01
+ property real percentage: 100
+ property real range: metric ? 100 * level / average : level * average
+ property real baseAverage: 20.7
+ property real average: mpgToLp100(baseAverage + mpgDiff)
+ property real mpgDiff: 0
+
+ NumberAnimation on percentage {
+ from: 100
+ to: 0
+ duration: 5000
+ loops: Animation.Infinite
+ easing.type: Easing.CosineCurve
+ }
+
+ NumberAnimation on mpgDiff {
+ from: -2
+ to: 2
+ duration: 11200
+ loops: Animation.Infinite
+ easing.type: Easing.CosineCurve
+ }
+}
diff --git a/imports/vehicle/PositionModel.qml b/imports/vehicle/PositionModel.qml
new file mode 100755
index 0000000..00956aa
--- /dev/null
+++ b/imports/vehicle/PositionModel.qml
@@ -0,0 +1,33 @@
+/* Copyright (C) 2015, Jaguar Land Rover, IoT.bzh. All Rights Reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pragma Singleton
+
+import QtQuick 2.0
+import amb 0.1
+
+Item {
+ property string nmeaString: nmea.value
+ property real satellites: satsUsed.value
+
+ AutomotivePropertyItem {
+ id: nmea
+
+ objectName: "GpsNmea"
+ propertyName: "Nmea"
+
+ Component.onCompleted: nmea.connect();
+ }
+
+ AutomotivePropertyItem {
+ id: satsUsed
+
+ objectName: "GpsSatsUsed"
+ propertyName: "SatsUsed"
+
+ Component.onCompleted: satsUsed.connect();
+ }
+}
diff --git a/imports/vehicle/SpeedModel.qml b/imports/vehicle/SpeedModel.qml
new file mode 100755
index 0000000..03422b0
--- /dev/null
+++ b/imports/vehicle/SpeedModel.qml
@@ -0,0 +1,38 @@
+/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pragma Singleton
+
+import QtQuick 2.0
+import amb 0.1
+
+Item {
+ property bool metric: false
+
+ function mphToKph(value) {
+ return (metric ? 1.60934 : 1 ) * value
+ }
+
+ property real max:Math.ceil(mphToKph(baseMaxSpeed)/30)*30
+ property real baseMaxSpeed: 255
+ property real textSpeed: prop.value
+ property real percentage: textSpeed / max * 100
+
+ AutomotivePropertyItem {
+ id: prop
+
+ objectName: "VehicleSpeed"
+ propertyName: "Speed"
+
+ Component.onCompleted: prop.connect();
+ }
+
+ Behavior on percentage {
+ SmoothedAnimation {
+ velocity: 100
+ }
+ }
+}
diff --git a/imports/vehicle/TemperatureModel.qml b/imports/vehicle/TemperatureModel.qml
new file mode 100755
index 0000000..2bfbbf4
--- /dev/null
+++ b/imports/vehicle/TemperatureModel.qml
@@ -0,0 +1,26 @@
+/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pragma Singleton
+
+import QtQuick 2.0
+
+Item {
+ property bool metric: true
+
+ function unit(value) {
+ return celsiusToFahrenheit(value).toFixed(1) + "\u00b0" + (metric ? "C" : "F")
+ }
+
+ function celsiusToFahrenheit(value) {
+ return (metric ? value : 1.8 * value + 32)
+ }
+
+ property real indoor: 20.4
+ property string indoorString: unit(indoor)
+ property real outdoor: 28.9
+ property string outdoorString: unit(outdoor)
+}
diff --git a/imports/vehicle/qmldir b/imports/vehicle/qmldir
new file mode 100755
index 0000000..6538e95
--- /dev/null
+++ b/imports/vehicle/qmldir
@@ -0,0 +1,11 @@
+#/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
+# *
+# * This Source Code Form is subject to the terms of the Mozilla Public
+# * License, v. 2.0. If a copy of the MPL was not distributed with this
+# * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+singleton FuelModel 1.0 FuelModel.qml
+singleton SpeedModel 1.0 SpeedModel.qml
+singleton TemperatureModel 1.0 TemperatureModel.qml
+singleton PositionModel 1.0 PositionModel.qml
+singleton ClimateModel 1.0 ClimateModel.qml