示例#1
0
        public override bool Parse(List <string> aAnswer)
        {
            if (base.Parse(aAnswer))
            {
                string[] zSplit = aAnswer[0].Split(new Char[] { ':', ',' });
                if (zSplit.Count() == 3)
                {
                    try
                    {
                        ushort zBits   = ushort.Parse(TrimValue(zSplit[1]));
                        ushort zParity = ushort.Parse(TrimValue(zSplit[2]));

                        ushort   zUartDataBits;
                        StopBits zUartStopBits;

                        if (CharacterFramingCommand.StopBitsEncode(zBits, out zUartDataBits, out zUartStopBits))
                        {
                            DataBits      = zUartDataBits;
                            ParityValue   = CharacterFramingCommand.ParityEncode(zParity);
                            StopBitsValue = zUartStopBits;

                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    catch (Exception zException)
                    {
                        _logger.WarnException("Handled exception", zException);
                        return(false);
                    }
                }
                else
                {
                    _logger.Debug("InCorrect Params Count: {0}", zSplit.Count());
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
 public CharacterFramingCases()
 {
     _CharFrCommand = new CharacterFramingCommand();
     _Command = _CharFrCommand;
 }