Exemplo n.º 1
0
        /// <summary>
        /// Create an instance of a DSMCC message.
        /// </summary>
        /// <param name="dsmccHeader">The header of the message.</param>
        /// <param name="byteData">The MPEG2 data block that contains the message.</param>
        /// <returns>An instance of the appropriate DSMCC message class.</returns>
        public static DSMCCMessage CreateInstance(DSMCCHeader dsmccHeader, byte[] byteData)
        {
            DSMCCMessage dsmccMessage;

            switch (dsmccHeader.MessageID)
            {
            case DSMCCDownloadDataBlock.MessageIDDownloadDataBlock:
                dsmccMessage = new DSMCCDownloadDataBlock(dsmccHeader);
                break;

            case DSMCCDownloadInfoIndication.MessageIDDownloadInfoIndication:
                dsmccMessage = new DSMCCDownloadInfoIndication(dsmccHeader);
                break;

            case DSMCCDownloadServerInitiate.MessageIDDownloadServerInitiate:
                dsmccMessage = new DSMCCDownloadServerInitiate(dsmccHeader);
                break;

            case DSMCCDownloadCancel.MessageIDDownloadCancel:
                dsmccMessage = new DSMCCDownloadCancel(dsmccHeader);
                break;

            default:
                throw (new ArgumentException("The DSMCC message ID is out of range"));
            }

            dsmccMessage.Process(byteData, dsmccHeader.Index);

            return(dsmccMessage);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create an instance of a DSMCC message.
        /// </summary>
        /// <param name="dsmccHeader">The header of the message.</param>
        /// <param name="byteData">The MPEG2 data block that contains the message.</param>
        /// <returns>An instance of the appropriate DSMCC message class.</returns>
        public static DSMCCMessage CreateInstance(DSMCCHeader dsmccHeader, byte[] byteData)
        {
            DSMCCMessage dsmccMessage;

            switch (dsmccHeader.MessageID)
            {
                case DSMCCDownloadDataBlock.MessageIDDownloadDataBlock:
                    dsmccMessage = new DSMCCDownloadDataBlock(dsmccHeader);
                    break;
                case DSMCCDownloadInfoIndication.MessageIDDownloadInfoIndication:
                    dsmccMessage = new DSMCCDownloadInfoIndication(dsmccHeader);
                    break;
                case DSMCCDownloadServerInitiate.MessageIDDownloadServerInitiate:
                    dsmccMessage = new DSMCCDownloadServerInitiate(dsmccHeader);
                    break;
                case DSMCCDownloadCancel.MessageIDDownloadCancel:
                    dsmccMessage = new DSMCCDownloadCancel(dsmccHeader);
                    break;
                default:
                    throw (new ArgumentException("The DSMCC message ID is out of range"));
            }

            dsmccMessage.Process(byteData, dsmccHeader.Index);

            return (dsmccMessage);
        }