IO.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.RT.IOCore;
  4. using Aitex.Core.Util;
  5. using MECF.Framework.Common.IOCore;
  6. namespace Aitex.Core.RT.IOCore
  7. {
  8. public class Index<T> where T : class
  9. {
  10. public T this[string name]
  11. {
  12. get
  13. {
  14. return IoManager.Instance.GetIO<T>(name);
  15. }
  16. }
  17. }
  18. public static class IO
  19. {
  20. public static Index<DIAccessor> DI = new Index<DIAccessor>();
  21. public static Index<DOAccessor> DO = new Index<DOAccessor>();
  22. public static Index<AIAccessor> AI = new Index<AIAccessor>();
  23. public static Index<AOAccessor> AO = new Index<AOAccessor>();
  24. public static bool CanSetDO(string doName, bool onOff, out string reason)
  25. {
  26. return IoManager.Instance.CanSetDo(doName, onOff, out reason);
  27. }
  28. public static List<Tuple<int, int, string>> GetIONameList(string group, IOType ioType)
  29. {
  30. return IoManager.Instance.GetIONameList(group, ioType);
  31. }
  32. public static List<DIAccessor> GetDiList(string source)
  33. {
  34. return IoManager.Instance.GetDIList(source);
  35. }
  36. public static List<DOAccessor> GetDoList(string source)
  37. {
  38. return IoManager.Instance.GetDOList(source);
  39. }
  40. public static List<AIAccessor> GetAiList(string source)
  41. {
  42. return IoManager.Instance.GetAIList(source);
  43. }
  44. public static List<AOAccessor> GetAoList(string source)
  45. {
  46. return IoManager.Instance.GetAOList(source);
  47. }
  48. }
  49. }