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

Feature/sdl 0293 oem exclusive apps support base impl #64

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/StateManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,25 @@ var StateManager = Em.StateManager.extend(
}
}
),
ccpuEditor: Em.State.create(
versionsEditor: Em.State.create(
{
enter: function() {
this._super();
SDL.SettingsController.set('editedCcpuVersionValue', SDL.SDLModel.data.ccpuVersion);
if (SDL.SDLModel.data.hardwareVersion != null) {
SDL.SettingsController.set('editedHardwareVersionValue', SDL.SDLModel.data.hardwareVersion);
SDL.SettingsController.set('hardwareVersionEditingEnabled', true);
} else {
SDL.SettingsController.set('hardwareVersionEditingEnabled', false);
}
}
}
),
vehicleTypeEditor: Em.State.create(
{
enter: function() {
this._super();
SDL.SettingsController.updateVehicleTypeValues(SDL.SDLVehicleInfoModel.vehicleType);
}
}
),
Expand Down
73 changes: 71 additions & 2 deletions app/controller/SettingsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ SDL.SettingsController = Em.Object.create(
*/
editedCcpuVersionValue: "",

/**
* @description Value of hardware version displayed in user input
*/
editedHardwareVersionValue: "",

/**
* @description Flag to enable/disable hardware version text field
*/
hardwareVersionEditingEnabled: true,

/**
* @description Map of vehicle type data displayed in user inputs
*/
editedVehicleType: {},

onState: function(event) {
if(SDL.States.currentState.name === 'rpcconfig'){
FFW.RPCHelper.setCurrentAppID(null);
Expand Down Expand Up @@ -606,10 +621,64 @@ SDL.SettingsController = Em.Object.create(
},

/**
* @description Saves new CCPU version value from user input
* @description Saves new CCPU and hardware version values from user input
*/
applyNewCcpuVersionValue: function() {
applyNewVersionValues: function() {
SDL.SDLModel.data.ccpuVersion = this.editedCcpuVersionValue;
SDL.SDLModel.data.hardwareVersion = this.hardwareVersionEditingEnabled ?
this.editedHardwareVersionValue : null;

Em.Logger.log("New system version settings have been applied");
},

/**
* @description Getter for all available vehicle type data and corresponding controls
*/
getVehicleTypeCheckboxes: function() {
return [
{ checkbox: SDL.VehicleTypeEditorView.vehicleMakeCheckBox, property: 'make' },
{ checkbox: SDL.VehicleTypeEditorView.vehicleModelCheckBox, property: 'model' },
{ checkbox: SDL.VehicleTypeEditorView.vehicleYearCheckBox, property: 'modelYear' },
{ checkbox: SDL.VehicleTypeEditorView.vehicleTrimCheckBox, property: 'trim' }
];
},

/**
* @description Applies edited by user vehicle data settings to internal data
*/
applyNewVehicleTypeValues: function() {
let setNewVehicleTypeValue = (checkbox, property) => {
if (checkbox.checked) {
SDL.SDLVehicleInfoModel.set('vehicleType.' + property, this.editedVehicleType[property]);
} else {
SDL.SDLVehicleInfoModel.set('vehicleType.' + property, null);
}
};

this.getVehicleTypeCheckboxes().forEach( (item) => {
setNewVehicleTypeValue(item.checkbox, item.property);
});

Em.Logger.log("New vehicle type have been applied");
},

/**
* @description Updated UI controls and values according to internal data values
* @param {Object} new_values internal data values structure
*/
updateVehicleTypeValues: function(new_values) {
let setNewVehicleTypeValue = (checkbox, property) => {
if (new_values[property] !== null) {
this.set('editedVehicleType.' + property, new_values[property]);
checkbox.set('checked', true);
} else {
checkbox.set('checked', false);
}
};

this.getVehicleTypeCheckboxes().forEach( (item) => {
setNewVehicleTypeValue(item.checkbox, item.property);
});
},

/**
Expand Down
5 changes: 5 additions & 0 deletions app/model/sdl/Abstract/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,11 @@ SDL.SDLModelData = Em.Object.create(
* @type {String}
*/
ccpuVersion: '12345_US',
/**
* Hardware version value
* @type {String}
*/
hardwareVersion: '123.456.7890',
/**
* Parameter describes if performInteraction session was started on HMI
* this flag set to true when UI.PerformInteraction request came on HMI
Expand Down
8 changes: 7 additions & 1 deletion app/model/sdl/VehicleInfoModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,13 @@ SDL.SDLVehicleInfoModel = Em.Object.create(
* @type {Number}
*/
getVehicleType: function(id) {
FFW.VehicleInfo.GetVehicleTypeResponse(this.vehicleType, id);
let data_to_send = {};
Object.keys(this.vehicleType).forEach((key) => {
if (this.vehicleType[key] !== null) {
data_to_send[key] = this.vehicleType[key];
}
});
FFW.VehicleInfo.GetVehicleTypeResponse(data_to_send, id);
},
/**
* SDL VehicleInfo.GetDTCs handler fill data for response about vehicle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

SDL.CcpuEditorView = Em.ContainerView.create(
SDL.SystemVersionsEditorView = Em.ContainerView.create(
{
elementId: 'policies_settings_ccpu_editor_view',
elementId: 'policies_settings_system_versions_editor_view',
classNames: 'in_settings_separate_view',
classNameBindings: [
'SDL.States.settings.policies.ccpuEditor.active:active_state:inactive_state'
'SDL.States.settings.policies.versionsEditor.active:active_state:inactive_state'
],
childViews: [
'ccpuTitle',
'versionsTitle',
'backButton',
'ccpuVersionLabel',
'ccpuVersionInput',
'hardwareVersionCheckBox',
'hardwareVersionLabel',
'hardwareVersionInput',
'applyButton'
],
ccpuTitle: SDL.Label.extend(
versionsTitle: SDL.Label.extend(
{
classNames: 'label',
content: 'Configure CCPU version'
content: 'Configure CCPU and hardware versions'
}
),
backButton: SDL.Button.extend(
Expand Down Expand Up @@ -70,12 +73,37 @@ SDL.CcpuEditorView = Em.ContainerView.create(
valueBinding: 'SDL.SettingsController.editedCcpuVersionValue'
}
),
hardwareVersionCheckBox: Em.Checkbox.extend(
{
elementId: 'hardwareVersionCheckBox',
classNames: 'hardwareVersionCheckBox item',
checkedBinding: 'SDL.SettingsController.hardwareVersionEditingEnabled'
}
),
hardwareVersionLabel: SDL.Label.extend(
{
classNames: 'hardwareVersionLabel',
content: 'Hardware version: '
}
),
hardwareVersionInput: Ember.TextField.extend(
{
elementId: 'hardwareVersionInput',
classNames: 'hardwareVersionInput dataInput',
placeholder: '<Type hardware version here>',
valueBinding: 'SDL.SettingsController.editedHardwareVersionValue',
disabledBinding: 'isEditingEnabled',
isEditingEnabled: function() {
return !SDL.SettingsController.hardwareVersionEditingEnabled;
}.property('SDL.SettingsController.hardwareVersionEditingEnabled')
}
),
applyButton: SDL.Button.extend(
{
elementId: 'applyButton',
classNames: 'applyButton button',
elementId: 'systemVersionsApplyButton',
classNames: 'systemVersionsApplyButton button',
text: 'Apply',
action: 'applyNewCcpuVersionValue',
action: 'applyNewVersionValues',
target: 'SDL.SettingsController',
onDown: false
}
Expand Down
Loading