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; }
public Address(AddressingMode mode) { if (mode != AddressingMode.ShortAddress && mode != AddressingMode.ExtendedAddress) { throw new ArgumentException("Unsupported addressing mode"); } Bytes = new byte[mode.GetBytesLength()]; }
public Address(AddressingMode mode) { if(mode != AddressingMode.ShortAddress && mode != AddressingMode.ExtendedAddress) { throw new ArgumentException("Unsupported addressing mode"); } Bytes = new byte[mode.GetBytesLength()]; }
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; }