Add sample qml application
[staging/HomeScreen.git] / sample-qml / imports / vehicle / ClimateModel.qml
1 /* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
2  *
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 pragma Singleton
8
9 import QtQuick 2.0
10 import Automotive.ClimateControl 1.0
11
12 Item {
13     property real fanStepSize:1/255 //Represents the stepSize for a given Climate control.
14     property alias fanSpeed: fanControl.fanSpeedLevel
15
16     property real temperatureStepSize:1/15 //0== 15c, 15 == 30c
17
18     property alias leftTemp: leftFront.targetTemperature
19     property alias rightTemp: rightFront.targetTemperature
20
21     ClimateControlItem {
22         id:fanControl
23     }
24
25     ClimateControlItem {
26         id: leftFront
27         zone: 9
28     }
29
30     ClimateControlItem {
31         id: rightFront
32         zone: 5
33     }
34
35     function getRangeValue(inputVal,stepSize){
36         if(inputVal > 0){
37             return Math.ceil(inputVal/stepSize);
38         }else{
39             return 0;
40         }
41     }
42
43 }
44