| | |
| | | |
| | | } |
| | | |
| | | void CHsmsPassive::addReport(unsigned int id, const char* pszName) |
| | | void CHsmsPassive::linkEventReport(unsigned int CEID, unsigned int RPTID) |
| | | { |
| | | Lock(); |
| | | REPORT report; |
| | | report.id = id; |
| | | strcpy_s(report.szName, REPORT_NAME_MAX, pszName); |
| | | m_mapReport[id] = report; |
| | | Unlock(); |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | | SERVO::CReport* pReport = getReport(RPTID); |
| | | if (pEvent != nullptr) { |
| | | pEvent->setReport(pReport); |
| | | } |
| | | |
| | | void CHsmsPassive::linkEventReport(unsigned int RPTID, unsigned int CEID) |
| | | { |
| | | m_mapReportIdToCEID[RPTID] = CEID; |
| | | } |
| | | |
| | | void CHsmsPassive::unlinkEventReport(unsigned int CEID) |
| | | { |
| | | for (auto it = m_mapReportIdToCEID.begin(); it != m_mapReportIdToCEID.end(); ) { |
| | | if (it->second == CEID) { |
| | | m_mapReportIdToCEID.erase(it++); // 更新迭代器 |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | | if (pEvent != nullptr) { |
| | | pEvent->setReport(nullptr); |
| | | } |
| | | else { |
| | | ++it; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | unsigned int CHsmsPassive::getCEID(int RPTID) |
| | | { |
| | | auto iter = m_mapReportIdToCEID.find(RPTID); |
| | | if (iter != m_mapReportIdToCEID.end()) return iter->second; |
| | | return 0; |
| | | } |
| | | |
| | | SERVO::CReport* CHsmsPassive::defineReport(unsigned int RPTID, std::vector<unsigned int>& vids) |
| | |
| | | if (!events.empty()) { |
| | | clearAllCollectionEvent(); |
| | | for (auto item : events) { |
| | | m_collectionEvent.push_back(item); |
| | | m_collectionEvents.push_back(item); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | std::vector<SERVO::CCollectionEvent*>& CHsmsPassive::getCollectionEvents() |
| | | { |
| | | return m_collectionEvent; |
| | | return m_collectionEvents; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllCollectionEvent() |
| | | { |
| | | for (auto item : m_collectionEvent) { |
| | | for (auto item : m_collectionEvents) { |
| | | delete item; |
| | | } |
| | | m_collectionEvent.clear(); |
| | | m_collectionEvents.clear(); |
| | | } |
| | | |
| | | SERVO::CCollectionEvent* CHsmsPassive::getEvent(unsigned short CEID) |
| | | { |
| | | for (auto item : m_collectionEvents) { |
| | | if (item->getEventId() == CEID) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<unsigned int> CHsmsPassive::parseVidList(CString& strNums) |
| | |
| | | else { |
| | | for (int k = 0; k < prtCount; k++) { |
| | | if (rptListItem->getSubItemU4(k, rptid)) { |
| | | linkEventReport(rptid, ceid); |
| | | linkEventReport(ceid, rptid); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | // 检验结果是否正确 |
| | | for (auto item : m_mapReportIdToCEID) { |
| | | LOGE("=== prtid:%d, ceid:%d", item.first, item.second); |
| | | for (auto item : m_collectionEvents) { |
| | | LOGE("=== ceid:%d, prtid:%d", item->getEventId(), item->getPortID()); |
| | | } |
| | | |
| | | MYREPLY: |
| | |
| | | } |
| | | |
| | | // S6F11 |
| | | int CHsmsPassive::requestEventReportSend(unsigned int DATAID, unsigned int RPTID, const std::vector<std::string>& values) |
| | | int CHsmsPassive::requestEventReportSend(unsigned int DATAID, unsigned int CEID, const std::vector<std::string>& values) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | | if (pEvent == nullptr) { |
| | | return ER_NO_EVENT; |
| | | } |
| | | if (pEvent == nullptr) { |
| | | return ER_UNLINK_EVENT_REPORT; |
| | | } |
| | | |
| | | Lock(); |
| | |
| | | ASSERT(pMessage); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addU4Item(DATAID, "DATAID"); |
| | | pItem->addU4Item(getCEID(RPTID), "CEID"); |
| | | pItem->addU4Item(CEID, "CEID"); |
| | | ISECS2Item* pItemList1 = pItem->addItem(); |
| | | ISECS2Item* pItemList2 = pItemList1->addItem(); |
| | | pItemList2->addU4Item(RPTID, "RPTID"); |
| | | pItemList2->addU4Item(pEvent->getPortID(), "RPTID"); |
| | | ISECS2Item* pItemList3 = pItemList2->addItem(); |
| | | for (auto item : values) { |
| | | pItemList3->addItem(item.c_str(), "V"); |