Author: ygrego Date: 2015-03-11 14:48:12 +0000 (Wed, 11 Mar 2015) New Revision: 937 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/937 Log: Implementation method "_createAnyDvbChannelObject". Replacement of all methods calls on object "ChannelTools" by calls of javascript anonymous functions (but they stay the same about name and implementation). Modified: oipf/js/impl/VideoBroadcastObject.js Modified: oipf/js/impl/VideoBroadcastObject.js =================================================================== --- oipf/js/impl/VideoBroadcastObject.js 2015-03-11 14:34:47 UTC (rev 936) +++ oipf/js/impl/VideoBroadcastObject.js 2015-03-11 14:48:12 UTC (rev 937) @@ -423,17 +423,15 @@ if (CHANNEL_CREATION[idType]) { //Verify a channel of this idType (ID_DVB_SI_DIRECT = 13). - var channelTools = new ChannelTools(); - if (channelTools.isAValidTerrestrialDsd(dsd)) { //Verify the dsd validity. + if (isAValidTerrestrialDsd(dsd)) { //Verify the dsd validity. if ((sid >= 1) && (sid <= 65535)) { //Verify the rigth range of service id. var newChannel = new Channel(idType, dsd, sid, "localChannel" + createUUID()); var channelConfig = this.getChannelConfig(); - channelTools = new ChannelTools(); - if (!channelTools.getChannelByDsd(channelConfig.channelList, dsd)) { + if (getChannelByDsd(channelConfig.channelList, dsd)) { /* Normally channelList is readonly but the method documentation say * that the channel must be add if it not already present. @@ -495,9 +493,35 @@ * argument that SHALL be specified when the idType specifies a channel * of type ID_IPTV_SDS or ID_IPTV_URI and SHALL otherwise be ignored * by the OITF. + * + * Important : We place us into a world without error. And no validation will be done like + * this documentation mention it. This criterion not very useful in our implementation. */ _createAnyDvbChannelObject: function(idType, onid, tsid, sid, sourceID, ipBroadcastID) { + if (CHANNEL_CREATION[idType]) { + if (idType == 13 || idType ==0) { + return null; + } + + if (idType == 30) { + var equivalentChannel = this.getChannelConfig().channelList.getChannelBySourceID(sourceID); + } else if (idType == 40) { + equivalentChannel = getChannelByIpBroadcastID(ipBroadcastID); + } else { + equivalentChannel = this.getChannelConfig().channelList.getChannelByTriplet(onid, tsid, sid); + } + + if (equivalentChannel) { + var newChannel = new Channel(arguments.push(equivalentChannel.name)); + } else { + newChannel = new Channel(arguments.push("localChannel:"+createUUID())); + } + + this.getChannelConfig().channelList.push(newChannel); + } + + return null; }, /* @@ -731,9 +755,11 @@ //Find the previous channel into the current favourite list channelCollection = channelConfig.currentFavouriteLists; } - var _channelTools = new ChannelTools(); - var previousChannel = _channelTools.findChannel(channelCollection, object.currentChannel, step); - var tunerFound = _channelTools.verifyASuitableTunerAvailable(previousChannel.idType, object); + + var previousChannel = findChannel(channelCollection, object.currentChannel, step); + + var tunerFound = verifyASuitableTunerAvailable(previousChannel.idType, object); + if (tunerFound) { //ToDO: Error handling, if the switch fail, this instruction correspond to channel switch. object.currentChannel = previousChannel;
participants (1)
-
ygregoï¼ users.nuiton.org