1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using Aitex.Common.Util;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Beckhoff.Station;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MECF.Framework.Common.Beckhoff.AxisProvider
- {
- public class BeckhoffAxisProviderManager : Singleton<BeckhoffAxisProviderManager>
- {
- public Dictionary<string, BeckhoffProviderAxis> _axisProviderDic = new Dictionary<string, BeckhoffProviderAxis>();
- /// <summary>
- /// 初始化
- /// </summary>
- public void Initialize()
- {
- string xmlPath = PathManager.GetCfgDir() + "Devices\\AxisProviderCfg.xml";
- BeckhoffAxisProviderCfg cfg= CustomXmlSerializer.Deserialize<BeckhoffAxisProviderCfg>(new FileInfo(xmlPath));
- if(cfg!=null)
- {
- foreach(BeckhoffProviderAxis item in cfg.Axes)
- {
- _axisProviderDic[item.Name] = item;
- DATA.Subscribe($"{item.Name}.AxisProvider", () => item, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- }
- }
- }
- /// <summary>
- /// 获取AxisProvider
- /// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
- public BeckhoffProviderAxis GetAxisProvider(string name)
- {
- return _axisProviderDic.ContainsKey(name) ? _axisProviderDic[name] : null;
- }
- }
- }
|