Skip to content

Commit 490daba

Browse files
BSolonenkoBSolonenko
authored andcommitted
Fixed onInteriorVehicleDataNotification
1 parent b4ad697 commit 490daba

1 file changed

Lines changed: 51 additions & 6 deletions

File tree

app/model/media/RadioModel.js

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,48 @@ SDL.RadioModel = Em.Object.create({
758758
if (data.radioEnable != null) {
759759
this.setRadioEnable(data.radioEnable);
760760
properties.push('radioEnable');
761+
if(data.radioEnable){
762+
properties.push('hdRadioEnable');
763+
properties.push('frequencyInteger');
764+
properties.push('band');
765+
switch(this.radioControlStruct.band){
766+
case 'AM':
767+
properties.push('availableHDs');
768+
properties.push('hdChannel');
769+
if(this.radioControlStruct.hdRadioEnable){
770+
properties.push('sisData.*');
771+
properties.push('stationIDNumber.*');
772+
properties.push('stationLocation.*');
773+
}
774+
break;
775+
case 'FM':
776+
properties.push('availableHDs');
777+
properties.push('hdChannel');
778+
properties.push('frequencyFraction');
779+
properties.push('rdsData.*');
780+
if(this.radioControlStruct.hdRadioEnable){
781+
properties.push('sisData.*');
782+
properties.push('stationIDNumber.*');
783+
properties.push('stationLocation.*');
784+
}
785+
break;
786+
default:
787+
properties.push('signalStrength');
788+
properties.push('signalChangeThreshold');
789+
properties.push('state');
790+
}
791+
}
761792
}
762793

763794
if (this.radioControlStruct.radioEnable) {
764795
if(data.hdRadioEnable != null){
765796
this.setHDRadioEnable(data.hdRadioEnable);
766797
this.set('radioControlCheckboxes.availableHDs',data.hdRadioEnable);
767798
this.set('radioControlCheckboxes.hdChannel',data.hdRadioEnable);
799+
if(data.hdRadioEnable && properties.indexOf('availableHDs') == -1){
800+
properties.push('availableHDs');
801+
properties.push('hdChannel');
802+
}
768803
}
769804
if (data.frequencyInteger != null) {
770805
this.setFrequencyInteger(data.frequencyInteger);
@@ -821,9 +856,10 @@ SDL.RadioModel = Em.Object.create({
821856
this.setRadioState(data.state);
822857
}
823858

824-
properties = [];
825859
for (var key in data) {
826-
properties.push(key);
860+
if(properties.indexOf(key) == -1){
861+
properties.push(key);
862+
}
827863
}
828864

829865
if (properties.indexOf('band') >= 0) {
@@ -841,6 +877,7 @@ SDL.RadioModel = Em.Object.create({
841877
}
842878

843879
var result = this.getRadioControlData(true);
880+
this.sendRadioChangeNotification(properties);
844881
return SDL.SDLController.filterObjectProperty(result, properties);
845882
},
846883

@@ -1214,7 +1251,7 @@ SDL.RadioModel = Em.Object.create({
12141251
this.set('station', this.temp);
12151252
}
12161253

1217-
if (this.optionsEnabled) {
1254+
if (this.optionsEnabled) {
12181255
this.toggleOptions();
12191256
}
12201257

@@ -1229,7 +1266,10 @@ SDL.RadioModel = Em.Object.create({
12291266
'band',
12301267
'availableHDs',
12311268
'hdChannel',
1232-
'rdsData.*'
1269+
'rdsData.*',
1270+
this.radioControlStruct.hdRadioEnable ? 'sisData.*': '',
1271+
this.radioControlStruct.hdRadioEnable ? 'stationIDNumber.*': '',
1272+
this.radioControlStruct.hdRadioEnable ? 'stationLocation.*': ''
12331273
]);
12341274

12351275
} else if (data.band == 'AM') {
@@ -1238,15 +1278,20 @@ SDL.RadioModel = Em.Object.create({
12381278
'frequencyInteger',
12391279
'band',
12401280
'availableHDs',
1241-
'hdChannel']);
1281+
'hdChannel',
1282+
this.radioControlStruct.hdRadioEnable ? 'sisData.*': '',
1283+
this.radioControlStruct.hdRadioEnable ? 'stationIDNumber.*': '',
1284+
this.radioControlStruct.hdRadioEnable ? 'stationLocation.*': ''
1285+
]);
12421286
} else {
12431287
this.sendRadioChangeNotification(['radioEnable',
12441288
'hdRadioEnable',
12451289
'frequencyInteger',
12461290
'band',
12471291
'signalStrength',
12481292
'signalChangeThreshold',
1249-
'state']);
1293+
'state'
1294+
]);
12501295
}
12511296
},
12521297

0 commit comments

Comments
 (0)