| | |
| | | |
| | | |
| | | // 初始化添加各子设备 |
| | | addLoadPort(0, listener); |
| | | addLoadPort(1, listener); |
| | | addLoadPort(2, listener); |
| | | addLoadPort(3, listener); |
| | | addFliper(listener); |
| | | addVacuumBake(listener); |
| | | addAligner(listener); |
| | | addEFEM(listener); |
| | | addBonder(0, listener); |
| | | addBonder(1, listener); |
| | | addBakeCooling(listener); |
| | | connectEquipments(); |
| | | |
| | | |
| | | // 读缓存数据 |
| | | readCache(); |
| | | |
| | | |
| | | // 定时器 |
| | |
| | | for (auto item : m_listEquipment) { |
| | | item->term(); |
| | | } |
| | | saveCache(); |
| | | |
| | | |
| | | return 0; |
| | | } |
| | |
| | | int CMaster::addLoadPort(int index, StepListener& listener) |
| | | { |
| | | ASSERT(index == 0 || index == 1 || index == 2 || index == 3); |
| | | char szName[62]; |
| | | char szName[64]; |
| | | sprintf_s(szName, 64, "LoadPort %d", index + 1); |
| | | CLoadPort* pEquipment = new CLoadPort(); |
| | | pEquipment->setID(EQ_ID_LOADPORT1 + index); |
| | | pEquipment->setName(szName); |
| | | pEquipment->setDescription(szName); |
| | | addToEquipmentList(pEquipment); |
| | |
| | | LOGE("已添加“%s”.", pEquipment->getName().c_str()); |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::addFliper(StepListener& listener) |
| | | { |
| | | CFliper* pEquipment = new CFliper(); |
| | | pEquipment->setID(EQ_ID_FLIPER); |
| | | pEquipment->setBaseAlarmId(BASE_ALARM_EFEM); |
| | | pEquipment->setName("Fliper"); |
| | | pEquipment->setDescription("Fliper."); |
| | | pEquipment->setReadBitBlock(0x4000, 0x45ff); |
| | | pEquipment->setStation(0, 255); |
| | | addToEquipmentList(pEquipment); |
| | | |
| | | |
| | | pEquipment->init(); |
| | | LOGE("已添加“Fliper”."); |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::addVacuumBake(StepListener& listener) |
| | | { |
| | | CVacuumBake* pEquipment = new CVacuumBake(); |
| | | pEquipment->setID(EQ_ID_VACUUMBAKE); |
| | | pEquipment->setBaseAlarmId(BASE_ALARM_EFEM); |
| | | pEquipment->setName("VacuumBake"); |
| | | pEquipment->setDescription("VacuumBake."); |
| | | pEquipment->setReadBitBlock(0x4000, 0x45ff); |
| | | pEquipment->setStation(0, 255); |
| | | addToEquipmentList(pEquipment); |
| | | |
| | | |
| | | pEquipment->init(); |
| | | LOGE("已添加“VacuumBake”."); |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::addAligner(StepListener& listener) |
| | | { |
| | | CAligner* pEquipment = new CAligner(); |
| | | pEquipment->setID(EQ_ID_ALIGNER); |
| | | pEquipment->setBaseAlarmId(BASE_ALARM_EFEM); |
| | | pEquipment->setName("Aligner"); |
| | | pEquipment->setDescription("Aligner."); |
| | | pEquipment->setReadBitBlock(0x4000, 0x45ff); |
| | | pEquipment->setStation(0, 255); |
| | | addToEquipmentList(pEquipment); |
| | | |
| | | |
| | | pEquipment->init(); |
| | | LOGE("已添加“Aligner”."); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | { |
| | | ASSERT(index == 0 || index == 1); |
| | | CBonder* pEquipment = new CBonder(); |
| | | pEquipment->setID(EQ_ID_Bonder1 + index); |
| | | pEquipment->setName(index == 0 ? "Bonder 1" : "Bonder 2"); |
| | | pEquipment->setDescription(index == 0 ? "Bonder 1." : "Bonder 2."); |
| | | pEquipment->setStation(1, index == 0 ? 3 : 4); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::addBakeCooling(StepListener& listener) |
| | | { |
| | | CBakeCooling* pEquipment = new CBakeCooling(); |
| | | pEquipment->setID(EQ_ID_BAKE_COOLING); |
| | | pEquipment->setBaseAlarmId(BASE_ALARM_EFEM); |
| | | pEquipment->setName("BakeCooling"); |
| | | pEquipment->setDescription("BakeCooling."); |
| | | pEquipment->setReadBitBlock(0x4000, 0x45ff); |
| | | pEquipment->setStation(0, 255); |
| | | addToEquipmentList(pEquipment); |
| | | |
| | | |
| | | pEquipment->init(); |
| | | LOGE("已添加“Aligner”."); |
| | | return 0; |
| | | } |
| | | |
| | | void CMaster::onTimer(UINT nTimerid) |
| | | { |
| | | for (auto item : m_listEquipment) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 自动保存缓存 |
| | | saveCache(); |
| | | } |
| | | |
| | | void CMaster::connectEquipments() |
| | | { |
| | | int nRet; |
| | | CLoadPort* pLoadPort1 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT1); |
| | | CLoadPort* pLoadPort2 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT2); |
| | | CLoadPort* pLoadPort3 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT3); |
| | | CLoadPort* pLoadPort4 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT4); |
| | | CFliper* pFliper = (CFliper*)getEquipment(EQ_ID_FLIPER); |
| | | CVacuumBake* pVacuumBake = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE); |
| | | CAligner* pAligner = (CAligner*)getEquipment(EQ_ID_ALIGNER); |
| | | CBonder* pBonder1 = (CBonder*)getEquipment(EQ_ID_Bonder1); |
| | | CBonder* pBonder2 = (CBonder*)getEquipment(EQ_ID_Bonder2); |
| | | CBakeCooling* pBakeCooling = (CBakeCooling*)getEquipment(EQ_ID_BAKE_COOLING); |
| | | |
| | | nRet = pLoadPort1->getPin("Out1")->connectPin(pFliper->getPin("In1")); |
| | | if (nRet < 0) { |
| | | LOGE("连接LoadPort1-Fliper失败"); |
| | | } |
| | | nRet = pLoadPort2->getPin("Out1")->connectPin(pFliper->getPin("In2")); |
| | | if (nRet < 0) { |
| | | LOGE("连接LoadPort1-Fliper失败"); |
| | | } |
| | | |
| | | nRet = pLoadPort1->getPin("Out2")->connectPin(pVacuumBake->getPin("In1")); |
| | | if (nRet < 0) { |
| | | LOGE("连接LoadPort1-VacuumBake失败"); |
| | | } |
| | | nRet = pLoadPort2->getPin("Out2")->connectPin(pVacuumBake->getPin("In2")); |
| | | if (nRet < 0) { |
| | | LOGE("连接LoadPort1-VacuumBake失败"); |
| | | } |
| | | |
| | | nRet = pFliper->getPin("Out")->connectPin(pAligner->getPin("In1")); |
| | | if (nRet < 0) { |
| | | LOGE("连接Fliper-Aligner失败"); |
| | | } |
| | | |
| | | nRet = pVacuumBake->getPin("Out")->connectPin(pAligner->getPin("In2")); |
| | | if (nRet < 0) { |
| | | LOGE("连接VacuumBake-Aligner失败"); |
| | | } |
| | | |
| | | nRet = pAligner->getPin("Out1")->connectPin(pBonder1->getPin("In")); |
| | | if (nRet < 0) { |
| | | LOGE("连接Aligner-Bondere1失败"); |
| | | } |
| | | |
| | | nRet = pAligner->getPin("Out2")->connectPin(pBonder2->getPin("In")); |
| | | if (nRet < 0) { |
| | | LOGE("连接Aligner-Bondere2失败"); |
| | | } |
| | | |
| | | nRet = pBonder1->getPin("Out")->connectPin(pBakeCooling->getPin("In1")); |
| | | if (nRet < 0) { |
| | | LOGE("连接Bonder1-BakeCooling失败"); |
| | | } |
| | | |
| | | nRet = pBonder2->getPin("Out")->connectPin(pBakeCooling->getPin("In2")); |
| | | if (nRet < 0) { |
| | | LOGE("连接Bonder2-BakeCooling失败"); |
| | | } |
| | | |
| | | nRet = pBakeCooling->getPin("Out1")->connectPin(pLoadPort3->getPin("In")); |
| | | if (nRet < 0) { |
| | | LOGE("连接BakeCooling-LoadPort3失败"); |
| | | } |
| | | |
| | | nRet = pBakeCooling->getPin("Out2")->connectPin(pLoadPort4->getPin("In")); |
| | | if (nRet < 0) { |
| | | LOGE("连接BakeCooling-LoadPort4失败"); |
| | | } |
| | | } |
| | | |
| | | int CMaster::saveCache() |
| | | { |
| | | CFile file; |
| | | if (!file.Open(m_strFilepath.c_str(), CFile::modeCreate | CFile::modeWrite)) { |
| | | return -1; |
| | | } |
| | | |
| | | CArchive ar(&file, CArchive::store); |
| | | serialize(ar); |
| | | ar.Close(); |
| | | file.Close(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CMaster::setCacheFilepath(const char* pszFilepath) |
| | | { |
| | | m_strFilepath = pszFilepath; |
| | | } |
| | | |
| | | int CMaster::readCache() |
| | | { |
| | | CFile file; |
| | | if (!file.Open(m_strFilepath.c_str(), CFile::modeRead)) { |
| | | return -1; |
| | | } |
| | | |
| | | CArchive ar(&file, CArchive::load); |
| | | serialize(ar); |
| | | ar.Close(); |
| | | file.Close(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CMaster::serialize(CArchive& ar) |
| | | { |
| | | for (auto item : m_listEquipment) { |
| | | item->serialize(ar); |
| | | } |
| | | } |
| | | } |