protected DeviceDescriptionInformationBlock(byte[] bytes) : base(bytes) { if (Type != DescriptionType.DeviceInfo) { throw new KnxNetIpException("Unable to determine Device Description. Wrong Description Type!"); } Medium = (KnxMedium)Information[0]; Status = Information[1]; Address = new KnxDeviceAddress(Information.ExtractBytes(2, 2)); ProjectInstallId = (Information[4] << 8) + Information[5]; SerialNumber = new DptString_8859_1(Information.ExtractBytes(6, 6)).Value; MacAddress = Information.ExtractBytes(12, 10); FriendlyName = Resources.Strings.UnknownDevice; if (Information.Length > 22) { var name = new DptString_8859_1(Information.ExtractBytes(22)).Value; if (name.IndexOf('\0') >= 0) { name = name.Substring(0, name.IndexOf('\0')); } FriendlyName = name; } }
protected KnxNetIpClient(IPEndPoint remoteEndPoint, KnxDeviceAddress deviceAddress, KnxNetIpConfiguration configuration = null) { Configuration = configuration ?? new KnxNetIpConfiguration(); RemoteEndPoint = remoteEndPoint ?? throw new ArgumentNullException(nameof(remoteEndPoint)); DeviceAddress = deviceAddress; UdpClient = new UdpClient(); }
public void KnxDeviceAddressByteArrayConstructorTest() { var bytes = new byte[] { 0x12, 0x03 }; var target = new KnxDeviceAddress(bytes); Assert.AreEqual(target.Area, 1); Assert.AreEqual(target.Line, 2); Assert.AreEqual(target.Device, 3); }
public KnxNetIpTunnelingClient(IPEndPoint remoteEndPoint, KnxDeviceAddress deviceAddress, KnxNetIpConfiguration configuration = null) : base(remoteEndPoint, deviceAddress, configuration) { ConnectionStateTimeStamp = DateTime.MinValue; _keepAliveTimer = new System.Timers.Timer(59000) { Enabled = false, AutoReset = true }; _keepAliveTimer.Elapsed += async(sender, args) => await SendKeepAliveMessage(); }
public void ToBitArrayTest() { var target = new KnxDeviceAddress(3, 2, 1); // 0x32, 0x01 var expected = new BitArray(new[] { false, false, true, true, false, false, true, false, false, false, false, false, false, false, false, true, }); BitArray actual = target.ToBitArray(); Assert.AreEqual(expected.Length, actual.Length); for (int i = 0; i < actual.Length; i++) { Assert.AreEqual(actual[i], expected[i]); } }
public KnxNetIpRoutingClient(IPEndPoint remoteEndPoint, KnxDeviceAddress deviceAddress, KnxNetIpConfiguration configuration = null) : base(remoteEndPoint, deviceAddress, configuration) { }