summaryrefslogtreecommitdiff
path: root/src/components/HMI/ffw/UIRPC.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/HMI/ffw/UIRPC.js')
-rw-r--r--src/components/HMI/ffw/UIRPC.js172
1 files changed, 156 insertions, 16 deletions
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 = {