Author: ygrego Date: 2015-03-02 09:29:09 +0000 (Mon, 02 Mar 2015) New Revision: 901 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/901 Log: Deletion of method "_findChannel" and "_verifyASuitableTunerAvailable", these one are present into class "ChannelTools". Modified: oipf/js/impl/VideoBroadcastObject.js Modified: oipf/js/impl/VideoBroadcastObject.js =================================================================== --- oipf/js/impl/VideoBroadcastObject.js 2015-03-02 09:21:46 UTC (rev 900) +++ oipf/js/impl/VideoBroadcastObject.js 2015-03-02 09:29:09 UTC (rev 901) @@ -409,9 +409,9 @@ //Find the previous channel into the current favourite list channelCollection = channelConfig.currentFavouriteLists; } - var previousChannel = this._findChannel(channelCollection, this.currentChannel, - 1); - console.log(previousChannel, channelCollection, this.currentChannel); - var tunerFound = this._verifyASuitableTunerAvailable(previousChannel.idType); + var _channelTools = new ChannelTools(); + var previousChannel = _channelTools.findChannel(channelCollection, this.currentChannel, - 1); + var tunerFound = _channelTools.verifyASuitableTunerAvailable(previousChannel.idType, this); if (tunerFound) { //ToDO: Error handling, if the switch fail, this instruction correspond to channel switch. this.currentChannel = previousChannel; @@ -531,53 +531,5 @@ stop: function() { - }, - - _findChannel: function(channelCollection, channel, step) { - for (var keys = Object.keys(channelCollection) in channelCollection) { - if (channelCollection[keys] == channel) { - return channelCollection[Math.abs((keys%(channelCollection.length))+step)]; - } - } - return null; - }, - - /* - * Description: - * This method verify that a tuner is available to receive a channel with this "idType". - * And return the first tuner found which match the "idType". - * Actually all video broadcast will use the same tuner because there is only one and - * this choice would be directed by parameter. - * - * ToDo :Normally the method should check if the tuner don't locked by another object but - * no way to do that in the norm. - * - * Argument: - * - idType : the type of tuner researched. - * - * Return: Tuner - */ - _verifyASuitableTunerAvailable: function(idType) { - var config = oipfObjectFactory.createConfigurationObject(); - var availableTuners = config.localSystem.tuners; - - for (var i = 0; i < availableTuners.length; i++) { - var tunerIdTypes = availableTuners[i].idTypes; - for (var j = 0; j < tunerIdTypes.length; j++) { - var tuner = availableTuners[i]; - if (tunerIdTypes[j] == idType) { - return tuner; - } - } - } - - if (idType == 40 || idType == 41) { - this.onChannelChangeError && this.onChannelChangeError(null, 8); - } else { - //this.onChannelChangeError && this.onChannelChangeError(null, 2); - this.onChannelChangeError && this.onChannelChangeError(null, 0); - } - return null; } - }); \ No newline at end of file
participants (1)
-
ygregoï¼ users.nuiton.org