From 410ea79955e2d115643a38f40e006f1aeaba897b Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期六, 26 四月 2025 14:39:23 +0800
Subject: [PATCH] 1.增加CVcrEventStep
---
SourceCode/Bond/Servo/CEqVcrEventStep.cpp | 82 +++++++++++++
SourceCode/Bond/Servo/Servo.vcxproj | 4
SourceCode/Bond/Servo/Servo.vcxproj.filters | 4
SourceCode/Bond/Servo/CEqVcrEventStep.h | 26 ++++
SourceCode/Bond/Servo/CEquipment.cpp | 21 +++
SourceCode/Bond/Servo/CVcrEventReport.h | 32 +++++
SourceCode/Bond/Servo/CMaster.cpp | 20 +++
SourceCode/Bond/Servo/CVcrEventReport.cpp | 119 +++++++++++++++++++
SourceCode/Bond/Servo/CMaster.h | 2
SourceCode/Bond/Servo/Model.cpp | 3
SourceCode/Bond/Servo/CEquipment.h | 4
SourceCode/Bond/Servo/Common.h | 2
12 files changed, 317 insertions(+), 2 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEqVcrEventStep.cpp b/SourceCode/Bond/Servo/CEqVcrEventStep.cpp
new file mode 100644
index 0000000..d98d170
--- /dev/null
+++ b/SourceCode/Bond/Servo/CEqVcrEventStep.cpp
@@ -0,0 +1,82 @@
+#include "stdafx.h"
+#include "CEqVcrEventStep.h"
+#include "Log.h"
+
+
+namespace SERVO {
+ CEqVcrEventStep::CEqVcrEventStep() : CReadStep()
+ {
+ m_nVcrEventReportDev = 0;
+ }
+
+ CEqVcrEventStep::~CEqVcrEventStep()
+ {
+
+ }
+
+ void CEqVcrEventStep::setVcrEventReportDev(int nDev)
+ {
+ m_nVcrEventReportDev = nDev;
+ }
+
+ void CEqVcrEventStep::getAttributeVector(CAttributeVector& attrubutes)
+ {
+ CReadStep::getAttributeVector(attrubutes);
+
+ std::string strTemp;
+ attrubutes.addAttribute(new CAttribute("Dev",
+ ("W" + CToolUnits::toHexString(m_nVcrEventReportDev, strTemp)).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("GlassId",
+ m_vcrEventReport.getGlassId().c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("CassetteSequenceNo",
+ std::to_string(m_vcrEventReport.getCassetteSequenceNo()).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("JobSequenceNo",
+ std::to_string(m_vcrEventReport.getJobSequenceNo()).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("UnitNo",
+ std::to_string(m_vcrEventReport.getUnitNo()).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("VCR No",
+ std::to_string(m_vcrEventReport.getVcrNo()).c_str(), ""));
+ attrubutes.addAttribute(new CAttribute("VCR Result",
+ m_vcrEventReport.getVcrResultDescription(strTemp).c_str(), ""));
+ }
+
+ int CEqVcrEventStep::onReadData()
+ {
+ CReadStep::onReadData();
+
+
+ char szBuffer[64];
+ int nRet = m_pCclink->ReadData2(m_station, DeviceType::W, m_nVcrEventReportDev,
+ 30, szBuffer);
+ if (0 != nRet) {
+ return -1;
+ }
+
+ m_vcrEventReport.unserialize(szBuffer, 60);
+ LOGI("<CEqVcrEventStep-%s>Read VCR Event Report\n", m_strName.c_str());
+
+ return 0;
+ }
+
+ int CEqVcrEventStep::onComplete()
+ {
+ CReadStep::onComplete();
+ LOGI("<CEqVcrEventStep> onComplete.");
+
+ return 0;
+ }
+
+ int CEqVcrEventStep::onTimeout()
+ {
+ CReadStep::onTimeout();
+ LOGI("<CEqVcrEventStep> onTimeout.");
+
+ return 0;
+ }
+
+ CVcrEventReport* CEqVcrEventStep::getVcrEventReport()
+ {
+ return &m_vcrEventReport;
+ }
+}
+
diff --git a/SourceCode/Bond/Servo/CEqVcrEventStep.h b/SourceCode/Bond/Servo/CEqVcrEventStep.h
new file mode 100644
index 0000000..6d8cb63
--- /dev/null
+++ b/SourceCode/Bond/Servo/CEqVcrEventStep.h
@@ -0,0 +1,26 @@
+#pragma once
+#include "CReadStep.h"
+#include "CVcrEventReport.h"
+
+
+namespace SERVO {
+ class CEqVcrEventStep : public CReadStep
+ {
+ public:
+ CEqVcrEventStep();
+ ~CEqVcrEventStep();
+
+ public:
+ virtual void getAttributeVector(CAttributeVector& attrubutes);
+ virtual int onReadData();
+ virtual int onComplete();
+ virtual int onTimeout();
+ void setVcrEventReportDev(int nDev);
+ CVcrEventReport* getVcrEventReport();
+
+ private:
+ int m_nVcrEventReportDev;
+ CVcrEventReport m_vcrEventReport;
+ };
+}
+
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 86a2bf2..f710669 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -23,7 +23,7 @@
CEquipment::CEquipment() : m_nID(0), m_strName(""), m_strDescription(""), m_station(0, 255)
{
- m_listener = { nullptr, nullptr, nullptr, nullptr };
+ m_listener = { nullptr, nullptr, nullptr, nullptr, nullptr };
m_alive = { FALSE, 0, FALSE };
m_bCimState = FALSE;
m_bUpstreamInline = FALSE;
@@ -67,6 +67,7 @@
m_listener.onCimStateChanged = listener.onCimStateChanged;
m_listener.onAlarm = listener.onAlarm;
m_listener.onDataChanged = listener.onDataChanged;
+ m_listener.onVcrEventReport = listener.onVcrEventReport;
}
void CEquipment::setCcLink(CCCLinkIEControl* pCcLink)
@@ -396,6 +397,9 @@
// CIM Message Confirm
CHECK_READ_STEP_SIGNAL(STEP_ID_CIM_MSG_CONFIRM_REPORT, pszData, size);
+ // VCR1 Event report
+ CHECK_READ_STEP_SIGNAL(STEP_ID_VCR1_EVENT_REPORT, pszData, size);
+
// EQ Job Event
CHECK_READ_STEP_SIGNAL(STEP_ID_RECIVE_JOB_UPS1, pszData, size);
CHECK_READ_STEP_SIGNAL(STEP_ID_RECIVE_JOB_UPS2, pszData, size);
@@ -530,6 +534,16 @@
msgId = (value & 0xffff0000 >> 16);
panelNo = (value & 0xffff);
LOGI("Cim Message Confirm(msgID = %d, panel no.=%d).", msgId, panelNo);
+ }
+ else if (isVcrEventStep(pStep)) {
+ SERVO::CEqVcrEventStep* pEqVcrEventStep = (SERVO::CEqVcrEventStep*)pStep;
+ CVcrEventReport* pVcrEventReport = pEqVcrEventStep->getVcrEventReport();
+ ASSERT(pVcrEventReport);
+ if (m_listener.onVcrEventReport != nullptr) {
+ m_listener.onVcrEventReport(this, pVcrEventReport);
+ }
+
+ return 1;
}
}
@@ -784,6 +798,11 @@
return pStep->getName().compare(STEP_EQ_CIM_MESSAGE_CONFIRM) == 0;
}
+ bool CEquipment::isVcrEventStep(SERVO::CStep* pStep)
+ {
+ return pStep->getName().compare(STEP_EQ_VCR1_EVENT_REPORT) == 0;
+ }
+
int CEquipment::setEqMode(short mode)
{
SERVO::CEqModeChangeStep* pStep = (SERVO::CEqModeChangeStep*)getStepWithName(STEP_EQ_MODE_CHANGE);
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 82e21ca..b041c86 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -18,6 +18,7 @@
#include "CEqCassetteTransferStateStep.h"
#include "CEqCassetteCtrlCmdStep.h"
#include "CEqJobEventStep.h"
+#include "CEqVcrEventStep.h"
#include <vector>
#include <map>
#include <list>
@@ -32,12 +33,14 @@
typedef std::function<void(void* pEiuipment, BOOL bAlive)> ONALIVE;
typedef std::function<void(void* pEiuipment, int code)> ONDATACHANGED;
typedef std::function<void(void* pEiuipment, int state, int alarmId, int unitId, int level)> ONALARM;
+ typedef std::function<void(void* pEiuipment, void* pReport)> ONVCREVENTREPORT;
typedef struct _EquipmentListener
{
ONALIVE onAlive;
ONALIVE onCimStateChanged;
ONALARM onAlarm;
ONDATACHANGED onDataChanged;
+ ONVCREVENTREPORT onVcrEventReport;
} EquipmentListener;
// Memory Block 结构体定义
@@ -106,6 +109,7 @@
CGlass* getFrontGlass();
BOOL removeClass(CGlass* pGlass);
bool isAlarmStep(SERVO::CStep* pStep);
+ bool isVcrEventStep(SERVO::CStep* pStep);
bool isCassetteTransferStateStep(SERVO::CStep* pStep);
bool isCimMessageConfirmStep(SERVO::CStep* pStep);
int setEqMode(short mode);
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 9d7a38d..0c7ab7c 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -34,7 +34,7 @@
CMaster::CMaster()
{
- m_listener = {nullptr, nullptr, nullptr};
+ m_listener = {nullptr, nullptr, nullptr, nullptr};
m_bDataModify = FALSE;
m_hEventReadBitsThreadExit[0] = ::CreateEvent(NULL, TRUE, FALSE, NULL);
m_hEventReadBitsThreadExit[1] = ::CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -65,6 +65,7 @@
m_listener.onEqAlive = listener.onEqAlive;
m_listener.onEqCimStateChanged = listener.onEqCimStateChanged;
m_listener.onEqAlarm = listener.onEqAlarm;
+ m_listener.onEqVcrEventReport = listener.onEqVcrEventReport;
}
int CMaster::init()
@@ -197,6 +198,13 @@
CEquipment* p = (CEquipment*)pEquipment;
if (m_listener.onEqAlarm != nullptr) {
m_listener.onEqAlarm(this, p, state, alarmId, unitId, level);
+ }
+ };
+ listener.onVcrEventReport = [&](void* pEquipment, void* pReport) -> void {
+ CEquipment* p = (CEquipment*)pEquipment;
+ CVcrEventReport* p2 = (CVcrEventReport*)pReport;
+ if (m_listener.onEqVcrEventReport != nullptr) {
+ m_listener.onEqVcrEventReport(this, p, p2);
}
};
listener.onDataChanged = [&](void* pEquipment, int code) -> void {
@@ -433,6 +441,16 @@
}
}
{
+ // VCR1 Event Report
+ CEqVcrEventStep* pStep = new CEqVcrEventStep();
+ pStep->setName(STEP_EQ_VCR1_EVENT_REPORT);
+ pStep->setWriteSignalDev(0x4a);
+ pStep->setVcrEventReportDev(0x5fef);
+ if (pEquipment->addStep(STEP_ID_VCR1_EVENT_REPORT, pStep) != 0) {
+ delete pStep;
+ }
+ }
+ {
CEqCimMessageClearStep* pStep = new CEqCimMessageClearStep();
pStep->setName(STEP_CIM_MESSAGE_CLEAR);
pStep->setWriteSignalDev(0x72);
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index fa79fce..073a460 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -15,11 +15,13 @@
typedef std::function<void(void* pMaster, CEquipment* pEiuipment, BOOL bAlive)> ONEQALIVE;
typedef std::function<void(CStep* pStep, int code, void* pData)> ONEQSTEPEVENT;
typedef std::function<void(void* pMaster, CEquipment* pEquipment, int state, int alarmId, int unitId, int level)> ONEQALARM;
+ typedef std::function<void(void* pMaster, CEquipment* pEquipment, CVcrEventReport* pReport)> ONEQVCREVENTREPORT;
typedef struct _MasterListener
{
ONEQALIVE onEqAlive;
ONEQALIVE onEqCimStateChanged;
ONEQALARM onEqAlarm;
+ ONEQVCREVENTREPORT onEqVcrEventReport;
} MasterListener;
class CMaster
diff --git a/SourceCode/Bond/Servo/CVcrEventReport.cpp b/SourceCode/Bond/Servo/CVcrEventReport.cpp
new file mode 100644
index 0000000..914b0d0
--- /dev/null
+++ b/SourceCode/Bond/Servo/CVcrEventReport.cpp
@@ -0,0 +1,119 @@
+#include "stdafx.h"
+#include "CVcrEventReport.h"
+#include "ToolUnits.h"
+
+
+namespace SERVO {
+ CVcrEventReport::CVcrEventReport()
+ {
+
+ }
+
+ CVcrEventReport::~CVcrEventReport()
+ {
+
+ }
+
+ std::string& CVcrEventReport::getGlassId()
+ {
+ return m_strGlassId;
+ }
+
+ short CVcrEventReport::getCassetteSequenceNo()
+ {
+ return m_nCassetteSequenceNo;
+ }
+
+ short CVcrEventReport::getJobSequenceNo()
+ {
+ return m_nJobSequenceNo;
+ }
+
+ short CVcrEventReport::getUnitNo()
+ {
+ return m_nUnitNo;
+ }
+
+ short CVcrEventReport::getVcrNo()
+ {
+ return m_nVcrNo;
+ }
+
+ short CVcrEventReport::getVcrResult()
+ {
+ return m_nVcrResult;
+ }
+
+ int CVcrEventReport::serialize(char* pszBuffer, int nBufferSize)
+ {
+ if (nBufferSize < 640) return -1;
+
+ int index = 0;
+ int strLen = min(20, m_strGlassId.size());
+ memcpy(&pszBuffer[index], m_strGlassId.c_str(), strLen);
+ index += 20;
+
+ memcpy(&pszBuffer[index], &m_nCassetteSequenceNo, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nJobSequenceNo, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nUnitNo, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nVcrNo, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nVcrResult, sizeof(short));
+ index += sizeof(short);
+
+ return 15 * 2;
+ }
+
+ int CVcrEventReport::unserialize(char* pszBuffer, int nBufferSize)
+ {
+ if (nBufferSize < 640) return -1;
+
+ int index = 0;
+ CToolUnits::convertString(&pszBuffer[index], 20, m_strGlassId);
+ index += 20;
+
+ memcpy(&m_nCassetteSequenceNo, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nJobSequenceNo, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nUnitNo, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nVcrNo, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nVcrResult, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ return 15 * 2;
+ }
+
+ std::string& CVcrEventReport::getVcrResultDescription(std::string& strDescription)
+ {
+ static char* pszDescription[4] = {
+ "VCR Reading OK & Match With Job Data Glass ID",
+ "VCR Reading OK & Miss Match With Job Data Glass ID",
+ "VCR Reading Fail & Key In & Match With Job Data Glass ID",
+ "VCR Reading Fail & Key In & Miss Match With Job Data Glass ID"
+ };
+
+ if (1 <= m_nVcrResult && m_nVcrResult <= 4) {
+ strDescription = pszDescription[m_nVcrResult - 1];
+ }
+ else {
+ strDescription = "";
+ }
+
+ return strDescription;
+ }
+}
+
diff --git a/SourceCode/Bond/Servo/CVcrEventReport.h b/SourceCode/Bond/Servo/CVcrEventReport.h
new file mode 100644
index 0000000..275cf30
--- /dev/null
+++ b/SourceCode/Bond/Servo/CVcrEventReport.h
@@ -0,0 +1,32 @@
+#pragma once
+#include <string>
+
+
+namespace SERVO {
+ class CVcrEventReport
+ {
+ public:
+ CVcrEventReport();
+ ~CVcrEventReport();
+
+ public:
+ std::string& getGlassId();
+ short getCassetteSequenceNo();
+ short getJobSequenceNo();
+ short getUnitNo();
+ short getVcrNo();
+ short getVcrResult();
+ std::string& getVcrResultDescription(std::string& strDescription);
+ int serialize(char* pszBuffer, int nBufferSize);
+ int unserialize(char* pszBuffer, int nBufferSize);
+
+ private:
+ std::string m_strGlassId; // Read Data
+ short m_nCassetteSequenceNo;
+ short m_nJobSequenceNo;
+ short m_nUnitNo;
+ short m_nVcrNo;
+ short m_nVcrResult;
+ };
+}
+
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index a4bb8e1..c42851a 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -137,6 +137,7 @@
#define STEP_EQ_RECEIVED_JOB_UPS2 _T("EQJEReceivedJobUps2")
#define STEP_EQ_SENT_OUT_JOB_DOWNS1 _T("EQJESentOutJobDowns1")
#define STEP_EQ_SENT_OUT_JOB_DOWNS2 _T("EQJESentOutJobDowns2")
+#define STEP_EQ_VCR1_EVENT_REPORT _T("EQVcr1EventReport")
/* Step ID */
@@ -155,6 +156,7 @@
#define STEP_ID_EQALARM5 0x566
#define STEP_ID_PROCESS_DATA_REPORT 0x567
#define STEP_ID_CIM_MSG_CONFIRM_REPORT 0x569
+#define STEP_ID_VCR1_EVENT_REPORT 0x56A
#define STEP_ID_RECIVE_JOB_UPS1 0x580
#define STEP_ID_RECIVE_JOB_UPS2 0x581
#define STEP_ID_SENT_OUT_JOB_DOWNS1 0x590
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 9ef4836..5dab65a 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -149,6 +149,9 @@
pEquipment->getBaseAlarmId() + alarmId,
strAlarmText.c_str());
};
+ masterListener.onEqVcrEventReport = [&](void* pMaster, SERVO::CEquipment* pEquipment, SERVO::CVcrEventReport* pReport) {
+ LOGE("<CModel>onEqVcrEventReport.");
+ };
m_master.setListener(masterListener);
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index 5944a3f..1802cf0 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -223,6 +223,7 @@
<ClInclude Include="CEquipmentPage1.h" />
<ClInclude Include="CEquipmentPage2.h" />
<ClInclude Include="CEqVCREnableStep.h" />
+ <ClInclude Include="CEqVcrEventStep.h" />
<ClInclude Include="CFliper.h" />
<ClInclude Include="CGlass.h" />
<ClInclude Include="CHMPropertyDlg.h" />
@@ -246,6 +247,7 @@
<ClInclude Include="CSample.h" />
<ClInclude Include="CStep.h" />
<ClInclude Include="CVacuumBake.h" />
+ <ClInclude Include="CVcrEventReport.h" />
<ClInclude Include="CWriteStep.h" />
<ClInclude Include="DevicePropertyDlg.h" />
<ClInclude Include="CEFEM.h" />
@@ -306,6 +308,7 @@
<ClCompile Include="CEquipmentPage1.cpp" />
<ClCompile Include="CEquipmentPage2.cpp" />
<ClCompile Include="CEqVCREnableStep.cpp" />
+ <ClCompile Include="CEqVcrEventStep.cpp" />
<ClCompile Include="CFliper.cpp" />
<ClCompile Include="CGlass.cpp" />
<ClCompile Include="CHMPropertyDlg.cpp" />
@@ -329,6 +332,7 @@
<ClCompile Include="CSample.cpp" />
<ClCompile Include="CStep.cpp" />
<ClCompile Include="CVacuumBake.cpp" />
+ <ClCompile Include="CVcrEventReport.cpp" />
<ClCompile Include="CWriteStep.cpp" />
<ClCompile Include="DevicePropertyDlg.cpp" />
<ClCompile Include="CEFEM.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index 576e90a..2f428f0 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -89,6 +89,8 @@
<ClCompile Include="CJobDataB.cpp" />
<ClCompile Include="CJobDataC.cpp" />
<ClCompile Include="CJobDataS.cpp" />
+ <ClCompile Include="CVcrEventReport.cpp" />
+ <ClCompile Include="CEqVcrEventStep.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AlarmManager.h" />
@@ -176,6 +178,8 @@
<ClInclude Include="CJobDataB.h" />
<ClInclude Include="CJobDataC.h" />
<ClInclude Include="CJobDataS.h" />
+ <ClInclude Include="CVcrEventReport.h" />
+ <ClInclude Include="CEqVcrEventStep.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Servo.rc" />
--
Gitblit v1.9.3