summaryrefslogtreecommitdiffstats
path: root/imports/shared/service
diff options
context:
space:
mode:
Diffstat (limited to 'imports/shared/service')
-rw-r--r--imports/shared/service/climate/ClimateService.qml134
-rw-r--r--imports/shared/service/climate/ClimateStateMachine.qml169
-rw-r--r--imports/shared/service/climate/qmldir1
-rw-r--r--imports/shared/service/movie/MovieService.qml67
-rw-r--r--imports/shared/service/movie/qmldir1
-rw-r--r--imports/shared/service/music/MusicService.qml118
-rw-r--r--imports/shared/service/music/qmldir1
-rw-r--r--imports/shared/service/settings/SettingsService.qml124
-rw-r--r--imports/shared/service/settings/qmldir1
-rw-r--r--imports/shared/service/statusbar/StatusBarService.qml60
-rw-r--r--imports/shared/service/statusbar/qmldir1
-rw-r--r--imports/shared/service/valuesource/ValueSource.qml282
-rw-r--r--imports/shared/service/valuesource/qmldir1
13 files changed, 960 insertions, 0 deletions
diff --git a/imports/shared/service/climate/ClimateService.qml b/imports/shared/service/climate/ClimateService.qml
new file mode 100644
index 0000000..ffdf71b
--- /dev/null
+++ b/imports/shared/service/climate/ClimateService.qml
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune IVI UI.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.0
+import QtIvi.VehicleFunctions 1.0
+import service.settings 1.0
+
+QtObject {
+ id: root
+
+ property ClimateControl climateControl: ClimateControl {
+ discoveryMode: ClimateControl.AutoDiscovery
+ }
+
+ property QtObject leftSeat: QtObject {
+ property real minValue: calculateUnitValue(16)
+ property real maxValue: calculateUnitValue(28)
+ property real stepValue: calculateUnitValue(0.5)
+ property real value: calculateUnitValue(climateControl.zoneAt.FrontLeft.targetTemperature.value)
+ property bool heat: climateControl.zoneAt.FrontLeft.seatHeater
+ }
+
+ property QtObject rightSeat: QtObject {
+ property real minValue: calculateUnitValue(16)
+ property real maxValue: calculateUnitValue(28)
+ property real stepValue: calculateUnitValue(0.5)
+ property real value: calculateUnitValue(climateControl.zoneAt.FrontRight.targetTemperature.value)
+
+ property bool heat: climateControl.zoneAt.FrontRight.seatHeater
+
+ onValueChanged: climateControl.zoneAt.FrontRight.targetTemperature.value = value
+ onHeatChanged: climateControl.zoneAt.FrontRight.seatHeater.value = heat
+ }
+
+ property QtObject frontHeat: QtObject {
+ property string symbol: "front"
+ property bool enabled: true
+ }
+
+ property QtObject rearHeat: QtObject {
+ property string symbol: "rear"
+ property bool enabled: true
+ }
+
+ property QtObject airCondition: QtObject {
+ property string symbol: "ac"
+ property bool enabled: climateControl.airConditioning.value
+
+ onEnabledChanged: {
+ climateControl.airConditioning.value = enabled;
+ enabled = Qt.binding(function() { return climateControl.airConditioning.value; });
+ }
+ }
+
+ property QtObject airflow: QtObject {
+ property int windshield: ClimateControl.Windshield
+ property int dashboard: ClimateControl.Dashboard
+ property int floor: ClimateControl.Floor
+ property int value: climateControl.airflowDirections.value
+ property var availableValues: climateControl.airflowDirections.availableValues
+ }
+
+ property QtObject airQuality: QtObject {
+ property string symbol: "air_quality"
+ property bool enabled: climateControl.recirculationMode.value == ClimateControl.RecirculationOn
+
+ onEnabledChanged: {
+ climateControl.recirculationMode.value = enabled ? ClimateControl.RecirculationOn : ClimateControl.RecirculationOff;
+ enabled = Qt.binding(function() { return climateControl.recirculationMode.value == ClimateControl.RecirculationOn });
+ }
+ }
+
+ property QtObject eco: QtObject {
+ property string symbol: "eco"
+ property bool enabled: false
+ }
+
+ property QtObject steeringWheelHeat: QtObject {
+ property string symbol: "stearing_wheel"
+ property bool enabled: climateControl.steeringWheelHeater.value >= 5
+
+ onEnabledChanged: {
+ climateControl.steeringWheelHeater.value = enabled ? 10 : 0;
+ enabled = Qt.binding(function() { return climateControl.steeringWheelHeater.value >= 5 });
+ }
+ }
+
+ property var climateOptions: [frontHeat, rearHeat, airCondition, airQuality, eco, steeringWheelHeat]
+
+ property int outsideTemp: calculateUnitValue(15)
+ property string outsideTempText: qsTr("%1" + tempSuffix).arg(outsideTemp)
+ property int ventilation: climateControl.fanSpeedLevel.value
+ property string tempSuffix: SettingsService.metric ? "°C" : "°F"
+ property int ventilationLevels: climateControl.fanSpeedLevel.maximumValue // 6 + off (0)
+ onVentilationChanged: climateControl.fanSpeedLevel.value = ventilation
+
+ property QtObject stateMachine: ClimateStateMachine {
+ climateControl: root.climateControl
+ doorsOpen: eco.enabled // TODO use QtIVI doors/window state for this eventually
+ }
+
+ function calculateUnitValue(value) {
+ // Defualt value is the celsius
+ return (SettingsService.unitSystem === "metric") ? value : (Math.round(value * 1.8 + 32))
+ }
+}
diff --git a/imports/shared/service/climate/ClimateStateMachine.qml b/imports/shared/service/climate/ClimateStateMachine.qml
new file mode 100644
index 0000000..596be08
--- /dev/null
+++ b/imports/shared/service/climate/ClimateStateMachine.qml
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune IVI UI.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQml.StateMachine 1.0 as DSM
+import QtIvi.VehicleFunctions 1.0
+
+QtObject {
+ id: root
+ property ClimateControl climateControl
+ property bool doorsOpen: false
+
+ property QtObject stateMachine: DSM.StateMachine {
+ id: climateStateMachine
+ running: true
+ initialState: runningState
+
+ DSM.State {
+ childMode: DSM.State.ParallelStates
+ id: runningState
+
+ DSM.State {
+ id: suspendable
+ initialState: doorsClosedState
+
+ DSM.State {
+ id: doorsClosedState
+ childMode: DSM.State.ParallelStates
+
+ DSM.State {
+ id: airConditionState
+ initialState: climateControl.airConditioning.value ? airConditionOn : airConditionOff
+
+ DSM.State {
+ id: airConditionOff
+ onEntered: climateControl.airConditioning.value = false
+ DSM.SignalTransition {
+ targetState: airConditionOn
+ signal: climateControl.airConditioning.valueChanged
+ guard: climateControl.airConditioning.value
+ }
+ }
+
+ DSM.State {
+ id: airConditionOn
+ onEntered: {
+ climateControl.airConditioning.value = true
+ steeringWheelHeat.enabled = false
+ }
+ DSM.SignalTransition {
+ targetState: airConditionOff
+ signal: climateControl.airConditioning.valueChanged
+ guard: !climateControl.airConditioning.value
+ }
+ }
+ } // airConditionState
+
+ DSM.State {
+ id: airRecirculationState
+ initialState: climateControl.recirculation.value ? airRecirculationOn : airRecirculationOff
+
+ DSM.State {
+ id: airRecirculationOff
+ onEntered: climateControl.recirculationMode.value = ClimateControl.RecirculationOff
+ DSM.SignalTransition {
+ targetState: airRecirculationOn
+ signal: climateControl.recirculationMode.valueChanged
+ guard: climateControl.recirculationMode.value == ClimateControl.RecirculationOn
+ }
+ }
+
+ DSM.State {
+ id: airRecirculationOn
+ onEntered: {
+ climateControl.recirculationMode.value = ClimateControl.RecirculationOn
+ }
+ DSM.SignalTransition {
+ targetState: airRecirculationOff
+ signal: climateControl.recirculationMode.valueChanged
+ guard: climateControl.recirculationMode.value == ClimateControl.RecirculationOff
+ }
+ }
+ } // airRecirculationState
+
+ DSM.HistoryState {
+ id: historyState
+ defaultState: doorsClosedState
+ historyType: DSM.HistoryState.DeepHistory
+ }
+
+ DSM.SignalTransition {
+ targetState: suspended
+ signal: doorsOpenChanged
+ guard: doorsOpen
+ }
+ } // door closed state
+
+ DSM.State {
+ id: suspended
+ onEntered: {
+ climateControl.airConditioning.value = false
+ climateControl.recirculationMode.value = ClimateControl.RecirculationOff
+ }
+ DSM.SignalTransition {
+ targetState: historyState
+ signal: doorsOpenChanged
+ guard: !doorsOpen
+ }
+ }
+
+ } // suspendable state
+
+ DSM.State {
+ id: steeringWheelHeatState
+ initialState: (climateControl.steeringWheelHeater.value >= 5) ? steeringWheelHeatOn : steeringWheelHeatOff
+
+ DSM.State {
+ id: steeringWheelHeatOff
+ onEntered: climateControl.steeringWheelHeater.value = 0
+ DSM.SignalTransition {
+ targetState: steeringWheelHeatOn
+ signal: climateControl.steeringWheelHeater.valueChanged
+ guard: climateControl.steeringWheelHeater.value >= 5
+ }
+ }
+
+ DSM.State {
+ id: steeringWheelHeatOn
+ onEntered: {
+ climateControl.steeringWheelHeater.value = 10
+ climateControl.airConditioning.value = false
+ }
+ DSM.SignalTransition {
+ targetState: steeringWheelHeatOff
+ signal: climateControl.steeringWheelHeater.valueChanged
+ guard: climateControl.steeringWheelHeater.value < 5
+ }
+ }
+ }
+ } // running state
+ }
+}
diff --git a/imports/shared/service/climate/qmldir b/imports/shared/service/climate/qmldir
new file mode 100644
index 0000000..322284f
--- /dev/null
+++ b/imports/shared/service/climate/qmldir
@@ -0,0 +1 @@
+singleton ClimateService 1.0 ClimateService.qml
diff --git a/imports/shared/service/movie/MovieService.qml b/imports/shared/service/movie/MovieService.qml
new file mode 100644
index 0000000..0e9655b
--- /dev/null
+++ b/imports/shared/service/movie/MovieService.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune IVI UI.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+pragma Singleton
+
+import QtQuick 2.0
+import "." 1.0
+
+QtObject {
+ id: root
+ property var movieProvider
+ property int currentIndex: 0
+ property int trackCount
+ property var currentTrack
+
+
+ function nextTrack() {
+ if (movieProvider)
+ movieProvider.next()
+ }
+
+ function previousTrack() {
+ if (movieProvider)
+ movieProvider.previous()
+ }
+
+ function sourcePath(source) {
+ return movieProvider ? movieProvider.sourcePath(source) : ""
+ }
+
+
+ function coverPath(cover) {
+ return movieProvider ? movieProvider.coverPath(cover) : ""
+ }
+
+ function selectRandomTracks() {
+ if (movieProvider)
+ movieProvider.selectRandom()
+ }
+}
diff --git a/imports/shared/service/movie/qmldir b/imports/shared/service/movie/qmldir
new file mode 100644
index 0000000..764d674
--- /dev/null
+++ b/imports/shared/service/movie/qmldir
@@ -0,0 +1 @@
+singleton MovieService 1.0 MovieService.qml
diff --git a/imports/shared/service/music/MusicService.qml b/imports/shared/service/music/MusicService.qml
new file mode 100644
index 0000000..22e858b
--- /dev/null
+++ b/imports/shared/service/music/MusicService.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune IVI UI.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.0
+import QtMultimedia 5.0
+import "." 1.0
+
+QtObject {
+ id: root
+
+ property string defaultMusicApp: "com.pelagicore.media"
+ property var musicProvider
+ property Audio player: Audio {
+ id: player
+ source: currentTrack ? root.url : ""
+ onVolumeChanged: {
+ print('volume: ' + volume)
+ }
+ onStatusChanged: {
+ if (status == Audio.EndOfMedia)
+ nextTrack()
+ }
+ }
+
+ property alias volume: player.volume
+
+ property int currentIndex
+ property int trackCount
+ property var currentTrack
+ property string coverPath
+ property bool playing: player.playbackState === Audio.PlayingState
+ property alias duration: player.duration
+ property alias position: player.position
+ property string currentTime: Qt.formatTime(new Date(position), 'mm:ss')
+ property string durationTime: Qt.formatTime(new Date(duration), 'mm:ss')
+ property int remaining: player.duration - player.position
+ property string remainingTime: Qt.formatTime(new Date(remaining), 'mm:ss')
+ property string url
+
+ function musicPlay() {
+ player.source = Qt.binding(function() { return currentTrack ? root.url : ""})
+ play()
+ }
+
+ function play() {
+ print('MusicService.play: ' + player.source)
+ player.autoPlay = true
+ player.play()
+ }
+
+ function pause() {
+ print('MusicService.pause: ' + player.source)
+ player.autoPlay = false
+ player.pause()
+ }
+
+ function togglePlay() {
+ if (playing) {
+ pause()
+ } else {
+ play()
+ }
+ }
+
+ function nextTrack() {
+ if (root.musicProvider)
+ root.musicProvider.next()
+ }
+
+ function previousTrack() {
+ if (root.musicProvider)
+ root.musicProvider.previous()
+ }
+
+ function selectAllAlbums() {
+ provider.query = 'select distinct album, cover, artist from music'
+ }
+
+ function seek(value) {
+ player.seek(value)
+ }
+
+ Component.onDestruction: {
+ // required to avoid crashing qmllive
+ player.autoLoad = false
+ player.autoPlay = false
+ player.stop()
+ player.source = ''
+ }
+}
diff --git a/imports/shared/service/music/qmldir b/imports/shared/service/music/qmldir
new file mode 100644
index 0000000..3ca99e6
--- /dev/null
+++ b/imports/shared/service/music/qmldir
@@ -0,0 +1 @@
+singleton MusicService 1.0 MusicService.qml
diff --git a/imports/shared/service/settings/SettingsService.qml b/imports/shared/service/settings/SettingsService.qml
new file mode 100644
index 0000000..10577bc
--- /dev/null
+++ b/imports/shared/service/settings/SettingsService.qml
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune IVI UI.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.1
+
+QtObject {
+ id: root
+
+ property bool clusterVisible: true
+ property string unitSystem: "metric" // "metric" or "imp_us"
+ property bool metric: unitSystem === "metric"
+
+ property ListModel entries: ListModel {
+ ListElement { title: "USER PROFILE"; icon: "profile"; checked: true; hasChildren: true }
+ ListElement { title: "SERVICE & SUPPORT"; icon: "service"; checked: false; hasChildren: false }
+ ListElement { title: "TRAFFIC INFORMATION"; icon: "warning"; checked: true; hasChildren: true }
+ ListElement { title: "TOLL & CONGESTION FEES"; icon: "toll"; checked: false; hasChildren: true }
+ ListElement { title: "METRIC SYSTEM"; icon: "fees"; checked: true; hasChildren: false }
+ ListElement { title: "APP UPDATES"; icon: "updates"; checked: true; hasChildren: true }
+ ListElement { title: "INSURANCE FEATURES"; icon: "insurance"; checked: true; hasChildren: true }
+ }
+
+ property var carSettings: [
+ { section: "Units", option: clockOption },
+ { section: "Units", option: speedOption },
+ { section: "Communication", option: bluetoothOption }
+ ]
+
+ property var clockOption: QtObject {
+ property string format: active === 0 ? "hh:mm" : "h:mm AP"
+ property var options: ['24H', 'AM/PM']
+ property string name: "Time"
+ property int active: 0
+
+ function setActive(index) { active = index }
+ }
+
+ property var speedOption: QtObject {
+ property var options: ['KMH', 'MPH']
+ property string name: "Speed"
+ property int active: 0
+
+ function setActive(index) { active = index }
+ }
+
+ property var bluetoothOption: QtObject {
+
+ property string name: "Bluetooth"
+ property bool active: false
+
+ function setActive(value) { active = value }
+ }
+
+ property ListModel functions: ListModel {
+ ListElement {
+ description: "Hill descent control"
+ icon: "hill_descent_control"
+ active: true
+ }
+ ListElement {
+ description: "Intelligent speed adaptation"
+ icon: "intelligent_speed_adaptation"
+ active: false
+ }
+ ListElement {
+ description: "Automatic beam switching"
+ icon: "automatic_beam_switching"
+ active: true
+ }
+ ListElement {
+ description: "Collision avoidance"
+ icon: "collision_avoidance"
+ active: false
+ }
+ ListElement {
+ description: "Lane keeping assist"
+ icon: "lane_keeping_assist"
+ active: false
+ }
+ ListElement {
+ description: "Traffic jam assist"
+ icon: "traffic_jam_assist"
+ active: false
+ }
+ ListElement {
+ description: "Driver drowsyness alert"
+ icon: "driver_drownsyness_alert"
+ active: true
+ }
+ ListElement {
+ description: "Park assist"
+ icon: "park_assist"
+ active: false
+ }
+ }
+}
diff --git a/imports/shared/service/settings/qmldir b/imports/shared/service/settings/qmldir
new file mode 100644
index 0000000..950972f
--- /dev/null
+++ b/imports/shared/service/settings/qmldir
@@ -0,0 +1 @@
+singleton SettingsService 1.0 SettingsService.qml
diff --git a/imports/shared/service/statusbar/StatusBarService.qml b/imports/shared/service/statusbar/StatusBarService.qml
new file mode 100644
index 0000000..e14bc30
--- /dev/null
+++ b/imports/shared/service/statusbar/StatusBarService.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune IVI UI.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.0
+import service.settings 1.0
+
+Item {
+ id: root
+
+ property string clusterTitle: ""
+ property int pageIndicatorSize: 3
+ property int currentPage: 0
+
+ property var indicators: [
+ { name: "4g-signal-strength", active: true },
+ { name: "bluetooth", active: SettingsService.bluetoothOption.active },
+ { name: "wifi-signal-strength", active: true }
+ ]
+
+ property var currentDate: new Date();
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ currentDate = new Date()
+ }
+ }
+
+ visible: false
+}
diff --git a/imports/shared/service/statusbar/qmldir b/imports/shared/service/statusbar/qmldir
new file mode 100644
index 0000000..129171d
--- /dev/null
+++ b/imports/shared/service/statusbar/qmldir
@@ -0,0 +1 @@
+singleton StatusBarService 1.0 StatusBarService.qml
diff --git a/imports/shared/service/valuesource/ValueSource.qml b/imports/shared/service/valuesource/ValueSource.qml
new file mode 100644
index 0000000..a534903
--- /dev/null
+++ b/imports/shared/service/valuesource/ValueSource.qml
@@ -0,0 +1,282 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.6
+import com.qtcompany.clusterdemodata 1.0
+
+Item {
+ id: valueSource
+ property real kph: 0
+ property real consumeKW: 0
+ property real maxConsumeKWValue: 90
+ property real maxChargeKWValue: 40
+ property real chargeKW: 0
+ property real maxRange: 600
+ property real range: (batteryLevel / 100) * maxRange
+
+ property string destination: "Ernst-Reuter-Platz"
+ property string currentLocation: "Kurt-Schumacher-Damm"
+
+ property var consumption: [300, 600, 700, 800, 900, 700, 600, 300, 50, 50, -100, 50, -100, -150,
+ -200, 50, 150, 200, 300, 200, 300, 200, 500, 50, -100, -100, -150, -80, 50, 300, 600, 700, 800,
+ 600, 700, 300, 50, 50]
+
+ property var turnSignal
+ property var currentDate: new Date()
+ //property string date: currentDate.toLocaleDateString(Qt.locale("fi_FI"), "ddd d. MMM")
+ //property string time: currentDate.toLocaleTimeString(Qt.locale("fi_FI"), "hh:mm")
+ property string date: currentDate.toLocaleDateString(Qt.locale("en_GB"))
+ property string time: currentDate.toLocaleTimeString(Qt.locale("en_GB"), "hh:mm")
+
+ ClusterData {
+ id: clusterDataSource
+
+ onVehicleSpeedChanged: {
+ kph = vehicleSpeed
+ }
+ property int notLeft: ~Qt.LeftArrow
+ property int notRight: ~Qt.RightArrow
+ onLeftTurnLightChanged: leftTurnLight ? turnSignal |= Qt.LeftArrow
+ : turnSignal &= notLeft
+ onRightTurnLightChanged: rightTurnLight ? turnSignal |= Qt.RightArrow
+ : turnSignal &= notRight
+ }
+
+ property real latitude: clusterDataSource.latitude
+ property real longitude: clusterDataSource.longitude
+ property real direction: clusterDataSource.direction
+ property bool lowBeam: automaticDemoMode//clusterDataSource.headLight
+ property int carId: clusterDataSource.carId
+ property bool lightFailure: clusterDataSource.lightFailure
+ property bool flatTire: clusterDataSource.flatTire
+
+ property bool frontLeftOpen: clusterDataSource.zoneAt.frontLeft.doorOpen
+ property bool frontRightOpen: clusterDataSource.zoneAt.frontRight.doorOpen
+ property bool rearLeftDoorOpen: clusterDataSource.zoneAt.rearLeft.doorOpen
+ property bool rearRighDoorOpen: clusterDataSource.zoneAt.rearRight.doorOpen
+ property bool hoodOpen: clusterDataSource.zoneAt.hood.doorOpen
+ property bool trunkOpen: clusterDataSource.zoneAt.trunk.doorOpen
+
+ property double batteryLevel: clusterDataSource.batteryPotential
+ property double fuelLevel: clusterDataSource.gasLevel
+ property int gear: clusterDataSource.gear
+ property bool parkingBrake: clusterDataSource.brake
+ // TODO: These two are hacks. View change messages might not come through CAN.
+ property bool viewChange: clusterDataSource.oilTemp
+ property bool rightViewChange: clusterDataSource.oilPressure
+
+ //
+ // ENABLE FOR FULLY AUTOMATIC DEMO MODE (in case there is no CanController)
+ //
+ property bool automaticDemoMode: true
+ property bool startAnimations: false
+
+ onAutomaticDemoModeChanged: {
+ if (startAnimations) {
+ kph = 0
+ if (automaticDemoMode) {
+ animation.start()
+ } else {
+ gear = 1
+ parkingBrake = false
+ animation.stop()
+ }
+ }
+ }
+
+ onStartAnimationsChanged: {
+ if (startAnimations)
+ animation.start()
+ }
+
+ //
+ // Speed animations for automatic demo mode
+ //
+ Timer {
+ running: startAnimations && automaticDemoMode
+ property bool turnLeft: true
+ repeat: true
+ interval: 7500
+ onTriggered: {
+ turnLeft = !turnLeft
+ if (turnLeft)
+ turnSignal = Qt.LeftArrow
+ else
+ turnSignal = Qt.RightArrow
+ stopSignaling.restart()
+ }
+ }
+
+ Timer {
+ id: stopSignaling
+ running: false
+ interval: 2750
+ onTriggered: turnSignal = Qt.NoArrow
+ }
+
+ Behavior on fuelLevel {
+ enabled: automaticDemoMode
+ PropertyAnimation {
+ duration: 18000
+ }
+ }
+
+ Behavior on batteryLevel {
+ enabled: automaticDemoMode
+ PropertyAnimation {
+ duration: 18000
+ }
+ }
+
+ onFuelLevelChanged: {
+ if (automaticDemoMode && fuelLevel <= 5)
+ fuelLevel = 100
+ }
+
+ onBatteryLevelChanged: {
+ if (automaticDemoMode && batteryLevel <= 5)
+ batteryLevel = 100
+ }
+
+ SequentialAnimation {
+ id: animation
+ running: false
+ loops: Animation.Infinite
+
+ ScriptAction {
+ script: {
+ gear = 0
+ parkingBrake = true
+ }
+ }
+ PauseAnimation { duration: 2000 }
+ ScriptAction {
+ script: {
+ parkingBrake = false
+ gear = 1
+ fuelLevel -= 10.
+ batteryLevel -= 10.
+ }
+ }
+ PropertyAnimation {
+ target: valueSource
+ property: "kph"
+ from: 0
+ to: 150
+ duration: 10000
+ }
+ PropertyAnimation {
+ target: valueSource
+ property: "kph"
+ from: 150
+ to: 120
+ duration: 500
+ }
+ PropertyAnimation {
+ target: valueSource
+ property: "kph"
+ from: 120
+ to: 200
+ duration: 1500
+ }
+ PropertyAnimation {
+ target: valueSource
+ property: "kph"
+ from: 200
+ to: 0
+ duration: 6000
+ }
+ }
+
+ // In normal Car UI mode only speed is animated based on gps data
+ // In automatic demo mode rpm, turbo, consumption and engine temperature are based on speed
+ //property int rpm: automaticDemoMode ? kph * 40 : kph * 150
+ //property double engineTemperature: automaticDemoMode ? kph * .25 + 60. : kph * .5 + 50.
+ // New route is faster, we can use the same values for both modes
+ property int rpm: kph * 40
+ property double engineTemperature: kph * .22 + 60.
+
+ property int totalDistance: 42300
+ property int kmSinceCharge: 8
+ property int avRangePerCharge: 425
+ property int energyPerKm: 324
+
+ property real totalDistanceSince: 0.
+
+ property string gearString: {
+ var g
+ if (gear === 0 || gear < -1)
+ return "N"
+ else if (gear === -1)
+ return "R"
+ else if (carId === 1) //sports car
+ return gear.toString()
+ else
+ return "D"
+ }
+
+ Timer {
+ id: timeTimer
+ interval: 15000
+ repeat: true
+ running: true
+ onTriggered: {
+ currentDate = new Date()
+ //date = currentDate.toLocaleDateString(Qt.locale("fi_FI"), "ddd d. MMM")
+ //time = currentDate.toLocaleTimeString(Qt.locale("fi_FI"), "hh:mm")
+ date = currentDate.toLocaleDateString(Qt.locale("en_GB"))
+ time = currentDate.toLocaleTimeString(Qt.locale("en_GB"), "hh:mm")
+ // Approximate total distance based on current speed
+ totalDistanceSince += kph / 240. // = km / 15 min
+ if (totalDistanceSince > 1.) {
+ var totalInt = Math.floor(totalDistanceSince)
+ totalDistance += totalInt
+ kmSinceCharge += totalInt
+ totalDistanceSince -= totalInt
+ }
+ }
+ }
+
+ Behavior on kph {
+ enabled: !automaticDemoMode
+ PropertyAnimation { duration: 2000 }
+ }
+}
diff --git a/imports/shared/service/valuesource/qmldir b/imports/shared/service/valuesource/qmldir
new file mode 100644
index 0000000..844c635
--- /dev/null
+++ b/imports/shared/service/valuesource/qmldir
@@ -0,0 +1 @@
+singleton ValueSource 1.0 ValueSource.qml