Skip to content

Commit 3915459

Browse files
authored
Merge pull request #694 from smartdevicelink/release/5.8.0
Release 5.8.0
2 parents fb1f122 + 4159ea1 commit 3915459

File tree

12 files changed

+531
-217
lines changed

12 files changed

+531
-217
lines changed

app/controller/sdl/Abstract/Controller.js

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,61 +1589,6 @@ SDL.SDLController = Em.Object.extend(
15891589
app.deactivateWindow(window);
15901590
},
15911591

1592-
/**
1593-
* @function getDefaultCapabilities
1594-
* @param {Integer} windowID
1595-
* @description returns string of predefined system capabilities for windowID
1596-
*/
1597-
getDefaultCapabilities: function (windowID, appID) {
1598-
let windowType = (windowID === undefined || windowID === 0) ? "MAIN" : "WIDGET";
1599-
1600-
let windowCapability = SDL.deepCopy(SDL.SDLModelData.defaultWindowCapability[windowType]);
1601-
if(windowType === "WIDGET") {
1602-
windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["windowID"] = windowID;
1603-
}
1604-
1605-
if(appID) {
1606-
const is_web_view_template = function(model) {
1607-
const template = model.templateConfiguration.template;
1608-
if (template == "DEFAULT" && model.appType.indexOf('WEB_VIEW') >= 0) {
1609-
return true;
1610-
}
1611-
1612-
return template == "WEB_VIEW";
1613-
}
1614-
1615-
var appModel = this.getApplicationModel(appID);
1616-
if (appModel && is_web_view_template(appModel) && windowType == "MAIN") {
1617-
let text_fields = windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["textFields"];
1618-
const text_fields_to_exclude = [
1619-
'mainField1', 'mainField2', 'mainField3', 'mainField4',
1620-
'mediaClock', 'mediaTrack'
1621-
];
1622-
for (var i = text_fields.length - 1; i >= 0; i--) {
1623-
if (text_fields_to_exclude.includes(text_fields[i].name)) {
1624-
text_fields.splice(i, 1);
1625-
}
1626-
}
1627-
1628-
let image_fields = windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["imageFields"];
1629-
const image_fields_to_exclude = [
1630-
'softButtonImage', 'menuIcon', 'graphic', 'secondaryGraphic'
1631-
];
1632-
for (var i = image_fields.length - 1; i >= 0; i--) {
1633-
if (image_fields_to_exclude.includes(image_fields[i].name)) {
1634-
image_fields.splice(i, 1);
1635-
}
1636-
}
1637-
1638-
delete windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["softButtonCapabilities"];
1639-
}
1640-
1641-
windowCapability["appID"] = appID;
1642-
}
1643-
1644-
return windowCapability;
1645-
},
1646-
16471592
/**
16481593
* @function getDisplayCapability
16491594
* @param {Integer} appID

app/model/media/AudioModel.js

Lines changed: 93 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -260,73 +260,85 @@ SDL.AudioModel = Em.Object.extend({
260260
/**
261261
* Turn on CD
262262
*/
263-
turnOnCD: function () {
263+
turnOnCD: function (event=null, is_background=false) {
264264
if (!SDL.States.media.player.cd.active) {
265265
this.deactivateAll();
266-
SDL.States.goToStates('media.player.cd');
266+
this.changeAudioSource('media.player.cd', is_background);
267+
}
268+
if (!is_background) {
269+
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.cdModel, 'cd');
267270
}
268-
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.cdModel, 'cd');
269271
this.returnParameters();
270272
},
271273

272274
/**
273275
* Turn on USB
274276
*/
275-
turnOnUSB: function () {
277+
turnOnUSB: function (event=null, is_background=false) {
276278
if (!SDL.States.media.player.usb.active) {
277279
this.deactivateAll();
278-
SDL.States.goToStates('media.player.usb');
280+
this.changeAudioSource('media.player.usb', is_background);
281+
}
282+
if (!is_background) {
283+
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.usbModel, 'usb');
279284
}
280-
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.usbModel, 'usb');
281285
this.returnParameters();
282286
},
283287

