#include "stdafx.h" #include "CEqPortChangeStep.h" #include "Log.h" namespace SERVO { CEqPortChangeStep::CEqPortChangeStep() : CReadStep() { m_nPortDev = 0; m_nPortType = 0; m_nPortMode = 0; m_nPortCassetteType = 0; m_nPortTransferMode = 0; m_nPortEanbleMode = 0; m_nPortTypeAutoChangeMode = 0; } CEqPortChangeStep::~CEqPortChangeStep() { } void CEqPortChangeStep::getAttributeVector(CAttributeVector& attrubutes) { CReadStep::getAttributeVector(attrubutes); unsigned int weight = 31; std::string strTemp; attrubutes.addAttribute(new CAttribute("Port Dev", ("W" + CToolUnits::toHexString(m_nPortDev, strTemp)).c_str(), "", weight++)); attrubutes.addAttribute(new CAttribute("PortType", std::to_string(m_nPortType).c_str(), getPortTypeDescription(strTemp).c_str(), weight++)); attrubutes.addAttribute(new CAttribute("PortMode", std::to_string(m_nPortMode).c_str(), getPortModeDescription(strTemp).c_str(), weight++)); attrubutes.addAttribute(new CAttribute("PortCassetteType", std::to_string(m_nPortCassetteType).c_str(), getPortCassetteTypeDescription(strTemp).c_str(), weight++)); attrubutes.addAttribute(new CAttribute("PortTransferMode", std::to_string(m_nPortTransferMode).c_str(), getPortTransferModeDescription(strTemp).c_str(), weight++)); attrubutes.addAttribute(new CAttribute("PortEnableMode", std::to_string(m_nPortEanbleMode).c_str(), getPortEnableModeDescription(strTemp).c_str(), weight++)); attrubutes.addAttribute(new CAttribute("PortTypeAutoChangeMode", std::to_string(m_nPortTypeAutoChangeMode).c_str(), getPortTypeAutoChangeModeDescription(strTemp).c_str(), weight++)); } int CEqPortChangeStep::onReadData() { CReadStep::onReadData(); char szBuffer[32]; int nRet = m_pCclink->ReadData2(m_station, DeviceType::W, m_nPortDev, 32, szBuffer); if (0 != nRet) { return -1; } m_nPortType = (unsigned int)CToolUnits::toInt16(&szBuffer[0]); m_nPortMode = (unsigned int)CToolUnits::toInt16(&szBuffer[2]); m_nPortCassetteType = (unsigned int)CToolUnits::toInt32(&szBuffer[4]); m_nPortTransferMode = (unsigned int)CToolUnits::toInt16(&szBuffer[8]); m_nPortEanbleMode = (unsigned int)CToolUnits::toInt16(&szBuffer[10]); m_nPortTypeAutoChangeMode = (unsigned int)CToolUnits::toInt16(&szBuffer[12]); /* LOGI(" Equipment Alarm state Changed\n", m_nAlarmState, m_nUnitId, m_nAlarmLevel, m_nAlarmCode, m_nAlarmId, m_strText.c_str(), m_strDescription.c_str()); */ return 0; } int CEqPortChangeStep::onComplete() { CReadStep::onComplete(); LOGI(" onComplete."); return 0; } int CEqPortChangeStep::onTimeout() { CReadStep::onTimeout(); LOGI(" onTimeout."); return 0; } void CEqPortChangeStep::setPortDev(int nDev) { m_nPortDev = nDev; } int CEqPortChangeStep::getPortType() { return m_nPortType; } /* 1: Loading Port 2: Unloading Port 3: Both Port 4: Buffer Port-Buffer Type 5: Buffer Port-Loader in Buffer Type 6: Buffer Port-Un-loader in Buffer Type 7: Unloading Partial Port */ std::string& CEqPortChangeStep::getPortTypeDescription(std::string& strDescription) { switch (m_nPortType) { case 1: strDescription = _T("Loading Port"); break; case 2: strDescription = _T("Unloading Port"); break; case 3: strDescription = _T("Both Port"); break; case 4: strDescription = _T("Buffer Port - Buffer Type"); break; case 5: strDescription = _T("Buffer Port - Loader in Buffer Type"); break; case 6: strDescription = _T("Buffer Port - Un-loader in Buffer Type"); break; case 7: strDescription = _T("Unloading Partial Port"); break; default: strDescription = _T(""); break; } return strDescription; } /* 0: OutOfService 1: TransferBlocked 2: ReadyToLoad 3: ReadyToUnload 4: InService 5: TransferReady */ std::string& CEqPortChangeStep::getPortModeDescription(std::string& strDescription) { switch (m_nPortMode) { case 0: strDescription = _T("OutOfService"); break; case 1: strDescription = _T("TransferBlocked"); break; case 2: strDescription = _T("ReadyToLoad"); break; case 3: strDescription = _T("ReadyToUnload"); break; case 4: strDescription = _T("InService"); break; case 5: strDescription = _T("TransferReady"); break; default: strDescription = _T(""); break; } return strDescription; } /* 1: G1 2: G2 3: G1&G2 */ std::string& CEqPortChangeStep::getPortCassetteTypeDescription(std::string& strDescription) { switch (m_nPortCassetteType) { case 1: strDescription = _T("G1"); break; case 2: strDescription = _T("G2"); break; case 3: strDescription = _T("G1&G2"); break; default: strDescription = _T(""); break; } return strDescription; } /* 1: MGV Mode 2: AGV Mode 3: Stocker Inline Mode */ std::string& CEqPortChangeStep::getPortTransferModeDescription(std::string& strDescription) { switch (m_nPortTransferMode) { case 1: strDescription = _T("MGV Mode"); break; case 2: strDescription = _T("AGV Mode"); break; case 3: strDescription = _T("Stocker Inline Mode"); break; default: strDescription = _T(""); break; } return strDescription; } /* 1 : Enable 2 : Disable */ std::string& CEqPortChangeStep::getPortEnableModeDescription(std::string& strDescription) { switch (m_nPortEanbleMode) { case 1: strDescription = _T("Enable"); break; case 2: strDescription = _T("Disable"); break; default: strDescription = _T(""); break; } return strDescription; } /* 1: Auto Change Enable 2: Auto Change Disable */ std::string& CEqPortChangeStep::getPortTypeAutoChangeModeDescription(std::string& strDescription) { switch (m_nPortTypeAutoChangeMode) { case 1: strDescription = _T("Auto Change Enable"); break; case 2: strDescription = _T("Auto Change Disable"); break; default: strDescription = _T(""); break; } return strDescription; } }