diff options
author | Justin Dickow <jjdickow@gmail.com> | 2015-01-24 16:58:15 -0500 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2015-01-24 16:58:15 -0500 |
commit | a24079cb8de5563376dcf782cdb9fe3cae063841 (patch) | |
tree | 1fca30dde1aa30c7ac11fb6b009d2bd6420bd648 /src/components/HMI | |
parent | f948dd4539eeecb2c32084cc39b68923fc94e3dd (diff) | |
download | sdl_core-a24079cb8de5563376dcf782cdb9fe3cae063841.tar.gz |
HmiStatus modify
HU DCHECK occurs during multisession registration
Remove unused variable
SIGSEGV handler added to flush logger queue
FixIncomplete device list in UpdateDeviceList request
Fix Memory leak on PutFile break
Fix Thread and Timer
Fix OnHmiStatus Notification
Fix Url array sending for endpoints.
Fix HashChange
Fix SDL parse incoming JSON message with both members error and result as success message
Fix Core crashes while connecting mobile app
Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Diffstat (limited to 'src/components/HMI')
-rw-r--r-- | src/components/HMI/app/controller/sdl/AppController.js | 6 | ||||
-rw-r--r-- | src/components/HMI/app/controller/sdl/Controller.js | 26 | ||||
-rw-r--r-- | src/components/HMI/app/controller/sdl/RPCController.js | 108 | ||||
-rw-r--r-- | src/components/HMI/app/model/sdl/MediaModel.js | 10 | ||||
-rw-r--r-- | src/components/HMI/app/model/sdl/Model.js | 1 | ||||
-rw-r--r-- | src/components/HMI/app/model/sdl/NonMediaModel.js | 10 | ||||
-rw-r--r-- | src/components/HMI/app/view/sdl/ExitAppView.js | 22 | ||||
-rw-r--r-- | src/components/HMI/app/view/sdl/TTSPopUp.js | 34 | ||||
-rw-r--r-- | src/components/HMI/app/view/sdl/shared/interactionChoicesView.js | 14 | ||||
-rw-r--r-- | src/components/HMI/css/general.css | 18 | ||||
-rw-r--r-- | src/components/HMI/css/sdl.css | 19 | ||||
-rw-r--r-- | src/components/HMI/ffw/BasicCommunicationRPC.js | 18 | ||||
-rw-r--r-- | src/components/HMI/ffw/NavigationRPC.js | 56 | ||||
-rw-r--r-- | src/components/HMI/ffw/RPCClient.js | 49 | ||||
-rw-r--r-- | src/components/HMI/ffw/RPCObserver.js | 235 | ||||
-rw-r--r-- | src/components/HMI/ffw/TTSRPC.js | 64 | ||||
-rw-r--r-- | src/components/HMI/ffw/UIRPC.js | 172 | ||||
-rw-r--r-- | src/components/HMI/ffw/VRRPC.js | 29 |
18 files changed, 708 insertions, 183 deletions
diff --git a/src/components/HMI/app/controller/sdl/AppController.js b/src/components/HMI/app/controller/sdl/AppController.js index 784e7e8d1c..8f37fa51f0 100644 --- a/src/components/HMI/app/controller/sdl/AppController.js +++ b/src/components/HMI/app/controller/sdl/AppController.js @@ -107,11 +107,10 @@ SDL.SDLAppController = Em.Object.create({ */ VRPerformAction: function (element) { - SDL.SDLController.vrInteractionResponse(SDL.SDLModel.resultCode["SUCCESS"], element.commandID); - if (SDL.SDLModel.VRActive) { SDL.SDLModel.toggleProperty('VRActive'); } + SDL.SDLController.vrInteractionResponse(SDL.SDLModel.resultCode["SUCCESS"], element.commandID); }, /** @@ -144,6 +143,9 @@ SDL.SDLAppController = Em.Object.create({ */ onVRCommand: function (element) { + if (SDL.SDLModel.VRActive) { + SDL.SDLModel.toggleProperty('VRActive'); + } FFW.VR.onCommand(element.commandID, element.appID); }, diff --git a/src/components/HMI/app/controller/sdl/Controller.js b/src/components/HMI/app/controller/sdl/Controller.js index 7c3ba164ef..a6dc92fc0d 100644 --- a/src/components/HMI/app/controller/sdl/Controller.js +++ b/src/components/HMI/app/controller/sdl/Controller.js @@ -55,7 +55,7 @@ SDL.SDLController = Em.Object */ sysContext: function() { - if (SDL.VRPopUp.VRActive) { + if (SDL.SDLModel.VRActive) { return 'VRSESSION'; } if (SDL.AlertPopUp.active) { @@ -78,7 +78,7 @@ SDL.SDLController = Em.Object }.property('SDL.OptionsView.active', 'SDL.SliderView.active', 'SDL.SDLModel.AudioPassThruState', - 'SDL.VRPopUp.VRActive', + 'SDL.SDLModel.VRActive', 'SDL.AlertPopUp.active', 'SDL.States.info.nonMedia.active', 'SDL.States.media.sdlmedia.active', @@ -200,7 +200,9 @@ SDL.SDLController = Em.Object SDL.VRHelpListView.deactivate(); } } - } + } else if (SDL.VRHelpListView.active) { + SDL.VRHelpListView.deactivate(); + } }.observes('SDL.SDLModel.VRActive', 'SDL.SDLModel.interactionData.vrHelp'), /** @@ -414,6 +416,15 @@ SDL.SDLController = Em.Object FFW.BasicCommunication.ExitAllApplications(state); }, /** + * OnAwakeSDL from HMI returns SDL to normal operation + * after OnExitAllApplications(SUSPEND) + * + */ + onAwakeSDLNotificationSend: function() { + FFW.BasicCommunication.OnAwakeSDL(); + }, + + /** * Method to sent notification with selected reason of OnSystemRequest * * @param {String} @@ -458,6 +469,8 @@ SDL.SDLController = Em.Object if (choiceID && SDL.TTSPopUp.active && FFW.TTS.requestId == null) { SDL.TTSPopUp.DeactivateTTS(); } + + SDL.SDLModel.interactionData.helpPrompt = null; }, /** * Method to sent notification for Alert @@ -640,6 +653,10 @@ SDL.SDLController = Em.Object if (SDL.SDLModel.stateLimited == appID) { SDL.SDLModel.set('stateLimited', null); } + + if (SDL.VRHelpListView.active) { + this.showVRHelpItems(); + } }, /** * SDL Driver Distraction ON/OFF switcher @@ -734,6 +751,9 @@ SDL.SDLController = Em.Object */ onActivateSDLApp: function(element) { + if (SDL.SDLModel.VRActive) { + SDL.SDLModel.toggleProperty('VRActive'); + } FFW.BasicCommunication.ActivateApp(element.appID); }, /** diff --git a/src/components/HMI/app/controller/sdl/RPCController.js b/src/components/HMI/app/controller/sdl/RPCController.js index d7ab4b2d01..27dd2ec087 100644 --- a/src/components/HMI/app/controller/sdl/RPCController.js +++ b/src/components/HMI/app/controller/sdl/RPCController.js @@ -72,41 +72,21 @@ SDL.RPCController = Em.Object capabilitiesCheck: function(key, value) { if (key == "imageType" && value == "STATIC") { - SDL.RPCController.capabilityCheckResult = 'UNSUPPORTED_RESOURCE'; + SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value}; } if (key == "type" && value == "PRE_RECORDED") { - SDL.RPCController.capabilityCheckResult = 'UNSUPPORTED_RESOURCE'; + SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value}; } if (key == "type" && value == "SAPI_PHONEMES") { - SDL.RPCController.capabilityCheckResult = 'UNSUPPORTED_RESOURCE'; + SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value}; } if (key == "type" && value == "LHPLUS_PHONEMES") { - SDL.RPCController.capabilityCheckResult = 'UNSUPPORTED_RESOURCE'; + SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value}; } if (key == "type" && value == "SILENCE") { - SDL.RPCController.capabilityCheckResult = 'UNSUPPORTED_RESOURCE'; + SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value}; } - }, - - /** - * Method to check supported image type in request - * - * @param {Object} - * array - */ - checkImagesArray: function(array) { - - var error = false; - if (array instanceof Array) { - for ( var i = 0; i < array.length; i++) { - if (array[i].image && - ((array[i].image.imageType !== "DYNAMIC") && - (array[i].image.imageType !== "STATIC"))) { - - } - } - } - return error; + return value; }, /** @@ -1093,17 +1073,6 @@ SDL.RPCController = Em.Object return this.resultStruct; } - if ("softButtons" in params) { - if (SDL.RPCController - .checkImagesArray(params.softButtons)) { - this.resultStruct = { - "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"], - "resultMessage": "Unsupported image type!" - }; - - return this.resultStruct; - } - } if ("turnIcon" in params && ((params.turnIcon.imageType !== "DYNAMIC") && (params.turnIcon.imageType !== "STATIC"))) { this.resultStruct = { @@ -1183,17 +1152,6 @@ SDL.RPCController = Em.Object return this.resultStruct; } - if ("softButtons" in params) { - if (SDL.RPCController - .checkImagesArray(params.softButtons)) { - this.resultStruct = { - "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"], - "resultMessage": "Unsupported image type!" - }; - - return this.resultStruct; - } - } if ("turnList" in params) { for ( var i = 0; i < params.turnList.length; i++) { @@ -1277,17 +1235,6 @@ SDL.RPCController = Em.Object return this.resultStruct; } - if ("softButtons" in params) { - if (SDL.RPCController - .checkImagesArray(params.softButtons)) { - this.resultStruct = { - "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"], - "resultMessage": "Unsupported image type!" - }; - - return this.resultStruct; - } - } if (params.alertStrings == null) { this.resultStruct = { @@ -1422,17 +1369,6 @@ SDL.RPCController = Em.Object return this.resultStruct; } - if ("softButtons" in params) { - if (SDL.RPCController - .checkImagesArray(params.softButtons)) { - this.resultStruct = { - "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"], - "resultMessage": "Unsupported image type!" - }; - - return this.resultStruct; - } - } if ("graphic" in params && ((params.graphic.imageType !== "DYNAMIC") && (params.graphic.imageType !== "STATIC"))) { this.resultStruct = { @@ -1934,16 +1870,6 @@ SDL.RPCController = Em.Object return this.resultStruct; } - if ("vrHelp" in params) { - if (SDL.RPCController.checkImagesArray(params.vrHelp)) { - this.resultStruct = { - "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"], - "resultMessage": "Unsupported image type!" - }; - - return this.resultStruct; - } - } if (params.appID == null) { this.resultStruct = { @@ -2278,17 +2204,6 @@ SDL.RPCController = Em.Object return this.resultStruct; } - if ("softButtons" in params) { - if (SDL.RPCController - .checkImagesArray(params.softButtons)) { - this.resultStruct = { - "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"], - "resultMessage": "Unsupported image type!" - }; - - return this.resultStruct; - } - } if (params.messageText == null) { this.resultStruct = { @@ -2434,17 +2349,6 @@ SDL.RPCController = Em.Object ShowVrHelp: function(params) { if (params) { - if ("vrHelp" in params) { - if (SDL.RPCController - .checkImagesArray(params.vrHelp)) { - this.resultStruct = { - "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"], - "resultMessage": "Unsupported image type!" - }; - - return this.resultStruct; - } - } if ("appID" in params) { if (typeof params.appID != 'number') { diff --git a/src/components/HMI/app/model/sdl/MediaModel.js b/src/components/HMI/app/model/sdl/MediaModel.js index b51156d2fd..0feceb2119 100644 --- a/src/components/HMI/app/model/sdl/MediaModel.js +++ b/src/components/HMI/app/model/sdl/MediaModel.js @@ -336,10 +336,12 @@ SDL.SDLMediaModel = SDL.SDLAppModel.extend({ 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..4d54e20e5a 100644 --- a/src/components/HMI/app/model/sdl/Model.js +++ b/src/components/HMI/app/model/sdl/Model.js @@ -1224,7 +1224,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/view/sdl/ExitAppView.js b/src/components/HMI/app/view/sdl/ExitAppView.js index 4f423f06af..81e9c7ad5f 100644 --- a/src/components/HMI/app/view/sdl/ExitAppView.js +++ b/src/components/HMI/app/view/sdl/ExitAppView.js @@ -47,7 +47,9 @@ SDL.ExitApp = Em.ContainerView.create( { [ 'exitAppViewLabel', 'exitAppViewTitle', - 'exitAppViewSelect' + 'exitAppViewSelect', + 'onAwakeSDLLabel', + 'onAwakeSDLButton' ], /** @@ -104,6 +106,24 @@ SDL.ExitApp = Em.ContainerView.create( { } } ), + onAwakeSDLLabel: SDL.Label.extend( { + + elementId: 'onAwakeSDLLabel', + + classNames: 'onAwakeSDLLabel', + + content: 'onAwakeSDL notification send' + } ), + + onAwakeSDLButton: SDL.Button.extend( { + classNames: 'button onAwakeSDLButton', + text: 'Send onAwakeSDL', + action: 'onAwakeSDLNotificationSend', + target: 'SDL.SDLController', + buttonAction: true, + onDown: false + }), + /** * Trigger function that activates and deactivates tbtClientStateView */ diff --git a/src/components/HMI/app/view/sdl/TTSPopUp.js b/src/components/HMI/app/view/sdl/TTSPopUp.js index 4fc0c7669c..be5652ff90 100644 --- a/src/components/HMI/app/view/sdl/TTSPopUp.js +++ b/src/components/HMI/app/view/sdl/TTSPopUp.js @@ -45,7 +45,9 @@ SDL.TTSPopUp = Em.ContainerView.create( { 'popUp', 'message', 'okButton', - 'timerText' + 'timerText', + 'checkBoxLabel', + 'checkBox' ], requestId: null, @@ -86,6 +88,25 @@ SDL.TTSPopUp = Em.ContainerView.create( { disabledBinding: 'parentView.buttons' }), + checkBoxLabel: SDL.Label.extend({ + + elementId: 'checkBoxLabel', + + classNames: 'checkBoxLabel', + + content: 'Send response' + }), + + checkBox: Em.Checkbox.extend( { + + elementId: 'checkBoxTTS', + + classNames: 'checkBoxTTS', + + checked: true + + }), + timerText: SDL.Label.extend({ elementId: 'timerText', @@ -95,6 +116,8 @@ SDL.TTSPopUp = Em.ContainerView.create( { contentBinding: 'parentView.timerSeconds' }), + + resetTimeout: function () { this.set('timerSeconds', 10); FFW.TTS.OnResetTimeout(this.appID, "TTS.Speak"); @@ -126,9 +149,12 @@ SDL.TTSPopUp = Em.ContainerView.create( { DeactivateTTS: function() { clearInterval(this.timer); this.set('active', false); - this.set('timerSeconds', 10); - SDL.SDLController.TTSResponseHandler(); - FFW.TTS.Stopped(); + this.set('timerSeconds', 5); + + if (this.checkBox.checked) { + SDL.SDLController.TTSResponseHandler(); + FFW.TTS.Stopped(); + } }, /** diff --git a/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js b/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js index d01165dd14..288031ab17 100644 --- a/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js +++ b/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js @@ -86,8 +86,10 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create({ ], click: function() { - SDL.InteractionChoicesView.timerUpdate(); - SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction"); + if (this._parentView.active) { + SDL.InteractionChoicesView.timerUpdate(); + SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction"); + } }, naviChoises: Em.ContainerView.extend({ @@ -119,8 +121,10 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create({ itemsOnPage: 5, items: [], click: function() { - SDL.InteractionChoicesView.timerUpdate(); - SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction"); + if (this._parentView.active) { + SDL.InteractionChoicesView.timerUpdate(); + SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction"); + } } }), @@ -143,7 +147,7 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create({ * Method updates popup timer when data changes through keyboard */ timerUpdate: function (){ - if (this.timeout && this.input.value !== null) { + if (this.timeout) { clearTimeout(this.timer); var self = this; this.timer = setTimeout(function () { diff --git a/src/components/HMI/css/general.css b/src/components/HMI/css/general.css index a1e581599a..415545deb9 100644 --- a/src/components/HMI/css/general.css +++ b/src/components/HMI/css/general.css @@ -162,6 +162,24 @@ div { font-size: 30px; } +#TTSPopUp .checkBoxLabel { + color: white; + top: 106px; + width: 72px; + height: 35px; + left: 25px; + background-color: rgb(90, 90, 90); + border-radius: 3px; + border: 1px solid rgb(255,255,255); + padding: 2px; +} + +#TTSPopUp .checkBoxTTS { + top: 118px; + position: absolute; + left: 8px; +} + #TTSPopUp .okButton { right: 52px; width: 113px; diff --git a/src/components/HMI/css/sdl.css b/src/components/HMI/css/sdl.css index cf5994491e..bd7741163d 100644 --- a/src/components/HMI/css/sdl.css +++ b/src/components/HMI/css/sdl.css @@ -601,6 +601,25 @@ background: #393939; } +#exitAppView .onAwakeSDLLabel{ + top: 200px; + width: 600px; + left: 40px; + height: 20px; + padding: 10px; + background: #535353; +} + +#exitAppView .onAwakeSDLButton{ + right: 268px; + top: 250px; + width: 150px; + height: 19px; + padding: 10px; + border-radius: 4px; + border: 1px solid white; +} + #VehicleInfo .odometrTitle{ top: 180px; width: 290px; diff --git a/src/components/HMI/ffw/BasicCommunicationRPC.js b/src/components/HMI/ffw/BasicCommunicationRPC.js index 4c541bf727..0bc2b06233 100644 --- a/src/components/HMI/ffw/BasicCommunicationRPC.js +++ b/src/components/HMI/ffw/BasicCommunicationRPC.js @@ -1004,6 +1004,24 @@ FFW.BasicCommunication = FFW.RPCObserver }, /** + * OnAwakeSDL from HMI returns SDL to normal operation + * after OnExitAllApplications(SUSPEND) + */ + OnAwakeSDL: function() { + + Em.Logger.log("FFW.BasicCommunication.OnAwakeSDL"); + + // send request + var JSONMessage = { + "jsonrpc": "2.0", + "method": "BasicCommunication.OnAwakeSDL" + }; + this.client.send(JSONMessage); + }, + + + + /** * Used by HMI when User chooses to exit application. * * @params {Number} diff --git a/src/components/HMI/ffw/NavigationRPC.js b/src/components/HMI/ffw/NavigationRPC.js index 5f594079a1..a3fb289dc6 100644 --- a/src/components/HMI/ffw/NavigationRPC.js +++ b/src/components/HMI/ffw/NavigationRPC.js @@ -172,6 +172,24 @@ FFW.Navigation = FFW.RPCObserver.create( { } case "Navigation.AlertManeuver": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("softButtons" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); @@ -180,6 +198,12 @@ FFW.Navigation = FFW.RPCObserver.create( { } case "Navigation.ShowConstantTBT": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } + SDL.SDLModel.tbtActivate(request.params); this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, @@ -189,6 +213,24 @@ FFW.Navigation = FFW.RPCObserver.create( { } case "Navigation.UpdateTurnList": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("turnList" in request.params || "softButtons" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + SDL.SDLModel.tbtTurnListUpdate(request.params); this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, @@ -238,6 +280,12 @@ FFW.Navigation = FFW.RPCObserver.create( { } case "Navigation.SendLocation": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } + this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); @@ -292,6 +340,14 @@ FFW.Navigation = FFW.RPCObserver.create( { */ sendNavigationResult: function(resultCode, id, method) { + if (this.errorResponsePull[id]) { + + this.sendError(this.errorResponsePull[id].code, id, method, + "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed."); + this.errorResponsePull[id] = null; + return; + } + Em.Logger.log("FFW.UI." + method + "Response"); if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { diff --git a/src/components/HMI/ffw/RPCClient.js b/src/components/HMI/ffw/RPCClient.js index 954dfbe17e..5df06334d2 100644 --- a/src/components/HMI/ffw/RPCClient.js +++ b/src/components/HMI/ffw/RPCClient.js @@ -129,34 +129,19 @@ FFW.RPCClient = Em.Object Em.Logger.log("Message received: " + evt.data);
- var jsonObj = JSON.parse(evt.data);
-
- JSON.parse(evt.data, SDL.RPCController.capabilitiesCheck);
-
- if (jsonObj.method == 'UI.Show' && SDL.RPCController.capabilityCheckResult == 'UNSUPPORTED_RESOURCE' && Object.size(jsonObj.params) != 3 && jsonObj.params.showStrings.length != 0) {
-
- this.observer.errorResponsePull[jsonObj.id] = SDL.SDLModel.resultCode["WARNINGS"];
-
- Em.Logger.error('Image of STATIC type is not supported on HMI. Other information was successfully displayed');
+ var jsonObj = JSON.parse(evt.data, SDL.RPCController.capabilitiesCheck);
+ if (SDL.RPCController.capabilityCheckResult != null) {
+ this.observer.errorResponsePull[jsonObj.id] = SDL.RPCController.capabilityCheckResult;
SDL.RPCController.capabilityCheckResult = null;
- } else {
-
- switch (SDL.RPCController.capabilityCheckResult) {
- case 'UNSUPPORTED_RESOURCE': {
-
- this.observer.errorResponsePull[jsonObj.id] = SDL.SDLModel.resultCode["UNSUPPORTED_RESOURCE"];
-
- Em.Logger.error('Unsupported incoming resource! In method ' + jsonObj.method);
-
- SDL.RPCController.capabilityCheckResult = null;
-
- break;
- }
- }
+ this.observer.checkImage(jsonObj.params);
+ this.observer.checkSoftButtons(jsonObj.params);
+ this.observer.checkChoice(jsonObj.params);
+ this.observer.checkChunk(jsonObj.params);
+ this.observer.checkHelpItems(jsonObj.params);
+ this.observer.checkTurnList(jsonObj.params);
}
-
// handle component registration
if (jsonObj.id == this.registerRequestId && jsonObj.method == null && typeof jsonObj.result == 'number') {
if (jsonObj.error == null) {
@@ -289,22 +274,6 @@ FFW.RPCClient = Em.Object if (this.socket.readyState == this.socket.OPEN) {
- if (this.observer.errorResponsePull[obj.id] && this.observer.errorResponsePull[obj.id] !== 0 && obj.result) {
- var method = obj.result.method;
-
- delete obj.result;
-
- obj.error = {
- "code": this.observer.errorResponsePull[obj.id],
- "message": this.observer.errorResponsePull[obj.id] == 21 ? "Image of STATIC type is not supported on HMI. Other information was successfully displayed" : "Unsupported incoming resource!",
- "data": {
- "method": method
- }
- }
-
- delete this.observer.errorResponsePull[obj.id];
- }
-
var strJson = JSON.stringify(obj);
Em.Logger.log(strJson);
diff --git a/src/components/HMI/ffw/RPCObserver.js b/src/components/HMI/ffw/RPCObserver.js index 6f598cbeb0..76b002aa8b 100644 --- a/src/components/HMI/ffw/RPCObserver.js +++ b/src/components/HMI/ffw/RPCObserver.js @@ -71,11 +71,244 @@ FFW.RPCObserver = Em.Object // parse JSON string and set necessary properties
},
- onRPCRequest: function(request) {
+ onRPCRequest: function(request, error) {
// parse JSON string and send back necessary data
},
+ /**
+ * Check for unsupported image type
+ * Return false if unsupported image type was found and delete unsupported resource
+ * @param params
+ * @returns {boolean}
+ */
+ checkImage: function(params){
+ if ("graphic" in params) {
+ if (params.graphic.imageType === "STATIC") {
+ delete params.graphic;
+ return false;
+ }
+ }
+ if ("secondaryGraphic" in params) {
+ if (params.secondaryGraphic.imageType === "STATIC") {
+ delete params.secondaryGraphic;
+ return false;
+ }
+ }
+ if ("image" in params) {
+ if (params.image.imageType === "STATIC") {
+ delete params.image;
+ return false;
+ }
+ }
+ if ("secondaryImage" in params) {
+ if (params.image.imageType === "STATIC") {
+ delete params.image;
+ return false;
+ }
+ }
+ if ("turnIcon" in params) {
+ if (params.turnIcon.imageType === "STATIC") {
+ delete params.turnIcon;
+ return false;
+ }
+ }
+ if ("nextTurnIcon" in params) {
+ if (params.nextTurnIcon.imageType === "STATIC") {
+ delete params.nextTurnIcon;
+ return false;
+ }
+ }
+ if ("cmdIcon" in params) {
+ if (params.cmdIcon.imageType === "STATIC") {
+ delete params.cmdIcon;
+ return false;
+ }
+ }
+ if ("menuIcon" in params) {
+ if (params.menuIcon.imageType === "STATIC") {
+ delete params.menuIcon;
+ return false;
+ }
+ }
+ if ("syncFileName" in params) {
+ if (params.syncFileName.imageType === "STATIC") {
+ delete params.syncFileName;
+ return false;
+ }
+ }
+ if ("locationImage" in params) {
+ if (params.locationImage.imageType === "STATIC") {
+ delete params.locationImage;
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /**
+ * Check for unsupported image type
+ * If unsupported image type was found delete unsupported resource
+ * @param params
+ */
+ checkSoftButtons: function(params){
+
+ if ("softButtons" in params) {
+ for (var i = params.softButtons.length-1; i >= 0 ; i--) {
+ if (!this.checkImage(params.softButtons[i])) {
+ if (!("text" in params.softButtons[i])) {
+
+ params.softButtons.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.softButtons.length == 0) {
+ delete params.softButtons;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported image type
+ * If unsupported image type was found delete unsupported resource
+ * @param params
+ */
+ checkTurnList: function(params){
+
+ if ("turnList" in params) {
+ for (var i = params.turnList.length-1; i >= 0 ; i--) {
+ if (!this.checkImage(params.turnList[i])) {
+ if (!("navigationText" in params.turnList[i])) {
+
+ params.turnList.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.turnList.length == 0) {
+ delete params.turnList;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported tts type
+ * If unsupported tts type was found delete unsupported resource
+ * @param params
+ */
+ checkChunk: function(params){
+
+ if ("ttsName" in params) {
+ for (var i = params.ttsName.length-1; i >= 0 ; i--) {
+ if (params.ttsName[i].type != "TEXT") {
+
+ params.ttsName.splice(i, 1);
+ }
+ }
+
+ if (params.ttsName.length == 0) {
+ delete params.ttsName;
+ }
+ }
+ if ("helpPrompt" in params) {
+ for (var i = params.helpPrompt.length-1; i >= 0 ; i--) {
+ if (params.helpPrompt[i].type != "TEXT") {
+
+ params.helpPrompt.splice(i, 1);
+ }
+ }
+
+ if (params.helpPrompt.length == 0) {
+ delete params.helpPrompt;
+ }
+ }
+ if ("initialPrompt" in params) {
+ for (var i = params.initialPrompt.length-1; i >= 0 ; i--) {
+ if (params.initialPrompt[i].type != "TEXT") {
+
+ params.initialPrompt.splice(i, 1);
+ }
+ }
+
+ if (params.initialPrompt.length == 0) {
+ delete params.initialPrompt;
+ }
+ }
+ if ("timeoutPrompt" in params) {
+ for (var i = params.timeoutPrompt.length-1; i >= 0 ; i--) {
+ if (params.timeoutPrompt[i].type != "TEXT") {
+
+ params.timeoutPrompt.splice(i, 1);
+ }
+ }
+
+ if (params.timeoutPrompt.length == 0) {
+ delete params.timeoutPrompt;
+ }
+ }
+ if ("ttsChunks" in params) {
+ for (var i = params.ttsChunks.length-1; i >= 0 ; i--) {
+ if (params.ttsChunks[i].type != "TEXT") {
+
+ params.ttsChunks.splice(i, 1);
+ }
+ }
+
+ if (params.ttsChunks.length == 0) {
+ delete params.ttsChunks;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported choiceSet type
+ * If unsupported choiceSet type was found delete unsupported resource
+ * @param params
+ */
+ checkChoice: function(params){
+
+ if ("choiceSet" in params) {
+ for (var i = params.choiceSet.length-1; i >= 0 ; i--) {
+ if (this.checkImage(params.choiceSet[i])) {
+ if (!("menuName" in params.choiceSet[i])
+ || !("secondaryText" in params.choiceSet[i])
+ || !("tertiaryText" in params.choiceSet[i])) {
+
+ params.choiceSet.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.choiceSet.length == 0) {
+ delete params.choiceSet;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported vrHelp type
+ * If unsupported vrHelp type was found delete unsupported resource
+ * @param params
+ */
+ checkHelpItems: function(params){
+
+ if ("vrHelp" in params) {
+ for (var i = params.vrHelp.length-1; i >= 0 ; i--) {
+ if (this.checkImage(params.vrHelp[i])) {
+ if (!("text" in params.vrHelp[i])) {
+
+ params.vrHelp.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.vrHelp.length == 0) {
+ delete params.vrHelp;
+ }
+ }
+ },
+
validationCheck: function(request) {
if (request && request.method) {
diff --git a/src/components/HMI/ffw/TTSRPC.js b/src/components/HMI/ffw/TTSRPC.js index 6939aa4938..0e0b92acd4 100644 --- a/src/components/HMI/ffw/TTSRPC.js +++ b/src/components/HMI/ffw/TTSRPC.js @@ -151,6 +151,24 @@ FFW.TTS = FFW.RPCObserver.create( { switch (request.method) { case "TTS.Speak": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("ttsChunks" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + if (SDL.TTSPopUp.active) { FFW.TTS.sendError(SDL.SDLModel.resultCode["REJECTED"], request.id, "TTS.Speak", "TTS in progress. Rejected."); } else { @@ -162,6 +180,25 @@ FFW.TTS = FFW.RPCObserver.create( { } case "TTS.SetGlobalProperties": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("helpPrompt" in request.params + || "timeoutPrompt" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + SDL.SDLModel.setProperties(request.params); this.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"], @@ -248,6 +285,25 @@ FFW.TTS = FFW.RPCObserver.create( { } case "TTS.ChangeRegistration": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("ttsName" in request.params + || "language" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + SDL.SDLModel.changeRegistrationTTSVR(request.params.language, request.params.appID); this.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"], @@ -328,6 +384,14 @@ FFW.TTS = FFW.RPCObserver.create( { */ sendTTSResult: function(resultCode, id, method) { + if (this.errorResponsePull[id]) { + + this.sendError(this.errorResponsePull[id].code, id, method, + "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed."); + this.errorResponsePull[id] = null; + return; + } + Em.Logger.log("FFW." + method + "Response"); if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { diff --git a/src/components/HMI/ffw/UIRPC.js b/src/components/HMI/ffw/UIRPC.js index 43ee73a850..ff0aa73013 100644 --- a/src/components/HMI/ffw/UIRPC.js +++ b/src/components/HMI/ffw/UIRPC.js @@ -168,6 +168,25 @@ FFW.UI = FFW.RPCObserver.create({ case "UI.Alert": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if (request.params.alertStrings.length > 0 + || "softButtons" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + if (SDL.SDLModel.onUIAlert(request.params, request.id)) { SDL.SDLController.onSystemContextChange(request.params.appID); } @@ -177,6 +196,28 @@ FFW.UI = FFW.RPCObserver.create({ case "UI.Show": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if (request.params.showStrings.length > 0 + || "graphic" in request.params + || "secondaryGraphic" in request.params + || "softButtons" in request.params + || "customPresets" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + SDL.TurnByTurnView.deactivate(); SDL.SDLController.getApplicationModel(request.params.appID).onSDLUIShow(request.params); this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); @@ -185,14 +226,29 @@ FFW.UI = FFW.RPCObserver.create({ } case "UI.SetGlobalProperties": { - SDL.SDLModel.setProperties(request.params); - this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { - break; - } - case "UI.ResetGlobalProperties": - { + //Check if there is any available data to process the request + if ("menuTitle" in request.params + || "keyboardProperties" in request.params + || "vrHelp" in request.params + || "menuIcon" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + + SDL.SDLModel.setProperties(request.params); this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); @@ -201,6 +257,25 @@ FFW.UI = FFW.RPCObserver.create({ case "UI.AddCommand": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("cmdIcon" in request.params + || "menuParams" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + SDL.SDLController.getApplicationModel(request.params.appID).addCommand(request); break; @@ -230,6 +305,26 @@ FFW.UI = FFW.RPCObserver.create({ case "UI.PerformInteraction": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("choiceSet" in request.params + && request.params + && request.params.interactionLayout != "KEYBOARD") { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + if (SDL.SDLModel.uiPerformInteraction(request)) { SDL.SDLController.onSystemContextChange(); } @@ -772,6 +867,20 @@ FFW.UI = FFW.RPCObserver.create({ case "UI.SetAppIcon": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if (!("syncFileName" in request.params)) { + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + SDL.SDLModel.onSDLSetAppIcon(request.params, request.id, request.method); break; @@ -1320,6 +1429,14 @@ FFW.UI = FFW.RPCObserver.create({ */ sendUIResult: function (resultCode, id, method) { + if (this.errorResponsePull[id]) { + + this.sendError(this.errorResponsePull[id].code, id, method, + "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed."); + this.errorResponsePull[id] = null; + return; + } + Em.Logger.log("FFW." + method + "Response"); if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { @@ -1351,16 +1468,8 @@ FFW.UI = FFW.RPCObserver.create({ switch (resultCode) { case SDL.SDLModel.resultCode["SUCCESS"]: { - // send repsonse - var JSONMessage = { - "jsonrpc": "2.0", - "id": id, - "result": { - "code": resultCode, // type (enum) from SDL protocol - "method": 'UI.Alert' - } - }; - this.client.send(JSONMessage); + + this.sendUIResult(resultCode, id, 'UI.Alert'); break; } @@ -1394,6 +1503,7 @@ FFW.UI = FFW.RPCObserver.create({ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { + this.sendUIResult(resultCode, id, 'UI.Alert'); // send repsonse var JSONMessage = { "jsonrpc": "2.0", @@ -1530,6 +1640,36 @@ FFW.UI = FFW.RPCObserver.create({ Em.Logger.log("FFW.UI.PerformInteractionResponse"); + if (this.errorResponsePull[requestID]) { + + if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { + // send repsonse + var JSONMessage = { + "jsonrpc": "2.0", + "id": requestID, + "error": { + "code": this.errorResponsePull[requestID].code, + "message": "Unsupported " + this.errorResponsePull[requestID].type + " type. Available data in request was processed.", + "data": { + "method": "UI.PerformInteraction" + } + } + }; + + if (commandID) { + JSONMessage.error.data.choiceID = commandID; + } + + if (manualTextEntry != null) { + JSONMessage.error.data.manualTextEntry = manualTextEntry; + } + } + + this.client.send(JSONMessage); + this.errorResponsePull[requestID] = null; + return; + } + if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { // send repsonse var JSONMessage = { diff --git a/src/components/HMI/ffw/VRRPC.js b/src/components/HMI/ffw/VRRPC.js index 680c9a87dc..55a51b68cb 100644 --- a/src/components/HMI/ffw/VRRPC.js +++ b/src/components/HMI/ffw/VRRPC.js @@ -247,6 +247,27 @@ FFW.VR = FFW.RPCObserver.create( { case "VR.PerformInteraction": { + // Werify if there is an ansupported data in request + if (this.errorResponsePull[request.id] != null) { + + //Check if there is any available data to process the request + if ("helpPrompt" in request.params + || "initialPrompt" in request.params + || "timeoutPrompt" in request.params + || "grammarID" in request.params) { + + this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"]; + } else { + //If no available data sent error response and stop process current request + + this.sendError(this.errorResponsePull[request.id].code, request.id, request.method, + "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed."); + this.errorResponsePull[request.id] = null; + + return; + } + } + SDL.SDLModel.vrPerformInteraction(request); break; @@ -366,6 +387,14 @@ FFW.VR = FFW.RPCObserver.create( { */ sendVRResult: function(resultCode, id, method) { + if (this.errorResponsePull[id]) { + + this.sendError(this.errorResponsePull[id].code, id, method, + "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed."); + this.errorResponsePull[id] = null; + return; + } + Em.Logger.log("FFW." + method + "Response"); if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { |