From 9e8d8b630affc4a4be428c775264ef4b0e5104b3 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期五, 17 五月 2024 15:25:45 +0800
Subject: [PATCH] 添加取消订阅接口

---
 service/nvcs.go |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/service/nvcs.go b/service/nvcs.go
index 2848e6a..6ada2b3 100644
--- a/service/nvcs.go
+++ b/service/nvcs.go
@@ -36,7 +36,7 @@
 }
 
 // 瀵规帴缃戠粶瑙嗛瀛楃鍙犲姞鍣�,鎺ユ敹udp鍙戦�佺殑妤煎眰淇℃伅, 鏇存柊device鍦板潃
-func NVCSServer() {
+func NVCSA1UDPServer() {
 	// 鎸囧畾鐩戝惉鐨勭鍙�
 	port := config.ServeConf.Port
 
@@ -91,9 +91,13 @@
 		}
 
 		elevator := data.Elevator[0]
-		elevator.Name = strings.Trim(elevator.Name, " ")
-		if elevator.Name == "" {
-			continue
+
+		// 绋嬪簭閮ㄧ讲鍦ㄨ澶囩, 瀛楃鍙犲姞鍣ㄤ笂鎶ョ殑鍚嶇О鍏佽涓虹┖. 鍦ㄤ簯绔�, 鍚嶇О蹇呴』涓庢憚鍍忔満鐩稿悓
+		if config.ServeConf.Role != "agent" {
+			elevator.Name = strings.Trim(elevator.Name, " ")
+			if elevator.Name == "" {
+				continue
+			}
 		}
 
 		var d = models.Device{
@@ -112,3 +116,9 @@
 		logger.Debug("Received %d bytes from %s, %+v", numBytes, clientAddr, data)
 	}
 }
+
+func StartNVCSServer() {
+	if config.NVCSConf.Model == "A1" {
+		go NVCSA1UDPServer()
+	}
+}

--
Gitblit v1.8.0