| | |
| | | #include "stdafx.h" |
| | | #include "CReadStep.h" |
| | | #include "Common.h" |
| | | #include "CEquipment.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | |
| | | m_hWorkThreadHandle = nullptr; |
| | | m_hReadSignalOn = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| | | m_hReadSignalOff = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| | | m_nSignalType = 0; |
| | | m_nCurStep = 0; |
| | | } |
| | | |
| | |
| | | m_nWriteSignalDev = dev; |
| | | } |
| | | |
| | | void CReadStep::onReadSignal(BOOL bSignal) |
| | | void CReadStep::onReadSignal(int nSignalType) |
| | | { |
| | | Lock(); |
| | | if (m_nCurStep == 0 && bSignal) { |
| | | m_nSignalType = nSignalType; |
| | | if (m_nCurStep == 0 && nSignalType != 0) { |
| | | SetEvent(m_hReadSignalOn); |
| | | } |
| | | else if (m_nCurStep == 3 && !bSignal) { |
| | | else if (m_nCurStep == 3 && nSignalType == 0) { |
| | | SetEvent(m_hReadSignalOff); |
| | | } |
| | | |
| | |
| | | nextStep(); |
| | | ASSERT(m_pCclink); |
| | | if (0 == onReadData()) { |
| | | if (m_listener.onEvent != nullptr) { |
| | | m_listener.onEvent(this, STEP_EVENT_READDATA, nullptr); |
| | | } |
| | | ASSERT(m_pEquipment); |
| | | m_pEquipment->onStepEvent(this, STEP_EVENT_READDATA); |
| | | } |
| | | |
| | | // 2.给对方写ON |
| | |
| | | // 6.完成 |
| | | nextStep(); |
| | | if (0 == onComplete()) { |
| | | if (m_listener.onEvent != nullptr) { |
| | | m_listener.onEvent(this, STEP_EVENT_COMPLETE, nullptr); |
| | | } |
| | | ASSERT(m_pEquipment); |
| | | m_pEquipment->onStepEvent(this, STEP_EVENT_COMPLETE); |
| | | } |
| | | } |
| | | } |
| | |
| | | void CReadStep::getAttributeVector(CAttributeVector& attrubutes) |
| | | { |
| | | CStep::getAttributeVector(attrubutes); |
| | | std::string strTemp; |
| | | |
| | | attrubutes.addAttribute(new CAttribute("Current Step", |
| | | std::to_string(m_nCurStep).c_str(), "")); |
| | | attrubutes.addAttribute(new CAttribute("Signal Dev", |
| | | std::to_string(m_nWriteSignalDev).c_str(), "")); |
| | | ("W" + CToolUnits::toHexString(m_nWriteSignalDev, strTemp)).c_str(), "")); |
| | | } |
| | | |
| | | void CReadStep::init() |