【半实物、动力学开启配置】

This commit is contained in:
weizhihong 2023-10-08 09:41:42 +08:00
parent a21ace47dd
commit 941901954f
6 changed files with 14 additions and 1 deletions

View File

@ -17,6 +17,7 @@ vobc:
ip: 10.60.1.59
localPort: 10000
remotePort: 4000
open: true
# 数据源
datasource:

View File

@ -59,6 +59,7 @@ type vobc struct {
Ip string
LocalPort int
RemotePort int
Open bool
}
var Config AppConfig

View File

@ -17,6 +17,7 @@ vobc:
ip: 10.60.1.59
localPort: 10000
remotePort: 4000
open: false
# 数据源
datasource:

View File

@ -17,6 +17,7 @@ vobc:
ip: 10.60.1.59
localPort: 10000
remotePort: 4000
open: true
# 数据源
datasource:

View File

@ -16,6 +16,9 @@ import (
)
func init() {
if !config.Config.Dynamics.Open {
return
}
go func() {
for {
info := <-trainInfoChan
@ -114,6 +117,9 @@ func RunUdpServer() {
}
func Run(tiFunc TurnoutInfoFunc) error {
if !config.Config.Dynamics.Open {
return nil
}
mutex.Lock()
defer mutex.Unlock()
trainLifeSignalInit = false

View File

@ -26,6 +26,9 @@ var (
)
func init() {
if !config.Config.Vobc.Open {
return
}
go func() {
for {
info := <-vobcMsgInfoChan
@ -103,7 +106,7 @@ func RegisterTrainInfoHandler(handler VobcDataHandler) {
// 创建UDP服务
func RunUdpServer() {
if !config.Config.Dynamics.Open {
if !config.Config.Vobc.Open {
return
}
server := &udpServer{addr: fmt.Sprintf("udp://:%d", config.Config.Vobc.LocalPort), multicore: false}