Skip to content

Commit 4e78da3

Browse files
authored
Merge pull request #532 from smartdevicelink/develop
Release/1.6.0
2 parents 5c281b2 + f541e2f commit 4e78da3

File tree

407 files changed

+1064
-984
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

407 files changed

+1064
-984
lines changed

examples/js/hello-sdl/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@
9494
})
9595
.setOnError((sdlManager, info) => {
9696
console.error('Error from SdlManagerListener: ', info);
97+
})
98+
.setManagerShouldUpdateLifecycleToLanguage((language = null, hmiLanguage = null) => {
99+
return new SDL.manager.lifecycle.LifecycleConfigurationUpdate()
100+
.setAppName('Hello JS')
101+
.setTtsName([new SDL.rpc.structs.TTSChunk().setText('Hello JS')]);
97102
});
98103

99104
this._sdlManager = new SDL.manager.SdlManager(this._appConfig, managerListener);

examples/node/hello-sdl-tcp/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class AppClient {
4747
.setAppId(CONFIG.appId)
4848
.setAppName(CONFIG.appName)
4949
.setLanguageDesired(SDL.rpc.enums.Language.EN_US)
50+
.setHmiDisplayLanguageDesired(SDL.rpc.enums.Language.EN_US)
5051
.setAppTypes([
5152
SDL.rpc.enums.AppHMIType.MEDIA,
5253
])
@@ -89,6 +90,11 @@ class AppClient {
8990
})
9091
.setOnError((sdlManager, info) => {
9192
console.error('Error from SdlManagerListener: ', info);
93+
})
94+
.setManagerShouldUpdateLifecycleToLanguage((language = null, hmiLanguage = null) => {
95+
return new SDL.manager.lifecycle.LifecycleConfigurationUpdate()
96+
.setAppName('Hello JS')
97+
.setTtsName([new SDL.rpc.structs.TTSChunk().setText('Hello JS')]);
9298
});
9399

94100
this._sdlManager = new SDL.manager.SdlManager(this._appConfig, managerListener);

examples/node/hello-sdl/AppClient.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class AppClient {
4747
.setAppId(CONFIG.appId)
4848
.setAppName(CONFIG.appName)
4949
.setLanguageDesired(SDL.rpc.enums.Language.EN_US)
50+
.setHmiDisplayLanguageDesired(SDL.rpc.enums.Language.EN_US)
5051
.setAppTypes([
5152
SDL.rpc.enums.AppHMIType.MEDIA,
5253
])
@@ -94,6 +95,11 @@ class AppClient {
9495
})
9596
.setOnError((sdlManager, info) => {
9697
console.error('Error from SdlManagerListener: ', info);
98+
})
99+
.setManagerShouldUpdateLifecycleToLanguage((language = null, hmiLanguage = null) => {
100+
return new SDL.manager.lifecycle.LifecycleConfigurationUpdate()
101+
.setAppName('Hello JS')
102+
.setTtsName([new SDL.rpc.structs.TTSChunk().setText('Hello JS')]);
97103
});
98104

99105
this._sdlManager = new SDL.manager.SdlManager(this._appConfig, managerListener);

examples/webengine/hello-sdl/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@
8686
})
8787
.setOnError((sdlManager, info) => {
8888
this._logMessage('APP:', 'Error from SdlManagerListener: ' + info, true);
89+
})
90+
.setManagerShouldUpdateLifecycleToLanguage((language = null, hmiLanguage = null) => {
91+
return new SDL.manager.lifecycle.LifecycleConfigurationUpdate()
92+
.setAppName('Hello JS')
93+
.setTtsName([new SDL.rpc.structs.TTSChunk().setText('Hello JS')]);
8994
});
9095

9196
this._sdlManager = new SDL.manager.SdlManager(this._appConfig, managerListener);

lib/js/src/manager/LifecycleConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class LifecycleConfig {
218218
}
219219

