Add Modello web sample applications; version up
[profile/ivi/sdk/web-sample-build.git] / samples / web / Sample / Tizen / Web App / Modello_Hvac / project / js / hvacControler.js
1 /*global bootstrap*/
2
3 /**
4  * Class provides methods to fill the content of HVAC's UI.
5  * @class hvacControler
6  * @module HVACApplication
7  */
8 var hvacControler = function() {
9         "use strict";
10         this.initButtons();
11 };
12
13 /**
14  * Holds statuses of connected buttons when turning Auto AC button ON.
15  * @property autoACStatus {Object}
16  */
17 var autoACStatus = {
18         fanSpeed : 0,
19         airflowDirection : 0,
20         fan : false,
21         airRecirculation : false,
22         targetTemperatureRight : 0,
23         targetTemperatureLeft : 0,
24         maxDefrost : false
25 };
26
27 /**
28  * Holds hazard timer object.
29  * @property hazardTimer {Object}
30  */
31 var hazardTimer;
32
33 /**
34  * Holds interval value for hazard timer in ms.
35  * @property hazardTimerInterval {Integer}
36  * @default 1000
37  */
38 var hazardTimerInterval = 1000;
39
40 /**
41  * Implements hazard light blinking functionality.
42  * @property hazardLight
43  */
44 var hazardLight = {
45         currentIndex : 1,
46         change : function() {
47                 "use strict";
48                 if (hazardLight.currentIndex === 0) {
49                         $("#hazard_btn").removeClass("blink");
50                         hazardLight.currentIndex = 1;
51                 } else if (hazardLight.currentIndex === 1) {
52                         $("#hazard_btn").addClass("blink");
53                         hazardLight.currentIndex = 0;
54                 }
55         }
56 };
57
58 /**
59  * Changes the status of AirflowDirection.
60  * @method changeAirflowDirectionStatus
61  * @param button {Object} AirflowDirection button
62  * @param currentStatus {Integer} current status of AirflowDirection
63  * @param value {Integer} AirflowDirection button value
64  * @return newStatus {Integer} a new status of AirflowDirection
65  */
66 function changeAirflowDirectionStatus(button, currentStatus, value) {
67         "use strict";
68         var newStatus;
69         if ($(button).hasClass("on") === true) {
70                 newStatus = currentStatus - value;
71         } else {
72                 newStatus = currentStatus + value;
73         }
74         return newStatus;
75 }
76
77 /**
78  * Toggles the SeatHeater button to its corresponding value.
79  * @method toggleSeatHeaterButton
80  * @param status {Integer} status to toggle the SeatHeater button to
81  * @param button {Object} SeatHeater button to toggle
82  */
83 function toggleSeatHeaterButton(status, button) {
84         "use strict";
85         if ((status >= 0) && (status <= 3)) {
86
87                 // Setting SeatHeater button to OFF state
88                 if ($(button).hasClass("stage4")) {
89                         $(button).removeClass("stage4");
90                 }
91                 if ($(button).hasClass("stage3")) {
92                         $(button).removeClass("stage3");
93                 }
94                 if ($(button).hasClass("stage2")) {
95                         $(button).removeClass("stage2");
96                 }
97                 if (!$(button).hasClass("stage1")) {
98                         $(button).addClass("stage1");
99                 }
100
101                 switch (status) {
102                 case 0:
103                         // Nothing to do as SeatHeater button was set to OFF state above
104                         break;
105                 case 1:
106                         $(button).addClass("stage2");
107                         break;
108                 case 2:
109                         $(button).addClass("stage3");
110                         break;
111                 case 3:
112                         $(button).addClass("stage4");
113                         break;
114                 }
115         }
116 }
117
118 /**
119  * Toggles the button ON/OFF.
120  * @method toggleButton
121  * @param buttonStatus {Boolean} ON/OFF status of the button
122  * @param button {Object} button to toggle ON/OFF
123  */
124 function toggleButton(buttonStatus, button) {
125         "use strict";
126         if (buttonStatus === true || buttonStatus === "true") {
127                 $(button).addClass("on");
128         } else {
129                 $(button).removeClass("on");
130         }
131 }
132
133 /**
134  * Turns the Auto AC button OFF.
135  * @method switchAutoACOff
136  */
137 function switchAutoACOff() {
138         "use strict";
139         if ($("#fan_control_auto").hasClass("on")) {
140                 $("#fan_control_auto").removeClass("on");
141         }
142 }
143
144 /**
145  * Gets the TargetTemperature slider value depending on temperature.
146  * @method getTargetTemperatureSliderValue
147  * @param temperature {Integer} temperature in Celsius degrees
148  * @return value {Integer} TargetTemperature slider value
149  */
150 function getTargetTemperatureSliderValue(temperature) {
151         "use strict";
152         var value;
153         if (temperature > 28) {
154                 value = 0;
155                 switchAutoACOff();
156         } else if (temperature < 16) {
157                 value = 14;
158                 switchAutoACOff();
159         } else {
160                 value = (temperature + 29) - (temperature * 2);
161         }
162         return value;
163 }
164
165 /**
166  * Sets AirflowDirection status to all the corresponding signals.
167  * @method setAirFlowDirectionStatus
168  * @param newStatus {Integer} a new AirflowDirection status value
169  */
170 function setAirFlowDirectionStatus(newStatus) {
171         "use strict";
172         bootstrap.carIndicator.setStatus("airflowDirection", newStatus);
173         bootstrap.carIndicator.setStatus("FLHSDistrCmd", newStatus);
174         bootstrap.carIndicator.setStatus("FRHSDistrCmd", newStatus);
175 }
176
177 /**
178  * Sets the status of AirRecirculation button. Allows following values:
179  *
180  * * `true` - `ON` - also turns off Automatic AC mode
181  * * `false` - `OFF`
182  *
183  * @method onAirRecirculationChanged
184  * @param newStatus {Boolean} New status of AirRecirculation
185  */
186 hvacControler.prototype.onAirRecirculationChanged = function(newStatus) {
187         "use strict";
188         if (newStatus === false || newStatus === "false") {
189                 $("#fan_control_circ").removeClass("on");
190         } else {
191                 $("#fan_control_circ").addClass("on");
192                 switchAutoACOff();
193         }
194 };
195
196 /**
197  * Sets the status of A/C button. Allows following values:
198  *
199  * * `true` - `ON`
200  * * `false` - `OFF` - also turns off Automatic AC mode
201  *
202  * @method onFanChanged
203  * @param newStatus {Boolean} New status of AirConditioning
204  */
205 hvacControler.prototype.onFanChanged = function(newStatus) {
206         "use strict";
207         if (newStatus === false || newStatus === "false") {
208                 $("#fan_control_ac").removeClass("on");
209                 switchAutoACOff();
210         } else {
211                 $("#fan_control_ac").addClass("on");
212         }
213 };
214
215 /**
216  * Sets the status of FanSpeed button. Allows following values:
217  *
218  * * `0` = `OFF`
219  * * `1` - `8` = sets fan speed to this value and also turns off Automatic AC mode
220  *
221  * @method onFanSpeedChanged
222  * @param newStatus {Integer} new status of FanSpeed
223  */
224 hvacControler.prototype.onFanSpeedChanged = function(newStatus) {
225         "use strict";
226         $("#fanSpeedSlider").val(newStatus);
227         $(".fanSpeedOn").css('width', parseInt($(".noUiSliderFan.horizontal.connect").find("a").css('left'), 10));
228         if (newStatus === 0) {
229                 bootstrap.carIndicator.setStatus("airflowDirection", 0);
230         } else if (newStatus > 0) {
231                 switchAutoACOff();
232         }
233 };
234
235 /**
236  * Sets the status of Right TargetTemperature slider and Right Temperature scrollable box.
237  * Temperature can be set to following values:
238  *
239  * * below `16` - `LOW`, also turns off Automatic AC mode
240  * * between `16` and `28` - exact temperature in Celsius degrees
241  * * above `28` - `HIGH`, also turns off Automatic AC mode
242  *
243  * @method onTargetTemperatureRightChanged
244  * @param newStatus {Integer} new status of Right TargetTemperature in Celsius degrees
245  */
246 hvacControler.prototype.onTargetTemperatureRightChanged = function(newStatus) {
247         "use strict";
248         var value = getTargetTemperatureSliderValue(newStatus);
249         $("#noUiSliderRight").val(value);
250         $(".scrollable.right").find(".temperature").stop(true, true).animate({
251                 "top" : (-680.0606 + (value * +48.57) + '%')
252         });
253 };
254
255 /**
256  * Sets the status of Left TargetTemperature slider and Left Temperature scrollable box.
257  * Temperature can be set to following values:
258  *
259  * * below `16` - `LOW`, also turns off Automatic AC mode
260  * * between `16` and `28` - exact temperature in Celsius degrees
261  * * above `28` - `HIGH`, also turns off Automatic AC mode
262  *
263  * @method onTargetTemperatureLeftChanged
264  * @param newStatus {Integer} new status of Left TargetTemperature in Celsius degrees
265  */
266 hvacControler.prototype.onTargetTemperatureLeftChanged = function(newStatus) {
267         "use strict";
268         var value = getTargetTemperatureSliderValue(newStatus);
269         $("#noUiSliderLeft").val(value);
270         $(".scrollable.left").find(".temperature").stop(true, true).animate({
271                 "top" : (-680.0606 + (value * +48.57) + '%')
272         });
273 };
274
275 /**
276  * Sets the status of Hazard button. Blink interval of hazard light can be configured
277  * using [hazardTimerInterval](../classes/hvacControler.html#property_hazardTimerInterval).
278  * @method onHazardChanged
279  * @param newStatus {Boolean} new status of the Hazard
280  */
281 hvacControler.prototype.onHazardChanged = function(newStatus) {
282         "use strict";
283         if (newStatus === true || newStatus === "true") {
284                 $("#hazard_btn").addClass("on");
285                 hazardTimer = setInterval(hazardLight.change, hazardTimerInterval);
286         } else {
287                 clearInterval(hazardTimer);
288                 hazardTimer = null;
289                 $("#hazard_btn").removeClass("on");
290                 if ($("#hazard_btn").hasClass("blink") === true) {
291                         $("#hazard_btn").removeClass("blink");
292                 }
293         }
294 };
295
296 /**
297  * Sets the status of Right SeatHeater button. Allows 4 levels of heating:
298  *
299  * * `0` - Off
300  * * `1` - Low
301  * * `2` - Normal
302  * * `3` - High
303  *
304  * @method onSeatHeaterRightChanged
305  * @param status {Integer} new status of Right SeatHeater
306  */
307 hvacControler.prototype.onSeatHeaterRightChanged = function(status) {
308         "use strict";
309         toggleSeatHeaterButton(status, "#right_seat_btn_stage");
310 };
311
312 /**
313  * Sets the status of Left SeatHeater button. Allows 4 levels of heating:
314  *
315  * * `0` - Off
316  * * `1` - Low
317  * * `2` - Normal
318  * * `3` - High
319  *
320  * @method onSeatHeaterLeftChanged
321  * @param status {Integer} new status of Left SeatHeater
322  */
323 hvacControler.prototype.onSeatHeaterLeftChanged = function(status) {
324         "use strict";
325         toggleSeatHeaterButton(status, "#left_seat_btn_stage");
326 };
327
328 /**
329  * Sets the status of AirflowDirection buttons to one of the following values:
330  *
331  * * `1` - `FOOT`
332  * * `2` - `FACE`
333  * * `4` - `SCREEN` - when disabled Max defrost mode is turned off as well.
334  *
335  * Values can be combined, e.g. `3` is `FOOT` + `FACE`. If any of these values is
336  * set Automatic AC mode is turned off.
337  *
338  * @method onAirflowDirectionChanged
339  * @param newStatus {Integer} new status of the AirflowDirection
340  */
341 hvacControler.prototype.onAirflowDirectionChanged = function(newStatus) {
342         "use strict";
343         if ((newStatus >= 0) && (newStatus <= 7)) {
344
345                 if (newStatus === 7) {
346                         // Setting all the buttons to ON state
347                         if ($("#fan_dir_up_btn").hasClass("on") === false) {
348                                 $("#fan_dir_up_btn").addClass("on");
349                         }
350                         if ($("#fan_dir_down_btn").hasClass("on") === false) {
351                                 $("#fan_dir_down_btn").addClass("on");
352                         }
353                         if ($("#fan_dir_right_btn").hasClass("on") === false) {
354                                 $("#fan_dir_right_btn").addClass("on");
355                         }
356                 } else {
357                         // Setting all the buttons to OFF state
358                         if ($("#fan_dir_up_btn").hasClass("on") === true) {
359                                 $("#fan_dir_up_btn").removeClass("on");
360                         }
361                         if ($("#fan_dir_down_btn").hasClass("on") === true) {
362                                 $("#fan_dir_down_btn").removeClass("on");
363                         }
364                         if ($("#fan_dir_right_btn").hasClass("on") === true) {
365                                 $("#fan_dir_right_btn").removeClass("on");
366                         }
367                 }
368
369                 switch (newStatus) {
370                 // AUTO state when all the buttons are OFF
371                 case 0:
372                         // Nothing to do as all the buttons were set to OFF state above
373                         break;
374                 // FOOT ON
375                 case 1:
376                         $("#fan_dir_down_btn").addClass("on");
377                         break;
378                 // FACE ON
379                 case 2:
380                         $("#fan_dir_right_btn").addClass("on");
381                         break;
382                 // FOOT ON, FACE ON
383                 case 3:
384                         $("#fan_dir_down_btn").addClass("on");
385                         $("#fan_dir_right_btn").addClass("on");
386                         break;
387                 // SCREEN ON
388                 case 4:
389                         $("#fan_dir_up_btn").addClass("on");
390                         break;
391                 // FOOT ON, SCREEN ON
392                 case 5:
393                         $("#fan_dir_down_btn").addClass("on");
394                         $("#fan_dir_up_btn").addClass("on");
395                         break;
396                 // SCREEN ON, FACE ON
397                 case 6:
398                         $("#fan_dir_up_btn").addClass("on");
399                         $("#fan_dir_right_btn").addClass("on");
400                         break;
401                 // FOOT ON, FACE ON, SCREEN ON
402                 case 7:
403                         // Nothing to do as this option is handled above
404                         break;
405                 }
406
407                 // If SCREEN OFF, Max Defrost OFF
408                 if ((newStatus >= 0) && (newStatus <= 3)) {
409                         if ($("#defrost_max_btn").hasClass("on")) {
410                                 $("#defrost_max_btn").removeClass("on");
411                         }
412                 }
413
414                 if (newStatus > 0) {
415                         switchAutoACOff();
416                 }
417         }
418 };
419
420 /**
421  * Sets the status of Rear Defrost button. Allows following values:
422  *
423  * * `true` - `ON`
424  * * `false` - `OFF`
425  *
426  * @method onRearDefrostChanged
427  * @param newStatus {Boolean} new status of the Rear Defrost
428  */
429 hvacControler.prototype.onRearDefrostChanged = function(newStatus) {
430         "use strict";
431         toggleButton(newStatus, "#defrost_rear_btn");
432 };
433
434 /**
435  * Sets the status of Front Defrost button. Allows following values:
436  *
437  * * `true` - `ON`
438  * * `false` - `OFF`
439  *
440  * @method onFrontDefrostChanged
441  * @param newStatus {Boolean} new status of the Front Defrost
442  */
443 hvacControler.prototype.onFrontDefrostChanged = function(newStatus) {
444         "use strict";
445         toggleButton(newStatus, "#defrost_front_btn");
446 };
447
448 /**
449  * HVAC buttons initialisation.
450  * @method initButtons
451  */
452 hvacControler.prototype.initButtons = function() {
453         "use strict";
454         // Hazard
455         $("#hazard_btn").bind('click', function() {
456                 bootstrap.carIndicator.setStatus("hazard", !bootstrap.carIndicator.status.hazard);
457                 bootstrap.carIndicator.setStatus("DirectionIndicationINST", !bootstrap.carIndicator.status.hazard ? 3 : 0);
458                 bootstrap.carIndicator.setStatus("DirectionIndicationMS", !bootstrap.carIndicator.status.hazard ? 3 : 0);
459         });
460         // A/C
461         $("#fan_control_ac").bind('click', function() {
462                 bootstrap.carIndicator.setStatus("Fan", !bootstrap.carIndicator.status.fan);
463                 bootstrap.carIndicator.setStatus("ACCommand", !bootstrap.carIndicator.status.fan);
464         });
465         // AUTO AC
466         $("#fan_control_auto").bind('click', function() {
467                 if (!$("#fan_control_auto").hasClass("on")) {
468                         autoACStatus.fanSpeed = bootstrap.carIndicator.status.fanSpeed;
469                         autoACStatus.airflowDirection = bootstrap.carIndicator.status.airflowDirection;
470                         autoACStatus.fan = bootstrap.carIndicator.status.fan;
471                         autoACStatus.airRecirculation = bootstrap.carIndicator.status.airRecirculation;
472                         autoACStatus.targetTemperatureRight = bootstrap.carIndicator.status.targetTemperatureRight;
473                         autoACStatus.targetTemperatureLeft = bootstrap.carIndicator.status.targetTemperatureLeft;
474                         autoACStatus.maxDefrost = $("#defrost_max_btn").hasClass("on") ? true : false;
475
476                         if (autoACStatus.maxDefrost) {
477                                 $("#defrost_max_btn").removeClass("on");
478                         }
479
480                         $("#fan_control_auto").addClass("on");
481
482                         bootstrap.carIndicator.setStatus("fanSpeed", 0);
483
484                         setAirFlowDirectionStatus(0);
485
486                         bootstrap.carIndicator.setStatus("Fan", true);
487                         bootstrap.carIndicator.setStatus("ACCommand", true);
488
489                         bootstrap.carIndicator.setStatus("airRecirculation", false);
490                         bootstrap.carIndicator.setStatus("RecircReq", 0);
491
492                         if (autoACStatus.targetTemperatureRight < 16 || autoACStatus.targetTemperatureRight > 28) {
493                                 bootstrap.carIndicator.setStatus("targetTemperatureRight", 22);
494                                 bootstrap.carIndicator.setStatus("FrontTSetRightCmd", 22);
495                         }
496                         if (autoACStatus.targetTemperatureLeft < 16 || autoACStatus.targetTemperatureLeft > 28) {
497                                 bootstrap.carIndicator.setStatus("targetTemperatureLeft", 22);
498                                 bootstrap.carIndicator.setStatus("FrontTSetLeftCmd", 22);
499                         }
500                 } else {
501                         $("#fan_control_auto").removeClass("on");
502
503                         bootstrap.carIndicator.setStatus("fanSpeed", autoACStatus.fanSpeed);
504                         if (autoACStatus.fanSpeed > 0 && autoACStatus.fanSpeed < 9) {
505                                 bootstrap.carIndicator.setStatus("FrontBlwrSpeedCmd", (autoACStatus.fanSpeed * 2) - 1);
506                         }
507
508                         setAirFlowDirectionStatus(autoACStatus.airflowDirection);
509
510                         bootstrap.carIndicator.setStatus("Fan", autoACStatus.fan);
511                         bootstrap.carIndicator.setStatus("ACCommand", autoACStatus.fan);
512
513                         bootstrap.carIndicator.setStatus("airRecirculation", autoACStatus.airRecirculation);
514                         bootstrap.carIndicator.setStatus("RecircReq", autoACStatus.airRecirculation ? 1 : 0);
515
516                         bootstrap.carIndicator.setStatus("targetTemperatureRight", autoACStatus.targetTemperatureRight);
517                         bootstrap.carIndicator.setStatus("FrontTSetRightCmd", autoACStatus.targetTemperatureRight);
518
519                         bootstrap.carIndicator.setStatus("targetTemperatureLeft", autoACStatus.targetTemperatureLeft);
520                         bootstrap.carIndicator.setStatus("FrontTSetLeftCmd", autoACStatus.targetTemperatureRight);
521
522                         if (autoACStatus.maxDefrost) {
523                                 $("#defrost_max_btn").addClass("on");
524                         }
525                 }
526         });
527         // AirRecirculation
528         $("#fan_control_circ").bind('click', function() {
529                 bootstrap.carIndicator.setStatus("airRecirculation", !bootstrap.carIndicator.status.airRecirculation);
530                 bootstrap.carIndicator.setStatus("RecircReq", !bootstrap.carIndicator.status.airRecirculation ? 1 : 0);
531         });
532         // SeatHeater - front right
533         $("#right_seat_btn").bind('click', function() {
534                 var status = bootstrap.carIndicator.status.seatHeaterRight;
535                 if (((status) >= 0) && ((status) <= 3)) {
536                         switch (status) {
537                         case 0:
538                         case 1:
539                         case 2:
540                                 status = status + 1;
541                                 break;
542                         case 3:
543                                 status = 0;
544                                 break;
545                         }
546                         bootstrap.carIndicator.setStatus("seatHeaterRight", status);
547
548                         if (status === 0) {
549                                 bootstrap.carIndicator.setStatus("HeatedSeatFRModeRequest", 3);
550                         } else {
551                                 bootstrap.carIndicator.setStatus("HeatedSeatFRModeRequest", 0);
552                         }
553
554                         var request;
555
556                         switch (status) {
557                         case 0:
558                         case 1:
559                                 request = status;
560                                 break;
561                         case 2:
562                                 request = 3;
563                                 break;
564                         case 3:
565                                 request = 5;
566                                 break;
567                         }
568
569                         bootstrap.carIndicator.setStatus("HeatedSeatFRRequest", request);
570                 }
571         });
572         // SeatHeater - front left
573         $("#left_seat_btn").bind('click', function() {
574                 var status = bootstrap.carIndicator.status.seatHeaterLeft;
575                 if (((status) >= 0) && ((status) <= 3)) {
576                         switch (status) {
577                         case 0:
578                         case 1:
579                         case 2:
580                                 status = status + 1;
581                                 break;
582                         case 3:
583                                 status = 0;
584                                 break;
585                         }
586                         bootstrap.carIndicator.setStatus("seatHeaterLeft", status);
587
588                         if (status === 0) {
589                                 bootstrap.carIndicator.setStatus("HeatedSeatFLModeRequest", 3);
590                         } else {
591                                 bootstrap.carIndicator.setStatus("HeatedSeatFLModeRequest", 0);
592                         }
593
594                         var request;
595
596                         switch (status) {
597                         case 0:
598                         case 1:
599                                 request = status;
600                                 break;
601                         case 2:
602                                 request = 3;
603                                 break;
604                         case 3:
605                                 request = 5;
606                                 break;
607                         }
608
609                         bootstrap.carIndicator.setStatus("HeatedSeatFLRequest", request);
610                 }
611         });
612         // AirflowDirection - FloorDuct - 1 (FOOT)
613         $("#fan_dir_down_btn").bind('click', function() {
614                 var currentStatus = bootstrap.carIndicator.status.airflowDirection;
615                 if ((currentStatus >= 0) && (currentStatus <= 7) && (bootstrap.carIndicator.status.fanSpeed !== 0)) {
616                         var newStatus = changeAirflowDirectionStatus("#fan_dir_down_btn", currentStatus, 1);
617                         setAirFlowDirectionStatus(newStatus);
618                 }
619         });
620         // AirflowDirection - Defroster - 4 (SCREEN)
621         $("#fan_dir_up_btn").bind('click', function() {
622                 var currentStatus = bootstrap.carIndicator.status.airflowDirection;
623                 if ((currentStatus >= 0) && (currentStatus <= 7) && (bootstrap.carIndicator.status.fanSpeed !== 0)) {
624                         var newStatus = changeAirflowDirectionStatus("#fan_dir_up_btn", currentStatus, 4);
625                         setAirFlowDirectionStatus(newStatus);
626                 }
627         });
628         // AirflowDirection - Front - 2 (FACE)
629         $("#fan_dir_right_btn").bind('click', function() {
630                 var currentStatus = bootstrap.carIndicator.status.airflowDirection;
631                 if ((currentStatus >= 0) && (currentStatus <= 7) && (bootstrap.carIndicator.status.fanSpeed !== 0)) {
632                         var newStatus = changeAirflowDirectionStatus("#fan_dir_right_btn", currentStatus, 2);
633                         setAirFlowDirectionStatus(newStatus);
634                 }
635         });
636         // Max Defrost
637         $("#defrost_max_btn").bind('click', function() {
638                 if ($("#defrost_max_btn").hasClass("on")) {
639                         $("#defrost_max_btn").removeClass("on");
640                 } else {
641                         $("#defrost_max_btn").addClass("on");
642
643                         if (bootstrap.carIndicator.status.targetTemperatureLeft < 16) {
644                                 bootstrap.carIndicator.setStatus("targetTemperatureLeft", 16);
645                                 bootstrap.carIndicator.setStatus("FrontTSetLeftCmd", 16);
646                         }
647                         if (bootstrap.carIndicator.status.targetTemperatureLeft > 28) {
648                                 bootstrap.carIndicator.setStatus("targetTemperatureLeft", 28);
649                                 bootstrap.carIndicator.setStatus("FrontTSetLeftCmd", 28);
650                         }
651
652                         bootstrap.carIndicator.setStatus("fanSpeed", 8);
653                         bootstrap.carIndicator.setStatus("FrontBlwrSpeedCmd", 15);
654
655                         setAirFlowDirectionStatus(7);
656
657                         switchAutoACOff();
658                 }
659         });
660         // Defrost - Rear
661         $("#defrost_rear_btn").bind('click', function() {
662                 bootstrap.carIndicator.setStatus("rearDefrost", !bootstrap.carIndicator.status.rearDefrost);
663         });
664         // Defrost - Front
665         $("#defrost_front_btn").bind('click', function() {
666                 bootstrap.carIndicator.setStatus("frontDefrost", !bootstrap.carIndicator.status.frontDefrost);
667         });
668 };