VPASimulator.cs 896 B

123456789101112131415161718192021222324252627282930313233
  1. using MECF.Framework.Simulator.Core.Driver;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. namespace CyberX8_Simulator.Devices
  10. {
  11. public class VPASimulator : SerialPortDeviceSimulator
  12. {
  13. private const string EOF = "\r";
  14. private const char MSG_DELIMITER = ' ';
  15. private const string VPA_Port = "COM159";
  16. public VPASimulator() : base(VPA_Port, -1, EOF, MSG_DELIMITER)
  17. {
  18. }
  19. protected override void ProcessUnsplitMessage(string message)
  20. {
  21. if (string.IsNullOrEmpty(message))
  22. throw new ArgumentException("Hardware command message is invalid");
  23. Thread.Sleep(500);
  24. OnWriteMessage("_RDY" + EOF);
  25. }
  26. }
  27. }