【修改站台屏蔽门消息格式】

This commit is contained in:
weizhihong 2023-11-08 11:27:42 +08:00
parent 256a9bc4cc
commit 2f754d1579
3 changed files with 31 additions and 31 deletions

@ -1 +1 @@
Subproject commit fe2d65a91d08c62c55608aa28f799bfaaf18808e
Subproject commit fba9d6979557d3b4ef2e3b3dbab1c907fcdd44f7

View File

@ -347,31 +347,31 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKS4", Xh: getRelayXqVal(spkElectronic.SPKSS4J)})
}
}
if platformScreenDoorMap[platform.Common.Id] != nil {
for _, psdId := range platformScreenDoorMap[platform.Common.Id] {
psdUid, ok := uidsMap.PsdIds[psdId]
if !ok {
continue
}
psdEntry, ok := entity.GetEntityByUid(ms.vs.World, psdUid.Uid)
if !ok {
return nil, fmt.Errorf("屏蔽门实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), psdUid.Uid)
}
if psdEntry.HasComponent(component.PlatformMkxCircuitType) {
mkxCircuit := component.PlatformMkxCircuitType.Get(psdEntry)
mkxj := &state.MkxJState{Code: psdUid.Code}
if mkxCircuit.PABJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "PABJ", Xh: getRelayXqVal(mkxCircuit.PABJ)})
}
if mkxCircuit.PCBJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "PCBJ", Xh: getRelayXqVal(mkxCircuit.PCBJ)})
}
if mkxCircuit.POBJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "POBJ", Xh: getRelayXqVal(mkxCircuit.POBJ)})
}
sta.MkxJState = append(sta.MkxJState, mkxj)
}
psdId := platformScreenDoorMap[platform.Common.Id]
if psdId != "" {
psdUid, ok := uidsMap.PsdIds[psdId]
if !ok {
continue
}
psdEntry, ok := entity.GetEntityByUid(ms.vs.World, psdUid.Uid)
if !ok {
return nil, fmt.Errorf("屏蔽门实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), psdUid.Uid)
}
if psdEntry.HasComponent(component.PlatformMkxCircuitType) {
mkxCircuit := component.PlatformMkxCircuitType.Get(psdEntry)
mkxj := &state.MkxJState{Code: psdUid.Code}
if mkxCircuit.PABJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "站台确认继电器", Xh: getRelayXqVal(mkxCircuit.PABJ)})
}
if mkxCircuit.PCBJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "站台关门继电器", Xh: getRelayXqVal(mkxCircuit.PCBJ)})
}
if mkxCircuit.POBJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "站台开门继电器", Xh: getRelayXqVal(mkxCircuit.POBJ)})
}
sta.MkxJState = mkxj
}
}
states = append(states, sta)
}
@ -379,10 +379,10 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
}
// 将屏蔽门关联到站台
func wrapScreenDoorToPlatform(mapData *graphicData.RtssGraphicStorage) map[string][]string {
platformMap := make(map[string][]string, len(mapData.Platforms))
func wrapScreenDoorToPlatform(mapData *graphicData.RtssGraphicStorage) map[string]string {
platformMap := make(map[string]string, len(mapData.Platforms))
for _, s := range mapData.ScreenDoors {
platformMap[s.RefPlatformId] = append(platformMap[s.RefPlatformId], s.Common.Id)
platformMap[s.RefPlatformId] = s.Common.Id
}
return platformMap
}

View File

@ -621,7 +621,7 @@ type PlatformState struct {
// SPKS继电器状态
SpksState []*ReplyState `protobuf:"bytes,3,rep,name=spksState,proto3" json:"spksState,omitempty"`
// 门控箱继电器状态
MkxJState []*MkxJState `protobuf:"bytes,4,rep,name=mkxJState,proto3" json:"mkxJState,omitempty"`
MkxJState *MkxJState `protobuf:"bytes,4,opt,name=mkxJState,proto3" json:"mkxJState,omitempty"`
}
func (x *PlatformState) Reset() {
@ -677,7 +677,7 @@ func (x *PlatformState) GetSpksState() []*ReplyState {
return nil
}
func (x *PlatformState) GetMkxJState() []*MkxJState {
func (x *PlatformState) GetMkxJState() *MkxJState {
if x != nil {
return x.MkxJState
}
@ -2327,7 +2327,7 @@ var file_device_state_proto_rawDesc = []byte{
0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x73, 0x70,
0x6b, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x6d, 0x6b, 0x78, 0x4a, 0x53,
0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x74, 0x61,
0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x4d, 0x6b, 0x78, 0x4a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x6d, 0x6b,
0x78, 0x4a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x1e, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,