47 lines
1.8 KiB
Go
47 lines
1.8 KiB
Go
package memory
|
|
|
|
import (
|
|
"fmt"
|
|
"joylink.club/bj-rtsts-server/dto/data_proto"
|
|
"joylink.club/bj-rtsts-server/dto/request_proto"
|
|
"joylink.club/rtsssimulation/component/component_proto"
|
|
"joylink.club/rtsssimulation/fi"
|
|
)
|
|
|
|
// 处理道岔操作
|
|
func HandlePsdOperation(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error {
|
|
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.ScreenDoor{})
|
|
switch req.Operation {
|
|
case request_proto.Psd_Km:
|
|
return fi.SetInterlockKm(simulation.World, uid, req.Group)
|
|
case request_proto.Psd_CancelKm:
|
|
return fi.CancelInterlockKm(simulation.World, uid, req.Group)
|
|
case request_proto.Psd_Gm:
|
|
return fi.SetInterlockGm(simulation.World, uid)
|
|
case request_proto.Psd_CancelGm:
|
|
return fi.CancelInterlockGm(simulation.World, uid)
|
|
case request_proto.Psd_ForceKm:
|
|
case request_proto.Psd_ForceGm:
|
|
case request_proto.Psd_CancelForce:
|
|
case request_proto.Psd_AsdCannotClose:
|
|
return fi.SetPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotClose, req.AsdCodes)
|
|
case request_proto.Psd_CancelAsdCannotClose:
|
|
return fi.CancelPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotClose, req.AsdCodes)
|
|
case request_proto.Psd_AsdCannotOpen:
|
|
return fi.SetPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotOpen, req.AsdCodes)
|
|
case request_proto.Psd_CancelAsdCannotOpen:
|
|
return fi.CancelPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotOpen, req.AsdCodes)
|
|
case request_proto.Psd_QDTC:
|
|
return fi.SetQDTC(simulation.World, uid)
|
|
case request_proto.Psd_CancelQDTC:
|
|
return fi.CancelQDTC(simulation.World, uid)
|
|
case request_proto.Psd_TZTC:
|
|
return fi.SetTZTC(simulation.World, uid)
|
|
case request_proto.Psd_CancelTZTC:
|
|
return fi.CancelTZTC(simulation.World, uid)
|
|
default:
|
|
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
|
|
}
|
|
return nil
|
|
}
|