284288
/**
285289
* Turn on Radio
286290
*/
287-
turnOnRadio: function () {
291+
turnOnRadio: function (event=null, is_background=false) {
288292
if (!SDL.States.media.player.radio.active) {
289293
this.deactivateAll();
290-
SDL.States.goToStates('media.player.radio');
294+
this.changeAudioSource('media.player.radio', is_background);
291295
}
292296
SDL.RCModulesController.currentRadioModel.saveCurrentOptions();
293-
SDL.RCModulesController.currentRadioModel.set('active', true);
297+
if (!is_background) {
298+
SDL.RCModulesController.currentRadioModel.set('active', true);
299+
}
294300
this.returnParameters();
295301
},
296302

297303
/**
298304
* Turn on Bluetooth
299305
*/
300-
turnOnBluetooth: function () {
306+
turnOnBluetooth: function (event=null, is_background=false) {
301307
if (!SDL.States.media.player.bluetooth.active) {
302308
this.deactivateAll();
303-
SDL.States.goToStates('media.player.bluetooth');
309+
this.changeAudioSource('media.player.bluetooth', is_background);
310+
}
311+
if (!is_background) {
312+
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.bluetoothModel, 'bluetooth');
304313
}
305-
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.bluetoothModel, 'bluetooth');
306314
this.returnParameters();
307315
},
308316

309317
/**
310318
* Turn on LineIn
311319
*/
312-
turnOnLineIn: function () {
320+
turnOnLineIn: function (event=null, is_background=false) {
313321
if (!SDL.States.media.player.lineIn.active) {
314322
this.deactivateAll();
315-
SDL.States.goToStates('media.player.lineIn');
323+
this.changeAudioSource('media.player.lineIn', is_background);
324+
}
325+
if (!is_background) {
326+
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.lineInModel, 'lineIn');
316327
}
317-
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.lineInModel, 'lineIn');
318328
this.returnParameters();
319329
},
320330

321331
/**
322332
* Turn on IPod
323333
*/
324-
turnOnIPod: function () {
334+
turnOnIPod: function (event=null, is_background=false) {
325335
if (!SDL.States.media.player.ipod.active) {
326336
this.deactivateAll();
327-
SDL.States.goToStates('media.player.ipod');
337+
this.changeAudioSource('media.player.ipod', is_background);
338+
}
339+
if (!is_background) {
340+
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.ipodModel, 'ipod');
328341
}
329-
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.ipodModel, 'ipod');
330342
this.returnParameters();
331343
},
332344

