private void ParseIbeoPacket(BinaryReader br) { //bear in mind the first byte is picked off for us. IbeoScan s = new IbeoScan(); s.packetNum = br.ReadUInt16(); uint secs = br.ReadUInt16(); uint ticks = br.ReadUInt32(); s.timestamp = (float)secs + ((float)ticks / 10000.0f); s.scannerID = br.ReadInt32(); int numPoints = br.ReadUInt16(); s.points = new List <IbeoPoint> (numPoints); for (int i = 0; i < numPoints; i++) { IbeoPoint p = new IbeoPoint(); p.location.x = br.ReadInt16() / 100.0f; p.location.y = br.ReadInt16() / 100.0f; p.location.z = br.ReadInt16() / 100.0f; byte chan = br.ReadByte(); p.ray = (chan >> 4) & 0x3; p.echo = chan & 0x3; p.finalHit = (chan & 0x4) != 0; p.type = (PointType)br.ReadByte(); s.points.Add(p); } if (ScanReceived != null) { ScanReceived(this, new IbeoRXEventArgs(s)); } }
public IbeoRXEventArgs(IbeoScan s) { this.s = s; }