zhangzengfei
2024-05-22 f946512f64f1e2e9aa887f62f04f8ebedb53d810
service/nvcs.go
@@ -6,7 +6,6 @@
   "fmt"
   "io/ioutil"
   "net"
   "strings"
   "time"
   "gat1400Exchange/config"
@@ -35,6 +34,12 @@
type ElevatorData struct {
   Elevator []Elevator `json:"Elevator"`
}
const (
   RunStop = iota
   RunUp
   RunDown
)
// 对接网络视频字符叠加器,接收udp发送的楼层信息, 更新device地址
func NVCSA1UDPServer() {
@@ -87,6 +92,23 @@
         continue
      }
      // 设置osd  格式 "1F 固 枪"
      if config.NVCSConf.OSD != "" {
         floorText := data.Elevator[0].Status.FloorName
         //if data.Elevator[0].Status.RunDir == RunStop {
         //   floorText = floorText + "停"
         //} else if data.Elevator[0].Status.RunDir == RunUp {
         //   floorText = floorText + "上"
         //} else {
         //   floorText = floorText + "下"
         //}
         floorText = floorText + " " + config.NVCSConf.OSD
         // 调用hik api 将文字添加到osd的左下角
         AddFloorToOSD(floorText)
      }
      if data.Elevator[0].Status.RunDir > 0 {
         continue
      }
@@ -94,11 +116,8 @@
      elevator := data.Elevator[0]
      // 程序部署在设备端, 字符叠加器上报的名称允许为空. 在云端, 名称必须与摄像机相同
      if config.ServeConf.Role != "agent" {
         elevator.Name = strings.Trim(elevator.Name, " ")
         if elevator.Name == "" {
            continue
         }
      if elevator.Name == "" {
         elevator.Name = "1"
      }
      var d = models.Positions{