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 | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/service/nvcs.go b/service/nvcs.go
index 7882db5..6ada2b3 100644
--- a/service/nvcs.go
+++ b/service/nvcs.go
@@ -6,6 +6,7 @@
"fmt"
"io/ioutil"
"net"
+ "strings"
"gat1400Exchange/config"
"gat1400Exchange/models"
@@ -35,7 +36,7 @@
}
// 瀵规帴缃戠粶瑙嗛瀛楃鍙犲姞鍣�,鎺ユ敹udp鍙戦�佺殑妤煎眰淇℃伅, 鏇存柊device鍦板潃
-func NVCSServer() {
+func NVCSA1UDPServer() {
// 鎸囧畾鐩戝惉鐨勭鍙�
port := config.ServeConf.Port
@@ -90,10 +91,19 @@
}
elevator := data.Elevator[0]
+
+ // 绋嬪簭閮ㄧ讲鍦ㄨ澶囩, 瀛楃鍙犲姞鍣ㄤ笂鎶ョ殑鍚嶇О鍏佽涓虹┖. 鍦ㄤ簯绔�, 鍚嶇О蹇呴』涓庢憚鍍忔満鐩稿悓
+ if config.ServeConf.Role != "agent" {
+ elevator.Name = strings.Trim(elevator.Name, " ")
+ if elevator.Name == "" {
+ continue
+ }
+ }
+
var d = models.Device{
- Id: elevator.Name,
- Pos: elevator.Status.FloorName,
- Ip: elevator.IP,
+ Id: elevator.Name,
+ Floor: elevator.Status.FloorName,
+ Ip: elevator.IP,
}
err = d.Upsert()
@@ -106,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