Exemplo n.º 1
0
        internal void DisconnectRequest()
        {
            // HEADER
            var datagram = new byte[16];

            datagram[00] = 0x06;
            datagram[01] = 0x10;
            datagram[02] = 0x02;
            datagram[03] = 0x09;
            datagram[04] = 0x00;
            datagram[05] = 0x10;

            datagram[06] = ChannelId;
            datagram[07] = 0x00;
            datagram[08] = 0x08;
            datagram[09] = 0x01;
            datagram[10] = _localEndpoint.Address.GetAddressBytes()[0];
            datagram[11] = _localEndpoint.Address.GetAddressBytes()[1];
            datagram[12] = _localEndpoint.Address.GetAddressBytes()[2];
            datagram[13] = _localEndpoint.Address.GetAddressBytes()[3];
            datagram[14] = (byte)(_localEndpoint.Port >> 8);
            datagram[15] = (byte)_localEndpoint.Port;

            KnxSender.SendData(datagram);
        }
Exemplo n.º 2
0
        private void StateRequest(object sender, ElapsedEventArgs ev)
        {
            // HEADER
            var datagram = new byte[16];

            datagram[00] = 0x06;
            datagram[01] = 0x10;
            datagram[02] = 0x02;
            datagram[03] = 0x07;
            datagram[04] = 0x00;
            datagram[05] = 0x10;

            datagram[06] = ChannelId;
            datagram[07] = 0x00;
            datagram[08] = 0x08;
            datagram[09] = 0x01;
            datagram[10] = _localEndpoint.Address.GetAddressBytes()[0];
            datagram[11] = _localEndpoint.Address.GetAddressBytes()[1];
            datagram[12] = _localEndpoint.Address.GetAddressBytes()[2];
            datagram[13] = _localEndpoint.Address.GetAddressBytes()[3];
            datagram[14] = (byte)(_localEndpoint.Port >> 8);
            datagram[15] = (byte)_localEndpoint.Port;

            try
            {
                KnxSender.SendData(datagram);
            }
            catch (Exception e)
            {
                Logger.Error(ClassName, e);
            }
        }