示例#1
0
        /// <summary>
        /// Handler for reading bytes from connection
        /// </summary>
        private void DataReceivedHandler()
        {
            int readlenght = SerialPortConnection.BytesToRead;

            byte[] read = new byte[readlenght];
            if (readlenght > 0)
            {
                SerialPortConnection.Read(ref read, 0, readlenght);
                LastAnswer = AnswerFactory.CreateNew(read);
                if (LastAnswer != null && (LastAnswer as AnswerBase).IsBroadCast)
                {
                    ProcessBroadCast();
                }
            }
        }