コード例 #1
0
        }//Scanner

        #endregion private

        #region creator

        private Channel(ComunicationNet.ChannelsRow myCDsc, CommServerComponent parent, bool demoVersion, ISettingsBase settings)
            : base(false, "ChannelSegTOL_" + myCDsc.Name)
        {
            CommServerComponent.Tracer.TraceVerbose(150, m_src, "Creating channel: " + myCDsc.Name);
            Multichannel.NextChannnel();
            myStatistics = new Statistics.ChannelStatistics(myCDsc);
            PluginCollection m_Plugins = new PluginCollection(parent.m_CommonBusControl);

            foreach (ComunicationNet.ProtocolRow proto in myCDsc.GetProtocolRows())
            {
                IApplicationLayerMaster chnProtocol = CreateApplicationProtocol(proto, parent, m_Plugins, settings);
                if (chnProtocol != null)
                {
                    foreach (ComunicationNet.SegmentsRow currDSC in proto.GetSegmentsRows())
                    {
                        SegmentParameters  parameters       = new SegmentParameters(currDSC);
                        Diagnostic.Segment segmentStatistic = new Diagnostic.Segment(currDSC, myStatistics);
                        Segment            segment          = new Segment
                                                                  (currDSC, (byte)proto.MaxNumberOfRetries, chnProtocol, parameters, demoVersion, segmentStatistic, this)
                        {
                            Cycle = parameters.TimeReconnect
                        };
                        segment.ResetCounter();
                    }
                }
                else
                {
                    string name = proto != null ? proto.Name : "---not set---";
                    CommServerComponent.Tracer.TraceWarning(199, m_src, "Cannot find component implementing the required protocol: " + name);
                }
            } //foreach (NetworkConfig.ComunicationNet.ProtocolRow proto in myCDsc.GetProtocolRows)
            CommServerComponent.Tracer.TraceVerbose(203, m_src, "Channel: " + myCDsc.Name + " has been created.");
        }     //Channel