Updates to utilize AMB set calls 05/32005/1 accepted/tizen/ivi/20141215.064929 submit/tizen_ivi/20141212.235817
authorBrian Jones <brian.j.jones@intel.com>
Fri, 12 Dec 2014 23:43:47 +0000 (15:43 -0800)
committerBrian Jones <brian.j.jones@intel.com>
Fri, 12 Dec 2014 23:44:04 +0000 (15:44 -0800)
Change-Id: I9d39c469b3c00bb067fa3a29f230bcbbfb1758ca

js/services/carIndicator.js
packaging/modello-common.changes

index 99d33a6..e82a4c1 100644 (file)
@@ -220,15 +220,15 @@ CarIndicator.prototype._mappingTable = {
                attributeName : "targetTemperature",
                callBackPropertyName : "targetTemperatureRight",
                interfaceName : "climateControl",
-               conversionFunction : parseInteger
-               //zone : new Zone(["Right"])
+               conversionFunction : parseInteger,
+               zone : new Zone(["front", "right"])
        },
        "TargetTemperatureLeft" : {
                attributeName : "targetTemperature",
                callBackPropertyName : "targetTemperatureLeft",
                interfaceName : "climateControl",
-               conversionFunction : parseInteger
-               //zone : new Zone(["Left"])
+               conversionFunction : parseInteger,
+               zone : new Zone(["front", "left"])
        },
        "Hazard" : {
                attributeName : "hazard",
@@ -243,14 +243,14 @@ CarIndicator.prototype._mappingTable = {
        "SeatHeaterRight" : {
                attributeName : "seatHeater",
                callBackPropertyName : "seatHeaterRight",
-               interfaceName : "climateControl"
-               //zone : new Zone(["Right"])
+               interfaceName : "climateControl",
+               zone : new Zone(["front", "right"])
        },
        "SeatHeaterLeft" : {
                attributeName : "seatHeater",
                callBackPropertyName : "seatHeaterLeft",
-               interfaceName : "climateControl"
-               //zone : new Zone(["Left"])
+               interfaceName : "climateControl",
+               zone : new Zone(["front", "left"])
        },
        "Parking" : {
                attributeName : "parking",
@@ -317,7 +317,7 @@ CarIndicator.prototype._mappingTable = {
                }
        },
        "VehicleSpeed" : {
-               attributeName : "vehicleSpeed",
+               attributeName : "speed",
                callBackPropertyName : "speed",
                interfaceName : "vehicleSpeed",
                conversionFunction : parseInteger
@@ -405,29 +405,21 @@ CarIndicator.prototype._mappingTable = {
                //interfaceName : "FrontTSetLeftCmd"
        },
        "FrontBlwrSpeedCmd" : {
-               attributeName : "FrontBlwrSpeedCmd",
+               attributeName : "fanSpeedLevel",
                callBackPropertyName : "FrontBlwrSpeedCmd",
-               //interfaceName : "FrontBlwrSpeedCmd"
-       },
-       "HeatedSeatFRModeRequest" : {
-               attributeName : "HeatedSeatFRModeRequest",
-               callBackPropertyName : "HeatedSeatFRModeRequest",
-               //interfaceName : "HeatedSeatFRModeRequest"
+               interfaceName : "climateControl"
        },
        "HeatedSeatFRRequest" : {
-               attributeName : "HeatedSeatFRRequest",
+               attributeName : "seatHeater",
                callBackPropertyName : "HeatedSeatFRRequest",
-               //interfaceName : "HeatedSeatFRRequest"
-       },
-       "HeatedSeatFLModeRequest" : {
-               attributeName : "HeatedSeatFLModeRequest",
-               callBackPropertyName : "HeatedSeatFLModeRequest",
-               //interfaceName : "HeatedSeatFLModeRequest"
+               interfaceName : "climateControl",
+               zone : new Zone(["front", "right"])
        },
        "HeatedSeatFLRequest" : {
-               attributeName : "HeatedSeatFLRequest",
+               attributeName : "seatHeater",
                callBackPropertyName : "HeatedSeatFLRequest",
-               //interfaceName : "HeatedSeatFLRequest"
+               interfaceName : "climateControl",
+               zone : new Zone(["front", "left"])
        },
        "FLHSDistrCmd" : {
                attributeName : "FLHSDistrCmd",
@@ -532,13 +524,14 @@ CarIndicator.prototype.onDataUpdate = function(data, self, lisenersID) {
                                        for ( var element in self._mappingTable) {
                                                if (self._mappingTable.hasOwnProperty(element) && self._mappingTable[element].interfaceName !== undefined) {
                                                        if (self._mappingTable[element].interfaceName.toLowerCase() === data.interfaceName.toLowerCase() &&
-                                                               self._mappingTable[element].attributeName.toLowerCase() === property.toLowerCase()) {
-                                                               /* jshint bitwise: false */
-                                                               if (!(zone ^ self._mappingTable[element].zone)) {
-                                                                       /* jshint bitwise: true */
+                                                               self._mappingTable[element].attributeName.toLowerCase() === property.toLowerCase() &&
+                                                               ((!self._mappingTable[element].zone && !data.zone) ||
+                                                                       ((self._mappingTable[element].zone && data.zone) &&
+                                                                               (typeof(self._mappingTable[element].zone.equals) === typeof(data.zone.equals)) &&
+                                                                               self._mappingTable[element].zone.equals(data.zone)))
+                                                               ) {
                                                                        mapping = self._mappingTable[element];
                                                                        break;
-                                                               }
                                                        }
                                                }
                                        }
@@ -684,7 +677,7 @@ CarIndicator.prototype.getStatus = function(callback) {
  * @param text_status {string} new status .
  * @param callback {function} callback function.
  */
-CarIndicator.prototype.setStatus = function(indicator, newValue, callback, zone) {
+CarIndicator.prototype.setStatus = function(indicator, newValue, zone) {
        "use strict";
        var mappingElement, mappingProperty;
        for ( var element in this._mappingTable) {
@@ -707,14 +700,22 @@ CarIndicator.prototype.setStatus = function(indicator, newValue, callback, zone)
                propertyValue.zone = propertyZone;
 
                if (typeof (navigator.vehicle) !== 'undefined') {
-                       navigator.vehicle.set(objectName, propertyValue, function(msg) {
-                               console.error("Set error: " + msg);
-                       });
+                       if (typeof (navigator.vehicle[objectName]) !== 'undefined' && typeof (navigator.vehicle[objectName].set) !== 'undefined') {
+                               console.log("trying to set: " + objectName + "." + mappingProperty + " in zone " + mappingElement.zone.value + " to " + newValue);
+                               var value = {};
+                               value[mappingProperty] = newValue;
+                               navigator.vehicle[objectName].set(value, mappingElement.zone).then(function() {
+                                   console.log("Set success!");
+                               }, function(error) {
+                                   console.log("Set failed! " + error.message);
+                               });
+                       }
+                       else
+                               console.error("Can't set status for " + objectName + " because it doesn't exist " + indicator);
+
                } else {
                        console.warn("Vehicle API is not available.");
                }
        }
-       if (!!callback) {
-               callback();
-       }
+
 };
index 48e9441..a705d1e 100644 (file)
@@ -1,3 +1,6 @@
+* Fri Dec 12 2014 Brian Jones <brian.j.jones@intel.com> accepted/tizen/ivi/20141204.025516-1-gb36e67a
+- Updates to utilize AMB set calls
+
 * Wed Dec 03 2014 Jimmy Huang <jimmy.huang@intel.com> accepted/tizen/ivi/20141202.054026-1-ge06950b
 - Added sanity check before calling Vehicle api