Exemplo n.º 1
0
        protected bool RunSingleWritableCommand(IWritableCommand aCommand)
        {
            try
            {
                //_communicatorInstance.ReadTimeout = 2000;
                _communicatorInstance.FlushBuffer();

                _communicatorInstance.WriteLine(aCommand.WriteCommand());

                string zAnswerLine = "";
                bool   zResult     = false;
                while (!BaseATCommand.CheckCommandAnswer(zAnswerLine))
                {
                    zAnswerLine = _communicatorInstance.ReadLine();
                    zResult     = zResult || BaseATCommand.PositiveAnswer(zAnswerLine);
                }

                _logger.Debug("Correct Answer received OK");
                return(zResult);
            }
            catch (Exception zException)
            {
                _logger.WarnException("Failed Single command run", zException);
                return(false);
            }
        }
Exemplo n.º 2
0
 public void Analyze(string fullCmd, IWritableCommand command)
 {
     Divider.TryDivide(fullCmd, out var cmd);
     command.CommandName = cmd.CommandName;
     command.Args        = cmd.Args;
     command.FreeArgs    = cmd.FreeArgs;
     command.Switches    = cmd.Switches;
     command.SimpleArgs  = cmd.SimpleArgs;
     command.ArgString   = cmd.ArgString;
 }
        protected bool RunSingleWritableCommand(IWritableCommand aCommand)
        {
            try
            {
                //_communicatorInstance.ReadTimeout = 2000;
                _communicatorInstance.FlushBuffer();

                _communicatorInstance.WriteLine(aCommand.WriteCommand());

                string zAnswerLine = "";
                bool zResult = false;
                while (!BaseATCommand.CheckCommandAnswer(zAnswerLine))
                {
                    zAnswerLine = _communicatorInstance.ReadLine();
                    zResult = zResult || BaseATCommand.PositiveAnswer(zAnswerLine);
                }

                _logger.Debug("Correct Answer received OK");
                return zResult;
            }
            catch (Exception zException)
            {
                _logger.WarnException("Failed Single command run", zException);
                return false;
            }
        }