summaryrefslogtreecommitdiff
path: root/SDL_Core/src/components/HMI/app/model/sdl/VehicleInfoModel.js
diff options
context:
space:
mode:
Diffstat (limited to 'SDL_Core/src/components/HMI/app/model/sdl/VehicleInfoModel.js')
-rw-r--r--SDL_Core/src/components/HMI/app/model/sdl/VehicleInfoModel.js642
1 files changed, 407 insertions, 235 deletions
diff --git a/SDL_Core/src/components/HMI/app/model/sdl/VehicleInfoModel.js b/SDL_Core/src/components/HMI/app/model/sdl/VehicleInfoModel.js
index 67abf141f..092e700df 100644
--- a/SDL_Core/src/components/HMI/app/model/sdl/VehicleInfoModel.js
+++ b/SDL_Core/src/components/HMI/app/model/sdl/VehicleInfoModel.js
@@ -2,15 +2,14 @@
* Copyright (c) 2013, Ford Motor Company All rights reserved.
*
* 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 Ford Motor Company nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
+ * 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 Ford Motor Company 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
@@ -33,135 +32,191 @@
* @version 1.0
*/
-SDL.SDLVehicleInfoModel = Em.Object.create( {
+SDL.SDLVehicleInfoModel = Em.Object
+ .create( {
- /**
- * Stored VehicleInfo transmission state Data
- *
- * @type {Array}
- */
- vehicleInfoPRNDL:
- [
+ /**
+ * Stored VehicleInfo transmission state Data
+ *
+ * @type {Array}
+ */
+ vehicleInfoPRNDL: [
"PARK",
"REVERSE",
"NEUTRAL",
- "FORWARD_DRIVE_2",
- "LOWGEAR"
+ "DRIVE",
+ "SPORT",
+ "LOWGEAR",
+ "FIRST",
+ "SECOND",
+ "THIRD",
+ "FOURTH",
+ "FIFTH",
+ "SIXTH"
],
- /**
- * PRNDL state value
- *
- * @type {String}
- */
- prndlSelectState: 'PARK',
-
- /**
- * Stored VehicleInfo Data
- *
- * @type {Array}
- */
- ecuDIDData:
- [
+ /**
+ * PRNDL state value
+ *
+ * @type {String}
+ */
+ prndlSelectState: 'PARK',
+
+ /**
+ * Stored VehicleInfo Data
+ *
+ * @type {Array}
+ */
+ ecuDIDData: [
{
'data': "ECU 1 Test Data"
- },
- {
+ }, {
'data': "ECU 2 Test Data"
}
],
- /**
- * Type of current vehicle: make of the vehicle, model of the vehicle, model
- * Year of the vehicle, trim of the vehicle.
- *
- * @type {Object}
- */
- vehicleType: {
- make: "Ford",
- model: "Fiesta",
- modelYear: "2013",
- trim: "SE"
- },
-
- /**
- * Stored VehicleInfo Data
- *
- * @type {Object}
- */
- vehicleData: {
- 'VEHICLEDATA_SPEED': {
- data: 80.0,
- type: 'speed'
- },
- 'VEHICLEDATA_ENGINERPM': {
- data: 5000,
- type: 'rpm'
- },
- 'VEHICLEDATA_FUELLEVEL': {
- data: 0.2,
- type: 'fuelLevel'
- },
- 'VEHICLEDATA_FUELECONOMY': {
- data: 0.1,
- type: 'avgFuelEconomy'
- },
- 'VEHICLEDATA_BATTVOLTS': {
- data: 12.5,
- type: 'batteryVoltage'
- },
- 'VEHICLEDATA_EXTERNTEMP': {
- data: 40.0,
- type: 'externalTemperature'
- },
- 'VEHICLEDATA_VIN': {
- data: '52-452-52-752',
- type: 'vin'
- },
- 'VEHICLEDATA_PRNDLSTATUS': {
- data: 'PARK',
- type: 'prndl'
+ /**
+ * Type of current vehicle: make of the vehicle, model of the vehicle,
+ * model Year of the vehicle, trim of the vehicle.
+ *
+ * @type {Object}
+ */
+ vehicleType: {
+ make: "Ford",
+ model: "Fiesta",
+ modelYear: "2013",
+ trim: "SE"
},
- 'VEHICLEDATA_BATTERYPACKVOLTAGE': {
- data: 12.5,
- type: 'batteryPackVoltage'
- },
- 'VEHICLEDATA_BATTERYCURRENT': {
- data: 7.0,
- type: 'batteryPackCurrent'
- },
- 'VEHICLEDATA_BATTERYTEMPERATURE': {
- data: 30,
- type: 'batteryPackTemperature'
- },
- 'VEHICLEDATA_ENGINETORQUE': {
- data: 650,
- type: 'engineTorque'
- },
- 'VEHICLEDATA_ODOMETER': {
- data: 0,
- type: 'odometer'
- },
- 'VEHICLEDATA_TRIPODOMETER': {
- data: 0,
- type: 'tripOdometer'
- },
- 'VEHICLEDATA_GENERICBINARY': {
- data: '165165650',
- type: 'genericbinary'
- },
- 'VEHICLEDATA_SATESN': {
- data: "165165650",
- type: 'satRadioESN'
- },
- 'VEHICLEDATA_RAINSENSOR': {
- data: 165165650,
- type: 'rainSensor'
+
+ eVehicleDataType:{
+ "gps" :"VEHICLEDATA_GPS",
+ "speed": "VEHICLEDATA_SPEED",
+ "rpm": "VEHICLEDATA_RPM",
+ "fuelLevel": "VEHICLEDATA_FUELLEVEL",
+ "fuelLevel_State": "VEHICLEDATA_FUELLEVEL_STATE",
+ "instantFuelConsumption": "VEHICLEDATA_FUELCONSUMPTION",
+ "externalTemperature": "VEHICLEDATA_EXTERNTEMP",
+ "prndl": "VEHICLEDATA_PRNDL",
+ "tirePressure": "VEHICLEDATA_TIREPRESSURE",
+ "odometer": "VEHICLEDATA_ODOMETER",
+ "beltStatus": "VEHICLEDATA_BELTSTATUS",
+ "bodyInformation": "VEHICLEDATA_BODYINFO",
+ "deviceStatus": "VEHICLEDATA_DEVICESTATUS",
+ "eCallInfo": "VEHICLEDATA_ECALLINFO",
+ "airbagStatus": "VEHICLEDATA_AIRBAGSTATUS",
+ "emergencyEvent": "VEHICLEDATA_EMERGENCYEVENT",
+ "clusterModes": "VEHICLEDATA_CLUSTERMODESTATUS",
+ "myKey": "VEHICLEDATA_MYKEY",
+ "driverBraking": "VEHICLEDATA_BRAKING",
+ "wiperStatus": "VEHICLEDATA_WIPERSTATUS",
+ "headLampStatus": "VEHICLEDATA_HEADLAMPSTATUS",
+ "engineTorque":"VEHICLEDATA_ENGINETORQUE",
+ "accPedalPosition": "VEHICLEDATA_ACCPEDAL",
+ "steeringWheelAngle": "VEHICLEDATA_STEERINGWHEEL"
},
- 'VEHICLEDATA_GPS': {
- data: {
- 'longitudeDegrees': 423293,
- 'latitudeDegrees': -830464,
+
+ /**
+ * Stored VehicleInfo Data
+ *
+ * @type {Object}
+ */
+ vehicleData: {
+ 'displayResolution':{
+ 'width': 800,
+ 'height': 480
+ },
+ 'speed': 80.0,
+ 'fuelLevel': 0.2,
+ 'fuelLevel_State': "UNKNOWN",
+ 'instantFuelConsumption': 2.2,
+ 'tirePressure': {
+ 'pressureTelltale': 'OFF',
+ 'leftFront': {
+ 'status': 'UNKNOWN'
+ },
+ 'rightFront': {
+ 'status': 'UNKNOWN'
+ },
+ 'leftRear': {
+ 'status': 'UNKNOWN'
+ },
+ 'rightRear': {
+ 'status': 'UNKNOWN'
+ },
+ 'innerLeftRear': {
+ 'status': 'UNKNOWN'
+ },
+ 'innerRightRear': {
+ 'status': 'UNKNOWN'
+ }
+ },
+ 'beltStatus': {
+ 'driverBeltDeployed': "NOT_SUPPORTED",
+ 'passengerBeltDeployed': "NOT_SUPPORTED",
+ 'passengerBuckleBelted': "NOT_SUPPORTED",
+ 'driverBuckleBelted': "NOT_SUPPORTED",
+ 'leftRow2BuckleBelted': "NOT_SUPPORTED",
+ 'passengerChildDetected': "NOT_SUPPORTED",
+ 'rightRow2BuckleBelted': "NOT_SUPPORTED",
+ 'middleRow2BuckleBelted': "NOT_SUPPORTED",
+ 'middleRow3BuckleBelted': "NOT_SUPPORTED",
+ 'leftRow3BuckleBelted': "NOT_SUPPORTED",
+ 'rightRow3BuckleBelted': "NOT_SUPPORTED",
+ 'leftRearInflatableBelted': "NOT_SUPPORTED",
+ 'rightRearInflatableBelted': "NOT_SUPPORTED",
+ 'middleRow1BeltDeployed': "NOT_SUPPORTED",
+ 'middleRow1BuckleBelted': "NOT_SUPPORTED"
+ },
+ 'bodyInformation': {
+ 'parkBrakeActive': false,
+ 'ignitionStableStatus': "MISSING_FROM_TRANSMITTER",
+ 'ignitionStatus': "UNKNOWN",
+ 'driverDoorAjar': true,
+ 'passengerDoorAjar': true,
+ 'rearLeftDoorAjar': true,
+ 'rearRightDoorAjar': true
+ },
+ 'deviceStatus': {
+ 'voiceRecOn': false,
+ 'btIconOn': false,
+ 'callActive': false,
+ 'phoneRoaming': false,
+ 'textMsgAvailable': false,
+ 'battLevelStatus': "NOT_PROVIDED",
+ 'stereoAudioOutputMuted': false,
+ 'monoAudioOutputMuted': false,
+ 'signalLevelStatus': "NOT_PROVIDED",
+ 'primaryAudioSource': "NO_SOURCE_SELECTED",
+ 'eCallEventActive': false
+ },
+ 'driverBraking': "NOT_SUPPORTED",
+ 'wiperStatus': "NO_DATA_EXISTS",
+ 'headLampStatus': {
+ "lowBeamsOn": false,
+ "highBeamsOn": false,
+ "ambientLightSensorStatus": "NIGHT"
+ },
+ 'engineTorque': 2.5,
+ 'accPedalPosition': 10.5,
+ 'steeringWheelAngle': 1.2,
+ 'myKey': {
+ "e911Override": "NO_DATA_EXISTS"
+ },
+ 'avgFuelEconomy': 0.1,
+ 'batteryVoltage': 12.5,
+ 'externalTemperature': 40.0,
+ 'vin': '52-452-52-752',
+ 'prndl': 'PARK',
+ 'batteryPackVoltage': 12.5,
+ 'batteryPackCurrent': 7.0,
+ 'batteryPackTemperature': 30,
+ 'tripOdometer': 0,
+ 'genericbinary': '165165650',
+ 'satRadioESN': "165165650",
+ 'rainSensor': 165165650,
+ 'gps': {
+ 'longitudeDegrees': 42,
+ 'latitudeDegrees': -83,
'utcYear': 2013,
'utcMonth': 2,
'utcDay': 14,
@@ -169,9 +224,9 @@ SDL.SDLVehicleInfoModel = Em.Object.create( {
'utcMinutes': 16,
'utcSeconds': 54,
'compassDirection': 'SOUTHWEST',
- 'pdop': 15,
+ 'pdop': 8,
'hdop': 5,
- 'vdop': 30,
+ 'vdop': 3,
'actual': false,
'satellites': 8,
'dimension': '2D',
@@ -179,114 +234,231 @@ SDL.SDLVehicleInfoModel = Em.Object.create( {
'heading': 173,
'speed': 2
},
- type: 'gps'
- }
- },
-
- /**
- * Method to set selected state of vehicle transmission to vehicleData
- */
- onPRNDLSelected: function() {
- if( this.prndlSelectState ) {
- this.set( 'vehicleData.VEHICLEDATA_PRNDLSTATUS.data', this.prndlSelectState );
- }
- }.observes( 'this.prndlSelectState' ),
-
- /**
- * Method calls GetVehicleType response
- *
- * @type {Number}
- */
- getVehicleType: function( id ) {
- FFW.VehicleInfo.GetVehicleTypeResponse( this.vehicleType, id );
- },
-
- /**
- * SDL VehicleInfo.GetDTCs handler fill data for response about vehicle
- * errors
- *
- * @type {Object} params
- * @type {Number} id
- */
- vehicleInfoGetDTCs: function( params, id ) {
- var data = [], i = 0, info = "Inormation about reported DTC's", result = "";
-
- for( i = 0; i < 3; i++ ){
- data.push( params.encrypted ? "0" : {
- "identifier": '0',
- "statusByte": '0'
- } );
- }
-
- result = "SUCCESS";
-
- if( params.encrypted ){
- result = 'ENCRYPTED';
- FFW.BasicCommunication.SendData( data );
- FFW.VehicleInfo.vehicleInfoGetDTCsResponse( null, info, result, id );
- }else{
- FFW.VehicleInfo.vehicleInfoGetDTCsResponse( data, info, result, id );
- }
- },
-
- /**
- * SDL VehicleInfo.ReadDID handler send response about vehicle conditions
- *
- * @type {Object} params
- * @type {Number} id
- */
- vehicleInfoReadDID: function( params, id ) {
- var data = [], i = 0, info = '', dataResult = [], resultCode = "";
- // magic number used because there is no huge database on HMI of vehicle
- // data
- if( this.ecuDIDData[1].data ){
- info = this.ecuDIDData[1].data;
+ 'eCallInfo': {
+ 'eCallNotificationStatus': 'NORMAL',
+ 'auxECallNotificationStatus': 'NORMAL',
+ 'eCallConfirmationStatus': 'NORMAL'
+ },
+ 'airbagStatus': {
+ 'driverAirbagDeployed': 'NO_EVENT',
+ 'driverSideAirbagDeployed': 'NO_EVENT',
+ 'driverCurtainAirbagDeployed': 'NO_EVENT',
+ 'passengerAirbagDeployed': 'NO_EVENT',
+ 'passengerCurtainAirbagDeployed': 'NO_EVENT',
+ 'driverKneeAirbagDeployed': 'NO_EVENT',
+ 'passengerSideAirbagDeployed': 'NO_EVENT',
+ 'passengerKneeAirbagDeployed': 'NO_EVENT'
+ },
+ 'emergencyEvent': {
+ 'emergencyEventType': 'NO_EVENT',
+ 'fuelCutoffStatus': 'NORMAL_OPERATION',
+ 'rolloverEvent': 'NO_EVENT',
+ 'maximumChangeVelocity': 'NO_EVENT',
+ 'multipleEvents': 'NO_EVENT'
+ },
+ 'clusterModeStatus': {
+ 'powerModeActive': false,
+ 'powerModeQualificationStatus': 'POWER_MODE_EVALUATION_IN_PROGRESS',
+ 'carModeStatus': 'FACTORY',
+ 'powerModeStatus': 'KEY_OUT'
+ }
+
+ },
+
+ /**
+ * Method to set selected state of vehicle transmission to vehicleData
+ */
+ onPRNDLSelected: function() {
+
+ if (this.prndlSelectState) {
+ this.set('vehicleData.prndl', this.prndlSelectState);
+ }
+ }.observes('this.prndlSelectState'),
+
+ /**
+ * Method calls GetVehicleType response
+ *
+ * @type {Number}
+ */
+ getVehicleType: function(id) {
+
+ FFW.VehicleInfo.GetVehicleTypeResponse(this.vehicleType, id);
+ },
+
+ /**
+ * SDL VehicleInfo.GetDTCs handler fill data for response about vehicle
+ * errors
+ *
+ * @type {Object} params
+ * @type {Number} id
+ */
+ vehicleInfoGetDTCs: function(params, id) {
+
+ var dtc = [], result = "", ecuHeader = 2;
+
+ for ( var i = 0; i < 3; i++) {
+ dtc.push("line " + i);
+ }
+
result = "SUCCESS";
- }else{
- result = "INVALID_DATA";
- }
-
- for( i = 0; i < params.didLocation.length; i++ ){
- if( i < 10 ){
- dataResult[i] = 'SUCCESS';
- data.push( '0' );
- }else{
- dataResult[i] = "INVALID_DATA";
- data.push( '0' );
+
+ FFW.VehicleInfo.vehicleInfoGetDTCsResponse(ecuHeader,
+ dtc,
+ result,
+ id);
+
+ },
+
+ /**
+ * SDL VehicleInfo.ReadDID handler send response about vehicle
+ * conditions
+ *
+ * @type {Object} params
+ * @type {Number} id
+ */
+ vehicleInfoReadDID: function(params, id) {
+
+ var didResult = [], resultCode = "";
+ // magic number used because there is no huge database on HMI of
+ // vehicle
+ // data
+ if (this.ecuDIDData[1].data) {
+ resultCode = "SUCCESS";
+ } else {
+ resultCode = "INVALID_DATA";
+ }
+
+ for ( var i = 0; i < params.didLocation.length; i++) {
+ if (i < 10) {
+ didResult[i] = {};
+ didResult[i].resultCode = 'SUCCESS';
+ didResult[i].didLocation = params.didLocation[i];
+ didResult[i].data = '0';
+ } else {
+ didResult[i] = {};
+ didResult[i].resultCode = "VEHICLE_DATA_NOT_AVAILABLE";
+ didResult[i].didLocation = params.didLocation[i];
+ didResult[i].data = '0';
+ }
}
- }
-
- if( params.encrypted ){
- result = 'ENCRYPTED';
- FFW.BasicCommunication.SendData( data );
- FFW.VehicleInfo.vehicleInfoReadDIDResponse( null, null, info, result, id );
- }else{
- FFW.VehicleInfo.vehicleInfoReadDIDResponse( dataResult, data, info, result, id );
- }
- },
-
- /**
- * Function returns response message to VehicleInfoRPC
- *
- * @type {Object} message
- */
- getVehicleData: function( message ) {
-
- return this.vehicleData[message.dataType].data;
-
- },
-
- /**
- * Function send all vehicle conditions on FFW.VehicleInfo.OnVehicleData fo
- * notification when data changes
- */
- onVehicleDataChanged: function() {
-
- var jsonData = {};
- for( var i in this.vehicleData ){
- jsonData[this.vehicleData[i].type] = this.vehicleData[i].data;
- }
- FFW.VehicleInfo.OnVehicleData( jsonData );
-
- }.observes( 'this.vehicleData.VEHICLEDATA_PRNDLSTATUS.data' )
-} );
+
+ FFW.VehicleInfo.vehicleInfoReadDIDResponse(didResult,
+ resultCode,
+ id);
+ },
+
+ /**
+ * Function returns response message to VehicleInfoRPC
+ *
+ * @type {Object} message
+ */
+ SubscribeVehicleData: function(message) {
+ if (SDL.SDLController.getApplicationModel(message.params.appID)) {
+
+ var subscribeVIData = {};
+ for (var key in message.params) {
+ if (message.params[key] && key != 'appID' && key in SDL.SDLController.getApplicationModel(message.params.appID).subscribedData && key !== "clusterModeStatus") {
+ SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = message.params[key];
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "SUCCESS"
+ };
+ } else if (key != 'appID' && message.params[key] && key !== "clusterModeStatus") {
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "VEHICLE_DATA_NOT_AVAILABLE"
+ }
+ } else if (key === "clusterModeStatus") {
+ subscribeVIData["clusterModes"] = {
+ dataType: this.eVehicleDataType["clusterModes"],
+ resultCode: "SUCCESS"
+ }
+ }
+ }
+ }
+ FFW.VehicleInfo.sendVISubscribeVehicleDataResult(SDL.SDLModel.resultCode["SUCCESS"], message.id, message.method, subscribeVIData);
+ },
+
+ /**
+ * Function returns response message to VehicleInfoRPC
+ *
+ * @type {Object} message
+ */
+ UnsubscribeVehicleData: function(message) {
+ if (SDL.SDLController.getApplicationModel(message.params.appID)) {
+
+ var subscribeVIData = {};
+ for (var key in message.params) {
+ if (message.params[key] && key != 'appID' && key in SDL.SDLController.getApplicationModel(message.params.appID).subscribedData && key !== "clusterModeStatus") {
+ SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = false;
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "SUCCESS"
+ };
+ } else if (key != 'appID' && message.params[key] && key !== "clusterModeStatus") {
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "VEHICLE_DATA_NOT_AVAILABLE"
+ }
+ } else if (key === "clusterModeStatus") {
+ subscribeVIData["clusterModes"] = {
+ dataType: this.eVehicleDataType["clusterModes"],
+ resultCode: "SUCCESS"
+ }
+ }
+ }
+ }
+ FFW.VehicleInfo.sendVISubscribeVehicleDataResult(SDL.SDLModel.resultCode["SUCCESS"], message.id, message.method, subscribeVIData);
+ },
+
+ /**
+ * Function returns response message to VehicleInfoRPC
+ *
+ * @type {Object} message
+ */
+ getVehicleData: function(message) {
+
+ var data = {}
+ text = "Params ", result = true;
+
+ for ( var key in message.params) {
+ if (key != "appID") {
+ if (this.vehicleData[key]) {
+ data[key] = this.vehicleData[key];
+ } else {
+ text += key + ", ";
+ result = false;
+ }
+ }
+ }
+
+ text += "are not avaliable";
+
+ if (result) {
+ FFW.VehicleInfo.sendGetVehicleDataResut(SDL.SDLModel.resultCode["SUCCESS"], message.id, message.method, data);
+ } else {
+ FFW.VehicleInfo.sendGetVehicleDataError(SDL.SDLModel.resultCode["DATA_NOT_AVAILABLE"], message.id, message.method, text, data);
+ }
+ },
+
+ /**
+ * Function send all vehicle conditions on FFW.VehicleInfo.OnVehicleData
+ * for notification when data changes
+ */
+ onVehicleDataChanged: function() {
+
+ var appID = null;
+
+ for (var i = 0; i < SDL.SDLModel.registeredApps.length; i++) {
+ appID = SDL.SDLModel.registeredApps[i].appID;
+ if (SDL.SDLController.getApplicationModel(appID).subscribedData["prndl"]) {
+
+ var jsonData = {};
+ jsonData["prndl"] = this.vehicleData["prndl"];
+ FFW.VehicleInfo.OnVehicleData(jsonData);
+ return;
+ }
+ }
+
+ }.observes('this.vehicleData.prndl')
+ });