CytEndPointDefine.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.EndPoints.CytEndPoints
  8. {
  9. public class EPDDefine
  10. {
  11. public static Dictionary<int, string> ErrorMap = new Dictionary<int, string>()
  12. {
  13. {0x0000, "OK"},
  14. {0x1000, "Format error"},
  15. {0x1001, "Parameter invalid"},
  16. {0x1002, "EPD not online"},
  17. {0x1003, "EPD is initializing"},
  18. {0x1004, "EPD config file has invalid setting"},
  19. {0x1005, "EPD calculation failed"},
  20. {0x1006, "EPD not remote"},
  21. { 0x1100, "Device has other error" },
  22. { 0x1101, "Device invalid" },
  23. { 0x1102, "No Device" },
  24. { 0x1103, "Device close failed" },
  25. { 0x1104, "Device: order not implemented" },
  26. { 0x1105, "Device: a features not found" },
  27. { 0x1106, "Device: transfer Error" },
  28. { 0x1107, "Device: bad user buffer" },
  29. { 0x1108, "Device: out of bounds" },
  30. { 0x1109, "Device Saturated" },
  31. {0x2000, "EPD device error"},
  32. };
  33. public static Dictionary<int, string> StateMap = new Dictionary<int, string>()
  34. {
  35. {0, "Device not ready"},
  36. {1, "Running"},
  37. {2, "Paused"},
  38. {3, "Idle"},
  39. };
  40. public static Dictionary<int, string> RunStatusMap = new Dictionary<int, string>()
  41. {
  42. {1, "Monitor"},
  43. {2, "Monitor Save"},
  44. {3, "Capture"},
  45. {4, "Process"},
  46. };
  47. public static Dictionary<int, string> ModeMap = new Dictionary<int, string>()
  48. {
  49. {1, "Local"},
  50. {2, "Remote"},
  51. };
  52. }
  53. public enum ErrorCode
  54. {
  55. OK = 0,
  56. InvalidZeroInHeader = 1, // 1-20 Horiba Error
  57. InvalidZeroInBody = 2,
  58. NoMatchHeaderWithBodyItems = 3,
  59. RequireCorrectValue = 4,
  60. RequireRecognizableTextCh = 5,
  61. MessageError = 6,
  62. BeyondRangeInHeader = 7,
  63. SizeErrorInHeader = 8,
  64. BeyondRangeInBody = 9,
  65. SizeErrorInBody = 10,
  66. NoMatchSensorID = 11,
  67. RemoteNotReady = 12,
  68. SensorNotReady = 13,
  69. ClusterNotReady = 14,
  70. UpperLimitOfHardDisk = 15,
  71. MismatchStepNames = 16,
  72. MissingStepName = 17,
  73. BeyondRangeRequiredAction = 18,
  74. RecipeNotExist = 19,
  75. AlreadyMeasuring = 20,
  76. InvalidPackage = 0x1000, // EPD Error
  77. InvalidParameter = 0x1001,
  78. NotOnline = 0x1002, //未连接
  79. Busy = 0x1003,
  80. SyntaxError = 0x1004, //模型语法错误
  81. CalcError = 0x1005,
  82. NotRemote = 0x1006,
  83. InvalidDevice = 0x1101, // RH Error
  84. NoDevice = 0x1102,
  85. FailedToClose = 0x1103,
  86. NotImplemented = 0x1104,
  87. FeatureNotFound = 0x1105,
  88. TransferError = 0x1106,
  89. BadUserBuffer = 0x1107,
  90. InputOutOfBounds = 0x1108,
  91. SpectrometerSaturated = 0x1109,
  92. HardwareNotReady = 0x2000,
  93. }
  94. public enum EPDEvent
  95. {
  96. Event_Message = 0x01,
  97. Event_SystemError = 0x02,
  98. Event_StepStart = 0x03,
  99. Event_StepDelay = 0x04,
  100. Event_StepNormalize = 0x05,
  101. Event_StepSatisfied = 0x06,
  102. Event_StepTrigger = 0x07,
  103. Event_StepStop = 0x08,
  104. Event_TrendData = 0x10,
  105. }
  106. public enum EPDCommand
  107. {
  108. Reset = 0x00,
  109. RecipeStart = 0x01,
  110. RecipeStop = 0x02,
  111. Complete = 0x03,
  112. Start = 0x04,
  113. Stop = 0x05,
  114. SetWaferInfo = 0x06,
  115. QueryCfgList = 0x07,
  116. QueryState = 0x08,
  117. QueryVer = 0x09,
  118. Event = 0x0A,
  119. Connect = 0x10,
  120. Disconnect = 0x11,
  121. HeartBeat = 0x20,
  122. QueryData = 0x30,
  123. QueryRunStatus = 0x31,
  124. SetRunStatus = 0x32,
  125. QueryOperateMode = 0x33,
  126. SetOperateMode = 0x34,
  127. QueryCurrentConfig = 0x40,
  128. GetSensorStatus = 0x101,
  129. StartMeasurement = 0x102,
  130. GetRecipesList = 0x103,
  131. StopMeasurement = 0x104,
  132. HoribaEvent = 0x105
  133. }
  134. [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 10, CharSet = CharSet.Ansi)]
  135. public struct PacketHeader
  136. {
  137. public static readonly int Size = Marshal.SizeOf(typeof(PacketHeader));
  138. [MarshalAs(UnmanagedType.U4, SizeConst = 4)]
  139. public int token;
  140. [MarshalAs(UnmanagedType.U1, SizeConst = 1)]
  141. public byte channel;
  142. [MarshalAs(UnmanagedType.U1, SizeConst = 1)]
  143. public byte command;
  144. [MarshalAs(UnmanagedType.U4, SizeConst = 4)]
  145. public int length;
  146. }
  147. [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 14, CharSet = CharSet.Ansi)]
  148. public struct ResponseHeader
  149. {
  150. public static readonly int Size = Marshal.SizeOf(typeof(ResponseHeader));
  151. [MarshalAs(UnmanagedType.U4, SizeConst = 4)]
  152. public int token;
  153. [MarshalAs(UnmanagedType.U1, SizeConst = 1)]
  154. public byte channel;
  155. [MarshalAs(UnmanagedType.U1, SizeConst = 1)]
  156. public byte command;
  157. [MarshalAs(UnmanagedType.U4, SizeConst = 4)]
  158. public int errorcode;
  159. [MarshalAs(UnmanagedType.U4, SizeConst = 4)]
  160. public int length;
  161. }
  162. [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 1792, CharSet = CharSet.Ansi)]
  163. public struct WaferData
  164. {
  165. public static readonly int Size = Marshal.SizeOf(typeof(WaferData));
  166. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  167. public char[] WaferID;
  168. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  169. public char[] Recipe;
  170. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  171. public char[] LotName;
  172. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  173. public char[] Cassette;
  174. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  175. public char[] Slot;
  176. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  177. public char[] ToolID;
  178. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  179. public char[] WorkFlow;
  180. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  181. public char[] Custom1;
  182. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  183. public char[] Custom2;
  184. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  185. public char[] Custom3;
  186. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  187. public char[] Custom4;
  188. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  189. public char[] Custom5;
  190. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  191. public char[] Date;
  192. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
  193. public char[] Time;
  194. public WaferData(int _)
  195. {
  196. WaferID = new char[128];
  197. Recipe = new char[128];
  198. LotName = new char[128];
  199. Cassette = new char[128];
  200. Slot = new char[128];
  201. ToolID = new char[128];
  202. WorkFlow = new char[128];
  203. Custom1 = new char[128];
  204. Custom2 = new char[128];
  205. Custom3 = new char[128];
  206. Custom4 = new char[128];
  207. Custom5 = new char[128];
  208. Date = new char[128];
  209. Time = new char[128];
  210. }
  211. }
  212. }