| | |
| | | #include "stdafx.h" |
| | | #include "CEFEM.h" |
| | | #include "Log.h" |
| | | |
| | | |
| | | #define ADD_EQ_CASSETTE_TRANSFER_STATE_STEP(name,ws,index,psd) { \ |
| | |
| | | if (index < 2) { |
| | | m_pArmTray[index] = pArmTray; |
| | | } |
| | | } |
| | | |
| | | int CEFEM::robotCmd(ROBOT_CMD_PARAM& robotCmdParam, ONWRITED onWritedBlock/* = nullptr*/) |
| | | { |
| | | SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EFEM_ROBOT_CMD); |
| | | if (pStep == nullptr) { |
| | | return -1; |
| | | } |
| | | |
| | | LOGI("<CEFEM-%s>准备发送RobotCmd<%d>", m_strName.c_str(), (int)robotCmdParam.rcmd); |
| | | if (onWritedBlock != nullptr) { |
| | | pStep->writeDataEx((const char*)&robotCmdParam, ROBOT_CMD_PARAM_SIZE, onWritedBlock); |
| | | } |
| | | else { |
| | | pStep->writeDataEx((const char*)&robotCmdParam, ROBOT_CMD_PARAM_SIZE, [&](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI("<CEFEM-%s>发送RobotCmd成功.", m_strName.c_str()); |
| | | } |
| | | else { |
| | | LOGI("<CEFEM-%s>发送RobotCmd失败,code:%d", m_strName.c_str(), code); |
| | | } |
| | | |
| | | return 0; |
| | | }); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CEFEM::robotCmds(ROBOT_CMD_PARAM* robotCmdParam, unsigned int count, ONWRITED onWritedBlock/* = nullptr*/) |
| | | { |
| | | SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EFEM_ROBOT_CMD); |
| | | if (pStep == nullptr) { |
| | | return -1; |
| | | } |
| | | |
| | | |
| | | // 平铺到内存中,如果ROBOT_CMD_PARAM不是4的整数倍,只能一个一个复制 |
| | | std::string strLog = "准备发送RobotCmds<"; |
| | | char szBuffer[ROBOT_CMD_PARAM_SIZE * 4]; |
| | | for (int i = 0; i < min(4, count); i++) { |
| | | memcpy(&szBuffer[i * ROBOT_CMD_PARAM_SIZE], (robotCmdParam + i), ROBOT_CMD_PARAM_SIZE); |
| | | strLog += std::to_string((robotCmdParam + i)->rcmd); |
| | | strLog += ","; |
| | | LOGI("%d", (robotCmdParam + 1)->rcmd); |
| | | } |
| | | strLog += ">."; |
| | | LOGI("<CEFEM-%s>%s", m_strName.c_str(), strLog.c_str()); |
| | | |
| | | |
| | | if (onWritedBlock != nullptr) { |
| | | pStep->writeDataEx(szBuffer, ROBOT_CMD_PARAM_SIZE * min(4, count), onWritedBlock); |
| | | } |
| | | else { |
| | | pStep->writeDataEx(szBuffer, ROBOT_CMD_PARAM_SIZE * min(4, count), [&](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI("<CEquipment-%s>发送RobotCmdS成功.", m_strName.c_str()); |
| | | } |
| | | else { |
| | | LOGI("<CEquipment-%s>发送RobotCmds失败,code:%d", m_strName.c_str(), code); |
| | | } |
| | | |
| | | return 0; |
| | | }); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CEFEM::init() |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | { |
| | | // Dispatching Mode Change Command |
| | | CEqWriteStep* pStep = new CEqWriteStep(); |
| | | pStep->setName(STEP_EQ_DISPATCHINT_MODE_CHANGE); |
| | | pStep->setWriteSignalDev(0x071); |
| | | pStep->setDataDev(0x5c6); |
| | | if (addStep(STEP_ID_DISPATCHING_MODE_CHANGE_REPLY, pStep) != 0) { |
| | | delete pStep; |
| | | } |
| | | } |
| | | |
| | | { |
| | | // Robot CMD |
| | | CEqWriteStep* pStep = new CEqWriteStep(); |
| | | pStep->setName(STEP_EFEM_ROBOT_CMD); |
| | | pStep->setWriteSignalDev(0x14D); |
| | | pStep->setDataDev(0x90a); |
| | | if (addStep(STEP_ID_ROBOT_CMD_REPLY, pStep) != 0) { |
| | | delete pStep; |
| | | } |
| | | } |
| | | } |
| | | |
| | | int CEFEM::onStepEvent(CStep* pStep, int code) |
| | |
| | | } |
| | | } |
| | | |
| | | int CEFEM::onFetchedOutJob(int port, const char* pszGlassId) |
| | | int CEFEM::onReceivedJob(int port, CJobDataS* pJobDataS) |
| | | { |
| | | m_pPort[0]->onReceivedJob(port, pJobDataS); |
| | | m_pPort[1]->onReceivedJob(port, pJobDataS); |
| | | m_pPort[2]->onReceivedJob(port, pJobDataS); |
| | | m_pPort[3]->onReceivedJob(port, pJobDataS); |
| | | m_pArmTray[0]->onReceivedJob(port, pJobDataS); |
| | | m_pArmTray[1]->onReceivedJob(port, pJobDataS); |
| | | m_pAligner->onReceivedJob(port, pJobDataS); |
| | | m_pFliper->onReceivedJob(port, pJobDataS); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CEFEM::onSentOutJob(int port, CJobDataS* pJobDataS) |
| | | { |
| | | m_pPort[0]->onSentOutJob(port, pJobDataS); |
| | | m_pPort[1]->onSentOutJob(port, pJobDataS); |
| | | m_pPort[2]->onSentOutJob(port, pJobDataS); |
| | | m_pPort[3]->onSentOutJob(port, pJobDataS); |
| | | m_pArmTray[0]->onSentOutJob(port, pJobDataS); |
| | | m_pArmTray[1]->onSentOutJob(port, pJobDataS); |
| | | m_pAligner->onSentOutJob(port, pJobDataS); |
| | | m_pFliper->onSentOutJob(port, pJobDataS); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CEFEM::onFetchedOutJob(int port, CJobDataB* pJobDataB) |
| | | { |
| | | if (port == 1) { |
| | | return m_pPort[0]->fetchedOutJob(pszGlassId); |
| | | return m_pPort[0]->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | if (port == 2) { |
| | | return m_pPort[1]->fetchedOutJob(pszGlassId); |
| | | return m_pPort[1]->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | if (port == 3) { |
| | | return m_pPort[2]->fetchedOutJob(pszGlassId); |
| | | return m_pPort[2]->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | if (port == 4) { |
| | | return m_pPort[3]->fetchedOutJob(pszGlassId); |
| | | return m_pPort[3]->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | if (port == 5) { |
| | | return m_pArmTray[0]->fetchedOutJob(pszGlassId); |
| | | return m_pArmTray[0]->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | if (port == 6) { |
| | | return m_pArmTray[1]->fetchedOutJob(pszGlassId); |
| | | return m_pArmTray[1]->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | if (port == 7) { |
| | | return m_pAligner->fetchedOutJob(pszGlassId); |
| | | return m_pAligner->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | if (port == 8) { |
| | | return m_pFliper->fetchedOutJob(pszGlassId); |
| | | return m_pFliper->onFetchedOutJob(port, pJobDataB); |
| | | } |
| | | |
| | | return -1; |
| | | } |
| | | |
| | | int CEFEM::onStoreJob(int port, const char* pszGlassId) |
| | | int CEFEM::onStoredJob(int port, CJobDataB* pJobDataB) |
| | | { |
| | | if (port == 1) { |
| | | return m_pPort[0]->storedJob(pszGlassId); |
| | | return m_pPort[0]->onStoredJob(port, pJobDataB); |
| | | } |
| | | if (port == 2) { |
| | | return m_pPort[1]->storedJob(pszGlassId); |
| | | return m_pPort[1]->onStoredJob(port, pJobDataB); |
| | | } |
| | | if (port == 3) { |
| | | return m_pPort[2]->storedJob(pszGlassId); |
| | | return m_pPort[2]->onStoredJob(port, pJobDataB); |
| | | } |
| | | if (port == 4) { |
| | | return m_pPort[3]->storedJob(pszGlassId); |
| | | return m_pPort[3]->onStoredJob(port, pJobDataB); |
| | | } |
| | | if (port == 5) { |
| | | return m_pArmTray[0]->storedJob(pszGlassId); |
| | | return m_pArmTray[0]->onStoredJob(port, pJobDataB); |
| | | } |
| | | if (port == 6) { |
| | | return m_pArmTray[1]->storedJob(pszGlassId); |
| | | return m_pArmTray[1]->onStoredJob(port, pJobDataB); |
| | | } |
| | | if (port == 7) { |
| | | return m_pAligner->storedJob(pszGlassId); |
| | | return m_pAligner->onStoredJob(port, pJobDataB); |
| | | } |
| | | if (port == 8) { |
| | | return m_pFliper->storedJob(pszGlassId); |
| | | return m_pFliper->onStoredJob(port, pJobDataB); |
| | | } |
| | | |
| | | return -1; |