Skip to content

Commit d95afc9

Browse files
authored
Merge pull request #428 from smartdevicelink/release/1.3.0_RC
Release/1.3.0
2 parents 9aa48d4 + ba1e898 commit d95afc9

File tree

507 files changed

+12455
-1063
lines changed

Some content is hidden

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

507 files changed

+12455
-1063
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This PR makes **[no / minor / major]** API changes.
99

1010
### Testing Plan
1111
- [ ] I have verified that I have not introduced new warnings in this PR (or explain why below)
12+
- [ ] I have verified that this PR passes lint validation
1213
- [ ] I have run the unit tests with this PR
1314
- [ ] I have tested this PR against Core and verified behavior (if applicable, if not applicable, explain why below).
1415

examples/js/hello-sdl/index.html

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@
133133
this._logPermissions();
134134

135135
// wait for the FULL state for more functionality
136-
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL) {
136+
const prevHmiFull = this._prevHmiLevel !== SDL.rpc.enums.HMILevel.HMI_FULL
137+
this._prevHmiLevel = hmiLevel;
138+
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL && prevHmiFull) {
137139
const screenManager = this._sdlManager.getScreenManager();
138140
const isRpcAllowed = (rpc) => {
141+
if (!this._permissionManager) {
142+
this._permissionManager = this._sdlManager.getPermissionManager();
143+
}
139144
return this._permissionManager &&
140145
this._permissionManager.isRpcAllowed(rpc);
141146
};
@@ -167,6 +172,25 @@
167172
this._isButtonSubscriptionRequested = true;
168173
}
169174

175+
const choices = [
176+
new SDL.manager.screen.choiceset.ChoiceCell('First Choice Cell'),
177+
new SDL.manager.screen.choiceset.ChoiceCell('Second Choice Cell'),
178+
];
179+
await screenManager.preloadChoices(choices);
180+
181+
await new Promise((resolve) => {
182+
const choiceSet = new SDL.manager.screen.choiceset.ChoiceSet('choice', screenManager.getPreloadedChoices(), new SDL.manager.screen.choiceset.ChoiceSetSelectionListener()
183+
.setOnChoiceSelected((choiceCell, triggerSource, rowIndex) => {
184+
console.log(choiceCell, triggerSource, rowIndex);
185+
resolve();
186+
})
187+
.setOnError((error) => {
188+
resolve();
189+
}));
190+
191+
screenManager.presentChoiceSet(choiceSet);
192+
});
193+
170194
const art1 = new SDL.manager.file.filetypes.SdlArtwork('logo', SDL.rpc.enums.FileType.GRAPHIC_PNG)
171195
.setFilePath(this._filePath);
172196

@@ -206,10 +230,34 @@
206230
await this._sleep();
207231
}
208232

209-
// tear down the app
210-
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());
233+
const alertState = new SDL.manager.screen.utils.SoftButtonState('EXIT', 'exit app', null);
234+
const alertState2 = new SDL.manager.screen.utils.SoftButtonState('DISMISS', 'dismiss alert', null);
235+
236+
const alertView = new SDL.manager.screen.utils.AlertView()
237+
.setText('Exit the Application?')
238+
.setTimeout(3000)
239+
.setSoftButtons([
240+
new SDL.manager.screen.utils.SoftButtonObject('Exit', [alertState], 'EXIT', async (id, rpc) => {
241+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
242+
// tear down the app
243+
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());
244+
245+
this._sdlManager.dispose();
246+
}
247+
}),
248+
new SDL.manager.screen.utils.SoftButtonObject('Dismiss', [alertState2], 'DISMISS', (id, rpc) => {
249+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
250+
console.log('Alert button pressed!');
251+
}
252+
}),
253+
]);
254+
255+
const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
256+
.setOnComplete((success, tryAgainTime) => {
257+
console.log(`Alert presented ${(success) ? 'successfully' : 'unsuccessfully'}`);
258+
});
211259

