Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDL-0293] Enable OEM exclusive apps support #374

Conversation

ymalovanyi
Copy link
Contributor

@ymalovanyi ymalovanyi commented Jan 14, 2021

Fixes #367

Risk

This PR makes minor API changes.

Testing Plan

  • I have verified that I have not introduced new warnings in this PR
  • I have run the unit tests with this PR
  • I have tested this PR against Core and verified behavior

Unit Tests

Core Tests

  • Check the Vehicle Details arrived through StartSessionACK packet and processed correctly
  • Check the Vehicle Details exist in RAI response and processed correctly
  • Check that Vehicle Details in RAI response is used when StartSessionACK has no Vehicle Details
  • Check that application continue work as usual if no onVehicleTypeReceived callback set in SdlManagerListener

Core version / branch / commit hash / module tested against: LuxoftSDL/sdl_core#sdl_0293_enable_oem_exclusive_apps_support
HMI name / version / branch / commit hash / module tested against: LuxoftSDL/sdl_hmi#sdl_0293_enable_oem_exclusive_apps_support

Summary

Applied [SDL-0293] Enable OEM exclusive apps support changes

Changelog

Breaking Changes
  • N/A
Enhancements
  • Added onVehicleTypeReceived, setOnVehicleTypeReceved methods to propagate Vehicle Type info to the application layer and check Vehicle Type on _SdlProtocolBase.js and _LifecycleManager.js levels
  • Added required getters/setters in related RPC classes
Bug Fixes
  • N/A

Tasks Remaining:

  • N/A

CLA

@a-prykho
Copy link

@santhanamk could you please start Ford review? Thanks

Copy link

@santhanamk santhanamk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi I have reviewed the PR, and have left a few comments/suggestions. Please take a look whenever you get the chance.

