Skip to content

Commit

Permalink
Merge pull request #428 from smartdevicelink/release/1.3.0_RC
Browse files Browse the repository at this point in the history
Release/1.3.0
  • Loading branch information
crokita authored Apr 14, 2021
2 parents 9aa48d4 + ba1e898 commit d95afc9
Show file tree
Hide file tree
Showing 507 changed files with 12,455 additions and 1,063 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This PR makes **[no / minor / major]** API changes.

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

Expand Down
56 changes: 52 additions & 4 deletions examples/js/hello-sdl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@
this._logPermissions();

// wait for the FULL state for more functionality
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL) {
const prevHmiFull = this._prevHmiLevel !== SDL.rpc.enums.HMILevel.HMI_FULL
this._prevHmiLevel = hmiLevel;
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL && prevHmiFull) {
const screenManager = this._sdlManager.getScreenManager();
const isRpcAllowed = (rpc) => {
if (!this._permissionManager) {
this._permissionManager = this._sdlManager.getPermissionManager();
}
return this._permissionManager &&
this._permissionManager.isRpcAllowed(rpc);
};
Expand Down Expand Up @@ -167,6 +172,25 @@
this._isButtonSubscriptionRequested = true;
}

const choices = [
new SDL.manager.screen.choiceset.ChoiceCell('First Choice Cell'),
new SDL.manager.screen.choiceset.ChoiceCell('Second Choice Cell'),
];
await screenManager.preloadChoices(choices);

await new Promise((resolve) => {
const choiceSet = new SDL.manager.screen.choiceset.ChoiceSet('choice', screenManager.getPreloadedChoices(), new SDL.manager.screen.choiceset.ChoiceSetSelectionListener()
.setOnChoiceSelected((choiceCell, triggerSource, rowIndex) => {
console.log(choiceCell, triggerSource, rowIndex);
resolve();
})
.setOnError((error) => {
resolve();
}));

screenManager.presentChoiceSet(choiceSet);
});

const art1 = new SDL.manager.file.filetypes.SdlArtwork('logo', SDL.rpc.enums.FileType.GRAPHIC_PNG)
.setFilePath(this._filePath);

Expand Down Expand Up @@ -206,10 +230,34 @@
await this._sleep();
}

// tear down the app
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());
const alertState = new SDL.manager.screen.utils.SoftButtonState('EXIT', 'exit app', null);
const alertState2 = new SDL.manager.screen.utils.SoftButtonState('DISMISS', 'dismiss alert', null);

const alertView = new SDL.manager.screen.utils.AlertView()
.setText('Exit the Application?')
.setTimeout(3000)
.setSoftButtons([
new SDL.manager.screen.utils.SoftButtonObject('Exit', [alertState], 'EXIT', async (id, rpc) => {
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
// tear down the app
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());

this._sdlManager.dispose();
}
}),
new SDL.manager.screen.utils.SoftButtonObject('Dismiss', [alertState2], 'DISMISS', (id, rpc) => {
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
console.log('Alert button pressed!');
}
}),
]);

const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
.setOnComplete((success, tryAgainTime) => {
console.log(`Alert presented ${(success) ? 'successfully' : 'unsuccessfully'}`);
});

this._sdlManager.dispose();
screenManager.presentAlert(alertView, alertCompletionListener);
}
}

Expand Down
56 changes: 52 additions & 4 deletions examples/node/hello-sdl-tcp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,14 @@ class AppClient {
this._logPermissions();

// wait for the FULL state for more functionality
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL) {
const prevHmiFull = this._prevHmiLevel !== SDL.rpc.enums.HMILevel.HMI_FULL;
this._prevHmiLevel = hmiLevel;
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL && prevHmiFull) {
const screenManager = this._sdlManager.getScreenManager();
const isRpcAllowed = (rpc) => {
if (!this._permissionManager) {
this._permissionManager = this._sdlManager.getPermissionManager();
}
return this._permissionManager &&
this._permissionManager.isRpcAllowed(rpc);
};
Expand Down Expand Up @@ -162,6 +167,25 @@ class AppClient {
this._isButtonSubscriptionRequested = true;
}

const choices = [
new SDL.manager.screen.choiceset.ChoiceCell('First Choice Cell'),
new SDL.manager.screen.choiceset.ChoiceCell('Second Choice Cell'),
];
await screenManager.preloadChoices(choices);

await new Promise ((resolve) => {
const choiceSet = new SDL.manager.screen.choiceset.ChoiceSet('choice', choices, new SDL.manager.screen.choiceset.ChoiceSetSelectionListener()
.setOnChoiceSelected((choiceCell, triggerSource, rowIndex) => {
console.log(choiceCell, triggerSource, rowIndex);
resolve();
})
.setOnError((error) => {
resolve();
}));

screenManager.presentChoiceSet(choiceSet);
});

const art1 = new SDL.manager.file.filetypes.SdlArtwork('logo', SDL.rpc.enums.FileType.GRAPHIC_PNG)
.setFilePath(this._filePath);

Expand Down Expand Up @@ -201,10 +225,34 @@ class AppClient {
await this._sleep();
}

// tear down the app
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());
const alertState = new SDL.manager.screen.utils.SoftButtonState('EXIT', 'exit app', null);
const alertState2 = new SDL.manager.screen.utils.SoftButtonState('DISMISS', 'dismiss alert', null);

