| | |
| | | { |
| | | // 加入Pin初始化代码 |
| | | LOGI("<CBonder>initPins"); |
| | | addPin(SERVO::PinType::INPUT, _T("In")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out")); |
| | | } |
| | | |
| | | void CBonder::onTimer(UINT nTimerid) |
| | |
| | | { |
| | | CEquipment::serialize(ar); |
| | | } |
| | | |
| | | int CBonder::recvSample(CPin* pPin, CSample* pSample) |
| | | { |
| | | ASSERT(pPin); |
| | | |
| | | CPin* pFromPin = pPin->getConnectedPin(); |
| | | ASSERT(pFromPin); |
| | | |
| | | CEquipment* pFromEq = pFromPin->getEquipment(); |
| | | ASSERT(pFromEq); |
| | | |
| | | |
| | | LOGI("<CBonder><%s-%s>收到来自<%s.%s>的Sample", |
| | | this->getName().c_str(), pPin->getName().c_str(), |
| | | pFromEq->getName().c_str(), pFromPin->getName().c_str()); |
| | | |
| | | delete pSample; |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | virtual void initPins(); |
| | | virtual void onTimer(UINT nTimerid); |
| | | virtual void serialize(CArchive& ar); |
| | | virtual int recvSample(CPin* pPin, CSample* pSample); |
| | | }; |
| | | } |
| | | |
| | |
| | | } |
| | | m_mapStep.clear(); |
| | | |
| | | for (auto item : m_inputPins) { |
| | | delete item; |
| | | } |
| | | m_inputPins.clear(); |
| | | |
| | | for (auto item : m_outputPins) { |
| | | delete item; |
| | | } |
| | | m_outputPins.clear(); |
| | | |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | |
| | | return m_bVCREnable[index]; |
| | | } |
| | | |
| | | CPin* CEquipment::addPin(PinType type, char* pszName) |
| | | { |
| | | // 不允许名字添加重复的pin |
| | | CPin* pPin = getPin(pszName); |
| | | if (pPin != nullptr) return nullptr; |
| | | |
| | | |
| | | // 添加到Pin列表,看是输入pin或输出pin |
| | | if (type == PinType::INPUT) { |
| | | pPin = new CPin(this, type, pszName); |
| | | m_inputPins.push_back(pPin); |
| | | return pPin; |
| | | } |
| | | else if (type == PinType::OUTPUT) { |
| | | pPin = new CPin(this, type, pszName); |
| | | m_outputPins.push_back(pPin); |
| | | return pPin; |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | CPin* CEquipment::getPin(char* pszName) |
| | | { |
| | | for (auto item : m_inputPins) { |
| | | if (item->getName().compare(pszName) == 0) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | for (auto item : m_outputPins) { |
| | | if (item->getName().compare(pszName) == 0) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<CPin*>& CEquipment::getInputPins() |
| | | { |
| | | return m_inputPins; |
| | | } |
| | | |
| | | std::vector<CPin*>& CEquipment::getOutputPins() |
| | | { |
| | | return m_outputPins; |
| | | } |
| | | |
| | | int CEquipment::recvSample(CPin* pPin, CSample* pSample) |
| | | { |
| | | LOGI("<CEquipment>recvSample, pin:%s", pPin->getName().c_str()); |
| | |
| | | #include "CEqCimMessageClearStep.h" |
| | | #include "CEqDateTimeSetCmdStep.h" |
| | | #include "CEqVCREnableStep.h" |
| | | #include <vector> |
| | | #include <map> |
| | | |
| | | |
| | |
| | | virtual void onTimer(UINT nTimerid); |
| | | virtual void serialize(CArchive& ar); |
| | | virtual void onReceiveLBData(const char* pszData, size_t size); |
| | | virtual CPin* addPin(PinType type, char* pszName); |
| | | CPin* getPin(char* pszName); |
| | | std::vector<CPin*>& CEquipment::getInputPins(); |
| | | std::vector<CPin*>& CEquipment::getOutputPins(); |
| | | virtual int recvSample(CPin* pPin, CSample* pSample); |
| | | |
| | | |
| | |
| | | StationIdentifier m_station; |
| | | MemoryBlock m_blockReadBit; |
| | | MemoryBlock m_blockWriteBit; |
| | | std::vector<CPin*> m_inputPins; |
| | | std::vector<CPin*> m_outputPins; |
| | | |
| | | // 以下为从CC-Link读取到的Bit标志位 |
| | | private: |
| | |
| | | { |
| | | // 加入Pin初始化代码 |
| | | LOGI("<CLoadPort>initPins"); |
| | | addPin(SERVO::PinType::INPUT, _T("In")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out")); |
| | | } |
| | | |
| | | void CLoadPort::onTimer(UINT nTimerid) |
| | |
| | | { |
| | | CEquipment::serialize(ar); |
| | | } |
| | | |
| | | void CLoadPort::getAttributeVector(CAttributeVector& attrubutes) |
| | | { |
| | | __super::getAttributeVector(attrubutes); |
| | | |
| | | for (auto item : m_inputPins) { |
| | | attrubutes.addAttribute(new CAttribute(item->getName().c_str(), |
| | | std::to_string((int)item->getType()).c_str(), "")); |
| | | } |
| | | |
| | | for (auto item : m_outputPins) { |
| | | attrubutes.addAttribute(new CAttribute(item->getName().c_str(), |
| | | std::to_string((int)item->getType()).c_str(), "")); |
| | | } |
| | | } |
| | | |
| | | void CLoadPort::outputPanel() |
| | | { |
| | | CPin* pOutPin = getPin("Out"); |
| | | |
| | | CSample* pSample = new CSample(); |
| | | pOutPin->sendSample(pSample); |
| | | } |
| | | } |
| | |
| | | virtual void initPins(); |
| | | virtual void onTimer(UINT nTimerid); |
| | | virtual void serialize(CArchive& ar); |
| | | virtual void getAttributeVector(CAttributeVector& attrubutes); |
| | | |
| | | public: |
| | | void outputPanel(); |
| | | }; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | // 初始化添加各子设备 |
| | | addLoadPort(0, listener); |
| | | addLoadPort(1, listener); |
| | | addLoadPort(2, listener); |
| | | addLoadPort(3, listener); |
| | | addEFEM(listener); |
| | | addBonder(0, listener); |
| | | addBonder(1, listener); |
| | | connectEquipments(); |
| | | |
| | | |
| | | // 定时器 |
| | |
| | | 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); |
| | |
| | | { |
| | | 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); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CMaster::connectEquipments() |
| | | { |
| | | CLoadPort* pLoadPort1 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT1); |
| | | CBonder* pBonder1 = (CBonder*)getEquipment(EQ_ID_Bonder1); |
| | | |
| | | int nRet = pLoadPort1->getPin("Out")->connectPin(pBonder1->getPin("In")); |
| | | if (nRet < 0) { |
| | | AfxMessageBox("连接失败"); |
| | | } |
| | | else { |
| | | AfxMessageBox("连接成功"); |
| | | } |
| | | } |
| | | } |
| | |
| | | int addLoadPort(int index, StepListener& listener); |
| | | int addEFEM(StepListener& listener); |
| | | int addBonder(int index, StepListener& listener); |
| | | void connectEquipments(); |
| | | |
| | | |
| | | private: |
| | | MasterListener m_listener; |
| | |
| | | #define EQ_ID_EFEM 1 |
| | | #define EQ_ID_Bonder1 2 |
| | | #define EQ_ID_Bonder2 3 |
| | | #define EQ_ID_LOADPORT1 4 |
| | | #define EQ_ID_LOADPORT2 5 |
| | | #define EQ_ID_LOADPORT3 6 |
| | | #define EQ_ID_LOADPORT4 7 |
| | | |
| | | |
| | | /* step name */ |