From 2d25068c16bd644c24754eb42086a24a415b7837 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 20 一月 2025 16:22:01 +0800
Subject: [PATCH] 1.SECS通讯, 实现S2F13(Equipment Constant Request)的回复,目前仅返回模拟结果,真实数据待机器端确认后再返回真实数据。

---
 SourceCode/Bond/Servo/Model.cpp |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 548e170..8bb0368 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -32,6 +32,11 @@
 	m_configuration.setFilepath((LPTSTR)(LPCTSTR)strIniFile);
 	m_configuration.getUnitId(strUnitId);
 
+	// 机器型号和软件版本号应从配置中读取,当前先固定值
+	CString strModeType = _T("Bond2860");
+	CString strSoftRev = _T("1.0.2");
+
+
 
 	// Log
 	CString strLogDir;
@@ -52,6 +57,17 @@
 	});
 
 
+	SECSListener listener;
+	listener.onEQConstantRequest = [&](void* pFrom, const std::vector<unsigned int>& ecids,
+		std::vector<unsigned int>& ecvs) -> void {
+		// 在此填充常量值,目前仅是加1后返回
+		for (auto item : ecids) {
+			ecvs.push_back(item + 1);
+		}
+	};
+	m_hsmsPassive.setListener(listener);
+	m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType);
+	m_hsmsPassive.setSoftRev((LPTSTR)(LPCTSTR)strSoftRev);
 	m_hsmsPassive.init(this, "APP", 7000);
 
 

--
Gitblit v1.9.3