Exemple #1
0
        public AddressInformation(AddressingMode destinationAddressingMode, AddressingMode sourceAddressingMode, bool intraPan, ArraySegment<byte> data)
        {
            var internalOffset = 0;
            if(destinationAddressingMode != AddressingMode.None)
            {
                DestinationPan = GetValue(data, 0);
                DestinationAddress = new Address(new ArraySegment<byte>(data.Array, data.Offset + 2, destinationAddressingMode.GetBytesLength()));
                internalOffset = 2 + DestinationAddress.Bytes.Count;
            }

            if(sourceAddressingMode != AddressingMode.None)
            {
                if(intraPan)
                {
                    SourcePan = DestinationPan;
                }
                else
                {
                    SourcePan = GetValue(data, internalOffset);
                    internalOffset += 2;
                }
                SourceAddress = new Address(new ArraySegment<byte>(data.Array, data.Offset + internalOffset, sourceAddressingMode.GetBytesLength()));
            }

            Bytes = data;
        }
Exemple #2
0
        public Address(AddressingMode mode)
        {
            if (mode != AddressingMode.ShortAddress && mode != AddressingMode.ExtendedAddress)
            {
                throw new ArgumentException("Unsupported addressing mode");
            }

            Bytes = new byte[mode.GetBytesLength()];
        }
Exemple #3
0
        public Address(AddressingMode mode)
        {
            if(mode != AddressingMode.ShortAddress && mode != AddressingMode.ExtendedAddress)
            {
                throw new ArgumentException("Unsupported addressing mode");
            }

            Bytes = new byte[mode.GetBytesLength()];
        }
Exemple #4
0
        public AddressInformation(AddressingMode destinationAddressingMode, AddressingMode sourceAddressingMode, bool intraPan, ArraySegment <byte> data)
        {
            var internalOffset = 0;

            if (destinationAddressingMode != AddressingMode.None)
            {
                DestinationPan     = GetValue(data, 0);
                DestinationAddress = new Address(new ArraySegment <byte>(data.Array, data.Offset + 2, destinationAddressingMode.GetBytesLength()));
                internalOffset     = 2 + DestinationAddress.Bytes.Count;
            }

            if (sourceAddressingMode != AddressingMode.None)
            {
                if (intraPan)
                {
                    SourcePan = DestinationPan;
                }
                else
                {
                    SourcePan       = GetValue(data, internalOffset);
                    internalOffset += 2;
                }
                SourceAddress = new Address(new ArraySegment <byte>(data.Array, data.Offset + internalOffset, sourceAddressingMode.GetBytesLength()));
            }

            Bytes = data;
        }