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); } }
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); } }