const alertView = new SDL.manager.screen.utils.AlertView()
.setText('Exit the Application?')
.setTimeout(3000)
.setSoftButtons([
new SDL.manager.screen.utils.SoftButtonObject('Exit', [alertState], 'EXIT', async (id, rpc) => {
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
// tear down the app
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());

this._sdlManager.dispose();
}
}),
new SDL.manager.screen.utils.SoftButtonObject('Dismiss', [alertState2], 'DISMISS', (id, rpc) => {
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
console.log('Alert button pressed!');
}
}),
]);

const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
.setOnComplete((success, tryAgainTime) => {
console.log(`Alert presented ${(success) ? 'successfully' : 'unsuccessfully'}`);
});

this._sdlManager.dispose();
screenManager.presentAlert(alertView, alertCompletionListener);
}
}

Expand Down
55 changes: 54 additions & 1 deletion examples/node/hello-sdl/AppClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ class AppClient {
this._logPermissions();

// wait for the FULL state for more functionality
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL) {
const prevHmiFull = this._prevHmiLevel !== SDL.rpc.enums.HMILevel.HMI_FULL;
this._prevHmiLevel = hmiLevel;
if (hmiLevel === SDL.rpc.enums.HMILevel.HMI_FULL && prevHmiFull) {
this._hmiFull = true;
this._checkReadyState();
}
Expand All @@ -125,6 +127,9 @@ class AppClient {
if (this._managersReady && this._hmiFull) {
const screenManager = this._sdlManager.getScreenManager();
const isRpcAllowed = (rpc) => {
if (!this._permissionManager) {
this._permissionManager = this._sdlManager.getPermissionManager();
}
return this._permissionManager &&
this._permissionManager.isRpcAllowed(rpc);
};
Expand Down Expand Up @@ -180,6 +185,25 @@ class AppClient {
screenManager.changeLayout(new SDL.rpc.structs.TemplateConfiguration()
.setTemplate(SDL.rpc.enums.PredefinedLayout.NON_MEDIA));

const choices = [
new SDL.manager.screen.choiceset.ChoiceCell('First Choice Cell'),
new SDL.manager.screen.choiceset.ChoiceCell('Second Choice Cell'),
];
await screenManager.preloadChoices(choices);

await new Promise ((resolve) => {
const choiceSet = new SDL.manager.screen.choiceset.ChoiceSet('choice', choices, new SDL.manager.screen.choiceset.ChoiceSetSelectionListener()
.setOnChoiceSelected((choiceCell, triggerSource, rowIndex) => {
console.log(choiceCell, triggerSource, rowIndex);
resolve();
})
.setOnError((error) => {
resolve();
}));

screenManager.presentChoiceSet(choiceSet);
});

const art1 = new SDL.manager.file.filetypes.SdlArtwork('logo', SDL.rpc.enums.FileType.GRAPHIC_PNG)
.setFilePath(this._filePath);

Expand Down Expand Up @@ -209,6 +233,35 @@ class AppClient {
await this._sleep(2000);
softButtonObjects[0].transitionToNextState();
await this._sleep(2000);

const alertState = new SDL.manager.screen.utils.SoftButtonState('EXIT', 'exit app', null);
const alertState2 = new SDL.manager.screen.utils.SoftButtonState('DISMISS', 'dismiss alert', null);

const alertView = new SDL.manager.screen.utils.AlertView()
.setText('Exit the Application?')
.setTimeout(3000)
.setSoftButtons([
new SDL.manager.screen.utils.SoftButtonObject('Exit', [alertState], 'EXIT', async (id, rpc) => {
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
// tear down the app
await this._sdlManager.sendRpcResolve(new SDL.rpc.messages.UnregisterAppInterface());

this._sdlManager.dispose();
}
}),
new SDL.manager.screen.utils.SoftButtonObject('Dismiss', [alertState2], 'DISMISS', (id, rpc) => {
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
console.log('Alert button pressed!');
}
}),
]);

const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
.setOnComplete((success, tryAgainTime) => {
console.log(`Alert presented ${(success) ? 'successfully' : 'unsuccessfully'}`);
});

screenManager.presentAlert(alertView, alertCompletionListener);
}
}

Expand Down
40 changes: 24 additions & 16 deletions examples/webengine/hello-sdl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -358,25 +358,33 @@
});

