Skip to content

Commit

Permalink
Send initial display capabilities notification based on app's template (
Browse files Browse the repository at this point in the history
#693)

* Send initial display capabilities notification based on app's template

* Fix button capabilities for NON-MEDIA template

* Remove unused function
  • Loading branch information
jacobkeeler authored Sep 27, 2022
1 parent f71955c commit 4159ea1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 143 deletions.
55 changes: 0 additions & 55 deletions app/controller/sdl/Abstract/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1589,61 +1589,6 @@ SDL.SDLController = Em.Object.extend(
app.deactivateWindow(window);
},

/**
* @function getDefaultCapabilities
* @param {Integer} windowID
* @description returns string of predefined system capabilities for windowID
*/
getDefaultCapabilities: function (windowID, appID) {
let windowType = (windowID === undefined || windowID === 0) ? "MAIN" : "WIDGET";

let windowCapability = SDL.deepCopy(SDL.SDLModelData.defaultWindowCapability[windowType]);
if(windowType === "WIDGET") {
windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["windowID"] = windowID;
}

if(appID) {
const is_web_view_template = function(model) {
const template = model.templateConfiguration.template;
if (template == "DEFAULT" && model.appType.indexOf('WEB_VIEW') >= 0) {
return true;
}

return template == "WEB_VIEW";
}

var appModel = this.getApplicationModel(appID);
if (appModel && is_web_view_template(appModel) && windowType == "MAIN") {
let text_fields = windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["textFields"];
const text_fields_to_exclude = [
'mainField1', 'mainField2', 'mainField3', 'mainField4',
'mediaClock', 'mediaTrack'
];
for (var i = text_fields.length - 1; i >= 0; i--) {
if (text_fields_to_exclude.includes(text_fields[i].name)) {
text_fields.splice(i, 1);
}
}

let image_fields = windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["imageFields"];
const image_fields_to_exclude = [
'softButtonImage', 'menuIcon', 'graphic', 'secondaryGraphic'
];
for (var i = image_fields.length - 1; i >= 0; i--) {
if (image_fields_to_exclude.includes(image_fields[i].name)) {
image_fields.splice(i, 1);
}
}

delete windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["softButtonCapabilities"];
}

windowCapability["appID"] = appID;
}

return windowCapability;
},

/**
* @function getDisplayCapability
* @param {Integer} appID
Expand Down
130 changes: 44 additions & 86 deletions app/model/sdl/Abstract/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -1186,112 +1186,70 @@ SDL.SDLModelData = Em.Object.create(
"templatesAvailable": ["MEDIA", "NON-MEDIA", "DEFAULT", "NAV_FULLSCREEN_MAP", 'WEB_VIEW', 'ONSCREEN_PRESETS'],
"buttonCapabilities": [
{
"longPressAvailable": true,
"name": "AC_MAX",
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "AC",
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "RECIRCULATE",
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "FAN_UP",
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "FAN_DOWN",
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "TEMP_UP",
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "TEMP_DOWN",
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "DEFROST_MAX",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_0',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "DEFROST",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_1',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "DEFROST_REAR",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_2',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "UPPER_VENT",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_3',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "LOWER_VENT",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_4',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "VOLUME_UP",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_5',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "VOLUME_DOWN",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_6',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "EJECT",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_7',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "SOURCE",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_8',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "SHUFFLE",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'PRESET_9',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
},
{
"longPressAvailable": true,
"name": "REPEAT",
"shortPressAvailable": true,
"upDownAvailable": false
name: 'CUSTOM_BUTTON',
shortPressAvailable: true,
longPressAvailable: true,
upDownAvailable: true
}
],
"softButtonCapabilities": [{
Expand Down
4 changes: 3 additions & 1 deletion capabilities/display_capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

let templateList = ["MEDIA", "NON-MEDIA", "NAV_FULLSCREEN_MAP", "WEB_VIEW", "ONSCREEN_PRESETS"]

let mediaButtonNames = ["PLAY_PAUSE", "SEEKLEFT", "SEEKRIGHT", "TUNEUP", "TUNEDOWN"]

let mediaCapabilities = {
"displayCapabilities": {
"displayType": "GEN2_8_DMA",
Expand Down Expand Up @@ -811,7 +813,7 @@ SDL.templateCapabilities = {
},
"numCustomPresetsAvailable": 8
},
"buttonCapabilities": SDL.ButtonCapability.filter(button => button.name !== 'PLAY_PAUSE'),
"buttonCapabilities": SDL.ButtonCapability.filter(button => !mediaButtonNames.contains(button.name) && button.name !== "OK"),
"softButtonCapabilities": [{
"shortPressAvailable": true,
"longPressAvailable": true,
Expand Down
2 changes: 1 addition & 1 deletion ffw/BasicCommunicationRPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ FFW.BasicCommunication = FFW.RPCObserver
);
FFW.RPCHelper.addApplication(notification.params.application.appID);
const mainWindowID = 0;
let capability = SDL.SDLController.getDefaultCapabilities(mainWindowID, notification.params.application.appID);
let capability = SDL.SDLController.getDisplayCapability(notification.params.application.appID, mainWindowID);
FFW.BasicCommunication.OnSystemCapabilityUpdated(capability);
}
if (notification.method == this.onAppUnregisteredNotification) {
Expand Down

0 comments on commit 4159ea1

Please sign in to comment.