Ejemplo n.º 1
0
        /// <summary>
        /// Parsing of Data packet
        /// </summary>
        /// <param name="receivedPacket"></param>
        public void ParsingData(Packet.Packet receivedPacket)
        {
            int responceId = -1;
            try
            {
                receivedPacket.CurrentPos = 0;
                receivedPacket.RemoveBytes(EnumAndConstants.CONSTANT_VALUE);//SOF
                receivedPacket.RemoveByte();//Protocol version
                receivedPacket.RemoveByte();//Unique number
                responceId = receivedPacket.RemoveByte();//Request ID : 6
                int PacketLength = receivedPacket.RemoveByte(); //Packet length
                if ((responceId == (int)ADCStatus.START_ADC || responceId == (int)ADCStatus.END_ADC) && isNewRequestSend == true)
                {
                    return;
                }
                if (responceId == (int)ADCStatus.START_ADC || responceId == (int)ADCStatus.END_ADC)
                {
                    GetTriggerModeRequest(receivedPacket, responceId);
                    return;
                }
                isNewRequestSend = false;
                if (PacketLength > 0)
                {
                    GetConfigurationDetails(receivedPacket);
                }
                receivedPacket.RemoveByte(); //CRC
                waitHandle.Set();

            }
            catch (Exception ex)
            {
                m_logger.Error(ex);
            }
        }