220220
/**
221-
* Get the desired langauge of the application.
221+
* Get the desired language of the application.
222222
* @returns {Language} - A Language enum value.
223223
*/
224224
getLanguageDesired () {
@@ -237,7 +237,7 @@ class LifecycleConfig {
237237

238238
/**
239239
* Get the desired HMI Display Language.
240-
* @returns {Language} - A Langauge enum value.
240+
* @returns {Language} - A Language enum value.
241241
*/
242242
getHmiDisplayLanguageDesired () {
243243
return this._hmiDisplayLanguageDesired;

lib/js/src/manager/SdlManager.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,29 @@ class SdlManager extends _SdlManagerBase {
222222
*/
223223
_checkLifecycleConfiguration () {
224224
const actualLanguage = this._lifecycleManager.getRegisterAppInterfaceResponse().getLanguage();
225+
const actualHmiLanguage = this._lifecycleManager.getRegisterAppInterfaceResponse().getHmiDisplayLanguage();
225226

226-
if (actualLanguage !== null && actualLanguage !== this._lifecycleConfig.getLanguageDesired()) {
227+
if ((actualLanguage !== null && actualLanguage !== this._lifecycleConfig.getLanguageDesired())
228+
|| (actualHmiLanguage !== null && actualHmiLanguage !== this._lifecycleConfig.getHmiDisplayLanguageDesired())) {
227229
// HMI language doesn't match the app's desired display language
228-
const lifecycleConfigUpdate = this._managerListener.managerShouldUpdateLifecycle(actualLanguage);
230+
const lifecycleConfigUpdateNew = this._managerListener.managerShouldUpdateLifecycleToLanguage(actualLanguage, actualHmiLanguage);
231+
const lifecycleConfigUpdateOld = this._managerListener.managerShouldUpdateLifecycle(actualLanguage);
232+
let lifecycleConfigUpdate;
233+
const changeRegistration = new ChangeRegistration();
234+
235+
if (lifecycleConfigUpdateNew === null) {
236+
lifecycleConfigUpdate = lifecycleConfigUpdateOld;
237+
changeRegistration.setLanguage(actualLanguage)
238+
.setHmiDisplayLanguage(actualLanguage);
239+
} else {
240+
lifecycleConfigUpdate = lifecycleConfigUpdateNew;
241+
changeRegistration.setLanguage(actualLanguage)
242+
.setHmiDisplayLanguage(actualHmiLanguage);
243+
}
229244

230245
if (lifecycleConfigUpdate !== null) {
231246
// send a ChangeRegistration RPC
232-
const changeRegistration = new ChangeRegistration();
233-
changeRegistration
234-
.setLanguage(actualLanguage)
235-
.setHmiDisplayLanguage(actualLanguage)
236-
.setAppName(lifecycleConfigUpdate.getAppName())
247+
changeRegistration.setAppName(lifecycleConfigUpdate.getAppName())
237248
.setNgnMediaScreenAppName(lifecycleConfigUpdate.getShortAppName())
238249
.setVrSynonyms(lifecycleConfigUpdate.getVoiceRecognitionCommandNames());
239250

@@ -244,7 +255,7 @@ class SdlManager extends _SdlManagerBase {
244255
this.sendRpcResolve(changeRegistration)
245256
.then((response) => {
246257
this._lifecycleConfig.setLanguageDesired(actualLanguage);
247-
this._lifecycleConfig.setHmiDisplayLanguageDesired(actualLanguage);
258+
this._lifecycleConfig.setHmiDisplayLanguageDesired(actualHmiLanguage);
248259
if (lifecycleConfigUpdate.getAppName() !== null) {
249260
this._lifecycleConfig.setAppName(lifecycleConfigUpdate.getAppName());
250261
}
@@ -502,7 +513,7 @@ class SdlManager extends _SdlManagerBase {
502513
}
503514

504515
/**
505-
* Retreives the RAI response from the _LifecycleManager
516+
* Retrieves the RAI response from the _LifecycleManager
506517
* @returns {RegisterAppInterfaceResponse|null} - A RegisterAppInterfaceResponse.
507518
*/
508519
getRegisterAppInterfaceResponse () {

lib/js/src/manager/SdlManagerListener.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class SdlManagerListener {
4242
this._managerShouldUpdateLifecycle = (language) => {
4343
return null;
4444
};
45+
this._managerShouldUpdateLifecycleToLanguage = (language, hmiLanguage) => {
46+
return null;
47+
};
4548
this._onSystemInfoReceived = null;
4649
}
4750

@@ -77,6 +80,7 @@ class SdlManagerListener {
7780

7881
/**
7982
* Set the ManagerShouldUpdateLifecycle event callback function.
83+
* @deprecated Use setManagerShouldUpdateLifecycleToLanguage instead
8084
* @param {function} callback - A function to invoke when the event is triggered.
8185
* @returns {SdlManagerListener} - A reference to this instance to support method chaining.
8286
*/
@@ -85,6 +89,16 @@ class SdlManagerListener {
8589
return this;
8690
}
8791

92+
/**
93+
* Set the ManagerShouldUpdateLifecycleToLanguage event callback function.
94+
* @param {function} callback - A function to invoke when the event is triggered.
95+
* @returns {SdlManagerListener} - A reference to this instance to support method chaining.
96+
*/
97+
setManagerShouldUpdateLifecycleToLanguage (callback) {
98+
this._managerShouldUpdateLifecycleToLanguage = callback;
99+
return this;
100+
}
101+
88102
/**
89103
* Safely attempts to invoke the OnStart event callback function.
90104
* @param {SdlManager} sdlManager - A reference to an SdlManager instance.
@@ -118,6 +132,7 @@ class SdlManagerListener {
118132

119133
/**
120134
* Safely attempts to invoke the ManagerShouldUpdateLifecycle event callback function.
135+
* @deprecated Use managerShouldUpdateLifecycleToLanguage instead
121136
* @param {Language} language - A Language enum value.
122137
* @returns {LifecycleConfigurationUpdate|null} - A reference to LifecycleConfigurationUpdate instance or null
123138
*/
@@ -128,6 +143,23 @@ class SdlManagerListener {
128143
return null;
129144
}
130145

146+
/**
147+
* Called when the SDL manager detected a language mismatch. In case of a language mismatch the
148+
* manager should change the apps registration by updating the lifecycle configuration to the
149+
* specified language. If the app can support the specified language it should return an Object
150+
* of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
151+
* is not supported.
152+
* @param {Language} language - The VR+TTS language of the connected head unit the manager is trying to update the configuration.
153+
* @param {Language} hmiLanguage - The HMI display language of the connected head unit the manager is trying to update the configuration.
154+
* @returns {LifecycleConfigurationUpdate|null} - A reference to LifecycleConfigurationUpdate instance or null
155+
*/
156+
managerShouldUpdateLifecycleToLanguage (language, hmiLanguage) {
157+
if (typeof this._managerShouldUpdateLifecycleToLanguage === 'function') {
158+
return this._managerShouldUpdateLifecycleToLanguage(language, hmiLanguage);
159+
}
160+
return null;
161+
}
162+
131163
/**
132164
* Set the onSystemInfoReceived function.
133165
* @param {function} listener - A function to be invoked when the event occurs.

lib/js/src/manager/file/filetypes/SdlFile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class SdlFile {
7272

7373
/**
7474
* Sets the location of the file
75-
* @param {String} filePath - a String value representing the the location of the file
75+
* @param {String} filePath - a String value representing the location of the file
7676
* @returns {SdlFile} - A reference to this instance to support method chaining.
7777
*/
7878
setFilePath (filePath) {
@@ -143,7 +143,7 @@ class SdlFile {
143143
}
144144

145145
/**
146-
* Sets the the name of the static file. Static files comes pre-shipped with the head unit
146+
* Sets the name of the static file. Static files comes pre-shipped with the head unit
147147
* @param {Boolean} staticIcon - a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
148148
* @returns {SdlFile} - A reference to this instance to support method chaining.
149149
*/
@@ -153,7 +153,7 @@ class SdlFile {
153153
}
154154

155155
/**
156-
* Gets the the name of the static file. Static files comes pre-shipped with the head unit
156+
* Gets the name of the static file. Static files comes pre-shipped with the head unit
157157
* @returns {Boolean} - a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
158158
*/
159159
isStaticIcon () {

lib/js/src/manager/lifecycle/_LifecycleManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ class _LifecycleManager {
412412
.setNgnMediaScreenAppName(this._lifecycleConfig.getShortAppName())
413413
.setAppHMIType(this._lifecycleConfig.getAppTypes())
414414
.setLanguageDesired(this._lifecycleConfig.getLanguageDesired())
415-
.setHmiDisplayLanguageDesired(this._lifecycleConfig.getLanguageDesired())
415+
.setHmiDisplayLanguageDesired(this._lifecycleConfig.getHmiDisplayLanguageDesired())
416416
.setIsMediaApplication(this._lifecycleConfig._isMediaApp)
417417
.setDayColorScheme(this._lifecycleConfig.getDayColorScheme())
418418
.setNightColorScheme(this._lifecycleConfig.getNightColorScheme())

lib/js/src/manager/permission/PermissionElement.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ class PermissionElement {
4747
}
4848

4949
/**
50-
* Retreives the RPC ID
50+
* Retrieves the RPC ID
5151
* @returns {Number} - A numeric FunctionID
5252
*/
5353
getRpcId () {
5454
return this._rpcId;
5555
}
5656

5757
/**
58-
* Retreives the permission parameters the developer wishes to track
58+
* Retrieves the permission parameters the developer wishes to track
5959
* @returns {String[]} - An array of parameter strings
6060
*/
6161
getParameters () {

0 commit comments

Comments
 (0)