From 1bc4fecb9cc1641ed3ad0a2fda30766fc06fb13e Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 01 四月 2025 16:05:07 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/Servo/CEqCassetteTransferStateStep.cpp | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 293 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEqCassetteTransferStateStep.cpp b/SourceCode/Bond/Servo/CEqCassetteTransferStateStep.cpp
new file mode 100644
index 0000000..22c85a7
--- /dev/null
+++ b/SourceCode/Bond/Servo/CEqCassetteTransferStateStep.cpp
@@ -0,0 +1,293 @@
+#include "stdafx.h"
+#include "CEqCassetteTransferStateStep.h"
+#include "Log.h"
+#include "Common.h"
+
+
+namespace SERVO {
+ CEqCassetteTransferStateStep::CEqCassetteTransferStateStep()
+ {
+ m_nPortStatusDev = 0;
+ m_nPortStatus = 0;
+ m_nCassetteSequenceNo = 0;
+ m_nLoadingCassetteType = 0;
+ m_nQTimeFlag = 0;
+ m_nCassetteMappingState = 0;
+ m_nCassetteStatus = 0;
+ }
+
+ CEqCassetteTransferStateStep::~CEqCassetteTransferStateStep()
+ {
+
+ }
+
+ void CEqCassetteTransferStateStep::getAttributeVector(CAttributeVector& attrubutes)
+ {
+ CReadStep::getAttributeVector(attrubutes);
+
+ std::string strTemp;
+ attrubutes.addAttribute(new CAttribute("Dev",
+ ("W" + CToolUnits::toHexString(m_nPortStatusDev, strTemp)).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("Port Status",
+ getPortStatusDescription(strTemp).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("CassetteSequenceNo",
+ std::to_string(m_nCassetteSequenceNo).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("CassetteID",
+ m_strCassetteID.c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("LoadingCassetteType",
+ getLoadingCassetteTypeDescription(strTemp).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("Q-Time Flag",
+ getQTimeFlagDescription(strTemp).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("CassetteMappingState",
+ getCassetteMappingStateDescription(strTemp).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("CassetteStatus",
+ getCassetteStatusDescription(strTemp).c_str(), ""));
+ }
+
+ int CEqCassetteTransferStateStep::onReadData()
+ {
+ CReadStep::onReadData();
+
+
+ char szBuffer[64];
+ int nRet = m_pCclink->ReadData2(m_station, DeviceType::W, m_nPortStatusDev,
+ 64, szBuffer);
+ if (0 != nRet) {
+ return -1;
+ }
+
+
+ // Port status,
+ // 注:也可以根据m_nSignalType的值来判断状态值
+ m_nPortStatus = (unsigned int)CToolUnits::toInt16(&szBuffer[0]);
+
+
+ // Cassette序号、ID
+ m_nCassetteSequenceNo = (unsigned int)CToolUnits::toInt16(&szBuffer[2]);
+ convertString(&szBuffer[4], 20, m_strCassetteID);
+
+
+ // Job Existence Slot
+ if (PORT_INUSE == m_nPortStatus) {
+
+ }
+
+
+ // Q-Time
+ if (PORT_UNLOAD_READY == m_nPortStatus) {
+ m_nQTimeFlag = (unsigned int)CToolUnits::toInt16(&szBuffer[50]);
+ }
+
+ // 其它
+ m_nCassetteMappingState = (unsigned int)CToolUnits::toInt16(&szBuffer[52]);
+ m_nCassetteStatus = (unsigned int)CToolUnits::toInt16(&szBuffer[54]);
+ if (m_nCassetteStatus > 1) {
+ m_nLoadingCassetteType = (unsigned int)CToolUnits::toInt16(&szBuffer[48]);
+ }
+
+
+ LOGI("<CCassetteTranserStateStep>Port status changed<Dev:%d, Status:%d, CassetteSequenceNo:%d>",
+ m_nPortStatusDev, m_nPortStatus, m_nCassetteSequenceNo);
+
+ return 0;
+ }
+
+ int CEqCassetteTransferStateStep::onComplete()
+ {
+ CReadStep::onComplete();
+ LOGI("<CCassetteTranserStateStep> onComplete.");
+
+ return 0;
+ }
+
+ int CEqCassetteTransferStateStep::onTimeout()
+ {
+ CReadStep::onTimeout();
+ LOGI("<CCassetteTranserStateStep> onTimeout.");
+
+ return 0;
+ }
+
+ void CEqCassetteTransferStateStep::setPortStatusDev(int nDev)
+ {
+ m_nPortStatusDev = nDev;
+ }
+
+ int CEqCassetteTransferStateStep::getPortStatus()
+ {
+ return m_nPortStatus;
+ }
+
+ int CEqCassetteTransferStateStep::getCassetteSequenceNo()
+ {
+ return m_nCassetteSequenceNo;
+ }
+
+ std::string& CEqCassetteTransferStateStep::getCassetteID()
+ {
+ return m_strCassetteID;
+ }
+
+ int CEqCassetteTransferStateStep::getLoadingCassetteType()
+ {
+ return m_nLoadingCassetteType;
+ }
+
+ int CEqCassetteTransferStateStep::getQTimeFlag()
+ {
+ return m_nQTimeFlag;
+ }
+
+ int CEqCassetteTransferStateStep::getCassetteMappingState()
+ {
+ return m_nCassetteMappingState;
+ }
+
+ int CEqCassetteTransferStateStep::getCassetteStatus()
+ {
+ return m_nCassetteStatus;
+ }
+
+ /*
+ 1: Load Ready(Load Request)
+ 2: Loaded
+ 3: In Use (Load Complete)
+ 4: Unload Ready (Unload Request)
+ 5: Empty (Unload Complete)
+ 6: Blocked
+ */
+ std::string& CEqCassetteTransferStateStep::getPortStatusDescription(std::string& strDescription)
+ {
+ switch (m_nPortStatus) {
+ case PORT_LOAD_READY:
+ strDescription = _T("Load Ready(Load Request)");
+ break;
+ case PORT_LOADED:
+ strDescription = _T("Loaded");
+ break;
+ case PORT_INUSE:
+ strDescription = _T("In Use (Load Complete)");
+ break;
+ case PORT_UNLOAD_READY:
+ strDescription = _T("Unload Ready (Unload Request)");
+ break;
+ case PORT_EMPTY:
+ strDescription = _T("Empty (Unload Complete)");
+ break;
+ case PORT_BLOCKED:
+ strDescription = _T("Blocked");
+ break;
+ default:
+ strDescription = _T("");
+ break;
+ }
+
+ return strDescription;
+ }
+
+ /*
+ 1: Actual Cassette
+ 2: Empty Cassette
+ *Include this item only when cassette exists
+ */
+ std::string& CEqCassetteTransferStateStep::getLoadingCassetteTypeDescription(std::string& strDescription)
+ {
+ switch (m_nLoadingCassetteType) {
+ case PORT_LOADING_CASSETTE_ACTUAL:
+ strDescription = _T("Actual Cassette");
+ break;
+ case PORT_LOADING_CASSETTE_EMPTY:
+ strDescription = _T("Empty Cassette");
+ break;
+ default:
+ strDescription = _T("");
+ break;
+ }
+
+ return strDescription;
+ }
+
+ /*
+ 1: Normal Un-loading
+ 2: Q-Time Over & Un-loading
+ * Include this item only when Port Status is 'Unload Ready'
+ */
+ std::string& CEqCassetteTransferStateStep::getQTimeFlagDescription(std::string& strDescription)
+ {
+ switch (m_nQTimeFlag) {
+ case Q_TIME_NORMAL:
+ strDescription = _T("Normal Un-loading");
+ break;
+ case Q_TIME_OVER:
+ strDescription = _T("Q-Time Over & Un-loading");
+ break;
+ default:
+ strDescription = _T("");
+ break;
+ }
+
+ return strDescription;
+ }
+
+ /*
+ 1: mapping use
+ 2: mapping not use
+ */
+ std::string& CEqCassetteTransferStateStep::getCassetteMappingStateDescription(std::string& strDescription)
+ {
+ switch (m_nCassetteMappingState) {
+ case CASSETTE_MAPPING_USE:
+ strDescription = _T("mapping use");
+ break;
+ case CASSETTE_MAPPING_NOT_USE:
+ strDescription = _T("mapping not use");
+ break;
+ default:
+ strDescription = _T("");
+ break;
+ }
+
+ return strDescription;
+ }
+
+ /*
+ 1: No Cassette Exist
+ 2: Waiting for Cassette Data
+ 3: Waiting for Start Command
+ 4: Waiting for Processing
+ 5: In Processing
+ 6: Process Paused
+ 7: Process Completed
+ */
+ std::string& CEqCassetteTransferStateStep::getCassetteStatusDescription(std::string& strDescription)
+ {
+ switch (m_nCassetteStatus) {
+ case CASSETTE_NO_EXIST:
+ strDescription = _T("No Cassette Exist");
+ break;
+ case CASSETTE_WAITING_DATA:
+ strDescription = _T("Waiting for Cassette Data");
+ break;
+ case CASSETTE_WAITING_START:
+ strDescription = _T("Waiting for Start Command");
+ break;
+ case CASSETTE_WAITING_PROCCESSING:
+ strDescription = _T("Waiting for Processing");
+ break;
+ case CASSETTE_IN_PROCCESSING:
+ strDescription = _T("In Processing");
+ break;
+ case CASSETTE_PROCCESS_PAUSED:
+ strDescription = _T("Process Paused");
+ break;
+ case CASSETTE_PROCCESS_COMPLETED:
+ strDescription = _T("Process Completed");
+ break;
+ default:
+ strDescription = _T("");
+ break;
+ }
+
+ return strDescription;
+ }
+}
--
Gitblit v1.9.3