@@ -72,6 +72,12 @@ _ControlFrameTags.RPC = Object.freeze({
VIDEO_SERVICE_TRANSPORTS: 'videoServiceTransports',
/** Auth token to be used for log in into services **/
AUTH_TOKEN: 'authToken',
VEHICLE_MAKE: 'make',
VEHICLE_MODEL: 'model',
VEHICLE_MODEL_YEAR: 'modelYear',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi On line 77, does the tag name need to be model year like it is defined in the proposal or is modelYear okay?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this is just a typo in the proposal, on testing alongside the core we received modelYear thus included it in camelcase instead of space-separated.

@@ -406,6 +438,23 @@ class _SdlProtocolBase {
const version = sdlPacket.getVersion();
const serviceType = sdlPacket.getServiceType();
if (version >= 5) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi On line 440, does this need to be >= 6 instead of >= 5? In the proposal the example method onPacketRead has it as > = 6.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our initial implementation was exactly with >= 6 according to the proposal, but testing alongside the core we never met that condition, it seems the protocol version is not increased with this proposal. Therefore we rolled back to 5.

* @param {String} systemHardwareVersion - hardware version of the system.
* @returns {Boolean} Return true if this session should continue, false if the session should end
*/
onVehicleTypeReceived (vehicleType, systemSoftwareVersion, systemHardwareVersion) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi In the proposal the method onVehicleTypeReceived is defined like: onVehicleTypeReceived (sdlManager, vehicleType) {}.... Does your definition starting on line 210 need to match with what the proposal has?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sdlManager parameter is not required in the context of the current library implementation, we assume this was added in the proposal by mistake. systemSoftwareVersion and systemHardwareVersion parameters now under discussion here smartdevicelink/sdl_evolution#1108 this PR already includes changes of that revision.

* Set the SystemHardwareVersion
* @since SmartDeviceLink 7.1.0
* @param {String} version - The hardware version of the system - The desired SystemHardwareVersion.
* {'string_min_length': 1, 'string_max_length': 500}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi Are these defined somewhere? For example, the string_min_length 1 string_max_length 500? It would be nice to cross verify.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is autogenerated code, no RPC classes in the library for now those cross-verify such parameters.

@@ -484,6 +510,17 @@ class _LifecycleManager {
this._cleanProxy();
}

if (this._rpcSpecVersion.isNewerThan(new Version(7, 0, 0)) === 1) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi Do the unit tests in LifecycleManagerTests.js need to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santhanamk Added tests for new methods.

* @param {String} systemHardwareVersion - hardware version of the system.
* @returns {Boolean} Return true if this session should continue, false if the session should end
*/
onVehicleTypeReceived (vehicleType, systemSoftwareVersion, systemHardwareVersion) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi In the proposal this method is defined as onVehicleTypeReceived (sdlManager, vehicleType) {}. Does your method definition need to change to match with the proposal?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@santhanamk santhanamk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @vladmu for the clarifications. I have approved this PR.

…peReceived and adjust the code to match the current 0293 proposal state

* added didReceiveVehicleType flag, to avoid double firing onVehicleTypeReceived in RAI response
@vladmu
Copy link
Contributor

vladmu commented Jan 22, 2021

@santhanamk I apologize, I should ask you to re-review the PR. I have made some changes to reflect the current state of the proposal instead of unapproved revision.

Copy link

@santhanamk santhanamk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladmu @ymalovanyi I have reviewed the PR. I have one suggestion. Please take a look whenever you get a chance.

@@ -38,14 +38,14 @@ import { _FrameType } from './enums/_FrameType.js';
import { _MessageFrameAssembler } from './_MessageFrameAssembler.js';
import { _SdlPacket } from './_SdlPacket.js';
import { _ControlFrameTags } from './enums/_ControlFrameTags.js';
import { _BitConverter } from './../util/_BitConverter.js';
import { _BitConverter } from '../util/_BitConverter.js';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi @vladmu Do you need unit tests for this? For example, sdl java suite has SdlProtocolTests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santhanamk we don't need the test for this particular line as this is just a shortenest path identical to previous but aligned with the style of other imports.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladmu I meant do you need unit tests overall for the changes made to this file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santhanamk it is hard to define expectations of such tests in the order of the library and this class as we don't have any tests of previous functionality covered here. We appreciate any help in this case.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladmu Ok no problem. It was an optional request, as these were not existing before.

Copy link

@santhanamk santhanamk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi @vladmu I have approved this PR.

@santhanamk
Copy link

Hi @jordynmackool This PR is ready for Livio review.

@ymalovanyi ymalovanyi marked this pull request as ready for review January 25, 2021 09:56
Comment on lines 283 to 285
// TODO: awaiting 0293 revisions to process those fields
const systemHardwareVersion = sdlPacket.getTag(_ControlFrameTags.RPC.StartServiceACK.VEHICLE_SYSTEM_HARDWARE_VERSION);
const systemSoftwareVersion = sdlPacket.getTag(_ControlFrameTags.RPC.StartServiceACK.VEHICLE_SYSTEM_SOFTWARE_VERSION);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method seems unfinished since these values are never used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renonick87 no, the method is finished and reflects the current state of the proposal. Without revisions, we receive those fields here but never use or process them. The TODO was added to reflect that the processing needs to be added after accepting the revisions.

Comment on lines 273 to 277
/**
* Gets the Vehicle details received in StartService ACK protocol message
* @returns {VehicleType|null} - A RPC VehicleType struct received from the packet if exists null otherwise.
*/
_getVehicleType(sdlPacket) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation here is missing the @param tag for the sdlPacket parameter. There also needs to be a space before the function parentheses on line 277. Use the command npm run lint to confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines 441 to 443
vehicleType
&& this._sdlProtocolListener !== null
&& typeof this._sdlProtocolListener.onVehicleTypeReceived === 'function'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation for lines 441-443 is incorrect. There is an indentation of 14 spaces but it should be 16. Use the command npm run lint to confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

* A way to determine if VehicleType already received
* @returns {Boolean} Return true if received
*/
didReceiveVehicleType() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There needs to be a space before the function parentheses on line 177. Use the command npm run lint to confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

@renonick87 renonick87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymalovanyi I've done an initial review of this PR but will hold off on a more thorough review until after the core and HMI PRs are ready to be tested against. See my comments for requested changes and please run npm run lint to ensure that all contributions pass lint validation.

@jordynmackool
Copy link

@ymalovanyi the proposal markdown file has been updated per the revisions included in the accepted with revisions review issue: SDL 0293 Revisions - Enable OEM exclusive apps support.

Please make the needed updates to this PR and then tag @renonick87 to re-review when ready. Thanks!

@vladmu
Copy link
Contributor

vladmu commented Jan 29, 2021

@renonick87 all required adjustments were made, the PR is ready for review.

@renonick87
Copy link
Contributor

@ymalovanyi, the Java Suite team has written a new PR, smartdevicelink/sdl_java_suite#1618, for this proposal. Please update this PR or open a new one to match.

@vladmu
Copy link
Contributor

vladmu commented Feb 10, 2021

@renonick87 I did review the new Java implementation and this JS seems to look the same at first glance. Did you compare on your own what is missed here?

@jordynmackool
Copy link

jordynmackool commented Feb 10, 2021

@ymalovanyi @vladmu The Java Suite PR 1681 has been approved on our side and tested with Core for this feature. We have not compared the differences between that PR and this PR. To ensure app library alignment, please review the approved Java Suite library PR and make the necessary updates to this PR to align. Once all the needed updates are complete, please tag @renonick87 for a re-review. Thanks!

@renonick87
Copy link
Contributor

@vladmu The PRs does seem similar at first glance but there are differences in the exact implementation. To name a few differences: all logic in the ProtocolBase has been moved, an existing listener has been updated in the SdlSessionListener, and the protocol version is updated to 5.4. There are likely other differences that I didn't cover so please review the Java PR and then update this PR to ensure that it matches the Java implementation.

@vladmu
Copy link
Contributor

vladmu commented Feb 12, 2021

@renonick87 I have aligned the code to smartdevicelink/sdl_java_suite#1618 PR and tested this against the core and hmi. Please review.

Copy link
Contributor

@renonick87 renonick87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladmu See my review comments for some requested revisions.

@@ -216,7 +216,7 @@ class _SdlProtocolBase {
*/
_setVersion (version) {
if (version > 5) {
this._protocolVersion = new Version('5.1.0'); // protect for future, proxy only supports v5 or lower
this._protocolVersion = new Version('5.4.0'); // protect for future, proxy only supports v5 or lower
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not need to be changed. This method is for setting the major version based on the packet header. The more accurate protocol version is set in the _handleStartServiceACK method based on the packet payload.

@@ -484,6 +518,16 @@ class _LifecycleManager {
this._cleanProxy();
}

if (!this._didCheckSystemInfo) {
this._didCheckSystemInfo = true;
const systemInfo = new SystemInfo(registerAppInterfaceResponse.getVehicleType(), registerAppInterfaceResponse.getSystemSoftwareVersion()) ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a check before creating the SystemInfo object that either vehicleType or systemSoftwareVersion exist.

if (vehicleType || systemSoftwareVersion)

@vladmu
Copy link
Contributor

vladmu commented Feb 17, 2021

@renonick87 I've processed all your comments. Please review.

@renonick87 renonick87 merged commit 2c9f9e2 into smartdevicelink:develop Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SDL 0293] Enable OEM exclusive apps support
7 participants