Пример #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);
        }
Пример #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);
        }
Пример #3
0
 private void addModules(DSMCCDownloadInfoIndication diiMessage)
 {
     foreach (DSMCCDownloadInfoIndicationModule module in diiMessage.ModuleList)
         checkAddModule(module);
 }
Пример #4
0
        private bool addDIIMessage(DSMCCDownloadInfoIndication newMessage)
        {
            foreach (DSMCCDownloadInfoIndication oldMessage in diiMessages)
            {
                if (oldMessage.DownloadID == newMessage.DownloadID)
                {
                    if (oldMessage.DSMCCHeader.TransactionID.Identification == newMessage.DSMCCHeader.TransactionID.Identification)
                    {
                        if (oldMessage.DSMCCHeader.TransactionID.Version == newMessage.DSMCCHeader.TransactionID.Version)
                            return (false);
                        else
                        {
                            if (Logger.ProtocolLogger != null)
                                Logger.ProtocolLogger.Write("DII Message version change (" +
                                    oldMessage.DSMCCHeader.TransactionID.Version + " -> " +
                                    newMessage.DSMCCHeader.TransactionID.Version + ") - removing modules");
                            diiMessages.Remove(oldMessage);
                            removeModules(oldMessage);
                            diiMessages.Add(newMessage);
                            newMessage.LogMessage();
                            addModules(newMessage);
                            return (true);
                        }
                    }
                    else
                    {
                        diiMessages.Add(newMessage);
                        newMessage.LogMessage();
                        addModules(newMessage);
                        return (true);
                    }
                }
            }

            diiMessages.Add(newMessage);
            newMessage.LogMessage();
            addModules(newMessage);

            return (true);
        }