using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Windows.Documents; using MECF.Framework.Simulator.Core.Driver; namespace Venus_Simulator.Devices { class RevtechMatchMockPMB : SerialPortDeviceSimulator { private const string EOF = "\n"; private const char MSG_DELIMITER = '\n'; private const string MOCKUP_PORT = "COM32"; private List info = new List(); public RevtechMatchMockPMB() : base(MOCKUP_PORT, -1, EOF, MSG_DELIMITER) { info.Add("1");//Mode info.Add("1"); info.Add("1"); info.Add("1"); info.Add("1"); info.Add("1"); info.Add("1"); info.Add("1"); info.Add("20");//C1 info.Add("30");//C2 info.Add("1"); info.Add("1"); info.Add("1"); info.Add("1"); info.Add("1"); } 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); } string[] msgs = message.Split('\n'); foreach(string msg in msgs) { switch (msg) { } Thread.Sleep(200); sRes += "\n"; OnWriteMessage(sRes); } } } }