VCEBase.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net.Configuration;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Xml;
  8. using Aitex.Core.Common.DeviceData;
  9. using Aitex.Core.RT.DataCenter;
  10. using Aitex.Core.RT.Device;
  11. using Aitex.Core.RT.Event;
  12. using Aitex.Core.RT.IOCore;
  13. using Aitex.Core.RT.OperationCenter;
  14. using Aitex.Core.RT.SCCore;
  15. using Aitex.Core.Util;
  16. namespace MECF.Framework.Common.Device.Bases
  17. {
  18. public abstract class VCEBase : BaseDevice, IDevice
  19. {
  20. public virtual bool IsIdle { get; set; }
  21. public virtual bool IsHomed { get; set; }
  22. public virtual bool IsDoorOpened { get; set; }
  23. public virtual bool IsDoorClosed { get; set; }
  24. public virtual bool IsAlarm { get; set; }
  25. public virtual bool IsConnected { get; set; }
  26. public virtual bool IsMapped { get; set; }
  27. protected VCEBase() : base()
  28. {
  29. }
  30. protected VCEBase(string module, string name) : base(module, name, name, name)
  31. {
  32. }
  33. public virtual bool Initialize()
  34. {
  35. OP.Subscribe($"{Module}.{Name}.Home", (string cmd, object[] args) =>
  36. {
  37. Home(out _);
  38. return true;
  39. });
  40. OP.Subscribe($"{Module}.{Name}.Abort", (string cmd, object[] args) =>
  41. {
  42. Abort();
  43. return true;
  44. });
  45. OP.Subscribe($"{Module}.{Name}.Reset", (string cmd, object[] args) =>
  46. {
  47. Reset();
  48. return true;
  49. });
  50. OP.Subscribe($"{Module}.{Name}.Unload", (string cmd, object[] args) =>
  51. {
  52. Unload(out _);
  53. return true;
  54. });
  55. OP.Subscribe($"{Module}.{Name}.Load", (string cmd, object[] args) =>
  56. {
  57. Load(out _);
  58. return true;
  59. });
  60. return true;
  61. }
  62. public virtual void Terminate()
  63. {
  64. }
  65. public virtual void Monitor()
  66. {
  67. }
  68. public virtual void Reset()
  69. {
  70. }
  71. public virtual bool Home(out string reason)
  72. {
  73. reason = string.Empty;
  74. return true;
  75. }
  76. public virtual bool Load(out string reason)
  77. {
  78. reason = string.Empty;
  79. return true;
  80. }
  81. public virtual bool Unload(out string reason)
  82. {
  83. reason = string.Empty;
  84. return true;
  85. }
  86. public virtual bool OpenDoor(out string reason)
  87. {
  88. reason = string.Empty;
  89. return true;
  90. }
  91. public virtual bool CloseDoor(out string reason)
  92. {
  93. reason = string.Empty;
  94. return true;
  95. }
  96. public virtual bool MapCassette(out string reason)
  97. {
  98. reason = string.Empty;
  99. return true;
  100. }
  101. public virtual void Abort()
  102. {
  103. return;
  104. }
  105. }
  106. }