using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using Aitex.Core.RT.Log; using Aitex.Core.RT.PLC; using Aitex.Jet.RT.Simulator; using Aitex.Triton160.RT.Module; using Aitex.Triton160.RT.PLC; namespace Aitex.Triton160.RT.Simulator { public class SimulatorFinsDataDevice : IDataDevice { private ISimulatorManager _simulator; private bool _isOpened = true; public bool IsOpened { get { return _isOpened; } } private List _types = new List {"local", "remote"}; public bool Open() { //if (SystemConfigManager.Instance.GetSystemType().ToLower() == "patronmax") //{ // _simulator = new SimulatorPatronMax(); // _types = new List {"local"}; //} //else if (SystemConfigManager.Instance.GetSystemType().ToLower() == "patron") //{ // _simulator = new SimulatorPatron(); //} //else //if (SystemConfigManager.Instance.GetSystemType().ToLower() == "hz") { _simulator = new SimulatorTriton160(); _types = new List {"local"}; } //else //{ // _simulator = new SimulatorTriton(); //} return true; } public void Close() { ; } public object Read(string type) { try { return _simulator.Read(type); } catch (Exception ex) { LOG.Write(ex); } return null; } public bool Write(string type, T buffer) { try { _simulator.Write(type, (PLC_OUTPUT_DATA)(object)buffer); } catch (Exception ex) { LOG.Write(ex); } return true; } public List GetTypes() { return _types; } public bool IsOpen(string type) { return IsOpened; } public bool Open(string type) { return Open(); } public void Close(string type) { Close(); } } }