Author: ygrego Date: 2015-03-30 15:41:58 +0000 (Mon, 30 Mar 2015) New Revision: 984 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/984 Log: Addition of namespace for all methods and deletion of exception firing in method "verifyASuitableTunerIsAvailable". Modified: oipf/js/utils/ChannelUtils.js Modified: oipf/js/utils/ChannelUtils.js =================================================================== --- oipf/js/utils/ChannelUtils.js 2015-03-30 15:40:32 UTC (rev 983) +++ oipf/js/utils/ChannelUtils.js 2015-03-30 15:41:58 UTC (rev 984) @@ -1,4 +1,6 @@ -function findChannel(channelCollection, channel, step) { +var channelUtils = {}; + +channelUtils.findChannel = function(channelCollection, channel, step) { for (var i = 0, l = channelCollection.length; i < l; i++ ) { if (channelCollection[i] == channel) { @@ -20,11 +22,11 @@ } } return null; -} +}; -function isAValidDVBTChannel(channel) { +channelUtils.isAValidDVBTChannel = function (channel) { return (channel.onid) && (channel.tsid) && (channel.sid); -} +}; /* * Description: @@ -41,7 +43,7 @@ * * Return: Tuner */ -function verifyASuitableTunerAvailable(idType, object) { +channelUtils.verifyASuitableTunerAvailable = function(idType, object) { var config = oipfObjectFactory.createConfigurationObject(); var availableTuners = config.localSystem.tuners; @@ -55,24 +57,16 @@ } } - if (idType == 40 || idType == 41) { - timeout(0) - .then(object.fireEvent.bind(object, createCustomEvent("ChannelChangeError", [null, 8]))); - } else { - //this.onChannelChangeError && this.onChannelChangeError(null, 2); - timeout(0) - .then(object.fireEvent.bind(object, createCustomEvent("ChannelChangeError", [null, 0]))); - } return null; -} +}; -function getChannelByDsd(channelCollection, dsd) { +channelUtils.getChannelByDsd = function(channelCollection, dsd) { for (var i = 0, l = channelCollection.length; i < l; i++) { if (channelCollection[i].dsd == dsd) { return channelCollection[i]; } } -} +}; /* * Description: @@ -84,7 +78,7 @@ * - dsd: the delivery system descriptor string necessary to create a channel by intermediate of method * createChannelObject. */ -function isAValidTerrestrialDsd(dsd) { +channelUtils.isAValidTerrestrialDsd = function(dsd) { var dsdAttributes = dsd.split(","); if (TERRESTIAL_DELIVERY_SYSTEM_DESCRIPTOR.length == dsdAttributes.length) { @@ -98,12 +92,12 @@ return true; } -} +}; -function getChannelByIpBroadcastID(channelCollection, ipBroadcastID) { +channelUtils.getChannelByIpBroadcastID = function(channelCollection, ipBroadcastID) { for (var i = 0, l = channelCollection.length; i < l; i++) { if (channelCollection[i].ipBroadcastID == ipBroadcastID) { return channelCollection[i]; } } -} +};
participants (1)
-
ygregoï¼ users.nuiton.org