LAPTOP-SNT8I5JK\Boounion
2025-07-28 bfe14e41fa5b07771d78af4511ba18d706bc23cc
SourceCode/Bond/Servo/ServoCommo.h
@@ -1,8 +1,46 @@
#pragma once
#include <string>
#include <vector>
#define CHECK_READ_STEP_SIGNAL(addr, data, size) {                     \
   BOOL bFlag = isBitOn(data, size, addr);                           \
   SERVO::CStep* pStep = getStep(addr);                           \
   if (pStep != nullptr) {                                       \
      ((CReadStep*)pStep)->onReadSignal(bFlag ? addr : 0);            \
   }                                                      \
}
#define CHECK_WRITE_STEP_SIGNAL(addr, data, size) {                     \
   BOOL bFlag = isBitOn(data, size, addr);                           \
   SERVO::CStep* pStep = getStep(addr);                           \
   if (pStep != nullptr) {                                       \
      ((CWriteStep*)pStep)->onRecvSignal(bFlag ? addr : 0);            \
   }                                                      \
}
namespace SERVO {
   enum PortType {
#define BLOCK_BUFFER_MAX         1024
#define ALIVE_TIMEOUT            15
#define VCR_MAX                  1
#define PATH_MAX               8
#define SIGNAL_MAX               8
#define ARM_ALL                  99
   enum class RET {
      OK = 1,
      NG,
   };
   using JobDataRequestAck = RET;
   enum class InspResult
   {
      NotInspected = 0,  // 初始化状态,尚未检测
      Pass,              // 检测合格
      Fail               // 检测不合格
   };
   enum class PortType {
      Loading = 1,
      Unloading,
      Both,
@@ -12,7 +50,7 @@
      UnloadingPartial
   };
   enum PortMode {
   enum class PortMode {
      OutOfService = 0,
      TransferBlocked,
      ReadyToLoad,
@@ -21,17 +59,155 @@
      TransferReady
   };
   enum MaterialsType {
      G1 = 0,
      G2 = 1,
      G1G2 = 2
   enum class MaterialsType {
      G1 = 1,
      G2 = 2,
      G1G2 = 3
   };
   typedef MaterialsType CassetteType;
   enum TransferMode {
   enum class TransferMode {
      MGVMode = 1,
      AGVMode,
      StockerInlineMode
   };
   // Memory Block 结构体定义
   typedef struct _MemoryBlock {
      unsigned int type;
      unsigned int start;
      unsigned int end;
      unsigned int size;
      char buffer[BLOCK_BUFFER_MAX];
   } MemoryBlock;
   // ALIVE
   typedef struct _ALIVE {
      BOOL flag;
      int count;
      BOOL alive;
   } ALIVE;
   enum class DISPATCHING_MODE {
      EAS = 1,
      Local = 2
   };
   enum class IDNEXER_OPERATION_MODE {
      Normal = 1,
      Clear_Out = 2,
      Cold_Run = 2,
      Start = 10,
      Stop = 11,
      Pause = 12,
      Resume = 13,
      Abort = 14,
      Cancel = 15,
   };
   enum class VCR_Reply_Code {
      OK = 1,
      NG,
      Job_Data_Request,
      VCR_Mismatch
   };
   // Robot cmd param
#define ROBOT_CMD_PARAM_SIZE      16         /* 防止以后修改ROBOT_CMD_PARAM为不是4的整数倍 */
   typedef struct _ROBOT_CMD_PARAM {
      short sequenceNo;
      short rcmd;
      short armNo;
      short getPosition;
      short putPosition;
      short getSlotNo;
      short putSlotNo;
      short subCmd;
   } ROBOT_CMD_PARAM;
   enum class RCMD {
      Robot_home = 1,
      Transfer,
      Move,
      Get,
      Put,
      One_Action_Exchange,
      Two_Action_Exchange,
      Command_Clear,
      Batch_get,
      Batch_put
   };
   enum class ROBOT_TASK_STATE {
      Ready = 0,
      Running,
      Picking,
      Picked,
      Placing,
      Restoring,
      Error,
      Abort,
      Restored,
      Completed
   };
   enum class ROBOT_STATUS {
      Setup = 0,
      Idle,
      Run,
      Pause,
      Stop,
      Moving,
   };
   enum class ROBOT_POSITION {
      Port1 = 0,
      Port2,
      Port3,
      Port4,
      Aligner,
      Fliper,
      Bonder1,
      Bonder2,
      Bake,
      Cooling,
      Measurement
   };
   /* Indexer Monitoring Status */
   /* Robot Monitoring Data */
   typedef struct _ROBOT_MONITORING_DATA {
      ROBOT_STATUS status;
      ROBOT_POSITION position;
      BOOL armState[2];
   } ROBOT_MONITORING_DATA, RMDATA;
   /* 工艺(加工处理)状态 */
   enum class PROCESS_STATE {
      Ready = 0,
      Processing,
      Complete,
      Error
   };
   /* Port Status */
   struct SlotConfig {
      int nSlotID = 0;
      bool isEnabled = false;
   };
   struct PortConfig {
      int nMaterialType;            // 物料类型,1: G1, 2: G2, 3: G1+G2
      std::string strPortName;       // 例如 "Port 1"
      std::string strRecipe;         // 例如 "P1001"
      std::string strLotID;
      std::string strProductID;
      std::string strOperationID;
      std::vector<SlotConfig> vecSlot;
   };
   /* EQ Data changed code */
#define EDCC_FETCHOUT_JOB            1000   /* ȡƬ */
#define EDCC_STORED_JOB               1001   /* 放片 */
}