summaryrefslogtreecommitdiff
path: root/src/components/HMI/ffw/BasicCommunicationRPC.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/HMI/ffw/BasicCommunicationRPC.js')
-rw-r--r--src/components/HMI/ffw/BasicCommunicationRPC.js212
1 files changed, 157 insertions, 55 deletions
diff --git a/src/components/HMI/ffw/BasicCommunicationRPC.js b/src/components/HMI/ffw/BasicCommunicationRPC.js
index 0fd63b0fc..ed33daef1 100644
--- a/src/components/HMI/ffw/BasicCommunicationRPC.js
+++ b/src/components/HMI/ffw/BasicCommunicationRPC.js
@@ -202,93 +202,134 @@ FFW.BasicCommunication = FFW.RPCObserver
Em.Logger.log("FFW.BasicCommunicationRPC.onRPCResult");
this._super();
- if (response.result.method == "SDL.GetUserFriendlyMessage") {
+ if ("result" in response
+ && response.result.code === SDL.SDLModel.resultCode["SUCCESS"]) {
- Em.Logger.log("SDL.GetUserFriendlyMessage: Response from SDL!");
+ if (response.result.method == "SDL.GetUserFriendlyMessage") {
- if (response.id in SDL.SDLModel.userFriendlyMessagePull) {
- var callbackObj = SDL.SDLModel.userFriendlyMessagePull[response.id];
- callbackObj.callbackFunc(response.result.messages, callbackObj.appID);
- delete SDL.SDLModel.userFriendlyMessagePull[response.id];
- }
- }
+ Em.Logger.log("SDL.GetUserFriendlyMessage: Response from SDL!");
- if (response.result.method == "SDL.ActivateApp") {
+ if (response.id in SDL.SDLModel.userFriendlyMessagePull) {
+ var callbackObj = SDL.SDLModel.userFriendlyMessagePull[response.id];
+ callbackObj.callbackFunc(response.result.messages);
+ delete SDL.SDLModel.userFriendlyMessagePull[response.id];
+ }
+ }
- Em.Logger.log("SDL.ActivateApp: Response from SDL!");
+ if (response.result.method == "SDL.ActivateApp") {
- if (response.id in SDL.SDLModel.activateAppRequestsList) {
+ Em.Logger.log("SDL.ActivateApp: Response from SDL!");
- var appID = SDL.SDLModel.activateAppRequestsList[response.id];
+ if (response.id in SDL.SDLModel.activateAppRequestsList) {
- if (!response.result.isSDLAllowed) {
+ var appID = SDL.SDLModel.activateAppRequestsList[response.id].appID,
+ popUp = SDL.SDLModel.activateAppRequestsList[response.id].popUp;
- SDL.SettingsController.currentDeviceAllowance = response.result.device;
+ popUp.deactivate();
- FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.AllowSDLFunctionality, appID, ["DataConsent"]);
- }
+ if (response.error && response.error.code === SDL.SDLModel.resultCode["APPLICATION_NOT_REGISTERED"]) {
- if (response.result.isPermissionsConsentNeeded) {
+ SDL.PopUp.create().appendTo('body').popupActivate("Activation FAILED!");
+ return;
+ }
- this.GetListOfPermissions(appID);
- }
+ if (!response.result.isSDLAllowed) {
- if (response.result.isAppPermissionsRevoked) {
+ SDL.SettingsController.currentDeviceAllowance = response.result.device;
- SDL.SDLModel.setAppPermissions(appID, response.result.appRevokedPermissions);
- }
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.AllowSDLFunctionality, appID, ["DataConsent"]);
+ }
- if (response.result.isAppRevoked) {
+ if (response.result.isPermissionsConsentNeeded) {
- FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, appID, ["AppUnsupported"]);
- } else {
+ this.GetListOfPermissions(appID);
+ }
- SDL.SDLController.getApplicationModel(appID).deviceID = response.result.device ? response.result.device.id : null;
+ if (response.result.isAppPermissionsRevoked) {
- if ( SDL.SDLAppController.model && SDL.SDLAppController.model.appID != appID) {
- SDL.States.goToStates('info.apps');
+ SDL.SDLModel.setAppPermissions(appID, response.result.appRevokedPermissions);
}
- if (SDL.SDLModel.stateLimited == appID) {
- SDL.SDLModel.stateLimited = null;
- SDL.SDLModel.set('limitedExist', false);
- }
+ if (response.result.isAppRevoked) {
- if (response.result.isSDLAllowed) {
- SDL.SDLController.getApplicationModel(appID).turnOnSDL(appID);
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, appID, ["AppUnsupported"]);
+ } else {
+
+ SDL.SDLController.getApplicationModel(appID).deviceID = response.result.device ? response.result.device.id : null;
+
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.appID != appID) {
+ SDL.States.goToStates('info.apps');
+ }
+
+ if (SDL.SDLModel.stateLimited == appID) {
+ SDL.SDLModel.stateLimited = null;
+ SDL.SDLModel.set('limitedExist', false);
+ }
+
+ if (response.result.isSDLAllowed) {
+ SDL.SDLController.getApplicationModel(appID).turnOnSDL(appID);
+ }
}
- }
- delete SDL.SDLModel.activateAppRequestsList[response.id];
+ delete SDL.SDLModel.activateAppRequestsList[response.id];
+ }
+ } else if (response.result.method == "SDL.ActivateApp" && response.result.code != 0) {
+ Em.Logger.error("SDL.ActivateApp: Wrong Response from SDL!");
}
- }
- if (response.result.method == "SDL.GetListOfPermissions") {
+ if (response.result.method == "SDL.GetListOfPermissions") {
- Em.Logger.log("SDL.GetListOfPermissions: Response from SDL!");
+ Em.Logger.log("SDL.GetListOfPermissions: Response from SDL!");
- SDL.SettingsController.GetListOfPermissionsResponse(response);
- }
+ SDL.SettingsController.GetListOfPermissionsResponse(response);
+ }
- if (response.result.method == "SDL.GetStatusUpdate") {
+ if (response.result.method == "SDL.GetStatusUpdate") {
- Em.Logger.log("SDL.GetStatusUpdate: Response from SDL!");
+ Em.Logger.log("SDL.GetStatusUpdate: Response from SDL!");
- SDL.PopUp.create().appendTo('body').popupActivate(response.result);
- }
+ SDL.PopUp.create().appendTo('body').popupActivate(response.result);
+ }
- if (response.result.method == "SDL.GetURLS") {
+ if (response.result.method == "SDL.GetURLS") {
- SDL.SDLModel.set('policyURLs', response.result.urls);
+ SDL.SDLModel.set('policyURLs', response.result.urls);
+
+ if (response.result.urls.length) {
+ this.OnSystemRequest("PROPRIETARY", response.result.urls[0].policyAppId, SDL.SettingsController.policyUpdateFile, response.result.urls[0].url);
+ } else {
+ this.OnSystemRequest("PROPRIETARY");
+ }
+
+ SDL.SettingsController.policyUpdateRetry();
- if (response.result.urls.length) {
- this.OnSystemRequest("PROPRIETARY", response.result.urls[0].policyAppId, SDL.SettingsController.policyUpdateFile, response.result.urls[0].url);
- } else {
- this.OnSystemRequest("PROPRIETARY");
}
+ } else if ("error" in response
+ && "code" in response.error
+ && response.error.code !== SDL.SDLModel.resultCode["SUCCESS"]) {
+
+
+ if ("data" in response.error && "method" in response.error.data) {
+ //&& response.error.data.method == "SDL.ActivateApp" && response.error.code === 15) {
+
+ if (response.error.data.method == "SDL.ActivateApp") {
+
+ var appID = SDL.SDLModel.activateAppRequestsList[response.id].appID,
+ popUp = SDL.SDLModel.activateAppRequestsList[response.id].popUp;
- SDL.SettingsController.policyUpdateRetry();
+ popUp.deactivate();
+ if (SDL.SDLModel.resultCode["APPLICATION_NOT_REGISTERED"]) {
+ SDL.PopUp.create().appendTo('body').popupActivate("Activation FAILED! Application not registered!");
+ }
+
+ delete SDL.SDLModel.activateAppRequestsList[response.id];
+ }
+ } else {
+ console.error("Wrong JSON response structure!");
+ }
+ } else {
+ console.error("Wrong JSON response structure!");
}
},
@@ -345,7 +386,7 @@ FFW.BasicCommunication = FFW.RPCObserver
if (notification.params.isAppPermissionsRevoked) {
- SDL.SDLModel.setAppPermissions(notification.params.appID, response.result.appRevokedPermissions);
+ SDL.SDLModel.setAppPermissions(notification.params.appID, notification.params.appRevokedPermissions);
}
if (notification.params.appRevoked) {
@@ -360,7 +401,7 @@ FFW.BasicCommunication = FFW.RPCObserver
}
if (notification.method == this.onAppRegisteredNotification) {
- SDL.SDLModel.onAppRegistered(notification.params);
+ SDL.SDLModel.onAppRegistered(notification.params.application);
this.OnFindApplications();
}
@@ -418,9 +459,19 @@ FFW.BasicCommunication = FFW.RPCObserver
}
if (request.method == "BasicCommunication.UpdateAppList") {
+ var message = "Was found " + request.params.applications.length + " apps";
+
+ SDL.PopUp.create().appendTo('body').popupActivate(message);
+
+ SDL.SDLModel.set('updatedAppsList', request.params.applications);
+
+ SDL.InfoAppsView.showAppList();
+
this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"],
request.id,
request.method);
+
+ SDL.InfoAppsView.showAppList();
}
if (request.method == "BasicCommunication.SystemRequest") {
@@ -494,7 +545,10 @@ FFW.BasicCommunication = FFW.RPCObserver
var itemIndex = this.client.generateId();
- SDL.SDLModel.activateAppRequestsList[itemIndex] = appID;
+ SDL.SDLModel.activateAppRequestsList[itemIndex] = {
+ "appID": appID,
+ "popUp": SDL.PopUp.create().appendTo('body').popupActivate("Activation in progress...", null, true)
+ };
Em.Logger.log("FFW.SDL.OnAppActivated: Request from HMI!");
@@ -508,6 +562,17 @@ FFW.BasicCommunication = FFW.RPCObserver
}
};
this.client.send(JSONMessage);
+
+ setTimeout(function(){
+ if (itemIndex in SDL.SDLModel.activateAppRequestsList) {
+
+ SDL.SDLModel.activateAppRequestsList[itemIndex].popUp.deactivate();
+
+ SDL.PopUp.create().appendTo('body').popupActivate("Activation FAILED! Application not registered!");
+
+ delete SDL.SDLModel.activateAppRequestsList[itemIndex];
+ }
+ }, 20000);
},
/**
@@ -1000,6 +1065,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}
@@ -1151,6 +1234,25 @@ FFW.BasicCommunication = FFW.RPCObserver
},
/**
+ * Notifies if audio state was changed
+ *
+ * @param {Boolean} enabled
+ */
+ OnEmergencyEvent: function(enabled) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnEmergencyEvent");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnEmergencyEvent",
+ "params": {
+ "enabled": enabled
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+ /**
* Send error response from onRPCRequest
*
* @param {Number}