SerialPortUtil.cs 672 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO.Ports;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace MECF.Framework.Common.Utilities
  8. {
  9. public class SerialPortUtil
  10. {
  11. public static Parity GetParity(string parity)
  12. {
  13. switch(parity)
  14. {
  15. case "N":
  16. return Parity.None;
  17. case "E":
  18. return Parity.Even;
  19. case "O":
  20. return Parity.Odd;
  21. default:
  22. return Parity.None;
  23. }
  24. }
  25. }
  26. }