diff options
Diffstat (limited to 'src/components/HMI/ffw/UIRPC.js')
-rw-r--r-- | src/components/HMI/ffw/UIRPC.js | 239 |
1 files changed, 219 insertions, 20 deletions
diff --git a/src/components/HMI/ffw/UIRPC.js b/src/components/HMI/ffw/UIRPC.js index 43ee73a85..5feb304d2 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,28 @@ 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(); } @@ -243,7 +340,10 @@ FFW.UI = FFW.RPCObserver.create({ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) { this.sendUIResult(resultCode, request.id, request.method); } else { - this.sendError(resultCode, request.id, request.method, 'Request is ignored, because the intended result is already in effect.'); + this.sendError(resultCode, + request.id, + request.method, + 'Request is ignored, because the intended result is already in effect.'); } break; @@ -270,10 +370,13 @@ FFW.UI = FFW.RPCObserver.create({ { if (request.params.appName) { - SDL.SDLController.getApplicationModel(request.params.appID).set('appName', request.params.appName); + SDL.SDLController.getApplicationModel(request.params.appID).set('appName', + request.params.appName); } - SDL.SDLModel.changeRegistrationUI(request.params.language, request.params.appID); + SDL.SDLModel.changeRegistrationUI(request.params.language, + request.params.appID, + request.params.appName); this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); break; @@ -492,6 +595,30 @@ FFW.UI = FFW.RPCObserver.create({ "characterSet": "TYPE2SET", "width": 500, "rows": 1 + }, + { + "name": "locationName", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "locationDescription", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "addressLines", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "phoneNumber", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 } ], "imageFields": [ @@ -772,6 +899,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; @@ -780,7 +921,11 @@ FFW.UI = FFW.RPCObserver.create({ { if (this.performAudioPassThruRequestID > 0) { - this.sendError(SDL.SDLModel.resultCode["REJECTED"], request.id, request.method, 'PerformAudioPassThru request aborted!'); + this.sendError( + SDL.SDLModel.resultCode["REJECTED"], + request.id, + request.method, + 'PerformAudioPassThru request aborted!'); } else { this.performAudioPassThruRequestID = request.id; @@ -1020,6 +1165,30 @@ FFW.UI = FFW.RPCObserver.create({ "characterSet": "TYPE2SET", "width": 500, "rows": 1 + }, + { + "name": "locationName", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "locationDescription", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "addressLines", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 + }, + { + "name": "phoneNumber", + "characterSet": "TYPE2SET", + "width": 500, + "rows": 1 } ], "imageFields": [ @@ -1320,6 +1489,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 +1528,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 +1563,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 +1700,35 @@ FFW.UI = FFW.RPCObserver.create({ Em.Logger.log("FFW.UI.PerformInteractionResponse"); + if (this.errorResponsePull[requestID]) { + + // 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 = { |