From e5fb1e316cd9e1a85abd9c8e9a81f66990a82c6b Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期四, 12 二月 2026 14:36:05 +0800
Subject: [PATCH] 1.S1F11与S1F21对换;

---
 SourceCode/Bond/Servo/HsmsPassive.cpp |   55 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index 0d0f8a3..1409059 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -1736,10 +1736,18 @@
 			replySelectedEquipmentStatusData(pMessage);
 		}
 		else if (nStream == 1 && pHeader->function == 11) {
-			replyStatusVariableNamelistRequest(pMessage);
+			// [EAP_MAPPING][S1F11] Status Variable namelist request -> S1F12.
+			// If customer requires swapping SV/DV mapping, this is one of the two switch points.
+			// Swap target with S1F21 branch below.
+			// replyStatusVariableNamelistRequest(pMessage);
+			replyDataVariableNamelistRequest(pMessage);
 		}
 		else if (nStream == 1 && pHeader->function == 21) {
-			replyDataVariableNamelistRequest(pMessage);
+			// [EAP_MAPPING][S1F21] Data Variable namelist request -> S1F22.
+			// If customer requires swapping SV/DV mapping, this is one of the two switch points.
+			// Swap target with S1F11 branch above.
+			// replyDataVariableNamelistRequest(pMessage);
+			replyStatusVariableNamelistRequest(pMessage);
 		}
 		else if (nStream == 1 && pHeader->function == 23) {
 			replyCollectionEventNamelistRequest(pMessage);
@@ -2339,9 +2347,13 @@
 	return 0;
 }
 
-// S1F11
+// S1F21
 int CHsmsPassive::replyStatusVariableNamelistRequest(IMessage* pRecv)
 {
+	// [EAP_MAPPING][SV_HANDLER]
+	// Current behavior: handles S1F11 and replies S1F12 with SVID/SVNAME/UNITS.
+	// If customer requires SV/DV swap, this function body can be swapped with
+	// replyDataVariableNamelistRequest (or dispatch branches can be swapped instead).
 	if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
 		return ER_NOTSELECT;
 	}
@@ -2376,7 +2388,7 @@
 	Unlock();
 
 	IMessage* pMessage = NULL;
-	HSMS_Create1Message(pMessage, m_nSessionId, 1, 12, pRecv->getHeader()->systemBytes);
+	HSMS_Create1Message(pMessage, m_nSessionId, 1, 22, pRecv->getHeader()->systemBytes);
 	ASSERT(pMessage);
 
 	ISECS2Item* pList = pMessage->getBody(); // Body is L[n] of {SVID, SVNAME, UNITS}
@@ -2448,9 +2460,13 @@
 	file.Close();
 	return 0;
 }
-// S1F21/S1F22 - Data Variable Namelist
+// S1F11/S1F12 - Data Variable Namelist
 int CHsmsPassive::replyDataVariableNamelistRequest(IMessage* pRecv)
 {
+	// [EAP_MAPPING][DV_HANDLER]
+	// Current behavior: handles S1F21 and replies S1F22 with DVID/DVNAME/UNITS.
+	// If customer requires SV/DV swap, this function body can be swapped with
+	// replyStatusVariableNamelistRequest (or dispatch branches can be swapped instead).
 	if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
 		return ER_NOTSELECT;
 	}
@@ -2481,7 +2497,7 @@
 	Unlock();
 
 	IMessage* pMessage = NULL;
-	HSMS_Create1Message(pMessage, m_nSessionId, 1, 22, pRecv->getHeader()->systemBytes);
+	HSMS_Create1Message(pMessage, m_nSessionId, 1, 12, pRecv->getHeader()->systemBytes);
 	ASSERT(pMessage);
 
 	ISECS2Item* pList = pMessage->getBody(); // L[n] of {DVID, DVNAME, UNITS}
@@ -3771,7 +3787,32 @@
 
 int CHsmsPassive::requestEventReportSend_OCR_PanelID_Read_OK()
 {
-	return requestEventReportSend("OCR_PanelID_Read_OK");
+	return requestEventReportSend_OCR_PanelID_Read(1);
+}
+
+int CHsmsPassive::requestEventReportSend_OCR_PanelID_Read(short vcrResult)
+{
+	const char* eventName = "OCR_PanelID_Read_OK";
+	switch (vcrResult) {
+	case 1: // OK & Match
+		eventName = "OCR_PanelID_Read_OK";
+		break;
+	case 2: // OK & Mismatch
+		eventName = "OCR_PanelID_Read_Mismatch";
+		break;
+	case 3: // Fail & KeyIn Match
+		eventName = "OCR_PanelID_Read_NG";
+		break;
+	case 4: // Fail & KeyIn Mismatch
+		eventName = "OCR_PanelID_Read_NG_Mismatch";
+		break;
+	default:
+		LOGE("<CHsmsPassive>Unknown VCR result=%d, fallback to OCR_PanelID_Read_OK", vcrResult);
+		eventName = "OCR_PanelID_Read_OK";
+		break;
+	}
+
+	return requestEventReportSend(eventName);
 }
 
 int CHsmsPassive::requestEventReportSend_LoadPortNotAssoc()

--
Gitblit v1.9.3