diff --git a/config/config.go b/config/config.go index 4dcdb7f..cc329db 100644 --- a/config/config.go +++ b/config/config.go @@ -136,6 +136,7 @@ type ElectricMachineryConfig struct { // BtmVobcConfig 11 号线 BTM vobc 网关设备配置 type BtmVobcConfig struct { + LocalUdpIp string `json:"LocalUdpIp" description:"本机监听接收UDP ip 配置"` LocalUdpPort int `json:"localUdpPort" description:"本机监听接收UDP端口"` RemoteIp string `json:"remoteIp" description:"btm串口设备IP配置"` RemoteUdpPort int `json:"remoteUdpPort" description:"btm串口设备UDP端口"` diff --git a/third_party/btm_vobc/btm_vobc.go b/third_party/btm_vobc/btm_vobc.go index 04109cb..5cd95eb 100644 --- a/third_party/btm_vobc/btm_vobc.go +++ b/third_party/btm_vobc/btm_vobc.go @@ -48,7 +48,7 @@ func (b *BtmVobcClient) Start(btmVobcManage BtmVobcManage) { slog.Info("11号线 btm vobc配置未开启...") return } - udpServer := udp.NewServer(fmt.Sprintf(":%d", cfg.RemoteUdpPort), b.handleBtmVobcFrames) + udpServer := udp.NewServer(fmt.Sprintf("%v:%d", cfg.LocalUdpIp, cfg.LocalUdpPort), b.handleBtmVobcFrames) err := udpServer.Listen() if err != nil { slog.Error("11号线 btm VOBC 服务启动失败...")