/// <summary>
        /// 实时监测回调
        /// </summary>
        /// <param name="segData"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        private int RealTimeMonitorCallBack(ref AgilentDll.Sensor.SegmentData segData, IntPtr data)
        {
            if (segData.errorNum != AgilentDll.Sensor.SalError.SAL_ERR_NONE)
            {
                return(-1);
            }
            if (segData.startFrequency <= RoadTestInfor.StartFreq * 1000000.0)
            {
                FreqMeasureId++;
                FreqMeasurePakageId = 0;
            }
            FreqMeasurePakageId++;
            FreqDataIndex++;

            if (FreqMeasurePakageId == 1)
            {
                if (CurrentFreqFrameItem != null)
                {
                    lock (FreqFrameItemQueue)
                    {
                        FreqFrameItemQueue.Enqueue(CurrentFreqFrameItem);
                        Monitor.Pulse(FreqFrameItemQueue);
                    }
                }
                TimeSpan ts = System.DateTime.Now.Subtract(beforDT);
                CurrentFreqFrameItem = new FreqFrameItem(FreqMeasureId, ts);
            }

            FreqDataTemplate FreqData = new FreqDataTemplate();

            //FreqData.MapNewTableName(RoadTestInfor.FreqDataTable);
            FreqData.FreqCount           = Convert.ToInt32(segData.numPoints);
            FreqData.AltitudeValue       = CarRunInfor.AltitudeValue;
            FreqData.LatitudeValue       = CarRunInfor.LatitudeValue;
            FreqData.LongitudeValue      = CarRunInfor.LongitudeValue;
            FreqData.SatelliteCount      = CarRunInfor.SatelliteCount;
            FreqData.CarSpeed            = CarRunInfor.CarSpeed;
            FreqData.DataIndex           = FreqDataIndex;
            FreqData.FreqMeasurePakageId = FreqMeasurePakageId;
            FreqData.MeasureId           = FreqMeasureId;
            FreqData.MeasureTime         = DateTime.Now;
            FreqData.StartFreq           = segData.startFrequency;
            FreqData.StepValue           = segData.frequencyStep;
            FreqData.segData             = segData;
            FreqData.volList             = new float[segData.numPoints];
            System.Runtime.InteropServices.Marshal.Copy(data, FreqData.volList, 0, Convert.ToInt32(segData.numPoints));

            CurrentFreqFrameItem.FreqDataItemList.Add(FreqData);


            FreqLineDataItem FreqShowData = new FreqLineDataItem();

            FreqShowData.byteArray = new float[segData.numPoints];
            System.Runtime.InteropServices.Marshal.Copy(data, FreqShowData.byteArray, 0, Convert.ToInt32(segData.numPoints));
            FreqShowData.FreqMeasureId       = FreqMeasureId;
            FreqShowData.FreqMeasurePakageId = FreqMeasurePakageId;
            FreqShowData.frequencyStep       = segData.frequencyStep;
            FreqShowData.startFrequency      = segData.startFrequency;
            FreqShowData.TestFreqStart       = RoadTestInfor.StartFreq;
            FreqShowData.TestFreqEnd         = RoadTestInfor.EndFreq;
            FreqShowData.DataIndex           = FreqDataIndex;

            _LineChartViewModel.InsertShowData(FreqShowData);

            if (!segDataDic.ContainsKey(FreqMeasurePakageId))
            {
                segDataDic.Add(FreqMeasurePakageId, FreqShowData.byteArray);
            }
            if (FreqShowDataGrid == null || FreqShowDataGrid.byteArray.Length <= FreqShowData.byteArray.Length)
            {
                FreqShowDataGrid = FreqShowData;
            }


            //ObservableCollection<AnalysisResult> tempList = new ObservableCollection<AnalysisResult>();
            //double startFreq = FreqShowData.startFrequency;
            //for (int i = 0; i < FreqShowData.byteArray.Length; i++)
            //{
            //    if (FreqShowData.byteArray[i] + 107 >= Convert.ToDouble(RoadTestInfor.SignalLimit))
            //    {
            //        AnalysisResult analysisResult = new AnalysisResult();

            //        analysisResult.Frequency = startFreq;
            //        analysisResult.BandWidth = RoadTestInfor.Bandwidth;
            //        analysisResult.AmplitudeMaxValue = Convert.ToInt32(FreqShowData.byteArray[i])+107;
            //        tempList.Add(analysisResult);
            //    }
            //    else {
            //        startFreq += Convert.ToDouble(RoadTestInfor.Bandwidth);
            //    }
            //}
            //RoadTestInfor.AnalysisList = tempList;
            //DateTime now = DateTime.Now;
            //if (collectTime.AddMilliseconds(1000 * 60 * 15).Hour == now.Hour && collectTime.AddMilliseconds(1000 * 60 * 15).Minute == now.Minute && collectTime.AddMilliseconds(1000 * 60 * 15).Second == now.Second)
            //{
            //    _CollectionDataSave.saveSqliteIndex(FreqShowData);
            //    collectTime = now;
            //}
            //if (IsRecordFreqCount)
            //{
            //    if (FreqCount != 0 && RoadTestInfor.StartFreq * 1000000 == FreqShowData.startFrequency)
            //    {
            //        _CollectionDataSave.saveFreqCount(FreqCount);
            //        IsRecordFreqCount = false;
            //    }
            //    else
            //    {
            //        FreqCount += FreqShowData.byteArray.Length;
            //    }
            //}
            //_CollectionDataSave.saveFreqData(FreqShowData.byteArray, FreqShowData);

            //UpdateRtFreqDataModel(segData);


            return(0);
        }
        private int CallBack(ref AgilentDll.Sensor.SegmentData segData, IntPtr data)
        {
            if (segData.errorNum != AgilentDll.Sensor.SalError.SAL_ERR_NONE)
            {
                return(-1);
            }
            if (segData.startFrequency <= RoadTestInfor.StartFreq * 1000000.0)
            {
                FreqMeasureId++;
                FreqMeasurePakageId = 0;
            }
            FreqMeasurePakageId++;
            FreqDataIndex++;

            if (FreqMeasurePakageId == 1)
            {
                if (CurrentFreqFrameItem != null)
                {
                    lock (FreqFrameItemQueue)
                    {
                        FreqFrameItemQueue.Enqueue(CurrentFreqFrameItem);
                        Monitor.Pulse(FreqFrameItemQueue);
                    }
                }
                TimeSpan ts = System.DateTime.Now.Subtract(beforDT);
                CurrentFreqFrameItem = new FreqFrameItem(FreqMeasureId, ts);
            }

            FreqDataTemplate FreqData = new FreqDataTemplate();

            //FreqData.MapNewTableName(RoadTestInfor.FreqDataTable);
            FreqData.FreqCount           = Convert.ToInt32(segData.numPoints);
            FreqData.AltitudeValue       = CarRunInfor.AltitudeValue;
            FreqData.LatitudeValue       = CarRunInfor.LatitudeValue;
            FreqData.LongitudeValue      = CarRunInfor.LongitudeValue;
            FreqData.SatelliteCount      = CarRunInfor.SatelliteCount;
            FreqData.CarSpeed            = CarRunInfor.CarSpeed;
            FreqData.DataIndex           = FreqDataIndex;
            FreqData.FreqMeasurePakageId = FreqMeasurePakageId;
            FreqData.MeasureId           = FreqMeasureId;
            FreqData.MeasureTime         = DateTime.Now;
            FreqData.StartFreq           = segData.startFrequency;
            FreqData.StepValue           = segData.frequencyStep;
            FreqData.segData             = segData;
            FreqData.volList             = new float[segData.numPoints];
            System.Runtime.InteropServices.Marshal.Copy(data, FreqData.volList, 0, Convert.ToInt32(segData.numPoints));

            CurrentFreqFrameItem.FreqDataItemList.Add(FreqData);


            FreqLineDataItem FreqShowData = new FreqLineDataItem();

            FreqShowData.byteArray = new float[segData.numPoints];
            System.Runtime.InteropServices.Marshal.Copy(data, FreqShowData.byteArray, 0, Convert.ToInt32(segData.numPoints));
            FreqShowData.FreqMeasureId       = FreqMeasureId;
            FreqShowData.FreqMeasurePakageId = FreqMeasurePakageId;
            FreqShowData.frequencyStep       = segData.frequencyStep;
            FreqShowData.startFrequency      = segData.startFrequency;
            FreqShowData.TestFreqStart       = RoadTestInfor.StartFreq;
            FreqShowData.TestFreqEnd         = RoadTestInfor.EndFreq;
            FreqShowData.DataIndex           = FreqDataIndex;


            _LineChartViewModel.InsertShowData(FreqShowData);

            DateTime now = DateTime.Now;

            if (collectTime.AddMilliseconds(1000 * 60 * 15).Hour == now.Hour && collectTime.AddMilliseconds(1000 * 60 * 15).Minute == now.Minute && collectTime.AddMilliseconds(1000 * 60 * 15).Second == now.Second)
            {
                _CollectionDataSave.saveSqliteIndex(FreqShowData);
                collectTime = now;
            }
            if (IsRecordFreqCount)
            {
                if (FreqCount != 0 && RoadTestInfor.StartFreq * 1000000 == FreqShowData.startFrequency)
                {
                    _CollectionDataSave.saveFreqCount(FreqCount);
                    IsRecordFreqCount = false;
                }
                else
                {
                    FreqCount += FreqShowData.byteArray.Length;
                }
            }
            _CollectionDataSave.saveFreqData(FreqShowData.byteArray, FreqShowData);

            //UpdateRtFreqDataModel(segData);


            return(0);
        }