public bool Load(byte[] pBuffer) { UInt32 fhval = BitConverter.ToUInt32(pBuffer, 0); if (fhval != Fh) { throw new Exception("帧头格式错误!"); } int pos = Utile.SizeOf(Fh); Length = BitConverter.ToUInt16(pBuffer, pos); pos += Utile.SizeOf(Length); int timestampLen = Timestamp.GetLength(); byte[] timestampBuffer = new byte[timestampLen]; Buffer.BlockCopy(pBuffer, pos, timestampBuffer, 0, timestampLen); Timestamp.Load(timestampBuffer); pos += timestampLen; DataType = (RmtpDataTypes)pBuffer[pos]; pos += 1; ChannelId = BitConverter.ToInt32(pBuffer, pos); pos += 4; Tag = BitConverter.ToInt32(pBuffer, pos); return(true); }
public void Load(byte[] pBuffer) { WYear = BitConverter.ToInt16(pBuffer, 0); int pos = Utile.SizeOf(WYear); WMonth = pBuffer[pos]; pos += 1; WDay = pBuffer[pos]; pos += 1; WHour = pBuffer[pos]; pos += 1; WMinute = pBuffer[pos]; pos += 1; WSecond = pBuffer[pos]; pos += 1; WMilliseconds = BitConverter.ToInt16(pBuffer, pos); }
public int GetLength() { return(Utile.SizeOf(Fh) + Utile.SizeOf(Length) + Timestamp.GetLength() + 1 /*数据类型*/ + 4 /*设备通道号*/ + 4 /*标签(测量序号)*/); }
public int GetLength() { return(Utile.SizeOf(WYear) + Utile.SizeOf(WMonth) + Utile.SizeOf(WDay) + Utile.SizeOf(WHour) + Utile.SizeOf(WMinute) + Utile.SizeOf(WSecond) + Utile.SizeOf(WMilliseconds)); }