zhangzengfei
2024-05-17 4691c6c2efe7fccc74c75eb01b91009791960259
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()
   }
}