From a351ed8a97a72bddfb281d2aa350a5c42a7f81a5 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 16 十月 2025 17:40:49 +0800
Subject: [PATCH] 1.添加客户端列表显示;

---
 SourceCode/Bond/Servo/CMaster.cpp |  182 ++++++++++++++++++++-------------------------
 1 files changed, 81 insertions(+), 101 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 037d0f5..d36f540 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -6,6 +6,7 @@
 #include "RecipeManager.h"
 #include <fstream>
 #include "SerializeUtil.h"
+#include "CServoUtilsTool.h"
 
 
 namespace SERVO {
@@ -236,6 +237,10 @@
 		// 监控bit线程
 		m_hReadBitsThreadHandle = (HANDLE)_beginthreadex(NULL, 0, SERVO::ReadBitsThreadFunction, this,
 			0, &m_nReadBitsThreadAddr);
+
+
+		// 曲线服务
+		CreateDAQBridgeServer();
 
 
 		LOGI("<Master>初始化完成.");
@@ -1624,55 +1629,75 @@
 		
 
 			// 以下加入到曲线数据中
+
+
 			const int64_t ts = now_ms_epoch();
 			int eqid = ((CEquipment*)pEquipment)->getID();
 			if (eqid == EQ_ID_Bonder1 || eqid == EQ_ID_Bonder2) {
-				m_pCollector->buffersPush(eqid, 1, ts, params.at(1).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 2, ts, params.at(2).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 3, ts, params.at(3).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 4, ts, params.at(4).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 5, ts, params.at(5).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 6, ts, params.at(6).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 7, ts, params.at(7).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 8, ts, params.at(8).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 9, ts, params.at(9).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 10, ts, params.at(10).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 11, ts, params.at(11).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 12, ts, params.at(12).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 13, ts, params.at(13).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 14, ts, params.at(14).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 15, ts, params.at(15).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 16, ts, params.at(16).getDoubleValue());
+				// 定义 Bonder 的特定映射
+				std::vector<std::pair<int, int>> bonderMapping = {
+					{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7},
+					{8, 8}, {9, 9}, {10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}
+				};
+
+				CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
+				auto& dataTypes = CServoUtilsTool::getEqDataTypes();
+				auto& bonderTypes = dataTypes[eqid];
+				for (const auto& mapping : bonderMapping) {
+					int paramIndex = mapping.first;
+					int channel = mapping.second;
+
+					if (paramIndex < params.size() && channel - 1 < bonderTypes.size()) {
+						if(m_pCollector != nullptr)
+							m_pCollector->buffersPush(eqid, channel, ts, params.at(paramIndex).getDoubleValue());
+						if(pGlass != nullptr)
+							pGlass->addSVData(eqid, bonderTypes[channel], ts, params.at(paramIndex).getDoubleValue());
+					}
+				}
 			}
 			else if (eqid == EQ_ID_VACUUMBAKE) {
-				m_pCollector->buffersPush(eqid, 1, ts, params.at(1).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 2, ts, params.at(2).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 3, ts, params.at(3).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 4, ts, params.at(4).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 5, ts, params.at(5).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 6, ts, params.at(6).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 7, ts, params.at(7).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 8, ts, params.at(10).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 9, ts, params.at(11).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 10, ts, params.at(12).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 11, ts, params.at(13).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 12, ts, params.at(14).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 13, ts, params.at(15).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 14, ts, params.at(16).getDoubleValue());
+				// 定义 VACUUMBAKE 的特定映射
+				std::vector<std::pair<int, int>> vacuumMapping = {
+					{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7},
+					{10, 8}, {11, 9}, {12, 10}, {13, 11}, {14, 12}, {15, 13}, {16, 14}
+				};
+
+				CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
+				auto& dataTypes = CServoUtilsTool::getEqDataTypes();
+				auto& vacuumbakeTypes = dataTypes[eqid];
+				for (const auto& mapping : vacuumMapping) {
+					int paramIndex = mapping.first;
+					int channel = mapping.second;
+
+					if (paramIndex < params.size() && channel - 1 < vacuumbakeTypes.size()) {
+						if (m_pCollector != nullptr)
+							m_pCollector->buffersPush(eqid, channel, ts, params.at(paramIndex).getDoubleValue());
+						if (pGlass != nullptr)
+							pGlass->addSVData(eqid, vacuumbakeTypes[channel], ts, params.at(paramIndex).getDoubleValue());
+					}
+				}
 			}
 			else if (eqid == EQ_ID_BAKE_COOLING) {
-				m_pCollector->buffersPush(eqid, 1, ts, params.at(1).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 2, ts, params.at(2).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 3, ts, params.at(3).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 4, ts, params.at(4).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 5, ts, params.at(5).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 6, ts, params.at(6).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 7, ts, params.at(11).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 8, ts, params.at(12).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 9, ts, params.at(13).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 10, ts, params.at(14).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 11, ts, params.at(15).getDoubleValue());
-				m_pCollector->buffersPush(eqid, 12, ts, params.at(16).getDoubleValue());
+				// 定义 BAKE_COOLING 的特定映射
+				std::vector<std::pair<int, int>> coolingMapping = {
+					{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6},
+					{11, 7}, {12, 8}, {13, 9}, {14, 10}, {15, 11}, {16, 12}
+				};
+
+				CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
+				auto& dataTypes = CServoUtilsTool::getEqDataTypes();
+				auto& coolingTypes = dataTypes[eqid];
+				for (const auto& mapping : coolingMapping) {
+					int paramIndex = mapping.first;
+					int channel = mapping.second;
+
+					if (paramIndex < params.size() && channel - 1 < coolingTypes.size()) {
+						if (m_pCollector != nullptr)
+							m_pCollector->buffersPush(eqid, channel, ts, params.at(paramIndex).getDoubleValue());
+						if (pGlass != nullptr)
+							pGlass->addSVData(eqid, coolingTypes[channel], ts, params.at(paramIndex).getDoubleValue());
+					}
+				}
 			}
 
 
@@ -3118,67 +3143,22 @@
 
 
 			// 2) 为通道设置“曲线名称”
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 1, "气囊压力");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 2, "上腔压力");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 3, "管道真空规值");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 4, "腔体真空规值");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 5, "上腔温度1");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 6, "上腔温度2");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 7, "上腔温度3");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 8, "上腔温度4");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 9, "上腔温度5");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 10, "上腔温度6");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 11, "下腔温度1");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 12, "下腔温度2");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 13, "下腔温度3");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 14, "下腔温度4");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 15, "下腔温度5");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 16, "下腔温度6");
+			auto& dataTypes = CServoUtilsTool::getEqDataTypes();
+			auto& bonderTypes = dataTypes[EQ_ID_Bonder1];
+			for (size_t i = 0; i < bonderTypes.size(); ++i) {
+				m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, i + 1, bonderTypes[i].c_str());
+				m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, i + 1, bonderTypes[i].c_str());
+			}
 
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 1, "气囊压力");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 2, "上腔压力");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 3, "管道真空规值");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 4, "腔体真空规值");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 5, "上腔温度1");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 6, "上腔温度2");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 7, "上腔温度3");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 8, "上腔温度4");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 9, "上腔温度5");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 10, "上腔温度6");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 11, "下腔温度1");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 12, "下腔温度2");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 13, "下腔温度3");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 14, "下腔温度4");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 15, "下腔温度5");
-			m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 16, "下腔温度6");
+			auto& vacuumbakeTypes = dataTypes[EQ_ID_VACUUMBAKE];
+			for (size_t i = 0; i < vacuumbakeTypes.size(); ++i) {
+				m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, i + 1, vacuumbakeTypes[i].c_str());
+			}
 
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 1, "A腔真空规值");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 2, "A腔温控1");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 3, "A腔温控2");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 4, "A腔温控4");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 5, "A腔温控5");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 6, "A腔温控6");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 7, "A腔温控7");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 8, "B腔真空规值");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 9, "B腔温控1");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 10, "B腔温控2");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 11, "B腔温控4");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 12, "B腔温控5");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 13, "B腔温控6");
-			m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 14, "B腔温控7");
-
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 1, "A烘烤温控1");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 2, "A烘烤温控2");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 3, "A烘烤温控4");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 4, "A烘烤温控5");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 5, "A烘烤温控6");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 6, "A烘烤温控7");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 7, "B烘烤温控1");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 8, "B烘烤温控2");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 9, "B烘烤温控4");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 10, "B烘烤温控5");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 11, "B烘烤温控6");
-			m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 12, "B烘烤温控7");
+			auto& coolingTypes = dataTypes[EQ_ID_BAKE_COOLING];
+			for (size_t i = 0; i < coolingTypes.size(); ++i) {
+				m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, i + 1, coolingTypes[i].c_str());
+			}
 		}
 	}
 }

--
Gitblit v1.9.3