document.getElementById("alertButton").addEventListener("click", function(){
const alert = new SDL.rpc.messages.Alert();
alert.setAlertText1("Test Alert")
.setDuration(5000);

const btn1 = new SDL.rpc.structs.SoftButton();
btn1.setSystemAction(SDL.rpc.enums.SystemAction.DEFAULT_ACTION)
.setType(SDL.rpc.enums.SoftButtonType.SBT_TEXT)
.setText("ReRoute")
.setSoftButtonID(5502);
const alertView = new SDL.manager.screen.utils.AlertView();
alertView.setText("Test Alert")
.setTimeout(5000);

const alertState = new SDL.manager.screen.utils.SoftButtonState('REROUTE', 'reroute', null)
.setSystemAction(SDL.rpc.enums.SystemAction.DEFAULT_ACTION);
const btn1 = new SDL.manager.screen.utils.SoftButtonObject('ReRoute', [alertState], 'REROUTE', async (id, rpc) => {
if (rpc instanceof SDL.rpc.messages.OnButtonPress) {
// Handle OnButtonPress
}
});

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

alert.setSoftButtons([btn1, btn2])
alertView.setSoftButtons([btn1, btn2])

app.sendRpcRequest(alert);
const alertCompletionListener = new SDL.manager.screen.utils.AlertCompletionListener()
.setOnComplete((success, tryAgainTime) => {
// Handle Alert presented
})
app._sdlManager.getScreenManager().presentAlert(alertView, alertCompletionListener);
});

document.getElementById("unregButton").addEventListener("click", async function(){
Expand Down
3 changes: 3 additions & 0 deletions generator/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"key": "KEY_LEVEL_SPAN"
}
}
},
"TemplateConfiguration": {
"script": "templates/scripts/TemplateConfiguration.js"
}
},
"functions": {
Expand Down
11 changes: 6 additions & 5 deletions generator/templates/base_struct_function.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base_template.js' %}

{% block typedef %}
{%- if description is defined or deprecated is defined %}
{%- if description is defined or deprecated is defined and deprecated is not none %}
/**
{% if description is defined -%}
{% for d in description -%}
Expand All @@ -10,15 +10,15 @@
{% else -%}
* Struct description not available.
{% endif -%}
{% if deprecated is defined -%}
{% if deprecated is defined and deprecated is not none -%}
* @deprecated
{% endif -%}
*/
{%- endif %}
{%- endblock %}
{% block body %}
/**
* Initalizes an instance of {{name}}.
* Initializes an instance of {{name}}.
* @class
* @param {object} parameters - An object map of parameters.
{%- if since is defined and since is not none %}
Expand Down Expand Up @@ -76,8 +76,9 @@

/**
* Get the {{method.method_title}}
{% if deprecated is defined -%}
* @deprecated
{% if method.deprecated is defined and method.deprecated is not none -%}
* @since SmartDeviceLink {{method.history[0].since}}
* @deprecated in SmartDeviceLink {{method.since}}
{% endif -%}
* @returns {{'%s%s%s'|format('{', method.type, '}')}} - the {{method.key}} value
*/
Expand Down
2 changes: 2 additions & 0 deletions generator/templates/base_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
*/
{% block imports -%}
{% for _import in imports|sort %}
{%- if _import.what != name %}
import {{'%s %s %s'|format('{', _import.what, '}')}} from '{{_import.wherefrom}}';
{%- endif -%}
{%- endfor %}
{% endblock -%}
{% block typedef -%}{%- endblock %}
Expand Down
24 changes: 24 additions & 0 deletions generator/templates/scripts/TemplateConfiguration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// ------ Not part of the RPC spec itself -----

/**
* Set the Template
* @deprecated Use setTemplateParam instead
* @param {String} template - Predefined or dynamically created window template. Currently only predefined window template layouts are defined. - The desired Template.
* {'string_min_length': 1, 'string_max_length': 500}
* @returns {TemplateConfiguration} - The class instance for method chaining.
*/
setTemplate (template) {
this.setParameter(TemplateConfiguration.KEY_TEMPLATE, template);
return this;
}

/**
* Get the Template
* @deprecated Use getTemplateParam instead
* @returns {String} - the KEY_TEMPLATE value
*/
getTemplate () {
return this.getParameter(TemplateConfiguration.KEY_TEMPLATE);
}

// ----------------- END -----------------------
3 changes: 2 additions & 1 deletion generator/test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def main():
suite.addTests(TestLoader().loadTestsFromTestCase(CodeFormatAndQuality))

runner = TextTestRunner(verbosity=2)
runner.run(suite)
ret = not runner.run(suite).wasSuccessful()
sys.exit(ret)


if __name__ == '__main__':
Expand Down
Loading

0 comments on commit d95afc9

Please sign in to comment.