212-
this._sdlManager.dispose();
260+
screenManager.presentAlert(alertView, alertCompletionListener);
213261
}
214262
}
215263

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

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,14 @@ class AppClient {
128128
this._logPermissions();
129129

130130
// wait for the FULL state for more functionality
131-
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL) {
131+
const prevHmiFull = this._prevHmiLevel !== SDL.rpc.enums.HMILevel.HMI_FULL;
132+
this._prevHmiLevel = hmiLevel;
133+
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL && prevHmiFull) {
132134
const screenManager = this._sdlManager.getScreenManager();
133135
const isRpcAllowed = (rpc) => {
136+
if (!this._permissionManager) {
137+
this._permissionManager = this._sdlManager.getPermissionManager();
138+
}
134139
return this._permissionManager &&
135140
this._permissionManager.isRpcAllowed(rpc);
136141
};
@@ -162,6 +167,25 @@ class AppClient {
162167
this._isButtonSubscriptionRequested = true;
163168
}
164169

170+
const choices = [
171+
new SDL.manager.screen.choiceset.ChoiceCell('First Choice Cell'),
172+
new SDL.manager.screen.choiceset.ChoiceCell('Second Choice Cell'),
173+
];
174+
await screenManager.preloadChoices(choices);
175+
176+
await new Promise ((resolve) => {
177+
const choiceSet = new SDL.manager.screen.choiceset.ChoiceSet('choice', choices, new SDL.manager.screen.choiceset.ChoiceSetSelectionListener()
178+
.setOnChoiceSelected((choiceCell, triggerSource, rowIndex) => {
179+
console.log(choiceCell, triggerSource, rowIndex);
180+
resolve();
181+
})
182+
.setOnError((error) => {
183+
resolve();
184+
}));
185+
186+
screenManager.presentChoiceSet(choiceSet);
187+
});
188+
165189
const art1 = new SDL.manager.file.filetypes.SdlArtwork('logo', SDL.rpc.enums.FileType.GRAPHIC_PNG)
166190
.setFilePath(this._filePath);
167191

@@ -201,10 +225,34 @@ class AppClient {
201225
await this._sleep();
202226
}
203227

204-
// tear down the app
205-
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());
228+
const alertState = new SDL.manager.screen.utils.SoftButtonState('EXIT', 'exit app', null);
229+
const alertState2 = new SDL.manager.screen.utils.SoftButtonState('DISMISS', 'dismiss alert', null);
230+
231+
const alertView = new SDL.manager.screen.utils.AlertView()
232+
.setText('Exit the Application?')
233+
.setTimeout(3000)
234+
.setSoftButtons([
235+
new SDL.manager.screen.utils.SoftButtonObject('Exit', [alertState], 'EXIT', async (id, rpc) => {
236+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
237+
// tear down the app
238+
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());
239+
240+
this._sdlManager.dispose();
241+
}
242+
}),
243+
new SDL.manager.screen.utils.SoftButtonObject('Dismiss', [alertState2], 'DISMISS', (id, rpc) => {
244+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
245+
console.log('Alert button pressed!');
246+
}
247+
}),
248+
]);
249+
250+
const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
251+
.setOnComplete((success, tryAgainTime) => {
252+
console.log(`Alert presented ${(success) ? 'successfully' : 'unsuccessfully'}`);
253+
});
206254

207-
this._sdlManager.dispose();
255+
screenManager.presentAlert(alertView, alertCompletionListener);
208256
}
209257
}
210258

