From d6d85fd225db353ab5786725d5a2fc777308f276 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 25 七月 2025 10:40:53 +0800
Subject: [PATCH] 1.EAP模拟端,已增加发送Link Event Report功能接口并正确发送数据,待Master解释和逻辑处理。

---
 SourceCode/Bond/EAPSimulator/CHsmsActive.cpp      |   23 +++++++++++++++++++++++
 SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp |    5 +++++
 SourceCode/Bond/EAPSimulator/CHsmsActive.h        |    5 +++++
 SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp   |    9 +++++++--
 SourceCode/Bond/EAPSimulator/CCollectionEvent.h   |    1 +
 5 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp b/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp
index fcb5e86..abb12d4 100644
--- a/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp
+++ b/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp
@@ -87,6 +87,11 @@
 		return m_reports;
 	}
 
+	std::vector<unsigned int>& CCollectionEvent::getReportIds()
+	{
+		return m_rptids;
+	}
+
 	std::string CCollectionEvent::getReportIdsText()
 	{
 		std::string strResult, strName;
diff --git a/SourceCode/Bond/EAPSimulator/CCollectionEvent.h b/SourceCode/Bond/EAPSimulator/CCollectionEvent.h
index b999c55..bfb6418 100644
--- a/SourceCode/Bond/EAPSimulator/CCollectionEvent.h
+++ b/SourceCode/Bond/EAPSimulator/CCollectionEvent.h
@@ -16,6 +16,7 @@
 		std::string& getName();
 		std::string& getDescription();
 		std::vector<CReport*>& getReports();
+		std::vector<unsigned int>& getReportIds();
 		std::string getReportIdsText();
 		BOOL addReport(CReport* pReport);
 		BOOL deleteReport(unsigned int nReportId);
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
index 925eb0e..8098ce0 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -222,6 +222,29 @@
 	return 0;
 }
 
+int CHsmsActive::hsmsLinkEventReport(std::map<unsigned int, std::vector<unsigned int>>& mapEvent)
+{
+	if (mapEvent.empty()) return 0;
+
+	IMessage* pMessage = nullptr;
+	int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 35, ++m_nSystemByte);
+	ISECS2Item* pItem = pMessage->getBody();
+	pItem->addU4Item(1, "DATAID");
+	ISECS2Item* pItemEventList = pItem->addItem();
+	for (auto item : mapEvent) {
+		ISECS2Item* pItemEvent = pItemEventList->addItem();
+		pItemEvent->addU4Item(item.first, "CEID");
+		ISECS2Item* pItemRptidList = pItemEvent->addItem();
+		for (auto vid : item.second) {
+			pItemRptidList->addU4Item(vid, "RPTID");
+		}
+	}
+	m_pActive->sendMessage(pMessage);
+	HSMS_Destroy1Message(pMessage);
+
+	return 0;
+}
+
 int CHsmsActive::replyAck0(IMessage* pMessage)
 {
 	return 0;
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.h b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
index c8bcbeb..a5925e6 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.h
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -2,6 +2,8 @@
 #include <string>
 #include <vector>
 #include <map>
+#include "CCollectionEvent.h"
+
 
 typedef std::function<void(void* pFrom, ACTIVESTATE state)> STATECHANGED;
 typedef struct _ACTIVEListener
@@ -48,6 +50,9 @@
 	// Define reports
 	int hsmsDefineReports(std::map<unsigned int, std::vector<unsigned int>>& mapReport);
 	
+	// Line Event Report
+	int hsmsLinkEventReport(std::map<unsigned int, std::vector<unsigned int>>& mapEvent);
+
 	// 通过的reply函数
 	void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName);
 
diff --git a/SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp b/SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp
index 0c23e25..5655fa1 100644
--- a/SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp
+++ b/SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp
@@ -183,14 +183,19 @@
 	CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST1);
 	POSITION pos = pListCtrl->GetFirstSelectedItemPosition();
 	while (pos) {
-		int nItem = pListCtrl->GetNextSelectedItem(pos); // 鑾峰彇閫変腑椤圭储寮�
+		int nItem = pListCtrl->GetNextSelectedItem(pos);
 		SERVO::CCollectionEvent* pEvent = (SERVO::CCollectionEvent*)pListCtrl->GetItemData(nItem);
 		events.push_back(pEvent);
 	}
 
+	std::map<unsigned int, std::vector<unsigned int>> mapEvent;
 	for (auto item : events) {
-		TRACE("name:%s\n", item->getName().c_str());
+		std::vector<unsigned int> RPTIDs = item->getReportIds();
+		mapEvent[item->getEventId()] = RPTIDs;
 	}
+
+
+	theApp.m_model.m_pHsmsActive->hsmsLinkEventReport(mapEvent);
 }
 
 void CLinkReportDlg::OnDestroy()

--
Gitblit v1.9.3