From 5edb485d226790306097e40ea954efb2ed90dd21 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 11 八月 2025 16:05:09 +0800
Subject: [PATCH] 1.EAP:查询CJSpace和PJSpace功能模拟,Master对EAP查询机器变量的回复;
---
SourceCode/Bond/Servo/HsmsPassive.cpp | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index 7a80fd5..1a18950 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -103,6 +103,31 @@
}
+void CHsmsPassive::addVariableValueToItem(ISECS2Item* pParent, SERVO::CVariable* pVariable)
+{
+ ASSERT(pParent);
+ ASSERT(pVariable);
+
+ SERVO::SVFromat format = pVariable->getFormat();
+ switch (format)
+ {
+ case SERVO::SVFromat::U1:
+ pParent->addU1Item((unsigned char)pVariable->getIntValue(), "SV");
+ break;
+ case SERVO::SVFromat::U2:
+ pParent->addU2Item((unsigned char)pVariable->getIntValue(), "SV");
+ break;
+ case SERVO::SVFromat::I2:
+ pParent->addI2Item((unsigned char)pVariable->getIntValue(), "SV");
+ break;
+ case SERVO::SVFromat::A20:
+ case SERVO::SVFromat::A50:
+ pParent->addItem(pVariable->getValue().c_str(), "SV");
+ default:
+ break;
+ }
+}
+
void CHsmsPassive::linkEventReport(unsigned int CEID, unsigned int RPTID)
{
SERVO::CCollectionEvent* pEvent = getEvent(CEID);
@@ -536,6 +561,9 @@
// S1F1
replyAreYouThere(pMessage);
}
+ else if (nStream == 1 && pHeader->function == 3) {
+ replySelectedEquipmentStatusData(pMessage);
+ }
else if (nStream == 1 && pHeader->function == 13) {
replyEstablishCommunications(pMessage);
}
@@ -902,6 +930,45 @@
return 0;
}
+int CHsmsPassive::replySelectedEquipmentStatusData(IMessage* pRecv)
+{
+ if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
+ return ER_NOTSELECT;
+ }
+
+ IMessage* pMessage = NULL;
+ HSMS_Create1Message(pMessage, m_nSessionId, 1, 4, pRecv->getHeader()->systemBytes);
+ ASSERT(pMessage);
+
+ unsigned char SVU1 = 0;
+ unsigned int SVID = 0;
+ ISECS2Item* pBody = pRecv->getBody();
+ if (pBody == nullptr || pBody->getType() != SITYPE::L) {
+ pMessage->getBody()->addU1Item(SVU1, "SV");
+ goto MYREPLY;
+ }
+ if (!pBody->getSubItemU4(0, SVID)) {
+ pMessage->getBody()->addU1Item(SVU1, "SV");
+ goto MYREPLY;
+ }
+
+ SERVO::CVariable* pVariable = getVariable(SVID);
+ if (pVariable == nullptr) {
+ pMessage->getBody()->addU1Item(SVU1, "SV");
+ goto MYREPLY;
+ }
+ addVariableValueToItem(pMessage->getBody(), pVariable);
+
+MYREPLY:
+ m_pPassive->sendMessage(pMessage);
+ LOGI("<HSMS>[SECS Msg SEND]%s", pMessage->toString());
+ HSMS_Destroy1Message(pMessage);
+
+
+
+ return 0;
+}
+
// S2F13
int CHsmsPassive::replyEquipmentConstantRequest(IMessage* pRecv)
{
--
Gitblit v1.9.3