Exemple #1
0
        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();
            }
        }
Exemple #2
0
 protected TriggeredLocationStartResponsePacket(LRRPPacketType type) : base(type)
 {
 }
Exemple #3
0
 protected ImmediateLocationRequestPacket(LRRPPacketType type) : base(type)
 {
 }
Exemple #4
0
 protected ImmediateLocationResponsePacket(LRRPPacketType type) : base(type)
 {
 }
Exemple #5
0
 public LRRPPacket(LRRPPacketType type)
 {
     this.type = type;
 }