列车前端操作接口,列车连接三方映射接口及ws返回列车连接状态

This commit is contained in:
tiger_zhou 2024-03-19 09:54:32 +08:00
parent 8f04d8bcb8
commit 752dfa11eb
4 changed files with 657 additions and 641 deletions

File diff suppressed because it is too large Load Diff

View File

@ -409,6 +409,7 @@ func convertTrainState(v *state_proto.TrainState) *state_proto.TrainMapState {
TailOffset: v.TailOffset, TailOffset: v.TailOffset,
TailDevicePort: v.TailDevicePort, TailDevicePort: v.TailDevicePort,
BtmState: v.BtmState, BtmState: v.BtmState,
ConnState: v.ConnState,
} }
convertDynamicConfig(v.TrainDynamicConfig, t.TrainDynamicConfig) convertDynamicConfig(v.TrainDynamicConfig, t.TrainDynamicConfig)
convertDynamicConfig(v.TrainEndsA, t.TrainEndsA) convertDynamicConfig(v.TrainEndsA, t.TrainEndsA)

@ -1 +1 @@
Subproject commit da149138353f1904cff3328327cae45980a59f8b Subproject commit 0e19775ba6eae193bd5e7156d8f33ae6bc704023

View File

@ -74,7 +74,8 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
status.Up = up status.Up = up
status.PointTo = pointTo status.PointTo = pointTo
status.TrainKilometer = kilometer.Value status.TrainKilometer = kilometer.Value
status.Tcc = &state_proto.TrainControlState{ConnState: &state_proto.TrainConnState{Conn: false, ConnType: state_proto.TrainConnState_NONE}} status.ConnState = &state_proto.TrainConnState{Conn: false, ConnType: state_proto.TrainConnState_NONE}
status.Tcc = &state_proto.TrainControlState{}
status.DynamicState = &state_proto.TrainDynamicState{ status.DynamicState = &state_proto.TrainDynamicState{
HeadLinkId: linkId, HeadLinkId: linkId,
HeadLinkOffset: loffset, HeadLinkOffset: loffset,
@ -130,7 +131,7 @@ func TrainConnTypeUpdate(vs *VerifySimulation, ct *dto.TrainConnThirdDto) {
if conn { if conn {
allTrainMap.Range(func(k, v any) bool { allTrainMap.Range(func(k, v any) bool {
tmpTrain := v.(*state_proto.TrainState) tmpTrain := v.(*state_proto.TrainState)
if tmpTrain.Tcc.ConnState.Conn { if tmpTrain.ConnState.Conn {
panic(sys_error.New(fmt.Sprintf("列车【%s】已经连接,此列车无法联系", k))) panic(sys_error.New(fmt.Sprintf("列车【%s】已经连接,此列车无法联系", k)))
return false return false
} }
@ -138,8 +139,8 @@ func TrainConnTypeUpdate(vs *VerifySimulation, ct *dto.TrainConnThirdDto) {
}) })
} }
train := data.(*state_proto.TrainState) train := data.(*state_proto.TrainState)
train.Tcc.ConnState.Conn = conn train.ConnState.Conn = conn
train.Tcc.ConnState.ConnType = ct.ConnType train.ConnState.ConnType = ct.ConnType
} }
func createOrUpdateStateDynamicConfig(trainState *state_proto.TrainState, configTrainData dto.ConfigTrainData, trainEndsA dto.ConfigTrainEnds, func createOrUpdateStateDynamicConfig(trainState *state_proto.TrainState, configTrainData dto.ConfigTrainData, trainEndsA dto.ConfigTrainEnds,
@ -327,8 +328,8 @@ func removeTrain(vs *VerifySimulation, trainId string, train *state_proto.TrainS
return err return err
} }
train.Show = false train.Show = false
if train.Tcc.ConnState.Conn { if train.ConnState.Conn {
train.Tcc.ConnState.ConnType = state_proto.TrainConnState_NONE train.ConnState.ConnType = state_proto.TrainConnState_NONE
} }
return fi.RemoveTrainFromWorld(vs.World, trainId) return fi.RemoveTrainFromWorld(vs.World, trainId)
} }