From 9b2d1e962bf802f75c44c1f5372fc4cf029e3f4e Mon Sep 17 00:00:00 2001
From: darker <mr.darker@163.com>
Date: 星期二, 11 二月 2025 11:11:13 +0800
Subject: [PATCH] 1. 添加SECS运行设置管理类
---
SourceCode/Bond/Servo/HsmsPassive.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index b77ee1a..39f7e68 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -38,7 +38,11 @@
m_bCimWorking = FALSE;
m_hCimWorkEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
m_nSessionId = 1;
+ m_listener.onEQOffLine = nullptr;
+ m_listener.onEQOnLine = nullptr;
+ m_listener.onCommand = nullptr;
m_listener.onEQConstantRequest = nullptr;
+ m_listener.onEQConstantSend = nullptr;
InitializeCriticalSection(&m_criticalSection);
}
@@ -66,6 +70,7 @@
{
m_listener.onEQOffLine = listener.onEQOffLine;
m_listener.onEQOnLine = listener.onEQOnLine;
+ m_listener.onCommand = listener.onCommand;
m_listener.onEQConstantRequest = listener.onEQConstantRequest;
m_listener.onEQConstantSend = listener.onEQConstantSend;
}
@@ -208,6 +213,9 @@
}
else if (nStream == 2 && pHeader->function == 37) {
replyEanbleDisableEventReport(pMessage);
+ }
+ else if (nStream == 2 && pHeader->function == 41) {
+ replyCommand(pMessage);
}
else if (nStream == 5 && pHeader->function == 3) {
replyEanbleDisableAlarmReport(pMessage);
@@ -598,6 +606,55 @@
return 0;
}
+// S2F41
+int CHsmsPassive::replyCommand(IMessage* pRecv)
+{
+ if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
+ return ER_NOTSELECT;
+ }
+ ISECS2Item* pBody = pRecv->getBody();
+ if (pBody == nullptr || pBody->getType() != SITYPE::A) ER_PARAM_ERROR;
+
+
+
+ BOOL bCheckData = FALSE;
+ const char* pszCmdName;
+ std::vector<CommandParameter> params;
+ {
+ ISECS2Item* pItemParams, *pItemParam;
+ ISECS2Item* pItem = pRecv->getBody();
+ if (pItem->getSubItemSize() < 2) goto MYREPLY;
+ if (!pItem->getSubItemString(0, pszCmdName)) goto MYREPLY;
+ pItemParams = pItem->getSubItem(1);
+ if (pItemParams == nullptr || pItemParams->getType() != SITYPE::L) goto MYREPLY;
+ for (int i = 0; i < pItemParams->getSubItemSize(); i++) {
+ const char* pszParamName, * pszParamValue;
+ pItemParam = pItemParams->getSubItem(i);
+ if (pItemParam != nullptr
+ && pItemParam->getSubItemString(0, pszParamName)
+ && pItemParam->getSubItemString(1, pszParamValue)) {
+ CommandParameter cp;
+ strcpy_s(cp.szName, 256, pszParamName);
+ strcpy_s(cp.szValue, 256, pszParamValue);
+ params.push_back(cp);
+ }
+ }
+ bCheckData = TRUE;
+ }
+
+
+ // 回调到应用层
+ if (bCheckData) {
+ if (m_listener.onCommand != nullptr) {
+ m_listener.onCommand(this, pszCmdName, params);
+ }
+ }
+
+MYREPLY:
+ replyAck(2, 42, pRecv->getHeader()->systemBytes, BYTE(0), "ERACK");
+ return 0;
+}
+
// S5F3
int CHsmsPassive::replyEanbleDisableAlarmReport(IMessage* pRecv)
{
--
Gitblit v1.9.3