diff options
Diffstat (limited to 'src/components/HMI/app/model/sdl')
-rw-r--r-- | src/components/HMI/app/model/sdl/AppModel.js | 31 | ||||
-rw-r--r-- | src/components/HMI/app/model/sdl/MediaModel.js | 12 | ||||
-rw-r--r-- | src/components/HMI/app/model/sdl/Model.js | 106 | ||||
-rw-r--r-- | src/components/HMI/app/model/sdl/NonMediaModel.js | 10 | ||||
-rw-r--r-- | src/components/HMI/app/model/sdl/VehicleInfoModel.js | 28 |
5 files changed, 148 insertions, 39 deletions
diff --git a/src/components/HMI/app/model/sdl/AppModel.js b/src/components/HMI/app/model/sdl/AppModel.js index 6f93e2d668..682eee592b 100644 --- a/src/components/HMI/app/model/sdl/AppModel.js +++ b/src/components/HMI/app/model/sdl/AppModel.js @@ -62,6 +62,37 @@ SDL.SDLAppModel = Em.Object.extend({ appName: '', /** + * Flag to define if application was initialized (registered) correctly + * Has correct application type + * + * @type {Boolean} + */ + initialized: false, + + /** + * Media application flag + * If application was successfully initialized this flag it set into correct value + * + * @type {Boolean} + */ + isMedia: null, + + /** + * Flag to determine if app in application list can not be activated from HMI + * + * @type {Boolean} + */ + disabledToActivate: false, + + /** + * Application type + * If application was successfully initialized this parameter it set into correct value + * + * @type {String} + */ + appType: "", + + /** * Navigation streaming url */ navigationStream: null, diff --git a/src/components/HMI/app/model/sdl/MediaModel.js b/src/components/HMI/app/model/sdl/MediaModel.js index fa8d8e2a83..0feceb2119 100644 --- a/src/components/HMI/app/model/sdl/MediaModel.js +++ b/src/components/HMI/app/model/sdl/MediaModel.js @@ -333,13 +333,15 @@ SDL.SDLMediaModel = SDL.SDLAppModel.extend({ } } else { - //this.appInfo.set('alignment', "text-align:center"); + this.appInfo.set('alignment', "text-align:center"); } - if (params.graphic && params.graphic.value != '') { - this.appInfo.set('trackIcon', params.graphic.value); - } else { - this.appInfo.set('trackIcon', 'images/sdl/audio_icon.jpg'); + if (params.graphic != null) { + if (params.graphic.value != "") { + this.appInfo.set('trackIcon', params.graphic.value); + } else { + this.appInfo.set('trackIcon', 'images/sdl/audio_icon.jpg'); + } } if ("softButtons" in params) { diff --git a/src/components/HMI/app/model/sdl/Model.js b/src/components/HMI/app/model/sdl/Model.js index a902e649ec..d47ecf023b 100644 --- a/src/components/HMI/app/model/sdl/Model.js +++ b/src/components/HMI/app/model/sdl/Model.js @@ -593,7 +593,7 @@ SDL.SDLModel = Em.Object.create({ messageCodes.push("AppPermissionsRevoked"); - FFW.BasicCommunication.GetUserFriendlyMessage(function(message){SDL.SettingsController.simpleParseUserFriendlyMessageData(message)}, appID, messageCodes); + FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, appID, messageCodes); }, @@ -826,10 +826,33 @@ SDL.SDLModel = Em.Object.create({ * * @param {Object} */ - startStream: function(params) { + startStream: function(request) { + + var text = "Would you like to start Video stream?"; + + SDL.PopUp.create().appendTo('body').popupActivate(text, function(result){ + if (result) { + + SDL.SDLController.getApplicationModel(request.params.appID).set('navigationStream', request.params.url); + SDL.SDLModel.playVideo(request.params.appID); + + FFW.Navigation.sendNavigationResult( + SDL.SDLModel.resultCode["SUCCESS"], + request.id, + request.method + ); + + } else if (result === false) { + + FFW.Navigation.sendError( + SDL.SDLModel.resultCode["REJECTED"], + request.id, + request.method, + "Ignored by USER!" + ); + } + }); - SDL.SDLController.getApplicationModel(params.appID).set('navigationStream', params.url); - SDL.SDLModel.playVideo(params.appID); }, /** @@ -866,8 +889,30 @@ SDL.SDLModel = Em.Object.create({ */ startAudioStream: function(params) { - SDL.SDLController.getApplicationModel(params.appID).set('navigationAudioStream', params.url); - SDL.StreamAudio.play(params.url); + var text = "Would you like to start Audio stream?"; + + SDL.PopUp.create().appendTo('body').popupActivate(text, function(result){ + if (result) { + + SDL.SDLController.getApplicationModel(params.appID).set('navigationAudioStream', params.url); + SDL.StreamAudio.play(params.url); + + FFW.Navigation.sendNavigationResult( + SDL.SDLModel.resultCode["SUCCESS"], + request.id, + request.method + ); + + } else if (result === false) { + + FFW.Navigation.sendError( + SDL.SDLModel.resultCode["REJECTED"], + request.id, + request.method, + "Ignored by USER!" + ); + } + }); }, /** @@ -947,11 +992,17 @@ SDL.SDLModel = Em.Object.create({ * * @type {String} lang */ - changeRegistrationUI: function (lang, appID) { + changeRegistrationUI: function (lang, appID, appName) { if (SDL.SDLController.getApplicationModel(appID)) { SDL.SDLController.getApplicationModel(appID).set('UILanguage', lang); } + + if (appName) { + SDL.SDLMediaController.currentAppId = 0; + SDL.SDLController.getApplicationModel(appID).appName = appName; + SDL.SDLMediaController.set('currentAppId', appID); + } }, /** @@ -975,31 +1026,55 @@ SDL.SDLModel = Em.Object.create({ */ onAppRegistered: function (params) { - var applicationType = 1; + var applicationType = null,//Default value - NonMediaModel see SDL.SDLController.applicationModels + app = SDL.SDLController.getApplicationModel(params.appID); + + if (app != undefined && app.initialized == false) { - if (SDL.SDLController.getApplicationModel(params.application.appID)) { + if (app.isMedia != params.isMediaApplication) { // If current not initialized model doe not matches the registered application type + this.convertModel(params); // then model should be changed + } else { + app.disabledToActivate = params.disabled; + } return; + } else if (app != undefined && app.initialized == true) { + console.error("Application with appID " + params.appID + " already registered!"); + return; // if application already registered and correctly initialized and BC.UpdateAppList came from SDL than nothing shoul happend } if (params.vrSynonyms) { - var message = {"cmdID": 0, "vrCommands": params.vrSynonyms, "appID": params.application.appID, "type": "Application"}; + var message = {"cmdID": 0, "vrCommands": params.vrSynonyms, "appID": params.appID, "type": "Application"}; this.addCommandVR(message); } - if (params.application.isMediaApplication) { + if (params.isMediaApplication === true) { + applicationType = 0; + } else if (params.isMediaApplication === false) { + + applicationType = 1; } - SDL.SDLController.registerApplication(params.application, applicationType); + SDL.SDLController.registerApplication(params, applicationType); - if (SDL.SDLModel.unRegisteredApps.indexOf(params.application.appID) >= 0) { - setTimeout(function(){ SDL.PopUp.create().appendTo('body').popupActivate("Connection with " + params.application.appName + " is re-established.")}, 1000); - this.unRegisteredApps.pop(params.application.appID); + if (SDL.SDLModel.unRegisteredApps.indexOf(params.appID) >= 0) { + setTimeout(function(){ SDL.PopUp.create().appendTo('body').popupActivate("Connection with " + params.appName + " is re-established.")}, 1000); + this.unRegisteredApps.pop(params.appID); } }, /** + * Method to convert existed model to registered type + */ + convertModel: function(params) { + + SDL.SDLModel.get('registeredApps').removeObjects(SDL.SDLModel.get('registeredApps').filterProperty('appID', params.appID)); + + this.onAppRegistered(params); + }, + + /** * Method to delete activation button from VR commands and delete device * parameters from model * @@ -1224,7 +1299,6 @@ SDL.SDLModel = Em.Object.create({ setTimeout(function(){ if (SDL.SDLModel.vrActiveRequests.vrPerformInteraction) { SDL.SDLModel.onPrompt(message.params.timeoutPrompt); - SDL.SDLModel.interactionData.helpPrompt = null; } }, message.params.timeout - 2000); //Magic numer is a platform depended HMI behavior: -2 seconds for timeout prompt diff --git a/src/components/HMI/app/model/sdl/NonMediaModel.js b/src/components/HMI/app/model/sdl/NonMediaModel.js index d9a14b32f2..42ac14bc0c 100644 --- a/src/components/HMI/app/model/sdl/NonMediaModel.js +++ b/src/components/HMI/app/model/sdl/NonMediaModel.js @@ -198,10 +198,12 @@ SDL.SDLNonMediaModel = SDL.SDLAppModel.extend({ this.appInfo.set('alignment', "text-align:center"); } - if (params.graphic) { - this.appInfo.set('mainImage', params.graphic.value); - } else { - this.appInfo.set('mainImage', 'images/sdl/audio_icon.jpg'); + if (params.graphic != null) { + if (params.graphic.value != "") { + this.appInfo.set('mainImage', params.graphic.value); + } else { + this.appInfo.set('mainImage', 'images/sdl/audio_icon.jpg'); + } } // Magic number is a count of Preset Buttons on HMI = 8 diff --git a/src/components/HMI/app/model/sdl/VehicleInfoModel.js b/src/components/HMI/app/model/sdl/VehicleInfoModel.js index f2b896190e..f9fe33d97c 100644 --- a/src/components/HMI/app/model/sdl/VehicleInfoModel.js +++ b/src/components/HMI/app/model/sdl/VehicleInfoModel.js @@ -132,10 +132,10 @@ SDL.SDLVehicleInfoModel = Em.Object 'width': 800, 'height': 480 }, - 'speed': 80.0, - 'fuelLevel': 0.2, + 'speed': 80.08E0, + 'fuelLevel': 0.2E0, 'fuelLevel_State': "UNKNOWN", - 'instantFuelConsumption': 2.2, + 'instantFuelConsumption': 2.2E0, 'tirePressure': { 'pressureTelltale': 'OFF', 'leftFront': { @@ -203,9 +203,9 @@ SDL.SDLVehicleInfoModel = Em.Object "highBeamsOn": false, "ambientLightSensorStatus": "NIGHT" }, - 'engineTorque': 2.5, - 'accPedalPosition': 10.5, - 'steeringWheelAngle': 1.2, + 'engineTorque': 2.5E0, + 'accPedalPosition': 10.5E0, + 'steeringWheelAngle': 1.2E0, 'myKey': { "e911Override": "NO_DATA_EXISTS" }, @@ -222,8 +222,8 @@ SDL.SDLVehicleInfoModel = Em.Object 'satRadioESN': "165165650", 'rainSensor': 165165650, 'gps': { - 'longitudeDegrees': 42, - 'latitudeDegrees': -83, + 'longitudeDegrees': 42.5E0, + 'latitudeDegrees': -83.3E0, 'utcYear': 2013, 'utcMonth': 2, 'utcDay': 14, @@ -231,15 +231,15 @@ SDL.SDLVehicleInfoModel = Em.Object 'utcMinutes': 16, 'utcSeconds': 54, 'compassDirection': 'SOUTHWEST', - 'pdop': 8, - 'hdop': 5, - 'vdop': 3, + 'pdop': 8.4E0, + 'hdop': 5.9E0, + 'vdop': 3.2E0, 'actual': false, 'satellites': 8, 'dimension': '2D', - 'altitude': 7, - 'heading': 173, - 'speed': 2 + 'altitude': 7.7E0, + 'heading': 173.99E0, + 'speed': 2.78E0 }, 'eCallInfo': { 'eCallNotificationStatus': 'NORMAL', |