Author: ygrego Date: 2015-03-10 17:11:19 +0000 (Tue, 10 Mar 2015) New Revision: 926 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/926 Log: During the creation of channel by the video/broadcast object, it's necessary to validate the delivery system descriptor(refer to specification "DVB:Specification for service information in DVB system"). That's performed by the method "isAValidTerrestrialDsd". Modified: oipf/js/utils/ChannelTools.js Modified: oipf/js/utils/ChannelTools.js =================================================================== --- oipf/js/utils/ChannelTools.js 2015-03-10 17:05:27 UTC (rev 925) +++ oipf/js/utils/ChannelTools.js 2015-03-10 17:11:19 UTC (rev 926) @@ -80,6 +80,33 @@ return channelCollection[i]; } } + }, + + /* + * Description: + * This method verify the validity of the terrestrial delivery system descriptor. + * The argument will be compare to the dsd array byte defined either in + * the transport stream or directly in the terminal. + * + * Arguments + * - dsd: the delivery system descriptor string necessary to create a channel by intermediate of method + * createChannelObject. + */ + isAValidTerrestrialDsd: function(dsd) { + var dsdAttributes = dsd.split(","); + + if (TERRESTIAL_DELIVERY_SYSTEM_DESCRIPTOR.length == dsdAttributes.length) { + + for (var i = 0, l = TERRESTIAL_DELIVERY_SYSTEM_DESCRIPTOR.length; i < l; i++) { + + if (!(TERRESTIAL_DELIVERY_SYSTEM_DESCRIPTOR[i] == dsdAttributes[i])) { + return false; + } + } + + return true; + } } + });