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

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 ip: 10.60.1.59
localPort: 10000 localPort: 10000
remotePort: 4000 remotePort: 4000
open: true
# 数据源 # 数据源
datasource: datasource:

View File

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

View File

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

View File

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

View File

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

View File

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