Esempio n. 1
0
        bool IMessageProcessor.ProcessMessage(byte[] data, int offset, out int count)
        {
            InsteonMessage message;

            if (InsteonMessageProcessor.ProcessMessage(data, offset, out count, out message))
            {
                if (!IsDuplicateMessage(message))
                {
                    //logger.DebugFormat("PROCESSOR: Message '{0}' processed...\r\n{1}", Utilities.ByteArrayToString(data, offset, count), message.ToString("Log"));
                    logger.DebugFormat("PROCESSOR: Message '{0}' processed...", Utilities.ByteArrayToString(data, offset, count));
                    OnMessage(message);
                    UpdateWaitItems(message);
                }
                else
                {
                    //logger.DebugFormat("PROCESSOR: Message '{0}' duplicate ignored...\r\n{1}", Utilities.ByteArrayToString(data, offset, count), message.ToString("Log"));
                    logger.DebugFormat("PROCESSOR: Message '{0}' duplicate ignored...", Utilities.ByteArrayToString(data, offset, count));
                }
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        bool IMessageProcessor.ProcessEcho(byte[] data, int offset, out int count)
        {
            var message = Utilities.ArraySubset(data, offset, sentMessage.Length);

            if (echoCommand)
            {
                if (InsteonMessageProcessor.ProcessMessage(data, offset, out count, out echoMessage))
                {
                    //logger.DebugFormat("PROCESSOR: Echo '{0}' processed...\r\n{1}", Utilities.ByteArrayToString(data, offset, count), echoMessage.ToString("Log"));
                    logger.DebugFormat("PROCESSOR: Echo '{0}' processed...", Utilities.ByteArrayToString(data, offset, count));
                    return(true);
                }
                return(false);
            }
            if (Utilities.ArraySequenceEquals(sentMessage, message))
            {
                count = sentMessage.Length;
                logger.DebugFormat("PROCESSOR: Echo '{0}' matched", Utilities.ByteArrayToString(data, offset, count));
                return(true);
            }
            count = 0;
            return(false);
        }