examples/node/hello-sdl/AppClient.js

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ class AppClient {
115115
this._logPermissions();
116116

117117
// wait for the FULL state for more functionality
118-
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL) {
118+
const prevHmiFull = this._prevHmiLevel !== SDL.rpc.enums.HMILevel.HMI_FULL;
119+
this._prevHmiLevel = hmiLevel;
120+
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL && prevHmiFull) {
119121
this._hmiFull = true;
120122
this._checkReadyState();
121123
}
@@ -125,6 +127,9 @@ class AppClient {
125127
if (this._managersReady && this._hmiFull) {
126128
const screenManager = this._sdlManager.getScreenManager();
127129
const isRpcAllowed = (rpc) => {
130+
if (!this._permissionManager) {
131+
this._permissionManager = this._sdlManager.getPermissionManager();
132+
}
128133
return this._permissionManager &&
129134
this._permissionManager.isRpcAllowed(rpc);
130135
};
@@ -180,6 +185,25 @@ class AppClient {
180185
screenManager.changeLayout(new SDL.rpc.structs.TemplateConfiguration()
181186
.setTemplate(SDL.rpc.enums.PredefinedLayout.NON_MEDIA));
182187

188+
const choices = [
189+
new SDL.manager.screen.choiceset.ChoiceCell('First Choice Cell'),
190+
new SDL.manager.screen.choiceset.ChoiceCell('Second Choice Cell'),
191+
];
192+
await screenManager.preloadChoices(choices);
193+
194+
await new Promise ((resolve) => {
195+
const choiceSet = new SDL.manager.screen.choiceset.ChoiceSet('choice', choices, new SDL.manager.screen.choiceset.ChoiceSetSelectionListener()
196+
.setOnChoiceSelected((choiceCell, triggerSource, rowIndex) => {
197+
console.log(choiceCell, triggerSource, rowIndex);
198+
resolve();
199+
})
200+
.setOnError((error) => {
201+
resolve();
202+
}));
203+
204+
screenManager.presentChoiceSet(choiceSet);
205+
});
206+
183207
const art1 = new SDL.manager.file.filetypes.SdlArtwork('logo', SDL.rpc.enums.FileType.GRAPHIC_PNG)
184208
.setFilePath(this._filePath);
185209

@@ -209,6 +233,35 @@ class AppClient {
209233
await this._sleep(2000);
210234
softButtonObjects[0].transitionToNextState();
211235
await this._sleep(2000);
236+
237+
const alertState = new SDL.manager.screen.utils.SoftButtonState('EXIT', 'exit app', null);
238+
const alertState2 = new SDL.manager.screen.utils.SoftButtonState('DISMISS', 'dismiss alert', null);
239+
240+
const alertView = new SDL.manager.screen.utils.AlertView()
241+
.setText('Exit the Application?')
242+
.setTimeout(3000)
243+
.setSoftButtons([
244+
new SDL.manager.screen.utils.SoftButtonObject('Exit', [alertState], 'EXIT', async (id, rpc) => {
245+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
246+
// tear down the app
247+
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());
248+
249+
this._sdlManager.dispose();
250+
}
251+
}),
252+
new SDL.manager.screen.utils.SoftButtonObject('Dismiss', [alertState2], 'DISMISS', (id, rpc) => {
253+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
254+
console.log('Alert button pressed!');
255+
}
256+
}),
257+
]);
258+
259+
const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
260+
.setOnComplete((success, tryAgainTime) => {
261+
console.log(`Alert presented ${(success) ? 'successfully' : 'unsuccessfully'}`);
262+
});
263+
264+
screenManager.presentAlert(alertView, alertCompletionListener);
212265
}
213266
}
214267

examples/webengine/hello-sdl/index.html

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -358,25 +358,33 @@
358358
});
359359

360360
document.getElementById("alertButton").addEventListener("click", function(){
361-
const alert = new SDL.rpc.messages.Alert();
362-
alert.setAlertText1("Test Alert")
363-
.setDuration(5000);
364-
365-
const btn1 = new SDL.rpc.structs.SoftButton();
366-
btn1.setSystemAction(SDL.rpc.enums.SystemAction.DEFAULT_ACTION)
367-
.setType(SDL.rpc.enums.SoftButtonType.SBT_TEXT)
368-
.setText("ReRoute")
369-
.setSoftButtonID(5502);
361+
const alertView = new SDL.manager.screen.utils.AlertView();
362+
alertView.setText("Test Alert")
363+
.setTimeout(5000);
364+
365+
const alertState = new SDL.manager.screen.utils.SoftButtonState('REROUTE', 'reroute', null)
366+
.setSystemAction(SDL.rpc.enums.SystemAction.DEFAULT_ACTION);
367+
const btn1 = new SDL.manager.screen.utils.SoftButtonObject('ReRoute', [alertState], 'REROUTE', async (id, rpc) => {
368+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
369+
// Handle OnButtonPress
370+
}
371+
});
370372

371-
const btn2 = new SDL.rpc.structs.SoftButton();
372-
btn2.setSystemAction(SDL.rpc.enums.SystemAction.DEFAULT_ACTION)
373-
.setType(SDL.rpc.enums.SoftButtonType.SBT_TEXT)
374-
.setText("Close")
375-
.setSoftButtonID(5503);
373+
const alertState2 = new SDL.manager.screen.utils.SoftButtonState('CLOSE', 'close', null)
374+
.setSystemAction(SDL.rpc.enums.SystemAction.DEFAULT_ACTION);
375+
const btn2 = new SDL.manager.screen.utils.SoftButtonObject('Close', [alertState2], 'CLOSE', async (id, rpc) => {
376+
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
377+
// Handle OnButtonPress
378+
}
379+
});
376380

