Author: ygrego Date: 2015-03-02 09:15:50 +0000 (Mon, 02 Mar 2015) New Revision: 899 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/899 Log: New method "isAValidChannelDVBTChannel" and "verifyASuitableTunerAvailable". Modified: oipf/js/utils/ChannelTools.js Modified: oipf/js/utils/ChannelTools.js =================================================================== --- oipf/js/utils/ChannelTools.js 2015-03-02 09:07:53 UTC (rev 898) +++ oipf/js/utils/ChannelTools.js 2015-03-02 09:15:50 UTC (rev 899) @@ -13,7 +13,46 @@ } } return null; + }, + isAValidDVBTChannel: function(channel) { + return (channel.onid) && (channel.tsid) && (channel.sid); + }, + /* + * 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, object) { + 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) { + object.onChannelChangeError && object.onChannelChangeError(null, 8); + } else { + //this.onChannelChangeError && this.onChannelChangeError(null, 2); + object.onChannelChangeError && object.onChannelChangeError(null, 0); + } + return null; } - });
participants (1)
-
ygregoï¼ users.nuiton.org