From faa6ebce32c5875687f028a4d6c990e33cf260d5 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Fri, 3 Jan 2020 18:13:33 -0500 Subject: Add signal-composer speed and steering wheel event support Changes include: - Pull in signal-composer support from libqtappfw - Add a configuration file that controls whether the existing canned animation behavior should be used, or events from signal-composer should drive speeds and indicators. - Add new icons provided by LF graphics team for cruise control and lane departure warning, and drive their state based on appropriate steering wheel events. - Hide/show the digital vehicle/engine speed values in the gauges based on the steering wheel info event. This is intended to work in sync with changes to tbtnavi to have it display larger speed indicators via an alternate page. Bug-AGL: SPEC-3045, SPEC-3049 Change-Id: I77249f65b80596fe7f2af9fe29b3ed86b63a8a45 Signed-off-by: Scott Murray --- app/ValueSource.qml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'app/ValueSource.qml') diff --git a/app/ValueSource.qml b/app/ValueSource.qml index 48e5cf6..80ef95c 100644 --- a/app/ValueSource.qml +++ b/app/ValueSource.qml @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2018 Konsulko Group +** Copyright (C) 2018, 2019 Konsulko Group ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -54,7 +54,7 @@ Item { id: valueSource property real kph: 0 property bool mphDisplay: true - property real speedScaling: mphDisplay == true ? 0.621 : 1.0 + property real speedScaling: mphDisplay == true ? 0.621504 : 1.0 property real rpm: 1 property real fuel: 0.85 property string gear: { @@ -87,13 +87,61 @@ Item { property int turnSignal: -1 property bool startUp: false property real temperature: 0.6 + property bool cruiseEnabled: false + property bool cruiseSet: false + property bool laneDepartureWarnEnabled: false + property bool displayNumericSpeeds: true function randomDirection() { return Math.random() > 0.5 ? Qt.LeftArrow : Qt.RightArrow; } + Connections { + target: SignalComposer + + onSignalEvent: { + if (uid === "event.vehicle.speed") { + var speed_tmp = parseFloat(value) + if(units == "mph") { + speed_tmp *= 1.609 + } + if(!runAnimation) { + valueSource.kph = speed_tmp + } + } + else if (uid === "event.engine.speed") { + if(!runAnimation) { + valueSource.rpm = parseFloat(value) / 1000 + } + } + else if (uid === "event.cruise.enable" && value === "true") { + if(valueSource.cruiseEnabled) { + valueSource.cruiseEnabled = false + valueSource.cruiseSet = false + } else { + valueSource.cruiseEnabled = true + } + } + else if ((uid === "event.cruise.set" || uid === "event.cruise.resume") && + value === "true") { + if(valueSource.cruiseEnabled) { + valueSource.cruiseSet = true + } + } + else if (uid === "event.cruise.cancel" && value === "true") { + valueSource.cruiseSet = false + } + else if (uid === "event.lane_departure_warning.enable" && value === "true") { + valueSource.laneDepartureWarnEnabled = !valueSource.laneDepartureWarnEnabled + } + else if (uid === "event.info" && value === "true") { + valueSource.displayNumericSpeeds = !valueSource.displayNumericSpeeds + } + } + } + SequentialAnimation { - running: true + running: runAnimation loops: 1 // We want a small pause at the beginning, but we only want it to happen once. -- cgit 1.2.3-korg