コード例 #1
0
        protected bool RunSingleReadableCommand(IReadableCommand aCommand)
        {
            try
            {
                //_communicatorInstance.ReadTimeout = 2000;
                _communicatorInstance.FlushBuffer();

                _communicatorInstance.WriteLine(aCommand.ReadParamsCommand());

                string        zAnswerLine = "";
                List <string> zAnswerList = new List <string>();

                while (!BaseATCommand.CheckCommandAnswer(zAnswerLine))
                {
                    zAnswerLine = _communicatorInstance.ReadLine();
                    zAnswerList.Add(zAnswerLine);
                }

                _logger.Debug("Correct Answer received. Try to parse it");
                return(aCommand.Parse(zAnswerList));
            }
            catch (Exception zException)
            {
                _logger.WarnException("Failed Single command run", zException);
                return(false);
            }
        }