diff --git a/app/controller/sdl/RCModulesController.js b/app/controller/sdl/RCModulesController.js index 12b4a7438..3b3310785 100644 --- a/app/controller/sdl/RCModulesController.js +++ b/app/controller/sdl/RCModulesController.js @@ -785,18 +785,6 @@ SDL.RCModulesController = Em.Object.create({ location_name = FLAGS.VehicleEmulationType; } - let getDataDifference = (one, another) => { - var diff = {}; - for (var param in one) { - if (undefined !== another[param] && - SDL.SDLController.compareObjects(another[param], one[param]) > 0) { - diff[param] = another[param]; - } - } - - return diff; - }; - var dataToReturn = {}; switch (moduleType) { case 'RADIO': @@ -843,18 +831,15 @@ SDL.RCModulesController = Em.Object.create({ ); return; } else { - const data_before = SDL.deepCopy(this.radioModels[location_name].getRadioControlData(false)); - const radioControlData = + var radioControlData = this.radioModels[location_name].setRadioData( data.params.moduleData.radioControlData); if (this.radioModels[location_name].radioControlStruct.radioEnable) { this.radioModels[location_name].saveCurrentOptions(); } - - const changedFields = getDataDifference(data_before, radioControlData); - if (Object.keys(changedFields).length > 0) { + if (Object.keys(radioControlData).length > 0) { FFW.RC.onInteriorVehicleDataNotification({moduleType:'RADIO', moduleId: moduleUUId, - radioControlData: changedFields}); + radioControlData: radioControlData}); } dataToReturn.radioControlData = radioControlData; } @@ -885,14 +870,12 @@ SDL.RCModulesController = Em.Object.create({ return; } } - const data_before = SDL.deepCopy(this.climateModels[location_name].generateClimateControlData()); var climateControlData = this.climateModels[location_name].setClimateData( data.params.moduleData.climateControlData); - const changedFields = getDataDifference(data_before, climateControlData); - if (Object.keys(changedFields).length > 0) { + if (Object.keys(data.params.moduleData.climateControlData).length > 0) { FFW.RC.onInteriorVehicleDataNotification({moduleType:'CLIMATE', moduleId: moduleUUId, - climateControlData: changedFields}); + climateControlData: climateControlData}); } dataToReturn.climateControlData = climateControlData; } @@ -909,15 +892,12 @@ SDL.RCModulesController = Em.Object.create({ ); return; } else { - const data_before = SDL.deepCopy(this.audioModels[location_name].getAudioControlData()); var audioControlData = (data.params.moduleData.audioControlData.keepContext!=null) ? - this.audioModels[location_name].setAudioControlDataWithKeepContext(data.params.moduleData.audioControlData, location_name) : - this.audioModels[location_name].setAudioControlData(data.params.moduleData.audioControlData, location_name); - - const changedFields = getDataDifference(data_before, audioControlData); - if (Object.keys(changedFields).length > 0) { + this.audioModels[location_name].setAudioControlDataWithKeepContext(data.params.moduleData.audioControlData, location_name) : + this.audioModels[location_name].setAudioControlData(data.params.moduleData.audioControlData, location_name); + if (Object.keys(data.params.moduleData.audioControlData).length > 0) { FFW.RC.onInteriorVehicleDataNotification({moduleType:'AUDIO', moduleId: moduleUUId, - audioControlData: changedFields}); + audioControlData: audioControlData}); } if(data.params.moduleData.audioControlData.source === 'MOBILE_APP') { FFW.RC.OnIVDNotificationWasSent = true; @@ -930,14 +910,11 @@ SDL.RCModulesController = Em.Object.create({ case 'HMI_SETTINGS': { if(data.params.moduleData.hmiSettingsControlData){ - const data_before = SDL.deepCopy(this.hmiSettingsModels[location_name].getHmiSettingsControlData()); var hmiSettingsControlData = this.hmiSettingsModels[location_name].setHmiSettingsData( data.params.moduleData.hmiSettingsControlData); - - const changedFields = getDataDifference(data_before, hmiSettingsControlData); - if (Object.keys(changedFields).length > 0) { + if (Object.keys(data.params.moduleData.hmiSettingsControlData).length > 0) { FFW.RC.onInteriorVehicleDataNotification({moduleType:'HMI_SETTINGS', moduleId: moduleUUId, - hmiSettingsControlData: changedFields}); + hmiSettingsControlData: hmiSettingsControlData}); } dataToReturn.hmiSettingsControlData = hmiSettingsControlData; } @@ -946,26 +923,12 @@ SDL.RCModulesController = Em.Object.create({ case 'LIGHT': { if(data.params.moduleData.lightControlData){ - const data_before_tmp = SDL.deepCopy(this.lightModels[location_name].getLightControlData()); - let data_before = { - lightState: [] - }; - var lightControlData = this.lightModels[location_name].setLightControlData( data.params.moduleData.lightControlData); - data_before_tmp.lightState.forEach( (element_dest) => { - lightControlData.lightState.forEach( (element_target) => { - if (element_target.id == element_dest.id) { - data_before.lightState.push(element_dest); - } - }); - }); - - const changedFields = getDataDifference(data_before, lightControlData); - if (Object.keys(changedFields).length > 0) { - FFW.RC.onInteriorVehicleDataNotification({moduleType:'LIGHT', moduleId: moduleUUId, - lightControlData: changedFields}); + if (Object.keys(lightControlData).length > 0) { + FFW.RC.onInteriorVehicleDataNotification({moduleType:'LIGHT', moduleId: moduleUUId, + lightControlData: data.params.moduleData.lightControlData}); } dataToReturn.lightControlData = lightControlData; } @@ -974,15 +937,11 @@ SDL.RCModulesController = Em.Object.create({ case 'SEAT': { if(data.params.moduleData.seatControlData){ - const data_before = SDL.deepCopy(this.seatModels[location_name].getSeatControlData()); var seatControlData = this.seatModels[location_name].setSeatControlData( - data.params.moduleData.seatControlData - ); - - const changedFields = getDataDifference(data_before, seatControlData); - if (Object.keys(changedFields).length > 0) { - FFW.RC.onInteriorVehicleDataNotification({moduleType:'SEAT', moduleId: moduleUUId, - seatControlData: changedFields}); + data.params.moduleData.seatControlData); + if (Object.keys(data.params.moduleData.seatControlData).length > 0) { + FFW.RC.onInteriorVehicleDataNotification({moduleType:'SEAT', moduleId: moduleUUId, + seatControlData: seatControlData}); } dataToReturn.seatControlData = seatControlData; }