Пример #1
0
 bool InsteonNetworkBridge.IMessageProcessor.ProcessEcho(byte[] data, int offset, out int count)
 {
     byte[] message = Utilities.ArraySubset(data, offset, sentMessage.Length);
     if (echoCommand)
     {
         if (InsteonMessageProcessor.ProcessMessage(data, offset, out count, out echoMessage))
         {
             Log.WriteLine("PROCESSOR: Echo '{0}' processed...\r\n{1}", Utilities.ByteArrayToString(data, offset, count), echoMessage.ToString("Log"));
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else if (Utilities.ArraySequenceEquals(sentMessage, message))
     {
         count = sentMessage.Length;
         Log.WriteLine("PROCESSOR: Echo '{0}' matched", Utilities.ByteArrayToString(data, offset, count));
         return(true);
     }
     else
     {
         count = 0;
         return(false);
     }
 }
Пример #2
0
        bool InsteonNetworkBridge.IMessageProcessor.ProcessMessage(byte[] data, int offset, out int count)
        {
            InsteonMessage message;

            if (InsteonMessageProcessor.ProcessMessage(data, offset, out count, out message))
            {
                if (!IsDuplicateMessage(message))
                {
                    Log.WriteLine("PROCESSOR: Message '{0}' processed...\r\n{1}", Utilities.ByteArrayToString(data, offset, count), message.ToString("Log"));
                    OnMessage(message);
                    UpdateWaitItems(message);
                }
                else
                {
                    Log.WriteLine("PROCESSOR: Message '{0}' duplicate ignored...\r\n{1}", Utilities.ByteArrayToString(data, offset, count), message.ToString("Log"));
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }