12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System;
- using System.Threading;
- using MECF.Framework.Simulator.Core.Driver;
- namespace EfemDualSimulator.Devices
- {
- class AdTecGeneratorMock : SerialPortDeviceSimulator
- {
- private const string EOF = "\r";
- private const char MSG_DELIMITER = '_';
- private const string MOCKUP_PORT = "COM51";
- public AdTecGeneratorMock() : base(MOCKUP_PORT, -1, EOF, MSG_DELIMITER)
- {
- }
- protected override void ProcessUnsplitMessage(string message)
- {
- if (string.IsNullOrEmpty(message))
- throw new ArgumentException("Hardware command message is invalid");
- string sRes = string.Empty;
- if (message.Contains(EOF))
- {
- message = message.Remove(message.Length - 1);
- }
- switch (message)
- {
- case "Q":
- sRes = "2000000 12345 23456 34567 45678";
- break;
- case "HS":
- sRes = "";
- break;
- default:
- break;
- }
- //string[] strs = message.Split(MSG_DELIMITER);
- //Thread.Sleep(2 * 1000);
- sRes += "\r";
- OnWriteMessage(sRes);
- }
- }
- }
|