resultStruct: {},
- /**
+ /**
+ * Validate method for request PolicyUpdate
+ *
+ * @param {Object}
+ * params
+ */
+ PolicyUpdate: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.file == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'file' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.file != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'file'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.timeout == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'timeout' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.timeout != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'timeout'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.retry == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'retry' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.retry.length < 1) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'retry'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
* Validate method for request SystemRequest
*
* @param {Object}
onPutFileSubscribeRequestID: -1,
-allowSDLFunctionalityRequestID: -1,
+ allowSDLFunctionalityRequestID: -1,
onSystemErrorSubscribeRequestID: -1,
onStatusUpdateSubscribeRequestID: -1,
onAppUnregisteredSubscribeRequestID: -1,
onPlayToneSubscribeRequestID: -1,
onSDLCloseSubscribeRequestID: -1,
-onSDLConsentNeededSubscribeRequestID: -1,
+ onSDLConsentNeededSubscribeRequestID: -1,
onPutFileUnsubscribeRequestID: -1,
-onSystemErrorUnsubscribeRequestID: -1,
+ onSystemErrorUnsubscribeRequestID: -1,
onStatusUpdateUnsubscribeRequestID: -1,
onAppPermissionChangedUnsubscribeRequestID: -1,
onFileRemovedUnsubscribeRequestID: -1,
onAppUnregisteredUnsubscribeRequestID: -1,
onPlayToneUnsubscribeRequestID: -1,
onSDLCloseUnsubscribeRequestID: -1,
-onSDLConsentNeededUnsubscribeRequestID: -1,
+ onSDLConsentNeededUnsubscribeRequestID: -1,
// const
onSystemErrorNotification: "SDL.OnSystemError",
onAppUnregisteredNotification: "BasicCommunication.OnAppUnregistered",
onPlayToneNotification: "BasicCommunication.PlayTone",
onSDLCloseNotification: "BasicCommunication.OnSDLClose",
-onSDLConsentNeededNotification: "SDL.OnSDLConsentNeeded",
+ onSDLConsentNeededNotification: "SDL.OnSDLConsentNeeded",
/**
* init object
// subscribe to notifications
this.onPutFileSubscribeRequestID = this.client
.subscribeToNotification(this.onPutFileNotification);
-this.onSystemErrorSubscribeRequestID = this.client
+ this.onSystemErrorSubscribeRequestID = this.client
.subscribeToNotification(this.onSystemErrorNotification);
this.onStatusUpdateSubscribeRequestID = this.client
.subscribeToNotification(this.onStatusUpdateNotification);
.subscribeToNotification(this.onPlayToneNotification);
this.onSDLCloseSubscribeRequestID = this.client
.subscribeToNotification(this.onSDLCloseNotification);
-this.onSDLConsentNeededSubscribeRequestID = this.client
+ this.onSDLConsentNeededSubscribeRequestID = this.client
.subscribeToNotification(this.onSDLConsentNeededNotification);
},
this.onPutFileUnsubscribeRequestID = this.client
.unsubscribeFromNotification(this.onPutFileNotification);
-this.onSystemErrorUnsubscribeRequestID = this.client
+ this.onSystemErrorUnsubscribeRequestID = this.client
.unsubscribeFromNotification(this.onSystemErrorNotification);
this.onStatusUpdateUnsubscribeRequestID = this.client
.unsubscribeFromNotification(this.onStatusUpdateNotification);
.unsubscribeFromNotification(this.onPlayToneUpdatedNotification);
this.onSDLCloseUnsubscribeRequestID = this.client
.unsubscribeFromNotification(this.onSDLCloseNotification);
-this.onSDLConsentNeededUnsubscribeRequestID = this.client
+ this.onSDLConsentNeededUnsubscribeRequestID = this.client
.unsubscribeFromNotification(this.onSDLConsentNeededNotification);
},
Em.Logger.log("SDL.GetListOfPermissions: Response from SDL!");
- if (response.id in SDL.SDLModel.getListOfPermissionsPull) {
- var appID = SDL.SDLModel.getListOfPermissionsPull[response.id];
- SDL.SDLController.getApplicationModel(appID).allowedFunctions = response.result.allowedFunctions;
-
- SDL.SettingsController.userFriendlyMessagePopUp();
-
- SDL.SDLModel.getListOfPermissionsPull.remove(response.id);
- }
+ SDL.SettingsController.GetListOfPermissionsResponse(response);
}
if (response.result.method == "SDL.GetStatusUpdate") {
if (response.result.method == "SDL.GetURLS") {
SDL.SDLModel.set('policyURLs', response.result.urls);
+
+ this.OnSystemRequest("PROPRIETARY", response.result.urls[0].policyAppId, SDl.SettingsController.policyUpdateFile, response.result.urls[0].url);
}
},
SDL.SDLModel.onFileRemoved(notification.params);
}
-if (notification.method == this.onSystemErrorNotification) {
+ if (notification.method == this.onSystemErrorNotification) {
var message = "Undefined";
if (notification.method == this.onSDLCloseNotification) {
//notification handler method
}
-if (notification.method == this.onSDLConsentNeededNotification) {
+ if (notification.method == this.onSDLConsentNeededNotification) {
//Show popUp
SDL.SettingsController.AllowSDLFunctionality(notification.params.device);
request.method);
}
if (request.method == "BasicCommunication.SystemRequest") {
+
+ this.OnReceivedPolicyUpdate(SDl.SettingsController.policyUpdateFile);
+
+ SDl.SettingsController.policyUpdateFile = null;
+
this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"],
request.id,
request.method);
SDL.SDLController.getApplicationModel(request.params.appID).turnOnSDL(request.params.appID);
this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
}
-if (request.method == "BasicCommunication.GetSystemInfo") {
+ if (request.method == "BasicCommunication.GetSystemInfo") {
Em.Logger.log("BasicCommunication.GetSystemInfo Response");
//TO DO
//popUp activation
}
+ if (request.method == "SDL.PolicyUpdate") {
+ SDl.SettingsController.policyUpdateFile = request.params.file;
+ this.GetURLS(7); //Service type for policies
+
+ this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+ }
}
},
/**
* Send request if application was activated
*
- * @param {Number} appID
+ * @param {Number} type
*/
- GetURLS: function(appID) {
+ GetURLS: function(type) {
Em.Logger.log("FFW.SDL.GetURLS: Request from HMI!");
"method": "SDL.GetURLS",
"params": {
"service": {
- "servicyType": "servicyType",
- "policyAppId": "policyAppId"
+ "service": type
}
}
};
*
* @callback callbackFunc
*/
- GetUserFriendlyMessage: function(callbackFunc, appID) {
+ GetUserFriendlyMessage: function(callbackFunc, appID, messageCodes) {
var itemIndex = this.client.generateId();
"id": itemIndex,
"method": "SDL.GetUserFriendlyMessage",
"params": {
- "messageCodes": ["code"],
"language": SDL.SDLModel.hmiUILanguage
}
};
+
+ if (messageCodes) {
+ JSONMessage.params.messageCodes = messageCodes;
+ }
+
this.client.send(JSONMessage);
},
this.client.send(JSONMessage);
},
+
+ /**
+ * Notification of decrypted policy table available
+ *
+ * @param {String} policyfile
+ */
+ OnReceivedPolicyUpdate: function(policyfile) {
+
+ Em.Logger.log("FFW.SDL.OnReceivedPolicyUpdate");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "SDL.OnReceivedPolicyUpdate",
+ "params": {
+ "policyfile": policyfile
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
/**
* Notifies if functionality was changed
*
/**
* Initiated by HMI.
*/
- OnSystemRequest: function(type) {
+ OnSystemRequest: function(type, appID, fileName, utl) {
Em.Logger.log("FFW.BasicCommunication.OnSystemRequest");
"offset": 1000,
"length": 10000,
"timeout": 500,
- "fileName": document.location.pathname.replace("index.html", "IVSU/PROPRIETARY_REQUEST"),
- "appID": SDL.SDLAppController.model ? SDL.SDLAppController.model.appID.toString() : "default"
+ "fileName": fileName ? fileName : document.location.pathname.replace("index.html", "IVSU/PROPRIETARY_REQUEST"),
+ "appID": SDL.SDLAppController.model ? SDL.SDLAppController.model.appID : null
}
};
this.client.send(JSONMessage);