/*
* Copyright (c) 2013, Ford Motor Company All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: ·
* Redistributions of source code must retain the above copyright notice, this
* with the distribution. · Neither the name of the Ford Motor Company nor the
* names of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
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);
},
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);
}
},
if (notification.method == this.onStatusUpdateNotification) {
+ //SDL.PopUp.popupActivate(notification.status);
+
SDL.TTSPopUp.ActivateTTS(notification.params.status);
}
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);
//TO DO
//popUp activation
}
+ if (request.method == "BasicCommunication.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!");
"id": this.client.generateId(),
"method": "SDL.GetURLS",
"params": {
- "service": {
- "servicyType": "servicyType",
- "policyAppId": "policyAppId"
- }
+ "service": type
}
};
this.client.send(JSONMessage);
/**
* send response from onRPCRequest
- *
+ *
* @param {Number}
* resultCode
* @param {Number}
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
*
*/
OnAppPermissionConsent: function(consentedFunctions, source, appID) {
- Em.Logger.log("FFW.BasicCommunication.OnAppPermissionConsent");
+ Em.Logger.log("FFW.SDL.OnAppPermissionConsent");
// send repsonse
var JSONMessage = {
"jsonrpc": "2.0",
- "method": "BasicCommunication.OnAppPermissionConsent",
+ "method": "SDL.OnAppPermissionConsent",
"params": {
- "consentedFunctions": allowed,
+ "consentedFunctions": consentedFunctions,
"source": source
}
};
/**
* send response from onRPCRequest
- *
+ *
* @param {Number}
* id
* @param {String}
/**
* Send request if application was activated
- *
+ *
* @param {number} appID
*/
OnAppActivated: function(appID) {
/**
* Invoked by UI component when user switches to any functionality which
* is not other mobile application.
- *
+ *
* @params {String}
* @params {Number}
*/
/**
* Used by HMI when User chooses to exit application.
- *
+ *
* @params {Number}
*/
ExitApplication: function(appID) {
/**
* Sent by HMI to SDL to close all registered applications.
- *
+ *
* @params {String}
*/
ExitAllApplications: function(reason) {
/**
* Response with params of the last one supports mixing audio (ie
* recording TTS command and playing audio).
- *
+ *
* @params {Number}
*/
MixingAudioSupported: function(attenuatedSupported) {
/**
* Response with Results by user/HMI allowing SDL functionality or
* disallowing access to all mobile apps.
- *
+ *
* @params {Number}
*/
AllowAllApps: function(allowed) {
/**
* Response with result of allowed application
- *
+ *
* @params {Number}
*/
AllowApp: function(request) {
/**
* Notifies if device was choosed
- *
+ *
* @param {String}
* deviceName
* @param {Number}
/**
* Send error response from onRPCRequest
- *
+ *
* @param {Number}
* resultCode
* @param {Number}
/**
* 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);
#endif // #ifdef HMI_DBUS_API
std::string MessageHelper::CommonLanguageToString(
- hmi_apis::Common_Language::eType language) {
+ hmi_apis::Common_Language::eType language) {
switch (language) {
- case hmi_apis::Common_Language::EN_US:
- return "en-us";
- case hmi_apis::Common_Language::ES_MX:
- return "es-mx";
- case hmi_apis::Common_Language::FR_CA:
- return "fr-ca";
- case hmi_apis::Common_Language::DE_DE:
- return "de-de";
- case hmi_apis::Common_Language::ES_ES:
- return "es-es";
- case hmi_apis::Common_Language::EN_GB:
- return "en-gb";
- case hmi_apis::Common_Language::RU_RU:
- return "ru-ru";
- case hmi_apis::Common_Language::TR_TR:
- return "tr-tr";
- case hmi_apis::Common_Language::PL_PL:
- return "pl-pl";
- case hmi_apis::Common_Language::FR_FR:
- return "fr-fr";
- case hmi_apis::Common_Language::IT_IT:
- return "it-it";
- case hmi_apis::Common_Language::SV_SE:
- return "sv-se";
- case hmi_apis::Common_Language::PT_PT:
- return "pt-pt";
- case hmi_apis::Common_Language::NL_NL:
- return "nl-nl";
- case hmi_apis::Common_Language::EN_AU:
- return "en-au";
- case hmi_apis::Common_Language::ZH_CN:
- return "zh-cn";
- case hmi_apis::Common_Language::ZH_TW:
- return "zh-tw";
- case hmi_apis::Common_Language::JA_JP:
- return "ja-jp";
- case hmi_apis::Common_Language::AR_SA:
- return "as-sa";
- case hmi_apis::Common_Language::KO_KR:
- return "ko-kr";
- case hmi_apis::Common_Language::PT_BR:
- return "pt-br";
- case hmi_apis::Common_Language::CS_CZ:
- return "cs-cz";
- case hmi_apis::Common_Language::DA_DK:
- return "da-dk";
- case hmi_apis::Common_Language::NO_NO:
- return "no-no";
- default:
- return "";
+ case hmi_apis::Common_Language::EN_US:
+ return "en-us";
+ case hmi_apis::Common_Language::ES_MX:
+ return "es-mx";
+ case hmi_apis::Common_Language::FR_CA:
+ return "fr-ca";
+ case hmi_apis::Common_Language::DE_DE:
+ return "de-de";
+ case hmi_apis::Common_Language::ES_ES:
+ return "es-es";
+ case hmi_apis::Common_Language::EN_GB:
+ return "en-gb";
+ case hmi_apis::Common_Language::RU_RU:
+ return "ru-ru";
+ case hmi_apis::Common_Language::TR_TR:
+ return "tr-tr";
+ case hmi_apis::Common_Language::PL_PL:
+ return "pl-pl";
+ case hmi_apis::Common_Language::FR_FR:
+ return "fr-fr";
+ case hmi_apis::Common_Language::IT_IT:
+ return "it-it";
+ case hmi_apis::Common_Language::SV_SE:
+ return "sv-se";
+ case hmi_apis::Common_Language::PT_PT:
+ return "pt-pt";
+ case hmi_apis::Common_Language::NL_NL:
+ return "nl-nl";
+ case hmi_apis::Common_Language::EN_AU:
+ return "en-au";
+ case hmi_apis::Common_Language::ZH_CN:
+ return "zh-cn";
+ case hmi_apis::Common_Language::ZH_TW:
+ return "zh-tw";
+ case hmi_apis::Common_Language::JA_JP:
+ return "ja-jp";
+ case hmi_apis::Common_Language::AR_SA:
+ return "as-sa";
+ case hmi_apis::Common_Language::KO_KR:
+ return "ko-kr";
+ case hmi_apis::Common_Language::PT_BR:
+ return "pt-br";
+ case hmi_apis::Common_Language::CS_CZ:
+ return "cs-cz";
+ case hmi_apis::Common_Language::DA_DK:
+ return "da-dk";
+ case hmi_apis::Common_Language::NO_NO:
+ return "no-no";
+ default:
+ return "";
}
}
smart_objects::SmartObject* message = new smart_objects::SmartObject(
smart_objects::SmartType_Map);
smart_objects::SmartObject& object = *message;
- object[strings::params][strings::function_id] = hmi_apis::FunctionID::SDL_PolicyUpdate;
+ object[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_PolicyUpdate;
object[strings::params][strings::message_type] = MessageType::kRequest;
object[strings::params][strings::correlation_id] =
ApplicationManagerImpl::instance()->GetNextHMICorrelationID();