示例#1
0
        private void ProcessConnectionStateResponse(byte[] datagram)
        {
            // HEADER
            // 06 10 02 08 00 08 -- 48 21
            var knxDatagram = new KnxDatagram
            {
                header_length    = datagram[0],
                protocol_version = datagram[1],
                service_type     = new[] { datagram[2], datagram[3] },
                total_length     = datagram[4] + datagram[5],
                channel_id       = datagram[6]
            };

            var response = datagram[7];

            //_logger.Debug(ClassName, "Received connection state response - response {0}", response);

            if (response != 0x21)
            {
                return;
            }

            _logger.Debug(ClassName, "Received connection state response - No active connection with channel ID {0}", knxDatagram.channel_id);

            KnxConnection.Disconnect();
        }
示例#2
0
        private void ProcessConnectionStateResponse(byte[] datagram)
        {
            // HEADER
            // 06 10 02 08 00 08 -- 48 21
            var knxDatagram = new KnxDatagram
            {
                header_length    = datagram[0],
                protocol_version = datagram[1],
                service_type     = new[] { datagram[2], datagram[3] },
                total_length     = datagram[4] + datagram[5],
                channel_id       = datagram[6]
            };

            var response = datagram[7];

            if (response != 0x21)
            {
                return;
            }

            if (KnxConnection.Debug)
            {
                Console.WriteLine("KnxReceiverTunneling: Received connection state response - No active connection with channel ID {0}", knxDatagram.channel_id);
            }

            KnxConnection.Disconnect();
        }
示例#3
0
        private static void Main()
        {
            _connection = new KnxConnectionTunneling("10.0.250.20", 3671, "10.0.253.5", 3671) { Debug = false };
            _connection.KnxConnectedDelegate += Connected;
            _connection.KnxDisconnectedDelegate += Disconnected;
            _connection.KnxEventDelegate += Event;
            _connection.KnxStatusDelegate += Status;
            _connection.Connect();

            Console.WriteLine("Done. Press [ENTER] to finish");
            Console.Read();

            _connection.KnxDisconnectedDelegate -= Disconnected;
            _connection.Disconnect();
            Environment.Exit(0);
        }