2023-10-26 16:41:18 +08:00
|
|
|
package message_server
|
|
|
|
|
|
|
|
import (
|
2024-01-11 10:24:56 +08:00
|
|
|
"joylink.club/bj-rtsts-server/dto/data_proto"
|
2023-12-25 14:15:22 +08:00
|
|
|
"joylink.club/bj-rtsts-server/mqtt"
|
2023-10-26 17:16:07 +08:00
|
|
|
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
|
2023-10-26 16:41:18 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// 启动仿真所需的消息服务
|
|
|
|
func Start(vs *memory.VerifySimulation) {
|
2023-12-25 14:15:22 +08:00
|
|
|
for _, mapId := range vs.MapIds {
|
|
|
|
t := memory.QueryGiType(mapId)
|
|
|
|
switch t {
|
2024-01-11 10:24:56 +08:00
|
|
|
case data_proto.PictureType_StationLayout: // 平面布置图
|
2023-12-25 14:15:22 +08:00
|
|
|
// 添加车站关联的平面布置图、IBP、PSL信息
|
2023-12-26 13:27:09 +08:00
|
|
|
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewSfpMs(vs, mapId), NewIBPMs(vs, mapId), NewPSLMs(vs, mapId))
|
2024-01-11 10:24:56 +08:00
|
|
|
case data_proto.PictureType_RelayCabinetLayout: // 继电器柜
|
2023-12-26 13:27:09 +08:00
|
|
|
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewRccMs(vs, mapId))
|
2023-10-27 14:57:37 +08:00
|
|
|
}
|
2023-10-26 16:41:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 关闭仿真消息服务
|
|
|
|
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
|
|
|
}
|