377-
alert.setSoftButtons([btn1, btn2])
381+
alertView.setSoftButtons([btn1, btn2])
378382

379-
app.sendRpcRequest(alert);
383+
const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
384+
.setOnComplete((success, tryAgainTime) => {
385+
// Handle Alert presented
386+
})
387+
app._sdlManager.getScreenManager().presentAlert(alertView, alertCompletionListener);
380388
});
381389

382390
document.getElementById("unregButton").addEventListener("click", async function(){

generator/mapping.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
"key": "KEY_LEVEL_SPAN"
6969
}
7070
}
71+
},
72+
"TemplateConfiguration": {
73+
"script": "templates/scripts/TemplateConfiguration.js"
7174
}
7275
},
7376
"functions": {

generator/templates/base_struct_function.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends 'base_template.js' %}
22

33
{% block typedef %}
4-
{%- if description is defined or deprecated is defined %}
4+
{%- if description is defined or deprecated is defined and deprecated is not none %}
55
/**
66
{% if description is defined -%}
77
{% for d in description -%}
@@ -10,15 +10,15 @@
1010
{% else -%}
1111
* Struct description not available.
1212
{% endif -%}
13-
{% if deprecated is defined -%}
13+
{% if deprecated is defined and deprecated is not none -%}
1414
* @deprecated
1515
{% endif -%}
1616
*/
1717
{%- endif %}
1818
{%- endblock %}
1919
{% block body %}
2020
/**
21-
* Initalizes an instance of {{name}}.
21+
* Initializes an instance of {{name}}.
2222
* @class
2323
* @param {object} parameters - An object map of parameters.
2424
{%- if since is defined and since is not none %}
@@ -76,8 +76,9 @@
7676

7777
/**
7878
* Get the {{method.method_title}}
79-
{% if deprecated is defined -%}
80-
* @deprecated
79+
{% if method.deprecated is defined and method.deprecated is not none -%}
80+
* @since SmartDeviceLink {{method.history[0].since}}
81+
* @deprecated in SmartDeviceLink {{method.since}}
8182
{% endif -%}
8283
* @returns {{'%s%s%s'|format('{', method.type, '}')}} - the {{method.key}} value
8384
*/

generator/templates/base_template.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
*/
3333
{% block imports -%}
3434
{% for _import in imports|sort %}
35+
{%- if _import.what != name %}
3536
import {{'%s %s %s'|format('{', _import.what, '}')}} from '{{_import.wherefrom}}';
37+
{%- endif -%}
3638
{%- endfor %}
3739
{% endblock -%}
3840
{% block typedef -%}{%- endblock %}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// ------ Not part of the RPC spec itself -----
2+
3+
/**
4+
* Set the Template
5+
* @deprecated Use setTemplateParam instead
6+
* @param {String} template - Predefined or dynamically created window template. Currently only predefined window template layouts are defined. - The desired Template.
7+
* {'string_min_length': 1, 'string_max_length': 500}
8+
* @returns {TemplateConfiguration} - The class instance for method chaining.
9+
*/
10+
setTemplate (template) {
11+
this.setParameter(TemplateConfiguration.KEY_TEMPLATE, template);
12+
return this;
13+
}
14+
15+
/**
16+
* Get the Template
17+
* @deprecated Use getTemplateParam instead
18+
* @returns {String} - the KEY_TEMPLATE value
19+
*/
20+
getTemplate () {
21+
return this.getParameter(TemplateConfiguration.KEY_TEMPLATE);
22+
}
23+
24+
// ----------------- END -----------------------

generator/test/runner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def main():
3333
suite.addTests(TestLoader().loadTestsFromTestCase(CodeFormatAndQuality))
3434

3535
runner = TextTestRunner(verbosity=2)
36-
runner.run(suite)
36+
ret = not runner.run(suite).wasSuccessful()
37+
sys.exit(ret)
3738

3839

3940
if __name__ == '__main__':

0 commit comments

Comments
 (0)