rts-sim-testing-service/message_server/simulation.go

27 lines
850 B
Go

package message_server
import (
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
)
// 启动仿真所需的消息服务
func Start(vs *memory.VerifySimulation) {
for _, mapId := range vs.MapIds {
t := memory.QueryGiType(mapId)
switch t {
case data_proto.PictureType_StationLayout: // 平面布置图
// 添加车站关联的平面布置图、IBP、PSL信息
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewSfpMs(vs, mapId), NewIBPMs(vs, mapId), NewPSLMs(vs, mapId))
case data_proto.PictureType_RelayCabinetLayout: // 继电器柜
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewRccMs(vs, mapId))
}
}
}
// 关闭仿真消息服务
func Close(vs *memory.VerifySimulation) {
mqtt.GetMsgClient().CloseTask(vs.SimulationId)
}