From c7a412c515aa2344fa776f4692d8f4a7607b3de6 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期五, 12 十二月 2025 16:27:31 +0800
Subject: [PATCH] 1.InAccess_2_Complete(Ready to Release)上报;

---
 SourceCode/Bond/Servo/HsmsPassive.cpp |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index e11cc50..29e53c9 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -1020,12 +1020,58 @@
 	return m_collectionEvents;
 }
 
+unsigned int CHsmsPassive::getMaxCollectionEventId() const
+{
+	unsigned int maxId = 0;
+	for (auto item : m_collectionEvents) {
+		if (item && item->getEventId() > maxId) {
+			maxId = item->getEventId();
+		}
+	}
+	return maxId;
+}
+
 int CHsmsPassive::deleteCollectionEvent(unsigned short CEID)
 {
 	for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) {
 		if ((*iter)->getEventId() == CEID) {
 			delete (*iter);
 			m_collectionEvents.erase(iter);
+			return writeCollectionEventsToFile(m_strCollectionEventFilepath);
+		}
+	}
+	return -1;
+}
+
+int CHsmsPassive::addCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids)
+{
+	if (getEvent((unsigned short)CEID) != nullptr) {
+		return -1;
+	}
+	auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids));
+	for (auto rptid : rptids) {
+		SERVO::CReport* pReport = getReport((int)rptid);
+		if (pReport != nullptr) {
+			pEvent->addReport(pReport);
+		}
+	}
+	m_collectionEvents.push_back(pEvent);
+	return writeCollectionEventsToFile(m_strCollectionEventFilepath);
+}
+
+int CHsmsPassive::updateCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids)
+{
+	for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) {
+		if ((*iter)->getEventId() == CEID) {
+			delete (*iter);
+			auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids));
+			for (auto rptid : rptids) {
+				SERVO::CReport* pReport = getReport((int)rptid);
+				if (pReport != nullptr) {
+					pEvent->addReport(pReport);
+				}
+			}
+			*iter = pEvent;
 			return writeCollectionEventsToFile(m_strCollectionEventFilepath);
 		}
 	}
@@ -2487,6 +2533,11 @@
 	return requestEventReportSend("Port_Load_Ready");
 }
 
+int CHsmsPassive::requestEventReportSend_Port_Ready_To_Release()
+{
+	return requestEventReportSend("Port_Ready_To_Release");
+}
+
 int CHsmsPassive::requestEventReportSend_Port_Blocked()
 {
 	return requestEventReportSend("Port_Blocked");
@@ -2531,6 +2582,5 @@
 {
 	return requestEventReportSend("OCR_PanelID_Read_OK");
 }
-
 
 

--
Gitblit v1.9.3