2023-10-19 17:09:57 +08:00
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
2024-03-26 13:12:17 +08:00
|
|
|
"joylink.club/bj-rtsts-server/sys_error"
|
2023-10-19 17:09:57 +08:00
|
|
|
"joylink.club/rtsssimulation/fi"
|
|
|
|
)
|
|
|
|
|
2023-10-27 14:57:37 +08:00
|
|
|
// 操作PSL按钮
|
2024-03-26 13:12:17 +08:00
|
|
|
func ChangePSLButtonState(sim *VerifySimulation, mapId int32, gateBoxId uint32, btnCode string, pressDown bool) *sys_error.BusinessError {
|
2023-10-27 14:57:37 +08:00
|
|
|
uid := QueryUidStructure[*StationUidStructure](mapId)
|
2024-02-20 09:20:52 +08:00
|
|
|
gateBoxUid := uid.PslIds[gateBoxId].Uid
|
2024-03-26 13:12:17 +08:00
|
|
|
var err error
|
2023-10-19 17:09:57 +08:00
|
|
|
if pressDown {
|
2024-03-26 13:12:17 +08:00
|
|
|
err = fi.PressDownButton(sim.World, gateBoxUid+"_"+btnCode)
|
2023-10-19 17:09:57 +08:00
|
|
|
} else {
|
2024-03-26 13:12:17 +08:00
|
|
|
err = fi.PressUpButton(sim.World, gateBoxUid+"_"+btnCode)
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
return sys_error.New("操作PSL按钮出错", err)
|
|
|
|
} else {
|
|
|
|
return nil
|
2023-10-19 17:09:57 +08:00
|
|
|
}
|
|
|
|
}
|