#include "stdafx.h"
|
#include "CLoadPort.h"
|
|
|
namespace SERVO {
|
CLoadPort::CLoadPort() : CEquipment()
|
{
|
|
}
|
|
CLoadPort::~CLoadPort()
|
{
|
|
}
|
|
const char* CLoadPort::getClassName()
|
{
|
static char* pszName = "CLoadPort";
|
return pszName;
|
}
|
|
void CLoadPort::init()
|
{
|
CEquipment::init();
|
}
|
|
void CLoadPort::term()
|
{
|
CEquipment::term();
|
}
|
|
// ±ØÐëҪʵÏÖµÄÐ麯Êý£¬Ôڴ˳õʼ»¯PinÁбí
|
void CLoadPort::initPins()
|
{
|
// ¼ÓÈëPin³õʼ»¯´úÂë
|
LOGI("<CLoadPort>initPins");
|
addPin(SERVO::PinType::INPUT, _T("In"));
|
addPin(SERVO::PinType::OUTPUT, _T("Out"));
|
}
|
|
void CLoadPort::onTimer(UINT nTimerid)
|
{
|
CEquipment::onTimer(nTimerid);
|
}
|
|
void CLoadPort::serialize(CArchive& ar)
|
{
|
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(), ""));
|
}
|
|
for (auto item : m_panelList) {
|
attrubutes.addAttribute(new CAttribute("Panel",
|
item->getID().c_str(), ""));
|
}
|
}
|
|
void CLoadPort::outputPanel()
|
{
|
CPin* pOutPin = getPin("Out");
|
|
|
// Èç¹ûÁбíÖÐûÓÐPanel,Ä£ÄâÉú³É10ÕÅ
|
if (m_panelList.empty()) {
|
static int ii = 0;
|
char szBuffer[64];
|
LOGI("<CLoadPort>Ä£ÄâÉú³É10ÕÅPANEL");
|
for (int i = 0; i < 10; i++) {
|
sprintf_s(szBuffer, "P20250320A1A%d", ++ii);
|
CPanel* pPanel = new CPanel();
|
pPanel->setID(szBuffer);
|
addPanelToList(pPanel);
|
}
|
}
|
|
|
// Ä£ÄâÈ¡³öµÚÒ»ÕÅPanel,´«Ë͵½ÏÂÒ»»·½Ú
|
Lock();
|
CPanel* pContext = m_panelList.front();
|
pContext->addRef();
|
|
CIntent intent(FLOW_MOVE_MATERIAL, "", pContext);
|
int nRet = pOutPin->sendIntent(&intent);
|
if (nRet == FLOW_REJECT) {
|
AfxMessageBox("¶Ô·½¾Ü¾ø½ÓÊÜ");
|
}
|
else if (nRet == FLOW_ACCEPT) {
|
m_panelList.pop_front();
|
pContext->release(); // Ìí¼Óµ½ÁжÓʱaddRef, È¡³öʱrelease
|
}
|
|
pContext->release();
|
Unlock();
|
}
|
}
|