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); }