1 /*global Bootstrap, hvacControler*/
4 * Heat, Ventilation and Air Conditioning provides UI controls to operate this subystem of the car from
5 * [tizen.vehicle API](https://raw.github.com/otcshare/automotive-message-broker/master/docs/amb.idl).
6 * Uses mainly {{#crossLink "CarIndicator"}}{{/crossLink}} module from {{#crossLink "Bootstrap/carIndicator:property"}}{{/crossLink}}.
8 * Application directly controls following AMB properties:
15 * * TargetTemperatureRight
16 * * TargetTemperatureLeft
24 * * DirectionIndicationINST
25 * * DirectionIndicationMS
31 * * HeatedSeatFRModeRequest
32 * * HeatedSeatFRRequest
33 * * HeatedSeatFLModeRequest
34 * * HeatedSeatFLRequest
38 * Additionaly HVAC application implements following scenarios:
40 * * Automatic AC mode - Sets Fan Speed to zero, Airflow direction to OFF, Air recirculation to off and both target temperatures to 22 degrees.
41 * Turning off Automatic AC mode will set all properties to their previous values. If any of properties are set separately Automatic AC mode is
43 * * Max defrost mode - Maximum defrost mode sets Fan speed to maximum value, Airflow direction to Screen and resets Left target temperature
44 * within range 16 to 28 degrees. If any of properties are set separately Max defrost mode is turned off.
46 * Hover and click on elements in images below to navigate to components of HVAC application.
48 * <img id="Image-Maps_1201312180420487" src="../assets/img/hvac.png" usemap="#Image-Maps_1201312180420487" border="0" width="649" height="1152" alt="" />
49 * <map id="_Image-Maps_1201312180420487" name="Image-Maps_1201312180420487">
50 * <area shape="rect" coords="0,0,573,78" href="../classes/TopBarIcons.html" alt="Top bar icons" title="Top bar icons" />
51 * <area shape="rect" coords="0,994,644,1147" href="../classes/BottomPanel.html" alt="bottom panel" title="Bottom panel" />
52 * <area shape="rect" coords="573,1,644,76" href="../modules/Settings.html" alt="Settings" title="Settings" />
53 * <area shape="rect" coords="138,103,513,176" alt="Hazard button" title="Hazard button" target="_self" href="../classes/hvacControler.html#method_onHazardChanged" >
54 * <area shape="rect" coords="13,197,99,653" alt="Left target temperature" title="Left target temperature" target="_self" href="../classes/hvacControler.html#method_onTargetTemperatureLeftChanged" >
55 * <area shape="rect" coords="551,194,637,650" alt="Right target temperature" title="Right target temperature" target="_self" href="../classes/hvacControler.html#method_onTargetTemperatureRightChanged" >
56 * <area shape="rect" coords="369,403,512,612" alt="Right target temperature indicator" title="Right target temperature indicator" target="_self" href="../classes/hvacControler.html#method_onTargetTemperatureRightChanged" >
57 * <area shape="rect" coords="135,404,278,614" alt="Left target temperature indicator" title="Left target temperature indicator" target="_self" href="../classes/hvacControler.html#method_onTargetTemperatureLeftChanged" >
58 * <area shape="rect" coords="137,252,278,368" alt="Left seat heater" title="Left seat heater" target="_self" href="../classes/hvacControler.html#method_onSeatHeaterLeftChanged" >
59 * <area shape="rect" coords="370,252,511,368" alt="Right seat heater" title="Right seat heater" target="_self" href="../classes/hvacControler.html#method_onSeatHeaterRightChanged" >
60 * <area shape="rect" coords="391,780,491,860" alt="Air recirculation" title="Air recirculation" target="_self" href="../classes/hvacControler.html#method_onAirRecirculationChanged" >
61 * <area shape="rect" coords="157,780,257,860" alt="Fan status" title="Fan status" target="_self" href="../classes/hvacControler.html#method_onFanChanged" >
62 * <area shape="rect" coords="273,781,373,861" alt="Automatic AC mode" title="Automatic AC mode" target="_self" href="../classes/HVAC.html" >
63 * <area shape="rect" coords="151,653,498,764" alt="Fan speed" title="Fan speed" target="_self" href="../classes/hvacControler.html#method_onFanSpeedChanged" >
64 * <area shape="rect" coords="17,672,135,961" alt="Airflow direction" title="Airflow direction" target="_self" href="../classes/hvacControler.html#method_onAirflowDirectionChanged" >
65 * <area shape="rect" coords="516,781,626,859" alt="Rear defrost" title="Rear defrost" target="_self" href="../classes/hvacControler.html#method_onRearDefrostChanged" >
66 * <area shape="rect" coords="518,876,627,956" alt="Front defrost" title="Front defrost" target="_self" href="../classes/hvacControler.html#method_onFrontDefrostChanged" >
67 * <area shape="rect" coords="515,676,627,764" alt="Max defrost mode" title="Max defrost mode" target="_self" href="../classes/HVAC.html" >
68 * <area shape="rect" coords="646,1150,648,1152" alt="Image Map" title="Image Map" href="http://www.image-maps.com/index.php?aff=mapped_users_0" >
72 * @module HVACApplication
73 * @main HVACApplication
78 * Reference to instance of bootstrap class.
79 * @property bootstrap {Bootstrap}
84 * Initializes plugins and register events for HVAC app.
88 var init = function() {
90 var hvacIndicator = new hvacControler();
91 bootstrap = new Bootstrap(function(status) {
92 $("#topBarIcons").topBarIconsPlugin('init');
93 $('#bottomPanel').bottomPanel('init');
95 $(".noUiSliderLeft").noUiSlider({
101 orientation : "vertical",
103 if ($("#defrost_max_btn").hasClass("on")) {
104 switch ($(this).val()) {
113 bootstrap.carIndicator.setStatus("targetTemperatureLeft", ($(this).val() + 29) - ($(this).val() * 2));
114 bootstrap.carIndicator.setStatus("FrontTSetLeftCmd", ($(this).val() + 29) - ($(this).val() * 2));
118 $(".noUiSliderRight").noUiSlider({
124 orientation : "vertical",
126 bootstrap.carIndicator.setStatus("targetTemperatureRight", ($(this).val() + 29) - ($(this).val() * 2));
127 bootstrap.carIndicator.setStatus("FrontTSetRightCmd", ($(this).val() + 29) - ($(this).val() * 2));
131 $(".noUiSliderFan").noUiSlider({
137 orientation : "horizontal",
139 bootstrap.carIndicator.setStatus("fanSpeed", $(this).val());
141 if ($(this).val() > 0 && $(this).val() < 9) {
142 bootstrap.carIndicator.setStatus("FrontBlwrSpeedCmd", ($(this).val() * 2) - 1);
147 bootstrap.carIndicator.addListener({
148 onAirRecirculationChanged : function(newValue) {
149 hvacIndicator.onAirRecirculationChanged(newValue);
151 onFanChanged : function(newValue) {
152 hvacIndicator.onFanChanged(newValue);
154 onFanSpeedChanged : function(newValue) {
155 hvacIndicator.onFanSpeedChanged(newValue);
157 onTargetTemperatureRightChanged : function(newValue) {
158 hvacIndicator.onTargetTemperatureRightChanged(newValue);
160 onTargetTemperatureLeftChanged : function(newValue) {
161 hvacIndicator.onTargetTemperatureLeftChanged(newValue);
163 onHazardChanged : function(newValue) {
164 hvacIndicator.onHazardChanged(newValue);
166 onSeatHeaterRightChanged : function(newValue) {
167 hvacIndicator.onSeatHeaterRightChanged(newValue);
169 onSeatHeaterLeftChanged : function(newValue) {
170 hvacIndicator.onSeatHeaterLeftChanged(newValue);
172 onAirflowDirectionChanged : function(newValue) {
173 hvacIndicator.onAirflowDirectionChanged(newValue);
175 onFrontDefrostChanged : function(newValue) {
176 hvacIndicator.onFrontDefrostChanged(newValue);
178 onRearDefrostChanged : function(newValue) {
179 hvacIndicator.onRearDefrostChanged(newValue);
186 * Calls initialization fuction after document is loaded.
187 * @method $(document).ready
188 * @param init {function} Callback function for initialize Homescreen.
193 // debug mode - window.setTimeout("init()", 20000);