From bfe14e41fa5b07771d78af4511ba18d706bc23cc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 七月 2025 17:07:52 +0800
Subject: [PATCH] 1.Spooling Config功能EAP模拟测试;
---
SourceCode/Bond/Servo/HsmsPassive.cpp | 125 +++++++++++++++++++++++++++++------------
1 files changed, 87 insertions(+), 38 deletions(-)
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index 3f52f0e..22840c2 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -98,39 +98,21 @@
}
-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();
-}
-
-void CHsmsPassive::linkEventReport(unsigned int RPTID, unsigned int CEID)
-{
- m_mapReportIdToCEID[RPTID] = CEID;
+ SERVO::CCollectionEvent* pEvent = getEvent(CEID);
+ SERVO::CReport* pReport = getReport(RPTID);
+ if (pEvent != nullptr) {
+ pEvent->setReport(pReport);
+ }
}
void CHsmsPassive::unlinkEventReport(unsigned int CEID)
{
- for (auto it = m_mapReportIdToCEID.begin(); it != m_mapReportIdToCEID.end(); ) {
- if (it->second == CEID) {
- m_mapReportIdToCEID.erase(it++); // 鏇存柊杩唬鍣�
- }
- else {
- ++it;
- }
+ SERVO::CCollectionEvent* pEvent = getEvent(CEID);
+ if (pEvent != nullptr) {
+ pEvent->setReport(nullptr);
}
-
-}
-
-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)
@@ -399,7 +381,7 @@
if (!events.empty()) {
clearAllCollectionEvent();
for (auto item : events) {
- m_collectionEvent.push_back(item);
+ m_collectionEvents.push_back(item);
}
}
@@ -410,15 +392,26 @@
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)
@@ -527,6 +520,9 @@
}
else if (nStream == 2 && pHeader->function == 41) {
replyCommand(pMessage);
+ }
+ else if (nStream == 2 && pHeader->function == 43) {
+ replyConfigureSpooling(pMessage);
}
else if (nStream == 5 && pHeader->function == 3) {
replyEanbleDisableAlarmReport(pMessage);
@@ -967,7 +963,7 @@
else {
for (int k = 0; k < prtCount; k++) {
if (rptListItem->getSubItemU4(k, rptid)) {
- linkEventReport(rptid, ceid);
+ linkEventReport(ceid, rptid);
}
}
}
@@ -976,10 +972,10 @@
// 妫�楠岀粨鏋滄槸鍚︽纭�
- 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:
replyAck(2, 36, pRecv->getHeader()->systemBytes, BYTE(0), "LRACK");
return 0;
@@ -1069,6 +1065,51 @@
}
}
+MYREPLY:
+ replyAck(2, 42, pRecv->getHeader()->systemBytes, BYTE(0), "ERACK");
+ return 0;
+}
+
+// S2F43
+int CHsmsPassive::replyConfigureSpooling(IMessage* pRecv)
+{
+ if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
+ return ER_NOTSELECT;
+ }
+ ISECS2Item* pBody = pRecv->getBody();
+ if (pBody == nullptr || pBody->getType() != SITYPE::L) ER_PARAM_ERROR;
+
+ // 娓呯┖鎵�鏈�
+ if (pBody->getSubItemSize() == 0) {
+ m_spoolingConfig.clear();
+ goto MYREPLY;
+ }
+
+ // 渚濇閰嶇疆Stream
+ for (int i = 0; i < pBody->getSubItemSize(); i++) {
+ ISECS2Item* pStreamItem = pBody->getSubItem(i);
+ ASSERT(pStreamItem);
+ unsigned char STRID, FCNID;
+ pStreamItem->getSubItemU1(0, STRID);
+ ISECS2Item* pFcnItemList = pStreamItem->getSubItem(1);
+ if (pFcnItemList->getSubItemSize() == 0) {
+ m_spoolingConfig[STRID].clear();
+ }
+ else {
+ for (int j = 0; j < pFcnItemList->getSubItemSize(); j++) {
+ pFcnItemList->getSubItemU1(j, FCNID);
+ m_spoolingConfig[STRID].insert(FCNID);
+ }
+ }
+ }
+
+ // 鎵撳嵃楠岃瘉缁撴灉
+ for (auto s : m_spoolingConfig) {
+ LOGI("====> stream:%d", s.first);
+ for (auto f : s.second) {
+ LOGI("function:%d", f);
+ }
+ }
MYREPLY:
replyAck(2, 42, pRecv->getHeader()->systemBytes, BYTE(0), "ERACK");
return 0;
@@ -1193,10 +1234,18 @@
}
// 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();
@@ -1207,10 +1256,10 @@
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");
--
Gitblit v1.9.3