protected void UpdateInterrupt(MonitorFrame frame)
        {
            if (frame.data_type != MonitorDataType.MDT_INTRRUPT_BEGIN)
            {
                return;
            }
            /*丢帧*/
            if (frame.frame_sn - interrupt_last_sn != 1)
            {
                interrupt_last_sn   = frame.frame_sn;
                interrupt_last_time = 0;
            }
            UInt32 this_time = frame.time_stamp;

            if (interrupt_last_time == 0)
            {
                interrupt_last_time = this_time;
                return;
            }
            UInt32 time_interval = this_time - interrupt_last_time;

            if (interrupt_count++ > 3)
            {
                UpdatePointsData1(InterruptDataPoints, interrupt_count, (time_interval * 1.0) / 1000);
            }

            interrupt_last_time = this_time;

            return;
        }
        protected void UpdateCiCycle(MonitorFrame frame)
        {
            switch (frame.data_type)
            {
            case MonitorDataType.MDT_CI_CYCLE_BEGIN:
                ci_cycle_start_time = frame.time_stamp;
                ci_cycle_last_sn    = frame.frame_sn;
                break;

            case MonitorDataType.MDT_CI_CYCLE_END:
                if (ci_cycle_start_time == 0)
                {
                    break;
                }
                /*丢帧*/
                if (frame.frame_sn - ci_cycle_last_sn != 1)
                {
                    ci_cycle_start_time = 0;
                    /*丢弃本次统计*/
                    break;
                }
                UInt32 end_time      = frame.time_stamp;
                UInt32 time_interval = end_time - ci_cycle_start_time;
                if (ci_cycle_count++ > 3)
                {
                }
                UpdatePointsData2(CiCycleDataPoints, ci_cycle_count, (time_interval * 1.0) / 1000);

                break;

            default:
                break;
            }
            return;
        }
        protected void UpdateCpuHeartBeatRecv(MonitorFrame frame)
        {
            switch (frame.data_type)
            {
            case MonitorDataType.MDT_CPU_HEART_BEAT_R_BEGIN:
                cpu_heart_beat_recv_start_time = frame.time_stamp;
                cpu_heart_beat_recv_last_sn    = frame.frame_sn;

                break;

            case MonitorDataType.MDT_CPU_HEART_BEAT_R_END:
                if (cpu_heart_beat_recv_start_time == 0)
                {
                    break;
                }
                /*丢帧*/
                if (frame.frame_sn - cpu_heart_beat_recv_last_sn != 1)
                {
                    cpu_heart_beat_recv_start_time = 0;
                    /*丢弃本次统计*/
                    break;
                }
                UInt32 end_time      = frame.time_stamp;
                UInt32 time_interval = end_time - cpu_heart_beat_recv_start_time;
                if (cpu_heart_beat_recv_count++ > 3)
                {
                }
                UpdatePointsData2(CpuHeartBeatRecvDataPoints, cpu_heart_beat_recv_count, (time_interval * 1.0) / 1000);
                break;

            default:
                break;
            }
            return;
        }
        protected override void UpdateSeriesResultSend(MonitorFrame frame)
        {
            switch (frame.data_type)
            {
            case MonitorDataType.MDT_SERIES_RESULT_T_BEGIN:
                series_result_send_start_time = frame.time_stamp;
                series_result_send_last_sn    = frame.frame_sn;
                break;

            case MonitorDataType.MDT_SERIES_RESULT_T_END:
                if (series_result_send_start_time == 0)
                {
                    break;
                }
                /*丢帧*/
                if (frame.frame_sn - series_result_send_last_sn != 1)
                {
                    series_result_send_start_time = 0;
                    /*丢弃本次统计*/
                    break;
                }
                UInt32 end_time      = frame.time_stamp;
                UInt32 time_interval = end_time - series_result_send_start_time;
                if (series_result_send_count++ > 3)
                {
                    UpdatePointsData2(SeriesResultSendDataPoints, series_result_send_count, (time_interval * 1.0) / 1000);
                }

                break;

            default:
                break;
            }
            return;
        }
        protected void UpdateCpuResultSend(MonitorFrame frame)
        {
            switch (frame.data_type)
            {
            case MonitorDataType.MDT_CPU_RESULT_T_BEGIN:
                cpu_result_send_start_time = frame.time_stamp;
                cpu_result_send_last_sn    = frame.frame_sn;
                break;

            case MonitorDataType.MDT_CPU_RESULT_T_END:
                if (cpu_result_send_start_time == 0)
                {
                    break;
                }
                /*丢帧*/
                if (frame.frame_sn - cpu_result_send_last_sn != 1)
                {
                    cpu_result_send_start_time = 0;
                    /*丢弃本次统计*/
                    break;
                }
                UInt32 end_time      = frame.time_stamp;
                UInt32 time_interval = end_time - cpu_result_send_start_time;
                if (cpu_result_send_count++ > 3)
                {
                    UpdatePointsData2(CpuResultSendDataPoints, cpu_result_send_count, (time_interval * 1.0) / 1000);
                }
                break;

            default:
                break;
            }
            return;
        }
        protected override void UpdateSeriesHeartBeatRecv(MonitorFrame frame)
        {
            switch (frame.data_type)
            {
            case MonitorDataType.MDT_SERIES_HEART_BEAT_R_BEGIN:
                series_heart_beat_recv_start_time = frame.time_stamp;
                series_heart_beat_recv_last_sn    = frame.frame_sn;
                break;

            case MonitorDataType.MDT_SERIES_HEART_BEAT_R_END:
                if (series_heart_beat_recv_start_time == 0)
                {
                    break;
                }
                /*丢帧*/
                if (frame.frame_sn - series_heart_beat_recv_last_sn != 1)
                {
                    series_heart_beat_recv_start_time = 0;
                    /*丢弃本次统计*/
                    break;
                }
                UInt32 end_time      = frame.time_stamp;
                UInt32 time_interval = end_time - series_heart_beat_recv_start_time;
                if (series_heart_beat_recv_count++ > 3)
                {
                    UpdatePointsData2(SeriesHeartBeatRecvDataPoints, series_heart_beat_recv_count, (time_interval * 1.0) / 1000);
                }
                break;

            default:
                break;
            }
            return;
        }
        protected override void UpdateAxisYMin(MonitorFrame frame)
        {
            double m = 0;

            switch (frame.data_type)
            {
            case MonitorDataType.MDT_INTRRUPT_BEGIN:
                m = DataPointsCollectionMin(InterruptDataPoints);
                Interrupt.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_CI_CYCLE_BEGIN:
            case MonitorDataType.MDT_CI_CYCLE_END:
                m = DataPointsCollectionMin(CiCycleDataPoints);
                //CiCycle.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_EEU_R_BEGIN:
            case MonitorDataType.MDT_EEU_R_END:
                m = DataPointsCollectionMin(EeuRecvDataPoints);
                //EeuRecv.AxisYMininum = m;
                break;
            }
            return;
        }
        protected override void UpdateAxisYMin(MonitorFrame frame)
        {
            double m = 0;

            switch (frame.data_type)
            {
            case MonitorDataType.MDT_INTRRUPT_BEGIN:
                m = DataPointsCollectionMin(InterruptDataPoints);
                Interrupt.AxisYMininum = m;
                break;

            /*series*/
            case MonitorDataType.MDT_SERIES_NEW_CYCLE_T_BEGIN:
            case MonitorDataType.MDT_SERIES_NEW_CYCLE_T_END:
                m = DataPointsCollectionMin(SeriesNewCycleSendDataPoints);
                //SeriesNewCycle.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_SERIES_INPUT_T_BEGIN:
            case MonitorDataType.MDT_SERIES_INPUT_T_END:
                m = DataPointsCollectionMin(SeriesInputSendDataPoints);
                //SeriesInput.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_SERIES_RESULT_T_BEGIN:
            case MonitorDataType.MDT_SERIES_RESULT_T_END:
                m = DataPointsCollectionMin(SeriesResultSendDataPoints);
                //SeriesResult.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_SERIES_HEART_BEAT_T_BEGIN:
            case MonitorDataType.MDT_SERIES_HEART_BEAT_T_END:
                m = DataPointsCollectionMin(SeriesHeartBeatSendDataPoints);
                //SeriesHeartBeat.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_CI_CYCLE_BEGIN:
            case MonitorDataType.MDT_CI_CYCLE_END:
                m = DataPointsCollectionMin(CiCycleDataPoints);
                //CiCycle.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_EEU_T_BEGIN:
            case MonitorDataType.MDT_EEU_T_END:
                m = DataPointsCollectionMin(EeuSendDataPoints);
                //EeuSend.AxisYMininum = m;
                break;

            case MonitorDataType.MDT_EEU_R_BEGIN:
            case MonitorDataType.MDT_EEU_R_END:
                m = DataPointsCollectionMin(EeuRecvDataPoints);
                //EeuRecv.AxisYMininum = m;
                break;
            }
            return;
        }
        protected override void UpdateEeuRecv(MonitorFrame frame)
        {
            switch (frame.data_type)
            {
            case MonitorDataType.MDT_EEU_R_BEGIN:
                eeu_recv_start_time = frame.time_stamp;
                eeu_recv_last_sn    = frame.frame_sn;
                break;

            case MonitorDataType.MDT_EEU_R_END:
                if (eeu_recv_start_time == 0)
                {
                    break;
                }
                /*丢帧*/
                if (frame.frame_sn - eeu_recv_last_sn != 1)
                {
                    eeu_recv_start_time = 0;
                    /*丢弃本次统计*/
                    break;
                }

                UInt32 end_time      = frame.time_stamp;
                UInt32 time_interval = end_time - eeu_recv_start_time;
                if (eeu_recv_count++ > 3)
                {
                    UpdatePointsData2(EeuRecvDataPoints, eeu_recv_count, (time_interval * 1.0) / 1000);
                }

                break;

            default:
                break;
            }
            return;
        }
        /// <summary>
        /// 接收数据并将数据分发下去
        /// </summary>
        public void RecvAndDispatch()
        {
            IPEndPoint ipEndPoint = new IPEndPoint(new IPAddress(0), 0);

            byte[] data;

            try
            {
                if (this.Available == 0)
                {
                    Thread.Sleep(1);
                    return;
                }

                data = this.Receive(ref ipEndPoint);
            }
            catch (Exception)
            {
                return;
            }
            for (int i = 0; i < data.Length / MonitorFrame.frame_len; i++)
            {
                byte[] one_frame = new byte[MonitorFrame.frame_len];
                for (int j = 0; j < MonitorFrame.frame_len; j++)
                {
                    /*parse this frame*/
                    one_frame[j] = data[i * MonitorFrame.frame_len + j];
                }
                MonitorFrame frame = new MonitorFrame(one_frame);

                if (frame.Check() == false)
                {
                    continue;
                }
                try
                {
                    if (frame.series_state == SeriesState.SERIES_PRIMARY)
                    {
                        if (frame.cpu_state == CpuState.CPU_STATE_PRIMARY && context.active_tab == 0)
                        {
                            PrimarySeriesPrimaryCpu chart = (PrimarySeriesPrimaryCpu)context.Shower.Children[0];
                            chart.Update(frame);
                            context.TabPrimarySeriesPrimaryCpu.Header = "主系主CPU" + ipEndPoint.Address.ToString();
                        }
                        else if (frame.cpu_state == CpuState.CPU_STATE_SLAVE && context.active_tab == 1)
                        {
                            PrimarySeriesSlaveCpu chart = (PrimarySeriesSlaveCpu)context.Shower.Children[0];
                            chart.Update(frame);
                            context.TabPrimarySeriesSlaveCpu.Header = "主系从CPU" + ipEndPoint.Address.ToString();
                        }
                        else
                        {
                            /*some thing be wrong*/
                            continue;
                        }
                    }
                    else if (frame.series_state == SeriesState.SERIES_SPARE)
                    {
                        if (frame.cpu_state == CpuState.CPU_STATE_PRIMARY && context.active_tab == 2)
                        {
                            SpareSeriesPrimaryCpu chart = (SpareSeriesPrimaryCpu)context.Shower.Children[0];
                            chart.Update(frame);
                            context.TabSpareSeriesPrimaryCpu.Header = "备系主CPU" + ipEndPoint.Address.ToString();
                        }
                        else if (frame.cpu_state == CpuState.CPU_STATE_SLAVE && context.active_tab == 3)
                        {
                            SpareSeriesSlaveCpu chart = (SpareSeriesSlaveCpu)context.Shower.Children[0];
                            chart.Update(frame);
                            context.TabSpareSeriesSlaveCpu.Header = "备系从CPU" + ipEndPoint.Address.ToString();
                        }
                        else
                        {
                            /*some thing be wrong*/
                            continue;
                        }
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }
            return;
        }
 protected virtual void UpdateEeuRecv(MonitorFrame frame)
 {
     return;
 }
 protected virtual void UpdateSeriesHeartBeatRecv(MonitorFrame frame)
 {
     return;
 }
 protected virtual void UpdateSeriesResultRecv(MonitorFrame frame)
 {
     return;
 }
 protected virtual void UpdateSeriesInputSend(MonitorFrame frame)
 {
     return;
 }
 protected virtual void UpdateSeriesNewCycleRecv(MonitorFrame frame)
 {
     return;
 }
 protected virtual void UpdateAxisYMin(MonitorFrame frame)
 {
     return;
 }
        protected void UpdatePoints(MonitorFrame frame)
        {
            switch (frame.data_type)
            {
            case MonitorDataType.MDT_INTRRUPT_BEGIN:
                UpdateInterrupt(frame);
                break;

            case MonitorDataType.MDT_CPU_NEW_CYCLE_T_BEGIN:
            case MonitorDataType.MDT_CPU_NEW_CYCLE_T_END:
                UpdateCpuNewCycleSend(frame);
                break;

            case MonitorDataType.MDT_CPU_NEW_CYCLE_R_BEGIN:
            case MonitorDataType.MDT_CPU_NEW_CYCLE_R_END:
                UpdateCpuNewCycleRecv(frame);
                break;

            case MonitorDataType.MDT_CPU_INPUT_T_BEGIN:
            case MonitorDataType.MDT_CPU_INPUT_T_END:
                UpdateCpuInputSend(frame);
                break;

            case MonitorDataType.MDT_CPU_INPUT_R_BEGIN:
            case MonitorDataType.MDT_CPU_INPUT_R_END:
                UpdateCpuInputRecv(frame);
                break;

            case MonitorDataType.MDT_CPU_RESULT_T_BEGIN:
            case MonitorDataType.MDT_CPU_RESULT_T_END:
                UpdateCpuResultSend(frame);
                break;

            case MonitorDataType.MDT_CPU_RESULT_R_BEGIN:
            case MonitorDataType.MDT_CPU_RESULT_R_END:
                UpdateCpuResultRecv(frame);
                break;

            case MonitorDataType.MDT_CPU_HEART_BEAT_T_BEGIN:
            case MonitorDataType.MDT_CPU_HEART_BEAT_T_END:
                UpdateCpuHeartBeatSend(frame);
                break;

            case MonitorDataType.MDT_CPU_HEART_BEAT_R_BEGIN:
            case MonitorDataType.MDT_CPU_HEART_BEAT_R_END:
                UpdateCpuHeartBeatRecv(frame);
                break;

            /*series*/
            case MonitorDataType.MDT_SERIES_NEW_CYCLE_T_BEGIN:
            case MonitorDataType.MDT_SERIES_NEW_CYCLE_T_END:
                UpdateSeriesNewCycleSend(frame);
                break;

            case MonitorDataType.MDT_SERIES_NEW_CYCLE_R_BEGIN:
            case MonitorDataType.MDT_SERIES_NEW_CYCLE_R_END:
                UpdateSeriesNewCycleRecv(frame);
                break;

            case MonitorDataType.MDT_SERIES_INPUT_T_BEGIN:
            case MonitorDataType.MDT_SERIES_INPUT_T_END:
                UpdateSeriesInputSend(frame);
                break;

            case MonitorDataType.MDT_SERIES_INPUT_R_BEGIN:
            case MonitorDataType.MDT_SERIES_INPUT_R_END:
                UpdateSeriesInputRecv(frame);
                break;

            case MonitorDataType.MDT_SERIES_RESULT_T_BEGIN:
            case MonitorDataType.MDT_SERIES_RESULT_T_END:
                UpdateSeriesResultSend(frame);
                break;

            case MonitorDataType.MDT_SERIES_RESULT_R_BEGIN:
            case MonitorDataType.MDT_SERIES_RESULT_R_END:
                UpdateSeriesResultRecv(frame);
                break;

            case MonitorDataType.MDT_SERIES_HEART_BEAT_T_BEGIN:
            case MonitorDataType.MDT_SERIES_HEART_BEAT_T_END:
                UpdateSeriesHeartBeatSend(frame);
                break;

            case MonitorDataType.MDT_SERIES_HEART_BEAT_R_BEGIN:
            case MonitorDataType.MDT_SERIES_HEART_BEAT_R_END:
                UpdateSeriesHeartBeatRecv(frame);
                break;

            case MonitorDataType.MDT_CI_CYCLE_BEGIN:
            case MonitorDataType.MDT_CI_CYCLE_END:
                UpdateCiCycle(frame);
                break;

            case MonitorDataType.MDT_EEU_T_BEGIN:
            case MonitorDataType.MDT_EEU_T_END:
                UpdateEeuSend(frame);
                break;

            case MonitorDataType.MDT_EEU_R_BEGIN:
            case MonitorDataType.MDT_EEU_R_END:
                UpdateEeuRecv(frame);
                break;
            }
            return;
        }
 public void Update(MonitorFrame frame)
 {
     UpdatePoints(frame);
     UpdateAxisYMin(frame);
 }