Author: ygrego Date: 2015-06-09 13:05:11 +0000 (Tue, 09 Jun 2015) New Revision: 1649 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1649 Log: Transformation of the class ChannelConfig in an ES6 class. Modified: oipf/lib/js/impl/ChannelConfig.js Modified: oipf/lib/js/impl/ChannelConfig.js =================================================================== --- oipf/lib/js/impl/ChannelConfig.js 2015-06-09 12:53:02 UTC (rev 1648) +++ oipf/lib/js/impl/ChannelConfig.js 2015-06-09 13:05:11 UTC (rev 1649) @@ -11,7 +11,7 @@ * ------------------------------------------------------------------------ * Capability | Properties | Methods * --------------------------------- --------------- ---------------------- - * Element <extendedAVControl> | onChannelScan | startScan() + * Element <extendedAVControl> | onChannelScan | startScan() * is set to “ true ” as defined in | | stopScan() * section 9.3.6. | | * ---------------------------------|---------------|---------------------- @@ -19,98 +19,88 @@ * type="ID_IPTV_SDS"> is set as | | * defined in section 9.3.6. | | */ -var ChannelConfig = Class.extend({ - - /* - * Description: - * The current channel of the OITF if the user has given permission to share this information, possibly through a - * mechanism outside the scope of this specification. If no channel is being presented, or if this information is - * not visible to the caller, the value of this property SHALL be null. - * In an OITF where exactly one video/broadcast object is in any state other than Unrealized and the - * channel being presented by that video/broadcast object is the only broadcast channel being presented by - * the OITF then changes to the channel presented by that video/broadcast object SHALL result in changes - * to the current channel of the OITF. - * In an OITF which is presenting more than one broadcast channel at the same time, the current channel of - * the OITF is the channel whose audio is being presented (as defined in the bindToCurrentChannel() - * method). If that current channel is under the control of a DAE application via a video/broadcast object - * then changes to the channel presented by that video/broadcast object SHALL result in changes to the - * current channel of the OITF. - * - * Visibility Type : readonly Channel - */ - currentChannel: null, +class ChannelConfig { - /* - * Description: - * The list of channels. - * If an OITF includes a platform-specific application that enables the end-user to choose a channel to be - * presented from a list then all the channels in the list offered to the user by that application SHALL be - * included in this ChannelList. - * The list of channels will be a subset of all those available to the OITF. The precise algorithm by which this - * subset is selected will be market and/or implementation dependent. For example; - * • If an OITF with a DVB-T tuner receives multiple versions of the same channel, one would be - * included in the list and the duplicates discarded - * • An OITF with a DVB tuner will often filter services based on service type to discard those which are - * obviously inappropriate or impossible for that device to present to the end-user, e.g. firmware - * download services. - * The order of the channels in the list corresponds to the channel ordering as managed by the OITF. SHALL - * return the value null if the channel list is not (partially) managed by the OITF (i.e., if the channel list - * information is managed entirely in the network). - * The properties of channels making up the channel list SHALL be set by the OITF to the appropriate values - * as determined by the tables in section 8.4.3. The OITF SHALL store all these values as part of the channel - * list. - * Some values are set according to the data carried in the broadcast stream. In this case, the OITF MAY set - * these values to undefined until such time as the relevant data has been received by the OITF, for example - * after tuning to the channel. Once the data has been received, the OITF SHALL update the properties of the - * channel in the channel list according to the received data. - * Note: There is no requirement for the OITF to pro-actively tune to every channel to gather such data. - * - * Visibility Type : readonly ChannelList - */ - channelList: null, - - /* Visibility : readonly FavouriteListCollection - */ - favouriteLists: null, - - /* Visibility : readonly FavouriteList - */ - currentFavouriteList: null, - - /* - * \param Integer - * \param Interger - * \param Interger - * \param Interger - * \param Interger - * \param Interger - * \param Interger - * \param Interger - * \param Channel - */ - onChannelScan: function(scanEvent, progress, frequency, signalStrength, channelNumber, channelType, channelCount, transponderCount, newChannel) { - + constructor(channelService) { + this._callbacks = {}; + this._channelService = channelService; + /* + * Description: + * The current channel of the OITF if the user has given permission + * to share this information, possibly through a + * mechanism outside the scope of this specification. + * If no channel is being presented, or if this information is + * not visible to the caller, the value of this property SHALL be null. + * In an OITF where exactly one video/broadcast object is in any state other than + * Unrealized and the + * channel being presented by that video/broadcast object is the only broadcast + * channel being presented by + * the OITF then changes to the channel presented by that video/broadcast object + * SHALL result in changes + * to the current channel of the OITF. + * In an OITF which is presenting more than one broadcast channel at the same time, + * the current channel of + * the OITF is the channel whose audio is being presented (as defined in the + * bindToCurrentChannel() + * method). If that current channel is under the control of a DAE application via a + * video/broadcast object + * then changes to the channel presented by that video/broadcast object SHALL + * result in changes to the + * current channel of the OITF + * + * Visibility Type : readonly Channel + */ + this.currentChannel = this._channelService.currentChannel; + + /* + * Description: + * The list of channels. + * If an OITF includes a platform-specific application that enables the end-user to choose a channel to be + * presented from a list then all the channels in the list offered to the user by that application SHALL be + * included in this ChannelList. + * The list of channels will be a subset of all those available to the OITF. The precise algorithm by which this + * subset is selected will be market and/or implementation dependent. For example; + * • If an OITF with a DVB-T tuner receives multiple versions of the same channel, one would be + * included in the list and the duplicates discarded + * • An OITF with a DVB tuner will often filter services based on service type to discard those which are + * obviously inappropriate or impossible for that device to present to the end-user, e.g. firmware + * download services. + * The order of the channels in the list corresponds to the channel ordering as managed by the OITF. SHALL + * return the value null if the channel list is not (partially) managed by the OITF (i.e., if the channel list + * information is managed entirely in the network). + * The properties of channels making up the channel list SHALL be set by the OITF to the appropriate values + * as determined by the tables in section 8.4.3. The OITF SHALL store all these values as part of the channel + * list. + * Some values are set according to the data carried in the broadcast stream. In this case, the OITF MAY set + * these values to undefined until such time as the relevant data has been received by the OITF, for example + * after tuning to the channel. Once the data has been received, the OITF SHALL update the properties of the + * channel in the channel list according to the received data. + * Note: There is no requirement for the OITF to pro-actively tune to every channel to gather such data. + * + * Visibility Type : readonly ChannelList + */ + this.channelList = this._channelService.channelList; + + /* Visibility : readonly FavouriteListCollection + */ + this.favouriteLists = this._channelService.favouriteLists; + + /* Visibility : readonly FavouriteList + */ + this.currentFavouriteList = this._channelService.currentFavouriteList; }, - - init: function(channelService) { - this._channelService = channelService; - var channelType = "TYPE_TV"; - var channelName = "ARTE"; - var channelIdType = 12; - var channelArte = new Channel(channelIdType, 52, 53, 54, channelName); - channelName = "FRANCE_5"; - var channelFrance5 = new Channel(channelIdType, 12, 13, 14, channelName); - - channelName = "FRANCE_4"; - var channelFrance4 = new Channel(channelIdType, 22, 23, 24, channelName); + _getCallback(type) { + if (this._callbacks) { + return this._callbacks[type]; + } + } - this.currentChannel = channelArte; - this.channelList = new ChannelList(channelArte, channelFrance5, channelFrance4); - this.favouriteLists = new FavouriteListCollection(); - this.currentFavouriteList = new FavouriteList(); - }, - + _setCallback(type, callback) { + if (this._callbacks) { + this._callbacks[type] = callback; + } + } /* * Description: * This function is the DOM 0 event handler for events relating to channel list updates. Upon receiving a @@ -119,7 +109,30 @@ * removed, but their order in the ChannelConfig.all collection MAY have changed. Any lists created with * ChannelConfig.createFilteredList() SHOULD be recreated in case channels have been removed. */ - onChannelListUpdate: function() { + get onChannelListUpdate() { + return this._getCallback("ChannelListUpdate"); + } + set onChannelListUpdate(callback) { + this._setCallback("ChannelListUpdate", callback); } -}); + + /* + * \param Integer scanEvent + * \param Interger progress + * \param Interger frequency + * \param Interger signalStrength + * \param Interger channelNumber + * \param Interger channelType + * \param Interger channelCount + * \param Interger transponderCount + * \param Channel newChannel + */ + get onChannelScan() { + return this._getCallback("ChannelScan"); + }, + + set onChannelScan(callback) { + this._setCallback("ChannelScan", callback); + }, +}
participants (1)
-
ygrego@users.nuiton.org