【增加动力学开启状态】
This commit is contained in:
parent
32725e8f14
commit
3fe1b3e330
@ -23,6 +23,9 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
if !config.Config.Dynamics.Open {
|
||||
return
|
||||
}
|
||||
// vobc 发来的列车信息
|
||||
vobc.RegisterTrainInfoHandler(func(info []byte) {
|
||||
memory.UdpUpdateTime.VobcTime = time.Now().UnixMilli()
|
||||
|
@ -11,6 +11,7 @@ dynamics:
|
||||
udpRemotePort: 3000
|
||||
udpRemoteTrainPort: 3001
|
||||
httpPort: 7800
|
||||
open: true
|
||||
# VOBC
|
||||
vobc:
|
||||
ip: 10.60.1.59
|
||||
|
@ -53,6 +53,7 @@ type dynamics struct {
|
||||
UdpRemotePort int
|
||||
UdpRemoteTrainPort int
|
||||
HttpPort int
|
||||
Open bool
|
||||
}
|
||||
type vobc struct {
|
||||
Ip string
|
||||
|
@ -11,6 +11,7 @@ dynamics:
|
||||
udpRemotePort: 3000
|
||||
udpRemoteTrainPort: 3001
|
||||
httpPort: 7800
|
||||
open: false
|
||||
# VOBC
|
||||
vobc:
|
||||
ip: 10.60.1.59
|
||||
|
@ -11,6 +11,7 @@ dynamics:
|
||||
udpRemotePort: 3000
|
||||
udpRemoteTrainPort: 3001
|
||||
httpPort: 7800
|
||||
open: true
|
||||
# VOBC
|
||||
vobc:
|
||||
ip: 10.60.1.59
|
||||
|
@ -11,6 +11,9 @@ import (
|
||||
)
|
||||
|
||||
func SendInitTrainReq(info *InitTrainInfo) (int, *[]byte, error) {
|
||||
if !config.Config.Dynamics.Open {
|
||||
return http.StatusOK, nil, nil
|
||||
}
|
||||
baseUrl := getUrlBase()
|
||||
uri := "/api/aerodynamics/init/train/"
|
||||
url := baseUrl + uri
|
||||
@ -33,6 +36,9 @@ func SendInitTrainReq(info *InitTrainInfo) (int, *[]byte, error) {
|
||||
}
|
||||
|
||||
func SendRemoveTrainReq(info *InitTrainInfo) (int, *[]byte, error) {
|
||||
if !config.Config.Dynamics.Open {
|
||||
return http.StatusOK, nil, nil
|
||||
}
|
||||
baseUrl := getUrlBase()
|
||||
uri := "/api/aerodynamics/remove/train/"
|
||||
url := baseUrl + uri
|
||||
@ -55,6 +61,9 @@ func SendRemoveTrainReq(info *InitTrainInfo) (int, *[]byte, error) {
|
||||
}
|
||||
|
||||
func SendSimulationStartReq(base *LineBaseInfo) (int, *[]byte, error) {
|
||||
if !config.Config.Dynamics.Open {
|
||||
return http.StatusOK, nil, nil
|
||||
}
|
||||
baseUrl := getUrlBase()
|
||||
uri := "/api/start/"
|
||||
url := baseUrl + uri
|
||||
@ -74,6 +83,9 @@ func SendSimulationStartReq(base *LineBaseInfo) (int, *[]byte, error) {
|
||||
}
|
||||
|
||||
func SendSimulationEndReq() (int, *[]byte, error) {
|
||||
if !config.Config.Dynamics.Open {
|
||||
return http.StatusOK, nil, nil
|
||||
}
|
||||
baseUrl := getUrlBase()
|
||||
uri := "/api/end/"
|
||||
url := baseUrl + uri
|
||||
|
2
main.go
2
main.go
@ -40,8 +40,10 @@ func main() {
|
||||
docs.SwaggerInfo.Title = "CBTC测试系统API"
|
||||
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
|
||||
if config.Config.Dynamics.Open {
|
||||
go dynamics.RunUdpServer()
|
||||
go vobc.RunUdpServer()
|
||||
}
|
||||
|
||||
serverConfig := config.Config.Server
|
||||
if serverConfig.Port == 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user