1.获取配方后自动刷新列表;
2.HsmsAction序列化和反序列化,将来用于缓存上报的数据;
| | |
| | | virtual HEADER* getHeader() = 0; |
| | | virtual ISECS2Item* getBody() = 0; |
| | | virtual const char* toString() = 0; |
| | | virtual int serialize(char* pszBuffer, int nBufferSize) = 0; |
| | | virtual int unserialize(const char* pszBuffer, int nBufferSize) = 0; |
| | | }; |
| | |
| | | */ |
| | | |
| | | // 测试设置时间 |
| | | /* |
| | | if (pEquipment->getID() == EQ_ID_EFEM) { |
| | | CTime time = CTime::GetCurrentTime(); |
| | | pEquipment->setDateTime((short)time.GetYear(), |
| | |
| | | (short)time.GetMinute(), |
| | | (short)time.GetSecond()); |
| | | } |
| | | |
| | | */ |
| | | |
| | | // 测试设置cim mode |
| | | /* |
| | |
| | | pEquipment->setEqMode((ii % 5) + 1); |
| | | } |
| | | */ |
| | | |
| | | theApp.m_model.m_hsmsPassive.requestAlarmReport(1, 2, "abc"); |
| | | } |
| | | |
| | | |
| | |
| | | return nResponseTime >= m_nTimeout; |
| | | } |
| | | |
| | | int CHsmsAction::serialize(char* pszBuffer, int nBufferSize) |
| | | { |
| | | int index = 0; |
| | | if (pszBuffer == nullptr) { |
| | | index += sizeof(int); |
| | | index += sizeof(m_nTimeout); |
| | | index += sizeof(int); |
| | | index += sizeof(BOOL); |
| | | index += m_pSendMessage->serialize(pszBuffer, nBufferSize); |
| | | |
| | | return index; |
| | | } |
| | | else { |
| | | memcpy(&pszBuffer[index], &m_nAction, sizeof(int)); |
| | | index += sizeof(int); |
| | | |
| | | memcpy(&pszBuffer[index], &m_nTimeout, sizeof(int)); |
| | | index += sizeof(int); |
| | | |
| | | memcpy(&pszBuffer[index], &m_nResponseTime, sizeof(int)); |
| | | index += sizeof(int); |
| | | |
| | | memcpy(&pszBuffer[index], &m_bNeedWaitReply, sizeof(BOOL)); |
| | | index += sizeof(BOOL); |
| | | |
| | | index += m_pSendMessage->serialize(&pszBuffer[index], nBufferSize - index); |
| | | |
| | | return index; |
| | | } |
| | | } |
| | | |
| | | int CHsmsAction::unserialize(const char* pszBuffer, int nBufferSize) |
| | | { |
| | | int index = 0; |
| | | if (index + sizeof(int) > nBufferSize) return -1; |
| | | memcpy(&m_nAction, &pszBuffer[index], sizeof(int)); |
| | | index += sizeof(int); |
| | | |
| | | if (index + sizeof(int) > nBufferSize) return -1; |
| | | memcpy(&m_nTimeout, &pszBuffer[index], sizeof(int)); |
| | | index += sizeof(int); |
| | | |
| | | if (index + sizeof(int) > nBufferSize) return -1; |
| | | memcpy(&m_nResponseTime, &pszBuffer[index], sizeof(int)); |
| | | index += sizeof(int); |
| | | |
| | | if (index + sizeof(BOOL) > nBufferSize) return -1; |
| | | memcpy(&m_bNeedWaitReply, &pszBuffer[index], sizeof(BOOL)); |
| | | index += sizeof(BOOL); |
| | | |
| | | HSMS_Create1Message(m_pSendMessage, 1, 1 | REPLY, 1, 1); |
| | | int nRet = m_pSendMessage->unserialize(&pszBuffer[index], nBufferSize - index); |
| | | if (nRet < 0) return nRet; |
| | | |
| | | return index + nRet; |
| | | } |
| | | |
| | |
| | | HANDLE getEvent(); |
| | | int responseTimeIncrement(); |
| | | BOOL incrementAndCheckTimeout(); |
| | | int serialize(char* pszBuffer, int nBufferSize); |
| | | int unserialize(const char* pszBuffer, int nBufferSize); |
| | | |
| | | private: |
| | | int m_nAction; |
| | |
| | | SetEvent(m_hCimWorkEvent); |
| | | Unlock(); |
| | | |
| | | |
| | | return ER_NOERROR; |
| | | } |
| | | |
| | |
| | | SetEvent(m_hCimWorkEvent); |
| | | Unlock(); |
| | | |
| | | int size = pAction->serialize(nullptr, 0);; |
| | | if (size > 0) { |
| | | char* pszBuffer = new char[size]; |
| | | pAction->serialize(pszBuffer, size); |
| | | AfxMessageBox("abc"); |
| | | |
| | | CHsmsAction* pAction2 = new CHsmsAction(); |
| | | pAction2->unserialize(pszBuffer, size); |
| | | AfxMessageBox("def"); |
| | | m_pPassive->sendMessage(pAction2->getSendMessage()); |
| | | } |
| | | |
| | | return ER_NOERROR; |
| | | } |
| | | |
| | |
| | | else { |
| | | // enable port |
| | | CMsgDlg msgDlg("请等待", "正在获取配方..."); |
| | | pEq->masterRecipeListRequest(0, [&](int status) -> void { |
| | | pEq->masterRecipeListRequest(0, [&, pEq](int status) -> void { |
| | | if (status == SS_FAILED || status == SS_TIMEOUT) { |
| | | CString strMsg; |
| | | strMsg.Format(status == SS_FAILED ? _T("获取配方失败!") : _T("获取配方超时!")); |
| | |
| | | msgDlg.SetMessage((LPTSTR)(LPCTSTR)strMsg); |
| | | msgDlg.SetMarquee(FALSE, 0); |
| | | msgDlg.SetCompleteCode(0); |
| | | SERVO::CRecipeList* pRecipeList = pEq->getRecipeList(0); |
| | | FillRecipeListToListCtrl(pRecipeList); |
| | | } |
| | | }); |
| | | msgDlg.DoModal(); |