public SignalChannel(RecordFile recordFile, AutoResetEvent autoEvent, byte[] data, int offset) { this.recordFile = recordFile; this.eventDSP = autoEvent; this.DecodeCurve = 0; this.DecodeFM = false; this.DecodeAngle = false; UInt16 crc = CRC16.ComputeCRC16(data, offset, 124 - 2); UInt16 crcCal = BitConverter.ToUInt16(data, offset + 124 - 2); if (crc != crcCal) { return; } // this.ChannnelNum = data[0 + offset]; this.State = (byte)(data[1 + offset] >> 7); this.SampleRate = data[0 + offset] + ((data[1 + offset] & 0x1f) << 8); this.ChannelType = data[2 + offset]; //时间 int year = data[3 + offset] + 2000; int month = data[4 + offset]; int day = data[5 + offset]; this.Time = new DateTime(year, month, day); //名字 int num = data[6 + offset]; if (num > 0) { num = num > 8 ? 8 : num; this.Person = ASCIIEncoding.UTF8.GetString(data, 7 + offset, num); } else { this.Person = ""; } for (int i = 0; i < 21; i++) { CalcItem calItm = new CalcItem(data, 15 + i * 5 + offset); if (calItm.IsValid) { calList.Add(calItm); } } this.TimeInterval = 40; //默认是40毫秒计算一个点 }
public SignalChannel(RecordFile recordFile, AutoResetEvent autoEvent, byte[] data, int offset) { this.recordFile = recordFile; this.eventDSP = autoEvent; this.DecodeCurve = 0; this.DecodeFM = false; this.DecodeAngle = false; UInt16 crc = CRC16.ComputeCRC16(data, offset, 124 - 2); UInt16 crcCal = BitConverter.ToUInt16(data, offset + 124 - 2); if (crc != crcCal) return; // this.ChannnelNum = data[0 + offset]; this.State = (byte)(data[1 + offset] >> 7); this.SampleRate = data[0 + offset] + ((data[1 + offset] & 0x1f) << 8); this.ChannelType = data[2 + offset]; //时间 int year = data[3 + offset] + 2000; int month = data[4 + offset]; int day = data[5 + offset]; this.Time = new DateTime(year, month, day); //名字 int num = data[6 + offset]; if (num > 0) { num = num > 8 ? 8 : num; this.Person = ASCIIEncoding.UTF8.GetString(data, 7 + offset, num); } else { this.Person = ""; } for (int i = 0; i < 21; i++) { CalcItem calItm = new CalcItem(data, 15 + i * 5 + offset); if (calItm.IsValid) { calList.Add(calItm); } } this.TimeInterval = 40; //默认是40毫秒计算一个点 }
public void ReplaceCalcItem(int m, CalcItem itm) { calList[m] = itm; }
public void AddCalcItem(CalcItem itm) { calList.Add(itm); }