|  | @@ -1,5 +1,6 @@
 | 
												
													
														
															|  |  using System;
 |  |  using System;
 | 
												
													
														
															|  |  using System.Threading;
 |  |  using System.Threading;
 | 
												
													
														
															|  | 
 |  | +using System.Threading.Tasks;
 | 
												
													
														
															|  |  using MECF.Framework.Simulator.Core.Driver;
 |  |  using MECF.Framework.Simulator.Core.Driver;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  namespace Venus_Simulator.Devices
 |  |  namespace Venus_Simulator.Devices
 | 
												
											
												
													
														
															|  | @@ -24,7 +25,7 @@ namespace Venus_Simulator.Devices
 | 
												
													
														
															|  |              _simGeneratorStatus = GeneratorStatus.Unknown;
 |  |              _simGeneratorStatus = GeneratorStatus.Unknown;
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -        protected override void ProcessUnsplitMessage(string message)
 |  | 
 | 
												
													
														
															|  | 
 |  | +        protected override  void ProcessUnsplitMessage(string message)
 | 
												
													
														
															|  |          {
 |  |          {
 | 
												
													
														
															|  |              if (string.IsNullOrEmpty(message))
 |  |              if (string.IsNullOrEmpty(message))
 | 
												
													
														
															|  |                  throw new ArgumentException("Hardware command message is invalid");
 |  |                  throw new ArgumentException("Hardware command message is invalid");
 | 
												
											
												
													
														
															|  | @@ -36,34 +37,36 @@ namespace Venus_Simulator.Devices
 | 
												
													
														
															|  |                  message = message.Remove(message.Length - 1);
 |  |                  message = message.Remove(message.Length - 1);
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -            switch (message)
 |  | 
 | 
												
													
														
															|  | 
 |  | +            string[] msgs = message.Split('\r');
 | 
												
													
														
															|  | 
 |  | +            foreach (string msg in msgs)
 | 
												
													
														
															|  |              {
 |  |              {
 | 
												
													
														
															|  | -                case "Q":
 |  | 
 | 
												
													
														
															|  | -                    if (_simGeneratorStatus == GeneratorStatus.ON)
 |  | 
 | 
												
													
														
															|  | -                    {
 |  | 
 | 
												
													
														
															|  | -                        sRes = "2010000 12345 00900 00100 45678\r";
 |  | 
 | 
												
													
														
															|  | -                    }
 |  | 
 | 
												
													
														
															|  | -                    else if (_simGeneratorStatus == GeneratorStatus.OFF)
 |  | 
 | 
												
													
														
															|  | -                    {
 |  | 
 | 
												
													
														
															|  | -                        sRes = "2000000 12345 00000 00000 45678\r";
 |  | 
 | 
												
													
														
															|  | -                    }
 |  | 
 | 
												
													
														
															|  | -                    break;
 |  | 
 | 
												
													
														
															|  | -                case "G":
 |  | 
 | 
												
													
														
															|  | -                    _simGeneratorStatus = GeneratorStatus.ON;
 |  | 
 | 
												
													
														
															|  | -                    sRes = "\r";
 |  | 
 | 
												
													
														
															|  | -                    break;
 |  | 
 | 
												
													
														
															|  | -                case "S":
 |  | 
 | 
												
													
														
															|  | -                    _simGeneratorStatus = GeneratorStatus.OFF;
 |  | 
 | 
												
													
														
															|  | -                    sRes = "\r";
 |  | 
 | 
												
													
														
															|  | -                    break;
 |  | 
 | 
												
													
														
															|  | -                default:
 |  | 
 | 
												
													
														
															|  | -                    break;
 |  | 
 | 
												
													
														
															|  | -            }
 |  | 
 | 
												
													
														
															|  | -
 |  | 
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -            //string[] strs = message.Split(MSG_DELIMITER);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                switch(msg)
 | 
												
													
														
															|  | 
 |  | +                {
 | 
												
													
														
															|  | 
 |  | +                    case "Q":
 | 
												
													
														
															|  | 
 |  | +                        if (_simGeneratorStatus == GeneratorStatus.ON)
 | 
												
													
														
															|  | 
 |  | +                        {
 | 
												
													
														
															|  | 
 |  | +                            sRes = "2010000 12345 00900 00100 45678\r";
 | 
												
													
														
															|  | 
 |  | +                        }
 | 
												
													
														
															|  | 
 |  | +                        else if (_simGeneratorStatus == GeneratorStatus.OFF)
 | 
												
													
														
															|  | 
 |  | +                        {
 | 
												
													
														
															|  | 
 |  | +                            sRes = "2000000 12345 00000 00000 45678\r";
 | 
												
													
														
															|  | 
 |  | +                        }
 | 
												
													
														
															|  | 
 |  | +                        break;
 | 
												
													
														
															|  | 
 |  | +                    case "G":
 | 
												
													
														
															|  | 
 |  | +                        _simGeneratorStatus = GeneratorStatus.ON;
 | 
												
													
														
															|  | 
 |  | +                        sRes = "\r";
 | 
												
													
														
															|  | 
 |  | +                        break;
 | 
												
													
														
															|  | 
 |  | +                    case "S":
 | 
												
													
														
															|  | 
 |  | +                        _simGeneratorStatus = GeneratorStatus.OFF;
 | 
												
													
														
															|  | 
 |  | +                        sRes = "\r";
 | 
												
													
														
															|  | 
 |  | +                        break;
 | 
												
													
														
															|  | 
 |  | +                    default:
 | 
												
													
														
															|  | 
 |  | +                        break;
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -            //Thread.Sleep(2 * 1000);
 |  | 
 | 
												
													
														
															|  | 
 |  | +            Thread.Sleep(200);
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |              sRes += "\r";
 |  |              sRes += "\r";
 | 
												
													
														
															|  |              OnWriteMessage(sRes);
 |  |              OnWriteMessage(sRes);
 |