Author: ygrego Date: 2015-06-11 15:31:19 +0000 (Thu, 11 Jun 2015) New Revision: 1704 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1704 Log: Refactor this class in an ES6 class. Modified: oipf/lib/configuration/CapabilitiesProperties.js Modified: oipf/lib/configuration/CapabilitiesProperties.js =================================================================== --- oipf/lib/configuration/CapabilitiesProperties.js 2015-06-11 14:58:40 UTC (rev 1703) +++ oipf/lib/configuration/CapabilitiesProperties.js 2015-06-11 15:31:19 UTC (rev 1704) @@ -1,157 +1,164 @@ -/* - * The OITF SHALL support following non-visual embedded object with +/* + * The OITF SHALL support following non-visual embedded object with * the mime type application/oipfCapabilities. */ -var CapabilitiesProperties = Class.extend({ - defaultConfig: { - extraSDVideoDecodes: null, - extraHDVideoDecodes: null - }, - - baseUIProfileName: [ - "OITF_SDEU_UIPROF", - "OITF_SD60_UIPROF", - "OITF_SDUS_UIPROF", - "OITF_HD_UIPROF", - "OITF_FULL_HD_UIPROF" - ], - - UIProfileNameFragment: [ - "+TRICKMODE", - "+AVCAD", - "+DL", - "+IPTV_SDS", - "+IPTV_URI", - "+ANA", - "+DVB_C", - "+DVB_T", - "+DVB_S", - "+DVB_C2", - "+DVB_T2", - "+DVB_S2", - "+META_BCG", - "+META_EIT", - "+META_SI", - "+ITV_KEYS", - "+CONTROLLED", - "+PVR", - "+DRM", - "+CommunicationServices", - "+SVG", - "+POINTER", - "+WIDGETS", - "+HTML5_MEDIA", - "+RCF", - "+TELEPHONY", - "+VIDEOTELEPHONY" - ], - - profileNameMapping: { - "+DVB_T": "DVB", - "+META_EIT": "META" - /*"+AVCAD": "DVB", - "+IPTV_SDS": "DVB", - "+IPTV_URI": "DVB", - "+ANA": "DVB", - "+DVB_C": "DVB", - "+DVB_S": "DVB", - "+DVB_C2": "DVB", - "+DVB_T2": "DVB", - "+DVB_S2": "DVB", - "+META_BCG": "META", - "+META_SI": "META"*/ - }, - - roots: "profilelist", - - defaultCapabilities: { - "DVB": { - video_broadcast: { - value: true, - attributes: { - type: "ID_DVB_T ID_DVB_SI_DIRECT", - transport: "", - nrstreams: 1, - scaling: "arbitrary", - minSize: 0, - postList: false, - networkTimeshift: false, - localTimeshift: false +class CapabilitiesProperties { + + constructor() { + this.defaultConfig = { + extraSDVideoDecodes: null, + extraHDVideoDecodes: null + }; + + this.baseUIProfileName = [ + "OITF_SDEU_UIPROF", + "OITF_SD60_UIPROF", + "OITF_SDUS_UIPROF", + "OITF_HD_UIPROF", + "OITF_FULL_HD_UIPROF" + ]; + + this.UIProfileNameFragment = [ + "+TRICKMODE", + "+AVCAD", + "+DL", + "+IPTV_SDS", + "+IPTV_URI", + "+ANA", + "+DVB_C", + "+DVB_T", + "+DVB_S", + "+DVB_C2", + "+DVB_T2", + "+DVB_S2", + "+META_BCG", + "+META_EIT", + "+META_SI", + "+ITV_KEYS", + "+CONTROLLED", + "+PVR", + "+DRM", + "+CommunicationServices", + "+SVG", + "+POINTER", + "+WIDGETS", + "+HTML5_MEDIA", + "+RCF", + "+TELEPHONY", + "+VIDEOTELEPHONY" + ]; + + this.profileNameMapping = { + "+DVB_T": "DVB", + "+META_EIT": "META" + /*"+AVCAD": "DVB", + "+IPTV_SDS": "DVB", + "+IPTV_URI": "DVB", + "+ANA": "DVB", + "+DVB_C": "DVB", + "+DVB_S": "DVB", + "+DVB_C2": "DVB", + "+DVB_T2": "DVB", + "+DVB_S2": "DVB", + "+META_BCG": "META", + "+META_SI": "META"*/ + }; + + this.roots = "profilelist"; + + this.defaultCapabilities = { + "DVB": { + video_broadcast: { + value: true, + attributes: { + type: "ID_DVB_T ID_DVB_SI_DIRECT", + transport: "", + nrstreams: 1, + scaling: "arbitrary", + minSize: 0, + postList: false, + networkTimeshift: false, + localTimeshift: false + } } - } - }, - "OITF_SDEU_UIPROF": { - overlaylocaltuner: { - value: "per-pixel" - } - }, - "+PVR": { - recording: { - value: true, - attributes: { - ipBroadcast: false, - HAS: false, - DASH: false, - manageRecordings: "initiator", - postList: false + }, + "OITF_SDEU_UIPROF": { + overlaylocaltuner: { + value: "per-pixel" } - } - }, - META: { - clientMetadata: { - value: true, - attributes: { - type: "eit-pf" + }, + "+PVR": { + recording: { + value: true, + attributes: { + ipBroadcast: false, + HAS: false, + DASH: false, + manageRecordings: "initiator", + postList: false + } } + }, + META: { + clientMetadata: { + value: true, + attributes: { + type: "eit-pf" + } + } + }, + "+CONTROLLED": { + configurationChanges: { + value: true + } } - }, - "+CONTROLLED": { - configurationChanges: { - value: true - } - } - }, - - rearrangeDefaultProperties: function() { + }; + } + + + + rearrangeDefaultProperties() { var defaultProperties = {}; - + var defaultCapabilitiesKeys = Object.keys(this.defaultCapabilities); - + for (var i = 0, l = defaultCapabilitiesKeys.length; i < l; i++) { var currentKey = defaultCapabilitiesKeys[i]; var currentCapability = this.defaultCapabilities[currentKey]; var currentCapabilityKeysList = Object.keys(currentCapability); - + for (var j = 0, l1 = currentCapabilityKeysList.length; j < l1; j++) { var currentCapabilityKeys = currentCapabilityKeysList[j]; - defaultProperties[currentCapabilityKeys] = + defaultProperties[currentCapabilityKeys] = currentCapability[currentCapabilityKeys]; } } return defaultProperties; - }, - + } + /* * FIXME: * Yannis - 13/05/2015 - Achieved a more detailed verification on capability - * but it's not an obligation + * but it's not an obligation */ - hasCapablity: function(profileName) { + hasCapablity(profileName) { this.defaultCapabilities[profileName]; this.profileNameMapping[profileName]; - - return this.defaultCapabilities[profileName] || + + return this.defaultCapabilities[profileName] || this.profileNameMapping[profileName]; - }, - - searchAnAttributeValue: function(attributeValue) { - - }, - searchATagName: function(tagName) { - - }, - searchAValue: function(value) { - } -}); + searchAnAttributeValue(attributeValue) { + + } + + searchATagName(tagName) { + + } + + searchAValue(value) { + + } +} +