summaryrefslogtreecommitdiffstats
path: root/app/qml/Main.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-07 15:50:29 -0400
commitb53c55799ff50fb51bec1bf75bac477fa4165336 (patch)
tree4200790f43db597c73de3acda9c71b76938a67e2 /app/qml/Main.qml
parent70dfe121582cda2c82c794e5af6550b5c1a237c4 (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/Main.qml')
-rw-r--r--app/qml/Main.qml57
1 files changed, 46 insertions, 11 deletions
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)
}
}
}