diff options
author | Grigorii Zimin <gzimin@luxoft.com> | 2020-03-27 10:52:09 +0300 |
---|---|---|
committer | Grigorii Zimin <gzimin@luxoft.com> | 2020-03-30 10:00:11 +0000 |
commit | 1b6b284525db7bbd3da7368c06ba4273ce3404ab (patch) | |
tree | 07629c67b38f3d929fff004c58e26b6d5ff0d432 | |
parent | 8ca81721d2ad98347c665b588b03fb6dd99adc2c (diff) |
[companion, cluster, drivedata] add property to control simulation
-add button in companion app (dev page) to enable/disable simulation
-simulation is ENABLED by default
Fixes: AUTOSUITE-1498
Change-Id: I18bfcc3c909c3fa819399f7c2fb91dd97ef07125
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
-rw-r--r-- | src/drivedata/drivedata-simulation-server/simulation.qml | 14 | ||||
-rw-r--r-- | src/drivedata/drivedata.qface | 3 | ||||
-rw-r--r-- | src/drivedata/drivedata.yaml | 8 | ||||
-rw-r--r-- | src/remotesettings/app/DevelopmentPage.qml | 34 |
4 files changed, 40 insertions, 19 deletions
diff --git a/src/drivedata/drivedata-simulation-server/simulation.qml b/src/drivedata/drivedata-simulation-server/simulation.qml index 016b631b..2371a16c 100644 --- a/src/drivedata/drivedata-simulation-server/simulation.qml +++ b/src/drivedata/drivedata-simulation-server/simulation.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2019-2020 Luxoft Sweden AB ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Neptune 3 UI. @@ -55,7 +55,7 @@ Item { speedTimer.start() } } - running: backend.driveTrainState !== 2 + running: backend.enableSimulation && backend.driveTrainState !== 2 } property Timer simulationSetTimer: Timer { @@ -76,7 +76,7 @@ Item { } } repeat: true - running: backend.driveTrainState === 2 + running: backend.enableSimulation && backend.driveTrainState === 2 } property Timer speedTimer: Timer { @@ -89,7 +89,7 @@ Item { backend.speed = backend.speed - 1; } } - repeat: true + repeat: backend.enableSimulation } property Timer powerTimer: Timer { @@ -102,7 +102,7 @@ Item { } } repeat: true - running: backend.driveTrainState === 2 + running: backend.enableSimulation && backend.driveTrainState === 2 } /* @@ -139,7 +139,7 @@ Item { backend.airbagFailure = getNewTelltaleState(); } repeat: true - running: true + running: backend.enableSimulation function getNewTelltaleState() { return Math.round(Math.random()); } @@ -166,7 +166,7 @@ Item { } } repeat: true - running: true + running: backend.enableSimulation } } } diff --git a/src/drivedata/drivedata.qface b/src/drivedata/drivedata.qface index 33c23d94..4473d122 100644 --- a/src/drivedata/drivedata.qface +++ b/src/drivedata/drivedata.qface @@ -2,6 +2,9 @@ module DriveData 1.0; interface InstrumentCluster { + /* default value is false (in qface) */ + bool enableSimulation; + /* * In Km/H */ diff --git a/src/drivedata/drivedata.yaml b/src/drivedata/drivedata.yaml index 1f7a73c2..c9338077 100644 --- a/src/drivedata/drivedata.yaml +++ b/src/drivedata/drivedata.yaml @@ -2,10 +2,18 @@ DriveData: config_simulator: simulationFile: "qrc:/plugin_resource/simulation.qml" +DriveData.InstrumentCluster#enableSimulation: + config_simulator: + default: true + DriveData.InstrumentCluster#ePower: config_simulator: default: 100 +DriveData.InstrumentCluster#speed: + config_simulator: + default: 45 + DriveData.InstrumentCluster#speedLimit: config_simulator: default: 50 diff --git a/src/remotesettings/app/DevelopmentPage.qml b/src/remotesettings/app/DevelopmentPage.qml index 484caa38..3f1e2937 100644 --- a/src/remotesettings/app/DevelopmentPage.qml +++ b/src/remotesettings/app/DevelopmentPage.qml @@ -1,6 +1,6 @@ -/**************************************************************************** +/**************************************************************************** ** -** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2019-2020 Luxoft Sweden AB ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Neptune 3 UI. @@ -74,6 +74,16 @@ Flickable { font.bold: true } + Button { + Layout.alignment: Qt.AlignHCenter + text: instrumentCluster.enableSimulation + ? qsTr("Disable simulation") + : qsTr("Enable simulation") + onClicked: { + instrumentCluster.enableSimulation = !instrumentCluster.enableSimulation; + } + } + GridLayout { Layout.alignment: Qt.AlignHCenter columns: root.width < neptuneScale(100) ? 2 : 4 @@ -100,7 +110,7 @@ Flickable { } GridLayout { - enabled: instrumentCluster.isConnected + enabled: instrumentCluster.isConnected && !instrumentCluster.enableSimulation Layout.alignment: Qt.AlignHCenter columns: root.width > 2 * (outsideTemperatureLabel.width + outsideTemperature.width + columnSpacing) ? 4 : 2 @@ -185,7 +195,7 @@ Flickable { RowLayout { - enabled: instrumentCluster.isConnected + enabled: instrumentCluster.isConnected && !instrumentCluster.enableSimulation Layout.alignment: Qt.AlignHCenter // driveTrainState field Label { @@ -246,7 +256,7 @@ Flickable { } GridLayout { - enabled: instrumentCluster.isConnected + enabled: instrumentCluster.isConnected && !instrumentCluster.enableSimulation Layout.alignment: Qt.AlignHCenter columns: root.width < neptuneScale(100) ? 2 : 4 @@ -287,7 +297,7 @@ Flickable { CheckBox { id: stabilityControlCheckbox checked: instrumentCluster.stabilityControl - enabled: false + onClicked: instrumentCluster.stabilityControl = checked } // leftTurn Field @@ -317,7 +327,7 @@ Flickable { CheckBox { id: seatBeltNotFastenedCheckbox checked: instrumentCluster.seatBeltNotFastened - enabled: false + onClicked: instrumentCluster.seatBeltNotFastened = checked } // ABSFailure Field @@ -327,7 +337,7 @@ Flickable { CheckBox { id: absFailureCheckbox checked: instrumentCluster.ABSFailure - enabled: false + onClicked: instrumentCluster.ABSFailure = checked } // parkBrake Field @@ -337,7 +347,7 @@ Flickable { CheckBox { id: parkBrakeCheckbox checked: instrumentCluster.parkBrake - enabled: false + onClicked: instrumentCluster.parkBrake = checked } // tyrePressureLow Field @@ -347,7 +357,7 @@ Flickable { CheckBox { id: tyrePressureLowCheckbox checked: instrumentCluster.tyrePressureLow - enabled: false + onClicked: instrumentCluster.tyrePressureLow = checked } // brakeFailure Field @@ -357,7 +367,7 @@ Flickable { CheckBox { id: brakeFailureCheckBox checked: instrumentCluster.brakeFailure - enabled: false + onClicked: instrumentCluster.brakeFailure = checked } // airbagFailure Field @@ -367,7 +377,7 @@ Flickable { CheckBox { id: airbagFailureCheckBox checked: instrumentCluster.airbagFailure - enabled: false + onClicked: instrumentCluster.airbagFailure = checked } } |