LAPTOP-SNT8I5JK\Boounion
2025-04-26 410ea79955e2d115643a38f40e006f1aeaba897b
1.增加CVcrEventStep
已添加4个文件
已修改8个文件
319 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CEqVcrEventStep.cpp 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEqVcrEventStep.h 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.cpp 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CVcrEventReport.cpp 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CVcrEventReport.h 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Common.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj.filters 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
    }
}
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;
    };
}
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);
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);
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);
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
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;
    }
}
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;
    };
}
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
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);
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" />
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" />