public static LinkLayerAddressAndTimeDUID FromEthernet( Byte[] hwAddress, DateTime time) { if (time < _nullReferenceTime) { throw new ArgumentException($"the time value must greater than {_nullReferenceTime}", nameof(time)); } if (hwAddress.Length != 6) { throw new ArgumentException("invalid mac address", nameof(hwAddress)); } Byte[] duidTypeByte = ByteHelper.GetBytes((UInt16)DUIDTypes.LinkLayerAndTime); Byte[] hwTypeByte = ByteHelper.GetBytes((UInt16)DUIDLinkLayerTypes.Ethernet); Byte[] timeByte = ByteHelper.GetBytes((UInt32)((time - _nullReferenceTime).TotalSeconds)); Byte[] concat = ByteHelper.ConcatBytes( new List <Byte[]> { duidTypeByte, hwTypeByte, timeByte, hwAddress }); return(FromByteArray(concat, 0)); }
protected DUID(DUIDTypes type, params Byte[][] data) { Type = type; Value = ByteHelper.ConcatBytes(data); }