private static ConnectionResponseDataBlock ParseConnectionResponseDataBlock(IEnumerable <byte> bytes) { var enumerable = bytes as byte[] ?? bytes.ToArray(); return(new ConnectionResponseDataBlock(enumerable.ElementAt(0), enumerable.ElementAt(1), UniCastAddress.FromByteArray(enumerable.Skip(2).ToArray()))); }
public void Usage() { var uniCastAddress = new UniCastAddress(1, 1, 100); var actualBytes = uniCastAddress.GetBytes(); actualBytes.Should().BeEquivalentTo(new byte[] { 0x11, 0x64 }); }
public void Usage() { var bytes = new byte[] { 0x11, 0x64 }; var uniCastAddress = UniCastAddress.FromByteArray(bytes); uniCastAddress.Area.Should().Be(1); uniCastAddress.Line.Should().Be(1); uniCastAddress.DeviceAddress.Should().Be(0x64); }
public void Usage() { const string address = "1.1.40"; var uniCastAddress = UniCastAddress.FromString(address); uniCastAddress.Area.Should().Be(1); uniCastAddress.Line.Should().Be(1); uniCastAddress.DeviceAddress.Should().Be(0x28); }
public TunnelRequest Build(byte headerLength, byte protocolVersion, ushort totalLength, byte[] responseBytes) { var structureLength = responseBytes[0]; var communicationChannel = responseBytes[1]; var sequenceCounter = responseBytes[2]; var messageCode = responseBytes[4]; var addInformationLength = responseBytes[5]; var controlField = responseBytes[6]; var controlField2 = responseBytes[7]; var npduLength = responseBytes[12]; return(new TunnelRequest(headerLength, protocolVersion, totalLength, structureLength, communicationChannel, sequenceCounter, messageCode, addInformationLength, controlField, controlField2, UniCastAddress.FromByteArray(new[] { responseBytes[8], responseBytes[9] }), MultiCastAddress.FromByteArray(new[] { responseBytes[10], responseBytes[11] }), npduLength, new[] { responseBytes[12], responseBytes[13] })); }
public TunnelRequest(byte headerLength, byte protocolVersion, ushort totalLength, byte structureLength, byte communicationChannel, byte sequenceCounter, byte messageCode, byte addInformationLength, byte controlField, byte controlField2, UniCastAddress sourceAddress, MultiCastAddress destinationAddress, byte npduLength, byte[] data) { HeaderLength = headerLength; ProtocolVersion = protocolVersion; TotalLength = totalLength; StructureLength = structureLength; CommunicationChannel = communicationChannel; SequenceCounter = sequenceCounter; MessageCode = messageCode; AddInformationLength = addInformationLength; ControlField = controlField; ControlField2 = controlField2; SourceAddress = sourceAddress; DestinationAddress = destinationAddress; NpduLength = npduLength; Data = data; }
public ConnectionResponseDataBlock(byte structureLength, byte connectionType, UniCastAddress knxAddress) { StructureLength = structureLength; ConnectionType = connectionType; KnxAddress = knxAddress; }