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

27 lines
859 B
Go
Raw Normal View History

package message_server
import (
2023-12-25 14:15:22 +08:00
"joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
2023-10-26 17:16:07 +08:00
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
)
// 启动仿真所需的消息服务
func Start(vs *memory.VerifySimulation) {
2023-12-25 14:15:22 +08:00
for _, mapId := range vs.MapIds {
t := memory.QueryGiType(mapId)
switch t {
case graphicData.PictureType_StationLayout: // 平面布置图
// 添加车站关联的平面布置图、IBP、PSL信息
2023-12-26 13:27:09 +08:00
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewSfpMs(vs, mapId), NewIBPMs(vs, mapId), NewPSLMs(vs, mapId))
2023-12-25 14:15:22 +08:00
case graphicData.PictureType_RelayCabinetLayout: // 继电器柜
2023-12-26 13:27:09 +08:00
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewRccMs(vs, mapId))
}
}
}
// 关闭仿真消息服务
func Close(vs *memory.VerifySimulation) {
2023-12-26 13:27:09 +08:00
mqtt.GetMsgClient().CloseTask(vs.SimulationId)
2023-10-26 17:48:43 +08:00
}