public LRRPPacket(byte[] data) { this.type = (LRRPPacketType)data[0]; //data[1] is the packet size... //This next bit seems to be a TLV, not sure what other tags are valid... if (data[2] != 0x22) { throw new NotImplementedException(string.Format("Unknown tag byte {0}", data[2])); } int offset; switch (data[3]) { case 1: this.requestID = data[4]; offset = 5; break; case 2: this.requestID = (UInt32)(data[4] << 8 | data[5]); offset = 6; break; case 3: this.requestID = (UInt32)(data[4] << 16 | data[5] << 8 | data[6]); offset = 7; break; case 4: this.requestID = (UInt32)(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]); offset = 8; break; default: throw new NotImplementedException(string.Format("Unknown length byte {0}", data[3])); } if (data[1] + 2 < data.Length) { //When I get this back from the repeater it's got a bunch of extra junk on the end. this.data = new byte[data[1] - (offset - 2)]; Array.Copy(data, offset, this.data, 0, this.data.Length); } else { this.data = data.Skip(offset).ToArray(); } }
protected TriggeredLocationStartResponsePacket(LRRPPacketType type) : base(type) { }
protected ImmediateLocationRequestPacket(LRRPPacketType type) : base(type) { }
protected ImmediateLocationResponsePacket(LRRPPacketType type) : base(type) { }
public LRRPPacket(LRRPPacketType type) { this.type = type; }