1.实现EAP中ProceedWithCarrier和CarrierRelease的功能模拟及测试;
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsCarrierActionRequest(unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN) |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 3 | REPLY, 17, ++m_nSystemByte); |
| | | pMessage->getBody()->addU4Item(DATAID, "DATAID"); |
| | | pMessage->getBody()->addItem(pszCarrierAction, "CARRIERACTION"); |
| | | pMessage->getBody()->addItem(pszCarrierId, "CARRIERID"); |
| | | pMessage->getBody()->addU1Item(PTN, "PTN"); |
| | | pMessage->getBody()->addItem(); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsProceedWithCarrier(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN) |
| | | { |
| | | return hsmsCarrierActionRequest(DATAID, "ProceedWithCarrier", pszCarrierId, PTN); |
| | | } |
| | | |
| | | int CHsmsActive::hsmsCarrierRelease(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN) |
| | | { |
| | | return hsmsCarrierActionRequest(DATAID, "CarrierRelease", pszCarrierId, PTN); |
| | | } |
| | | |
| | | int CHsmsActive::replyAck0(IMessage* pMessage) |
| | | { |
| | | return 0; |
| | |
| | | // 鏌ヨPPID List |
| | | int hsmsQueryPPIDList(); |
| | | |
| | | // S3F17 |
| | | // 鍗″專鍔ㄤ綔璇锋眰 |
| | | int hsmsCarrierActionRequest(unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN); |
| | | int hsmsProceedWithCarrier(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN); |
| | | int CHsmsActive::hsmsCarrierRelease(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN); |
| | | |
| | | |
| | | // 閫氳繃鐨剅eply鍑芥暟 |
| | | void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName); |
| | | |
| | |
| | | ON_BN_CLICKED(IDC_BUTTON_TRANSMIT_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonTransmitSpooledData) |
| | | ON_BN_CLICKED(IDC_BUTTON_PURGE_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonPurgeSpooledData) |
| | | ON_BN_CLICKED(IDC_BUTTON_QUERY_PPID_LIST, &CEAPSimulatorDlg::OnBnClickedButtonQueryPpidList) |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCEED_WITH_CARRIER, &CEAPSimulatorDlg::OnBnClickedButtonProceedWithCarrier) |
| | | ON_BN_CLICKED(IDC_BUTTON_CARRIER_RELEASE, &CEAPSimulatorDlg::OnBnClickedButtonCarrierRelease) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | GetDlgItem(IDC_BUTTON_TRANSMIT_SPOOLED_DATA)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_PURGE_SPOOLED_DATA)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_QUERY_PPID_LIST)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_PROCEED_WITH_CARRIER)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_CARRIER_RELEASE)->EnableWindow(enabled); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonConnect() |
| | |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsQueryPPIDList(); |
| | | } |
| | | |
| | | static int DATAID = 1; |
| | | void CEAPSimulatorDlg::OnBnClickedButtonProceedWithCarrier() |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsProceedWithCarrier(DATAID++, "CSX 52078", 1); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonCarrierRelease() |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsCarrierRelease(DATAID++, "CSX 52078", 2); |
| | | } |
| | |
| | | afx_msg void OnBnClickedButtonTransmitSpooledData(); |
| | | afx_msg void OnBnClickedButtonPurgeSpooledData(); |
| | | afx_msg void OnBnClickedButtonQueryPpidList(); |
| | | afx_msg void OnBnClickedButtonProceedWithCarrier(); |
| | | afx_msg void OnBnClickedButtonCarrierRelease(); |
| | | }; |
| | |
| | | #define IDC_EDIT_CE_NAME 1031 |
| | | #define IDC_BUTTON_QUERY_PPID_LIST 1032 |
| | | #define IDC_EDIT_CE_RPTID 1033 |
| | | #define IDC_BUTTON_PROCEED_WITH_CARRIER 1033 |
| | | #define IDC_BUTTON_TRANSMIT_SPOOLED_DATA 1034 |
| | | |
| | | #define IDC_BUTTON_PROCEED_WITH_CARRIER2 1035 |
| | | #define IDC_BUTTON_CARRIER_RELEASE 1035 |
| | | |
| | | // Next default values for new objects |
| | | // |
| | |
| | | { |
| | | return m_bEnableAlarmReport; |
| | | } |
| | | |
| | | int CMaster::proceedWithCarrier(unsigned int port) |
| | | { |
| | | if (port >= 4) return -1; |
| | | |
| | | static int pid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4}; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(pid[port]); |
| | | pPort->sendCassetteCtrlCmd(CCC_PROCESS_START, nullptr, 0, 0, 0, nullptr, nullptr); |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::carrierRelease(unsigned int port) |
| | | { |
| | | if (port >= 4) return -1; |
| | | |
| | | static int pid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 }; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(pid[port]); |
| | | pPort->sendCassetteCtrlCmd(CCC_PROCESS_CANCEL, nullptr, 0, 0, 0, nullptr, nullptr); |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | void enableEventReport(bool bEnable); |
| | | void enableAlarmReport(bool bEnable); |
| | | bool isAlarmReportEnable(); |
| | | int proceedWithCarrier(unsigned int port); |
| | | int carrierRelease(unsigned int port); |
| | | |
| | | private: |
| | | inline void lock() { EnterCriticalSection(&m_criticalSection); } |
| | |
| | | else if (nStream == 2 && pHeader->function == 43) { |
| | | replyConfigureSpooling(pMessage); |
| | | } |
| | | else if (nStream == 3 && pHeader->function == 17) { |
| | | replyCarrierAction(pMessage); |
| | | } |
| | | else if (nStream == 5 && pHeader->function == 3) { |
| | | replyEanbleDisableAlarmReport(pMessage); |
| | | } |
| | |
| | | return 0; |
| | | } |
| | | |
| | | // S3F17 |
| | | int CHsmsPassive::replyCarrierAction(IMessage* pRecv) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | |
| | | unsigned char CAACK = CAACK_0; |
| | | unsigned int ERRCODE = 0; |
| | | std::string strError = "no error"; |
| | | if (m_listener.onCarrierAction == nullptr) { |
| | | CAACK = 5; |
| | | ERRCODE = CAACK_5; |
| | | strError = "Not supported"; |
| | | goto MYREPLY; |
| | | } |
| | | |
| | | |
| | | ISECS2Item* pBody = pRecv->getBody(); |
| | | if (pBody == nullptr || pBody->getType() != SITYPE::L) ER_PARAM_ERROR; |
| | | |
| | | unsigned int DATAID; |
| | | unsigned char PTN; |
| | | const char* pszCarrierAction, *pszCarrierId; |
| | | pBody->getSubItemU4(0, DATAID); |
| | | pBody->getSubItemString(1, pszCarrierAction); |
| | | pBody->getSubItemString(2, pszCarrierId); |
| | | pBody->getSubItemU1(3, PTN); |
| | | ERRCODE = m_listener.onCarrierAction(this, |
| | | DATAID, |
| | | pszCarrierAction, |
| | | pszCarrierId, |
| | | PTN, |
| | | strError); |
| | | CAACK = ERRCODE; |
| | | |
| | | // 鍥炲 |
| | | MYREPLY: |
| | | IMessage* pMessage = NULL; |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 3, 18, pRecv->getHeader()->systemBytes); |
| | | pMessage->getBody()->addU1Item(CAACK, "CAACK"); |
| | | ISECS2Item* pErrItem = pMessage->getBody()->addItem(); |
| | | pErrItem->addU4Item(ERRCODE, "ERRCODE"); |
| | | pErrItem->addItem(strError.c_str(), "ERRTEXT"); |
| | | m_pPassive->sendMessage(pMessage); |
| | | LOGI("<HSMS>[SECS Msg SEND]S3F18 (SysByte=%u)", pMessage->getHeader()->systemBytes); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | // S5F3 |
| | | int CHsmsPassive::replyEanbleDisableAlarmReport(IMessage* pRecv) |
| | | { |
| | |
| | | #define ER_NO_EVENT -4 |
| | | #define ER_UNLINK_EVENT_REPORT -5 |
| | | #define ER_NO_PPID_LIST -6 |
| | | #define ER_NOT_SUPPORTED -7 |
| | | |
| | | |
| | | /* CAACK */ |
| | | |
| | | #define CAACK_0 0 /* ok */ |
| | | #define CAACK_1 1 /* invalid command */ |
| | | #define CAACK_2 2 /* cannot perform now */ |
| | | #define CAACK_3 3 /* invalid data or argument */ |
| | | #define CAACK_4 4 /* initiated for asynchronous completion */ |
| | | #define CAACK_5 5 /* rejected - invalid state */ |
| | | #define CAACK_6 6 /* command performed with errors */ |
| | | |
| | | /* |
| | | * 甯搁噺鏁版嵁缁撴瀯 |
| | |
| | | typedef std::function<void(void* pFrom, bool bEnable, std::vector<unsigned int>& ids)> EDEVENTREPORT; |
| | | typedef std::function<void(void* pFrom, bool bEnable, unsigned int id)> EDALARMREPORT; |
| | | typedef std::function<std::vector<std::string> (void* pFrom)> QUERYPPIDLIST; |
| | | typedef std::function<unsigned int (void* pFrom, |
| | | unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN, |
| | | std::string& strErrorTxt)> CARRIERACTION; |
| | | typedef struct _SECSListener |
| | | { |
| | | SECSEQOFFLINE onEQOffLine; |
| | |
| | | EDEVENTREPORT onEnableDisableEventReport; |
| | | EDALARMREPORT onEnableDisableAlarmReport; |
| | | QUERYPPIDLIST onQueryPPIDList; |
| | | CARRIERACTION onCarrierAction; |
| | | } SECSListener; |
| | | |
| | | |
| | |
| | | int replyEanbleDisableEventReport(IMessage* pRecv); |
| | | int replyCommand(IMessage* pRecv); |
| | | int replyConfigureSpooling(IMessage* pRecv); |
| | | int replyCarrierAction(IMessage* pRecv); |
| | | int replyEanbleDisableAlarmReport(IMessage* pRecv); |
| | | int replyPurgeSpooledData(IMessage* pRecv); |
| | | int replyQueryPPIDList(IMessage* pRecv); |
| | |
| | | } |
| | | return ppids; |
| | | }; |
| | | listener.onCarrierAction = [&](void* pFrom, |
| | | unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN, |
| | | std::string& strErrorTxt) -> unsigned int { |
| | | if (PTN < 1 || 4 < PTN) { |
| | | strErrorTxt = "invalid data or argument"; |
| | | return CAACK_3; |
| | | } |
| | | |
| | | if (_strcmpi(pszCarrierAction, "ProceedWithCarrier") == 0) { |
| | | m_master.proceedWithCarrier(PTN); |
| | | return CAACK_0; |
| | | } |
| | | else if (_strcmpi(pszCarrierAction, "CarrierRelease") == 0) { |
| | | m_master.carrierRelease(PTN); |
| | | return CAACK_0; |
| | | } |
| | | |
| | | strErrorTxt = "rejected - invalid state"; |
| | | return CAACK_5; |
| | | LOGI("<Model>onCarrierAction %d, %s, %d, %d", DATAID, pszCarrierAction, pszCarrierId, PTN); |
| | | }; |
| | | m_hsmsPassive.setListener(listener); |
| | | m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType); |
| | | m_hsmsPassive.setSoftRev((LPTSTR)(LPCTSTR)strSoftRev); |