using Aitex.Core.Util; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MECF.Framework.Common.TwinCat { public class BeckhoffItemManager : Singleton { private Dictionary _ioItemMap = new Dictionary(); private Dictionary _writeItemMap = new Dictionary(); public BeckhoffItem GetIOBeckhoffItem(string name) { return _ioItemMap.ContainsKey(name) ? _ioItemMap[name] : null; } public BeckhoffItem GetWriteBeckhoffItem(string name) { return _writeItemMap.ContainsKey(name) ? _writeItemMap[name]: null; } public void InitBeckhoffItem(string name,string address,string dataType,string scaling,string ioType,int size,bool bitOperated,int bit,bool invert) { _ioItemMap[name] = new BeckhoffItem(name,address, dataType,scaling, ioType, size,bitOperated,bit,invert); ScalingManager.Instance.Initialize(name, scaling); } public void InitBeckhoffItem(string name, string address, string dataType, string ioType, int size, bool bitOperated, int bit,bool invert) { _ioItemMap[name] = new BeckhoffItem(name, address, dataType, ioType, size,bitOperated,bit,invert); } public void InitWriteBeckoffItem(string name, string address, string dataType, string scaling,string ioType, int size, bool bitOperated, int bit,bool invert) { _writeItemMap[name]=new BeckhoffItem(name,address, dataType,scaling, ioType, size,bitOperated,bit,invert); ScalingManager.Instance.Initialize(name, scaling); } public void InitWriteBeckoffItem(string name, string address, string dataType, string ioType, int size, bool bitOperated, int bit,bool invert) { _writeItemMap[name] = new BeckhoffItem(name, address, dataType, ioType, size, bitOperated, bit,invert); } public List GetIOItems() { return _ioItemMap.Values.ToList(); } public List GetWriteItems() { return _writeItemMap.Values.ToList(); } } }