@@ -544,12 +556,12 @@ SDL.AudioModel = Em.Object.extend({
544556
this.changeSourceFromBluetooth(is_background);
545557
break;
546558
}
547-
case 'media.player.lieIn': {
559+
case 'media.player.lineIn': {
548560
this.changeSourceFromLineIn(is_background);
549561
break;
550562
}
551563
case 'media.player.ipod': {
552-
this.changeSourceFromIpod(is_background);
564+
this.changeSourceFromIPod(is_background);
553565
break;
554566
}
555567
default: {
@@ -558,17 +570,63 @@ SDL.AudioModel = Em.Object.extend({
558570
}
559571
},
560572

573+
/**
574+
* Switch RC Audio source based on whether the app is in focus
575+
* @param nextState Audio source to transition to
576+
* @param isBackground
577+
*/
578+
changeAudioSource : function (nextState, isBackground){
579+
if (!isBackground) {
580+
SDL.States.goToStates(nextState);
581+
return;
582+
}
583+
584+
SDL.RCModulesController.currentAudioModel.set('activeState', nextState);
585+
if (FFW.RC.isSetVdInProgress) {
586+
return;
587+
}
588+
let currentAudioModel = this.getAudioModel(nextState);
589+
currentAudioModel.sendAudioNotification();
590+
},
591+
592+
/**
593+
* Get audio model based on state name
594+
* @param stateName name of audio source state(e.g. 'media.player.ipod')
595+
*/
596+
getAudioModel : function (stateName){
597+
switch (stateName) {
598+
case 'media.player.radio': {
599+
return SDL.RCModulesController.currentRadioModel;
600+
}
601+
case 'media.player.cd': {
602+
return SDL.RCModulesController.currentAudioModel.cdModel;
603+
}
604+
case 'media.player.usb': {
605+
return SDL.RCModulesController.currentAudioModel.usbModel;
606+
}
607+
case 'media.player.bluetooth': {
608+
return SDL.RCModulesController.currentAudioModel.bluetoothModel;
609+
}
610+
case 'media.player.lineIn': {
611+
return SDL.RCModulesController.currentAudioModel.lineInModel;
612+
}
613+
case 'media.player.ipod': {
614+
return SDL.RCModulesController.currentAudioModel.ipodModel;
615+
}
616+
default: { // Default to RADIO
617+
return SDL.RCModulesController.currentRadioModel;
618+
}
619+
}
620+
},
621+
561622
/**
562623
* Switches to next after radio source
563624
* @param is source switched from background or not
564625
*/
565626
changeSourceFromRadio: function (is_background) {
566627
var old_state = SDL.States.currentState.get('path');
567628
this.deactivateRadio();
568-
this.turnOnCD();
569-
if (is_background) {
570-
SDL.States.goToStates(old_state);
571-
}
629+
this.turnOnCD(null, is_background);
572630
},
573631

574632
/**
@@ -578,10 +636,7 @@ SDL.AudioModel = Em.Object.extend({
578636
changeSourceFromCD: function (is_background) {
579637
var old_state = SDL.States.currentState.get('path');
580638
this.deactivateCD();
581-
this.turnOnUSB();
582-
if (is_background) {
583-
SDL.States.goToStates(old_state);
584-
}
639+
this.turnOnUSB(null, is_background);
585640
},
586641

587642
/**
@@ -591,14 +646,7 @@ SDL.AudioModel = Em.Object.extend({
591646
changeSourceFromUSB: function (is_background) {
592647
var old_state = SDL.States.currentState.get('path');
593648
this.deactivateUSB();
594-
if (SDL.SDLMediaController.currentAppId != null && !is_background) {
595-
SDL.SDLMediaController.activateCurrentApp();
596-
} else {
597-
this.turnOnRadio();
598-
}
599-
if (is_background) {
600-
SDL.States.goToStates(old_state);
601-
}
649+
this.turnOnBluetooth(null, is_background);
602650
},
603651

604652
/**
@@ -608,10 +656,7 @@ SDL.AudioModel = Em.Object.extend({
608656
changeSourceFromBluetooth: function (is_background) {
609657
var old_state = SDL.States.currentState.get('path');
610658
this.deactivateBluetooth();
611-
this.turnOnLineIn();
612-
if (is_background) {
613-
SDL.States.goToStates(old_state);
614-
}
659+
this.turnOnLineIn(null, is_background);
615660
},
616661

617662
/**
@@ -621,22 +666,20 @@ SDL.AudioModel = Em.Object.extend({
621666
changeSourceFromLineIn: function (is_background) {
622667
var old_state = SDL.States.currentState.get('path');
623668
this.deactivateLineIn();
624-
this.turnOnIpod();
625-
if (is_background) {
626-
SDL.States.goToStates(old_state);
627-
}
669+
this.turnOnIPod(null, is_background);
628670
},
629671

630672
/**
631673
* Switches to next after IPod source
632674
* @param is source switched from background or not
633675
*/
634-
changeSourceFromIpod: function (is_background) {
676+
changeSourceFromIPod: function (is_background) {
635677
var old_state = SDL.States.currentState.get('path');
636-
this.deactivateIpod();
637-
this.turnOnIpod();
638-
if (is_background) {
639-
SDL.States.goToStates(old_state);
678+
this.deactivateIPod();
679+
if (SDL.SDLMediaController.currentAppId != null && !is_background) {
680+
SDL.SDLMediaController.activateCurrentApp();
681+
} else {
682+
this.turnOnRadio(null, is_background);
640683
}
641684
},
642685

@@ -646,10 +689,7 @@ SDL.AudioModel = Em.Object.extend({
646689
*/
647690
changeSourceFromUnknown: function (is_background) {
648691
var old_state = SDL.States.currentState.get('path');
649-
this.turnOnRadio();
650-
if (is_background) {
651-
SDL.States.goToStates(old_state);
652-
}
692+
this.turnOnRadio(null, is_background);
653693
},
654694

655695
/**

0 commit comments

Comments
 (0)