aboutsummaryrefslogtreecommitdiffstats
path: root/app/qml
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-06-07 15:39:51 -0400
committerScott Murray <scott.murray@konsulko.com>2022-06-08 12:21:48 +0000
commitd63cd17b21e201dc1a94242f16b957aa9b6d232b (patch)
tree3423b58046fd633d27b9a6ad094ca750ba88ed48 /app/qml
parentf91fb7dc3cbc37dc408e18263e59ec0fcd4d5cae (diff)
Updates to restore to a functional state
Changes: - Add setenv of QT_QUICK_CONTROLS_STYLE and setting of the frameless window hint to match the previous behavior before the removal of the previous application framework. - Use the new VehicleSignals API from libqtappfw to replace the previous signal-composer usage. - Update the use of the Navigation API from libqtappfw for its rework to use VIS signals instead of the previous signal-composer usage. - The default unit for the vehicle speed has been switched to kilometers with switching driven by the appropriate VSS schema value. Bug-AGL: SPEC-4409, SPEC-4426 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I69b60a1e3207a54c34aaf114a1e89fce2cf0059f
Diffstat (limited to 'app/qml')
-rw-r--r--app/qml/InfoWindow.qml2
-rw-r--r--app/qml/Main.qml57
2 files changed, 47 insertions, 12 deletions
diff --git a/app/qml/InfoWindow.qml b/app/qml/InfoWindow.qml
index 4acba5d..7183040 100644
--- a/app/qml/InfoWindow.qml
+++ b/app/qml/InfoWindow.qml
@@ -53,7 +53,7 @@ Rectangle {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
- text: "MPH"
+ text: tbtnavi.mphDisplay ? "MPH" : "KPH"
color: "white"
font.pixelSize: 32
font.bold: true
diff --git a/app/qml/Main.qml b/app/qml/Main.qml
index 188fa86..471d160 100644
--- a/app/qml/Main.qml
+++ b/app/qml/Main.qml
@@ -11,17 +11,54 @@ ApplicationWindow {
title: "Turn By Turn Navigation Demo"
height: Window.height
width: Window.width
+ flags: Qt.FramelessWindowHint
visible: true
property double vehicleSpeed: 0
property double engineSpeed: 0
+ property bool mphDisplay: false
+
+ Component.onCompleted : {
+ VehicleSignals.connect()
+ }
Connections {
- target: SignalComposer
+ target: VehicleSignals
+
+ onConnected: {
+ VehicleSignals.authorize()
+ }
+
+ onAuthorized: {
+ VehicleSignals.subscribe("Vehicle.Speed")
+ VehicleSignals.subscribe("Vehicle.Powertrain.CombustionEngine.Engine.Speed")
+ VehicleSignals.subscribe("Vehicle.Cabin.Infotainment.Cluster.Mode")
+ VehicleSignals.get("Vehicle.Cabin.Infotainment.HMI.DistanceUnit")
+ VehicleSignals.subscribe("Vehicle.Cabin.Infotainment.HMI.DistanceUnit")
+ }
- onSignalEvent: {
- //console.log ("Received uid = " + uid + ", value = " + value)
- if (uid === "event.info" && value === "true") {
+ onGetSuccessResponse: {
+ //console.log("response path = " + path + ", value = " + value)
+ if (path === "Vehicle.Cabin.Infotainment.HMI.DistanceUnit") {
+ if (value === "km") {
+ mphDisplay = false
+ } else if (value === "mi") {
+ mphDisplay = true
+ }
+ }
+ }
+
+ onSignalNotification: {
+ //console.log("signal path = " + path + ", value = " + value)
+ if (path === "Vehicle.Speed") {
+ // value units are always km/h
+ if (mphDisplay)
+ vehicleSpeed = parseFloat(value) * 0.621504
+ else
+ vehicleSpeed = parseFloat(value)
+ } else if (path === "Vehicle.Powertrain.CombustionEngine.Engine.Speed") {
+ engineSpeed = parseFloat(value)
+ } else if (path === "Vehicle.Cabin.Infotainment.Cluster.Mode" && value === "true") {
console.log ("Switching views!")
console.log ("currentIndex = " + container.currentIndex)
if (container.currentIndex === 0) {
@@ -31,14 +68,12 @@ ApplicationWindow {
console.log ("Switching to map")
container.currentIndex = 0
}
- } else if (uid === "event.vehicle.speed") {
- var speed_tmp = parseFloat(value)
- if(units == "km/h") {
- speed_tmp /= 1.609
+ } else if (path === "Vehicle.Cabin.Infotainment.HMI.DistanceUnit") {
+ if (value === "km") {
+ mphDisplay = false
+ } else if (value === "mi") {
+ mphDisplay = true
}
- vehicleSpeed = speed_tmp
- } else if (uid === "event.engine.speed") {
- engineSpeed = parseFloat(value)
}
}
}