Example #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);
        }
Example #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);
        }
Example #3
0
        private void processControlSection(Mpeg2Section section)
        {
            Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();

            try
            {
                mpeg2Header.Process(section.Data);
                if (mpeg2Header.Current)
                {
                    DSMCCSection dsmccSection = new DSMCCSection();
                    dsmccSection.Process(section.Data, mpeg2Header);

                    if (dsmccSection.DSMCCMessage as DSMCCDownloadServerInitiate != null)
                        addDSIMessage(dsmccSection.DSMCCMessage as DSMCCDownloadServerInitiate);
                    else
                    {
                        if (dsmccSection.DSMCCMessage as DSMCCDownloadInfoIndication != null)
                            addDIIMessage(dsmccSection.DSMCCMessage as DSMCCDownloadInfoIndication);
                        else
                        {
                            if (dsmccSection.DSMCCMessage as DSMCCDownloadCancel != null)
                            {
                                Logger.Instance.Write("DSMCC Cancel message received: reloading all data");
                                dsiMessage = null;
                                diiMessages = null;
                                modules = null;
                            }
                        }
                    }
                }
            }
            catch (ArgumentOutOfRangeException e)
            {
                Logger.Instance.Write("<e> Error processing DSMCC control message: " + e.Message);
            }
        }
Example #4
0
        private bool addDSIMessage(DSMCCDownloadServerInitiate newMessage)
        {
            if (dsiMessage == null)
            {
                dsiMessage = newMessage;
                dsiMessage.LogMessage();
                return (true); ;
            }

            if (dsiMessage.DSMCCHeader.TransactionID.Identification == newMessage.DSMCCHeader.TransactionID.Identification)
            {
                if (dsiMessage.DSMCCHeader.TransactionID.Version == newMessage.DSMCCHeader.TransactionID.Version)
                    return (false);
                else
                {
                    dsiMessage = newMessage;
                    dsiMessage.LogMessage();
                }
            }
            else
            {
                dsiMessage = newMessage;
                dsiMessage.LogMessage();
            }

            return (true);
        }