rts-sim-testing-service/third_party/axle_device/rssp_axle_manage.go
2023-11-10 10:54:44 +08:00

36 lines
1.0 KiB
Go

package axle_device
import (
"joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/third_party/message"
)
//联锁集中站计轴与联锁通信管理
type AxleMessageManager interface {
GetLineAllRsspAxleCfgs() []config.RsspAxleConfig
//HandleSectionCmdMsg 计轴设备接收到联锁发送来的控制命令
HandleSectionCmdMsg(city string, lineId string, centralizedStation string, msg *message.SectionCmdMsgPack)
//CollectSectionStatus 收集仿真中计轴区段状态
CollectSectionStatus(city string, lineId string, centralizedStation string) ([]*message.SectionStatusMsg, error)
}
var allRsspAxleServices []RsspAxle
func StartLineAllRsspAxleServices(ram AxleMessageManager) {
allRsspAxleServices = nil
cfgs := ram.GetLineAllRsspAxleCfgs()
for _, cfg := range cfgs {
if cfg.Open {
as := InitRsspAxle(&cfg)
allRsspAxleServices = append(allRsspAxleServices, as)
as.Start(ram)
}
}
}
func StopLineAllRsspAxleServices() {
for _, as := range allRsspAxleServices {
as.Stop()
}
}