【地图元素ID类型改变】

This commit is contained in:
weizhihong 2023-12-14 13:04:48 +08:00
parent 3edeec44c6
commit 52cdb57d47
17 changed files with 1632 additions and 1933 deletions

View File

@ -381,7 +381,7 @@ type TurnoutOperationReq struct {
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id
DeviceId string `protobuf:"bytes,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
Operation Turnout_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Turnout_Operation" json:"operation,omitempty"` // 道岔操作
}
@ -431,11 +431,11 @@ func (x *TurnoutOperationReq) GetMapId() int32 {
return 0
}
func (x *TurnoutOperationReq) GetDeviceId() string {
func (x *TurnoutOperationReq) GetDeviceId() uint32 {
if x != nil {
return x.DeviceId
}
return ""
return 0
}
func (x *TurnoutOperationReq) GetOperation() Turnout_Operation {
@ -570,7 +570,7 @@ type PsdOperationReq struct {
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id
DeviceId string `protobuf:"bytes,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
Operation Psd_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Psd_Operation" json:"operation,omitempty"` // 操作
AsdCodes []int32 `protobuf:"varint,5,rep,packed,name=asdCodes,proto3" json:"asdCodes,omitempty"` //无法关闭/无法开启故障涉及的滑动门的编号
Group int32 `protobuf:"varint,6,opt,name=group,proto3" json:"group,omitempty"` //开门操作的编组
@ -622,11 +622,11 @@ func (x *PsdOperationReq) GetMapId() int32 {
return 0
}
func (x *PsdOperationReq) GetDeviceId() string {
func (x *PsdOperationReq) GetDeviceId() uint32 {
if x != nil {
return x.DeviceId
}
return ""
return 0
}
func (x *PsdOperationReq) GetOperation() Psd_Operation {
@ -671,7 +671,7 @@ var file_request_proto_rawDesc = []byte{
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08,
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x72, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x4f, 0x70,
@ -721,7 +721,7 @@ var file_request_proto_rawDesc = []byte{
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64,
0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64,
0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64,
0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,

View File

@ -42,7 +42,7 @@ type AddTrainReqDto struct {
//车头所在link内的偏移量单位为mm
HeadLinkOffset int64 `json:"headLinkOffset" form:"headLinkOffset"`
//物理区段、道岔ID
Id string `json:"id" form:"id"`
Id uint32 `json:"id" form:"id"`
//道岔端口
DevicePort string `json:"devicePort" form:"devicePort"`
//车头所在link内的偏移量单位为mm
@ -94,7 +94,7 @@ type SwitchOperationReqDto struct {
type SignalOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
DeviceId string `form:"id" json:"id" binding:"required"`
DeviceId uint32 `form:"id" json:"id" binding:"required"`
Operation request_proto.Signal_Operation `form:"operation" json:"operation" binding:"required"` //信号机操作类型
Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` // 当操作为Operation.Display时有效表示显示的信号
}
@ -103,7 +103,7 @@ type SignalOperationReqDto struct {
type AxleSectionOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
DeviceId string `form:"id" json:"id" binding:"required"`
DeviceId uint32 `form:"id" json:"id" binding:"required"`
Operation request_proto.Section_Operation `form:"operation" json:"operation"`
TrainIn bool `form:"trainIn" json:"trainIn"`
TrainOut bool `form:"trainOut" json:"trainOut"`
@ -111,22 +111,22 @@ type AxleSectionOperationReqDto struct {
type EsbButtonOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
Id string `form:"id" json:"id" binding:"required"`
Id uint32 `form:"id" json:"id" binding:"required"`
Down bool `form:"down" json:"down"`
}
type IBPButtonOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
StationId string `form:"stationId" json:"stationId" binding:"required"`
ButtonId string `form:"buttonId" json:"buttonId" binding:"required"`
StationId uint32 `form:"stationId" json:"stationId" binding:"required"`
ButtonId uint32 `form:"buttonId" json:"buttonId" binding:"required"`
Down bool `form:"down" json:"down"`
}
type PslOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
GateBoxId string `form:"gateBoxId" json:"gateBoxId"`
GateBoxId uint32 `form:"gateBoxId" json:"gateBoxId"`
ButtonCode string `form:"buttonCode" json:"buttonCode" binding:"required"`
Down bool `form:"down" json:"down"`
}
@ -134,8 +134,8 @@ type PslOperationReqDto struct {
type KeyOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
StationId string `form:"stationId" json:"stationId" binding:"required"`
KeyId string `form:"keyId" json:"keyId"`
StationId uint32 `form:"stationId" json:"stationId" binding:"required"`
KeyId uint32 `form:"keyId" json:"keyId"`
Gear int32 `form:"gear" json:"gear"`
}
@ -165,6 +165,6 @@ type SimulationInfoRspDtoArr []SimulationInfoRspDto
type RelayOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
Id string `form:"id" json:"id" binding:"required"`
Id uint32 `form:"id" json:"id" binding:"required"`
Td bool `form:"td" json:"td"`
}

View File

@ -12,7 +12,7 @@ func TestTurnoutOperationReqDto(t *testing.T) {
b, err := json.Marshal(&request_proto.TurnoutOperationReq{
SimulationId: "1",
MapId: 2,
DeviceId: "3",
DeviceId: 3,
Operation: 2,
})
if err != nil {

View File

@ -109,7 +109,7 @@ func (ms *IbpMs) collectIBPButtonState(stationUid string, uidsMap *memory.IBPUid
}
// 获取IBP盘按钮状态
func getIBPButtonState(id string, entry *ecs.Entry) *state.ButtonState {
func getIBPButtonState(id uint32, entry *ecs.Entry) *state.ButtonState {
status := &state.ButtonState{Id: id}
bit := component.BitStateType.Get(entry)
status.Down = bit.Val
@ -173,6 +173,6 @@ func (ms *IbpMs) collectIBPKeyState(stationUid string, uidsMap *memory.IBPUidStr
}
// 处理订阅通道名称
func (ms *IbpMs) handlerIBPChannelName(stationId string) string {
func (ms *IbpMs) handlerIBPChannelName(stationId uint32) string {
return fmt.Sprintf(SimulationIbpTopic, ms.vs.SimulationId, ms.mapId, stationId)
}

View File

@ -56,7 +56,7 @@ func (p *PslMs) OnTick() ([]*ms_api.TopicMsg, error) {
func (p *PslMs) OnError(err error) {}
// 处理订阅通道名称
func (p *PslMs) handlerPSLChannelName(gateBoxId string) string {
func (p *PslMs) handlerPSLChannelName(gateBoxId uint32) string {
return fmt.Sprintf(SimulationPslTopic, p.vs.SimulationId, p.mapId, gateBoxId)
}
@ -72,13 +72,19 @@ func (p *PslMs) collectGateBoxPSLState(box *graphicData.GatedBox) (*state.Pushed
mkx := component.MkxType.Get(mkxEntry)
var buttonStateArr []*state.ButtonState
if ok {
pslMapId := memory.QueryGiId(box.RefGatedBoxMapCode)
pslStorage := memory.QueryGiData[*graphicData.PslGraphicStorage](pslMapId)
btnUidMap := make(map[string]uint32, len(pslStorage.PslButtons))
for _, button := range pslStorage.PslButtons {
btnUidMap[boxUid+"_"+button.Code] = memory.GetMapElementId(button.Common)
}
btnArr := []*ecs.Entry{mkx.PCB, mkx.POB, mkx.PAB}
for _, btn := range btnArr {
if btn == nil {
continue
}
buttonStateArr = append(buttonStateArr, &state.ButtonState{
Id: component.UidType.Get(btn).Id,
Id: btnUidMap[component.UidType.Get(btn).Id],
Down: component.BitStateType.Get(btn).Val,
Active: component.BitStateType.Get(btn).Val,
})

View File

@ -333,12 +333,12 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
for _, platform := range mapData.Platforms {
pid := memory.GetMapElementId(platform.Common)
stationCommonId := platform.RefStationId
if stationCommonId == "" {
if stationCommonId == 0 {
return nil, fmt.Errorf("站台没有绑定车站:id=%v", pid)
}
uidInfo := uidsMap.StationIds[stationCommonId]
if uidInfo == nil {
return nil, fmt.Errorf("车站实体不存在uid映射:id=%s", stationCommonId)
return nil, fmt.Errorf("车站实体不存在uid映射:id=%v", stationCommonId)
}
entry, ok := entity.GetEntityByUid(ms.vs.World, uidInfo.Uid)
if !ok {
@ -366,7 +366,7 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
}
}
psdId := platformScreenDoorMap[pid]
if psdId != "" {
if psdId != 0 {
psdUid, ok := uidsMap.PsdIds[psdId]
if !ok {
continue
@ -397,8 +397,8 @@ 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[uint32]uint32 {
platformMap := make(map[uint32]uint32, len(mapData.Platforms))
for _, s := range mapData.ScreenDoors {
platformMap[s.RefPlatformId] = memory.GetMapElementId(s.Common)
}

View File

@ -20,9 +20,9 @@ const (
// 继电器组合柜布置图设备状态消息topic
SimulationRccTopic = SimulationTopicPrefix + "rcc/%d"
// PSL设备状态消息topic
SimulationPslTopic = SimulationTopicPrefix + "psl/%d/%s"
SimulationPslTopic = SimulationTopicPrefix + "psl/%d/%d"
// IBP设备状态消息topic
SimulationIbpTopic = SimulationTopicPrefix + "ibp/%d/%s"
SimulationIbpTopic = SimulationTopicPrefix + "ibp/%d/%d"
)
var smsMap sync.Map

View File

@ -549,8 +549,9 @@ type Combinationtype struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
RefRelays []string `protobuf:"bytes,2,rep,name=refRelays,proto3" json:"refRelays,omitempty"` //设备关联的继电器
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
OldrefRelays []string `protobuf:"bytes,2,rep,name=oldrefRelays,proto3" json:"oldrefRelays,omitempty"` //设备关联的继电器
RefRelays []uint32 `protobuf:"varint,3,rep,packed,name=refRelays,proto3" json:"refRelays,omitempty"` //设备关联的继电器
}
func (x *Combinationtype) Reset() {
@ -592,7 +593,14 @@ func (x *Combinationtype) GetCode() string {
return ""
}
func (x *Combinationtype) GetRefRelays() []string {
func (x *Combinationtype) GetOldrefRelays() []string {
if x != nil {
return x.OldrefRelays
}
return nil
}
func (x *Combinationtype) GetRefRelays() []uint32 {
if x != nil {
return x.RefRelays
}
@ -825,8 +833,9 @@ type CjDataItem struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RelayId string `protobuf:"bytes,1,opt,name=relayId,proto3" json:"relayId,omitempty"` //采集对应的继电器Id
Position CjDataItem_PostionType `protobuf:"varint,2,opt,name=position,proto3,enum=relayCabinetGraphicData.CjDataItem_PostionType" json:"position,omitempty"` //继电器的位置QH对应着吸合
OldrelayId string `protobuf:"bytes,1,opt,name=oldrelayId,proto3" json:"oldrelayId,omitempty"` //采集对应的继电器Id
Position CjDataItem_PostionType `protobuf:"varint,2,opt,name=position,proto3,enum=relayCabinetGraphicData.CjDataItem_PostionType" json:"position,omitempty"` //继电器的位置QH对应着吸合
RelayId uint32 `protobuf:"varint,3,opt,name=relayId,proto3" json:"relayId,omitempty"` //采集对应的继电器Id
}
func (x *CjDataItem) Reset() {
@ -861,9 +870,9 @@ func (*CjDataItem) Descriptor() ([]byte, []int) {
return file_relayCabinetLayoutGraphics_proto_rawDescGZIP(), []int{11}
}
func (x *CjDataItem) GetRelayId() string {
func (x *CjDataItem) GetOldrelayId() string {
if x != nil {
return x.RelayId
return x.OldrelayId
}
return ""
}
@ -875,6 +884,13 @@ func (x *CjDataItem) GetPosition() CjDataItem_PostionType {
return CjDataItem_Q
}
func (x *CjDataItem) GetRelayId() uint32 {
if x != nil {
return x.RelayId
}
return 0
}
// 驱动
type CiQd struct {
state protoimpl.MessageState
@ -991,7 +1007,8 @@ type QdData struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RefRelays []string `protobuf:"bytes,1,rep,name=refRelays,proto3" json:"refRelays,omitempty"` //驱动的继电器Id
OldrefRelays []string `protobuf:"bytes,1,rep,name=oldrefRelays,proto3" json:"oldrefRelays,omitempty"` //驱动的继电器Id
RefRelays []uint32 `protobuf:"varint,2,rep,packed,name=refRelays,proto3" json:"refRelays,omitempty"` //驱动的继电器Id
}
func (x *QdData) Reset() {
@ -1026,7 +1043,14 @@ func (*QdData) Descriptor() ([]byte, []int) {
return file_relayCabinetLayoutGraphics_proto_rawDescGZIP(), []int{14}
}
func (x *QdData) GetRefRelays() []string {
func (x *QdData) GetOldrefRelays() []string {
if x != nil {
return x.OldrefRelays
}
return nil
}
func (x *QdData) GetRefRelays() []uint32 {
if x != nil {
return x.RefRelays
}
@ -1133,61 +1157,67 @@ var file_relayCabinetLayoutGraphics_proto_rawDesc = []byte{
0x32, 0x22, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52,
0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x22, 0x43, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x74,
0x22, 0x67, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x74,
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65,
0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52,
0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0x7c, 0x0a, 0x0c, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49,
0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e,
0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x65, 0x49,
0x64, 0x12, 0x40, 0x0a, 0x1b, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x73, 0x43, 0x6f, 0x6e, 0x63,
0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x73, 0x43,
0x6f, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x04, 0x43, 0x69, 0x43, 0x6a, 0x12, 0x18, 0x0a, 0x07, 0x64,
0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x73,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x63, 0x6a, 0x4c, 0x69, 0x73, 0x74, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62,
0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e,
0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x06, 0x63, 0x6a, 0x4c, 0x69, 0x73,
0x74, 0x22, 0x5a, 0x0a, 0x09, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e,
0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a,
0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x4b, 0x0a,
0x06, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65,
0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x72, 0x65, 0x6c,
0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63,
0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x52,
0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0a, 0x43,
0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6c,
0x61, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61,
0x79, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62,
0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e,
0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x69,
0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x22, 0x1b, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12,
0x05, 0x0a, 0x01, 0x51, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x48, 0x10, 0x01, 0x22, 0x5c, 0x0a,
0x04, 0x43, 0x69, 0x51, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x3a, 0x0a, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72,
0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61,
0x53, 0x65, 0x74, 0x52, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x5a, 0x0a, 0x09, 0x51,
0x64, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07,
0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e,
0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70,
0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07,
0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x26, 0x0a, 0x06, 0x51, 0x64, 0x44, 0x61, 0x74,
0x61, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x42,
0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x72, 0x65,
0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f,
0x6c, 0x64, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72,
0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x09,
0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0x7c, 0x0a, 0x0c, 0x55, 0x6e, 0x69,
0x71, 0x75, 0x65, 0x49, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a,
0x06, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c,
0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x1b, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x73,
0x43, 0x6f, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, 0x62, 0x65, 0x6c, 0x6f,
0x6e, 0x67, 0x73, 0x43, 0x6f, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x04, 0x43, 0x69, 0x43, 0x6a, 0x12,
0x18, 0x0a, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x63, 0x6a, 0x4c,
0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61,
0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44,
0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x06, 0x63,
0x6a, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x5a, 0x0a, 0x09, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53,
0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73,
0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43,
0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74,
0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73,
0x74, 0x22, 0x4b, 0x0a, 0x06, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x09, 0x72,
0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23,
0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61,
0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49,
0x74, 0x65, 0x6d, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0xb0,
0x01, 0x0a, 0x0a, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1e, 0x0a,
0x0a, 0x6f, 0x6c, 0x64, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x6f, 0x6c, 0x64, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x12, 0x4b, 0x0a,
0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x2f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72,
0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61,
0x49, 0x74, 0x65, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65,
0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65,
0x6c, 0x61, 0x79, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x65, 0x6c,
0x61, 0x79, 0x49, 0x64, 0x22, 0x1b, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54,
0x79, 0x70, 0x65, 0x12, 0x05, 0x0a, 0x01, 0x51, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x48, 0x10,
0x01, 0x22, 0x5c, 0x0a, 0x04, 0x43, 0x69, 0x51, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x73, 0x43,
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x73, 0x43, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e,
0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64,
0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22,
0x5a, 0x0a, 0x09, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x39, 0x0a, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74,
0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64, 0x44, 0x61,
0x74, 0x61, 0x52, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x4a, 0x0a, 0x06, 0x51,
0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x72, 0x65, 0x66, 0x52,
0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x6c, 0x64,
0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66,
0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65,
0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x42, 0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x74, 0x73, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61,
0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

View File

@ -208,7 +208,7 @@ type LinkState struct {
unknownFields protoimpl.UnknownFields
// link索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// link上的列车id列表
TrainId []string `protobuf:"bytes,2,rep,name=trainId,proto3" json:"trainId,omitempty"`
}
@ -245,11 +245,11 @@ func (*LinkState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{0}
}
func (x *LinkState) GetId() string {
func (x *LinkState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *LinkState) GetTrainId() []string {
@ -266,7 +266,7 @@ type SectionState struct {
unknownFields protoimpl.UnknownFields
// 区段索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 区段占用
// true-占用false-出清
Occupied bool `protobuf:"varint,3,opt,name=occupied,proto3" json:"occupied,omitempty"`
@ -306,11 +306,11 @@ func (*SectionState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{1}
}
func (x *SectionState) GetId() string {
func (x *SectionState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *SectionState) GetOccupied() bool {
@ -334,7 +334,7 @@ type SwitchState struct {
unknownFields protoimpl.UnknownFields
// 道岔索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 道岔处于定位(表示)
Normal bool `protobuf:"varint,2,opt,name=normal,proto3" json:"normal,omitempty"`
// 道岔处于反位(表示)
@ -401,11 +401,11 @@ func (*SwitchState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{2}
}
func (x *SwitchState) GetId() string {
func (x *SwitchState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *SwitchState) GetNormal() bool {
@ -527,7 +527,7 @@ type SignalState struct {
unknownFields protoimpl.UnknownFields
// 信号机索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 信号机的灯列表
Aspect Signal_Aspect `protobuf:"varint,2,opt,name=aspect,proto3,enum=state.Signal_Aspect" json:"aspect,omitempty"`
}
@ -564,11 +564,11 @@ func (*SignalState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{3}
}
func (x *SignalState) GetId() string {
func (x *SignalState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *SignalState) GetAspect() Signal_Aspect {
@ -624,7 +624,7 @@ type PlatformState struct {
unknownFields protoimpl.UnknownFields
// 站台索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// EMP继电器状态
Empj bool `protobuf:"varint,2,opt,name=empj,proto3" json:"empj,omitempty"`
// SPKS继电器状态
@ -665,11 +665,11 @@ func (*PlatformState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{5}
}
func (x *PlatformState) GetId() string {
func (x *PlatformState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *PlatformState) GetEmpj() bool {
@ -700,7 +700,7 @@ type StationState struct {
unknownFields protoimpl.UnknownFields
// 车站索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *StationState) Reset() {
@ -735,11 +735,11 @@ func (*StationState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{6}
}
func (x *StationState) GetId() string {
func (x *StationState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
// 列车状态
@ -759,7 +759,7 @@ type TrainState struct {
// 列车是否显示
Show bool `protobuf:"varint,5,opt,name=show,proto3" json:"show,omitempty"`
// 列车车头所在设备ID
HeadDeviceId string `protobuf:"bytes,6,opt,name=headDeviceId,proto3" json:"headDeviceId,omitempty"`
HeadDeviceId uint32 `protobuf:"varint,6,opt,name=headDeviceId,proto3" json:"headDeviceId,omitempty"`
// 列车车头所在设备偏移量
HeadOffset int64 `protobuf:"varint,7,opt,name=headOffset,proto3" json:"headOffset,omitempty"`
// 设备端口
@ -849,11 +849,11 @@ func (x *TrainState) GetShow() bool {
return false
}
func (x *TrainState) GetHeadDeviceId() string {
func (x *TrainState) GetHeadDeviceId() uint32 {
if x != nil {
return x.HeadDeviceId
}
return ""
return 0
}
func (x *TrainState) GetHeadOffset() int64 {
@ -1446,7 +1446,7 @@ type ReplyState struct {
unknownFields protoimpl.UnknownFields
// 继电器索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 继电器吸合状态
Xh bool `protobuf:"varint,2,opt,name=xh,proto3" json:"xh,omitempty"`
// 继电器编号
@ -1485,11 +1485,11 @@ func (*ReplyState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{10}
}
func (x *ReplyState) GetId() string {
func (x *ReplyState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *ReplyState) GetXh() bool {
@ -1512,7 +1512,7 @@ type ButtonState struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Down bool `protobuf:"varint,2,opt,name=down,proto3" json:"down,omitempty"`
Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` // 带灯的按钮
}
@ -1549,11 +1549,11 @@ func (*ButtonState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{11}
}
func (x *ButtonState) GetId() string {
func (x *ButtonState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *ButtonState) GetDown() bool {
@ -1576,7 +1576,7 @@ type AlarmState struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"`
}
@ -1612,11 +1612,11 @@ func (*AlarmState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{12}
}
func (x *AlarmState) GetId() string {
func (x *AlarmState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *AlarmState) GetActive() bool {
@ -1632,7 +1632,7 @@ type LightState struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"`
}
@ -1668,11 +1668,11 @@ func (*LightState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{13}
}
func (x *LightState) GetId() string {
func (x *LightState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *LightState) GetActive() bool {
@ -1688,7 +1688,7 @@ type PsdState struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id
AsdStates []*AsdState `protobuf:"bytes,2,rep,name=asdStates,proto3" json:"asdStates,omitempty"` //滑动门状态
Mgj bool `protobuf:"varint,3,opt,name=mgj,proto3" json:"mgj,omitempty"` //屏蔽门整体的关闭(继电器)状态
}
@ -1725,11 +1725,11 @@ func (*PsdState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{14}
}
func (x *PsdState) GetId() string {
func (x *PsdState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *PsdState) GetAsdStates() []*AsdState {
@ -1824,7 +1824,7 @@ type KeyState struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Gear int32 `protobuf:"varint,2,opt,name=gear,proto3" json:"gear,omitempty"`
}
@ -1860,11 +1860,11 @@ func (*KeyState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{16}
}
func (x *KeyState) GetId() string {
func (x *KeyState) GetId() uint32 {
if x != nil {
return x.Id
}
return ""
return 0
}
func (x *KeyState) GetGear() int32 {
@ -2292,16 +2292,16 @@ var file_device_state_proto_rawDesc = []byte{
0x0a, 0x12, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x35, 0x0a, 0x09, 0x4c,
0x69, 0x6e, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69,
0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6e,
0x49, 0x64, 0x22, 0x58, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02,
0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x03,
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x12, 0x1c,
0x0a, 0x09, 0x61, 0x78, 0x6c, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
0x08, 0x52, 0x09, 0x61, 0x78, 0x6c, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x22, 0xcf, 0x02, 0x0a,
0x0b, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6e, 0x6f,
0x72, 0x6d, 0x61, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x0e,
@ -2322,7 +2322,7 @@ var file_device_state_proto_rawDesc = []byte{
0x79, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x11,
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x4b,
0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a,
0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x41, 0x73, 0x70,
0x65, 0x63, 0x74, 0x52, 0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22, 0x4f, 0x0a, 0x06, 0x53,
@ -2332,7 +2332,7 @@ var file_device_state_proto_rawDesc = []byte{
0x05, 0x0a, 0x01, 0x55, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x55, 0x10, 0x05, 0x12, 0x05,
0x0a, 0x01, 0x42, 0x10, 0x06, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x07, 0x22, 0x94, 0x01, 0x0a,
0x0d, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x65, 0x6d, 0x70, 0x6a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x65, 0x6d,
0x70, 0x6a, 0x12, 0x2f, 0x0a, 0x09, 0x73, 0x70, 0x6b, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65,
@ -2341,7 +2341,7 @@ var file_device_state_proto_rawDesc = []byte{
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, 0x01, 0x28, 0x09, 0x52,
0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x02, 0x69, 0x64, 0x22, 0xad, 0x04, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02,
@ -2351,7 +2351,7 @@ var file_device_state_proto_rawDesc = []byte{
0x72, 0x61, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x68,
0x6f, 0x77, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x68, 0x6f, 0x77, 0x12, 0x22,
0x0a, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73,
0x65, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74,
@ -2496,22 +2496,22 @@ var file_device_state_proto_rawDesc = []byte{
0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x40, 0x0a, 0x0a, 0x52, 0x65,
0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x78, 0x68, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x78, 0x68, 0x18, 0x02,
0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x78, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x49, 0x0a, 0x0b,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64,
0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12,
0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a,
0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61,
0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74,
0x69, 0x76, 0x65, 0x22, 0x5b, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12,
0x2d, 0x0a, 0x09, 0x61, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x73, 0x64, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x09, 0x61, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x10,
@ -2523,7 +2523,7 @@ var file_device_state_proto_rawDesc = []byte{
0x28, 0x08, 0x52, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18,
0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x22, 0x2e, 0x0a, 0x08, 0x4b, 0x65,
0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x65, 0x61, 0x72, 0x18, 0x02,
0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x65, 0x61, 0x72, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x65, 0x61, 0x72, 0x22, 0x52, 0x0a, 0x09, 0x4d, 0x6b,
0x78, 0x4a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72,

View File

@ -8,13 +8,13 @@ import (
)
// 操作IBP按钮
func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId string, pressDown bool) error {
func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId uint32, pressDown bool) error {
uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId)
if err != nil {
return err
}
if uidMap.IbpButtonIds[btnId] == nil {
return fmt.Errorf("车站【%s】按钮【%s】UID不存在", stationId, btnId)
return fmt.Errorf("车站【%d】按钮【%d】UID不存在", stationId, btnId)
}
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{})
if pressDown {
@ -25,20 +25,20 @@ func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId s
}
// 操作IBP按钮
func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, stationId, keyId string, gear int32) error {
func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, stationId, keyId uint32, gear int32) error {
uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId)
if err != nil {
return err
}
if uidMap.IbpKeyIds[keyId] == nil {
return fmt.Errorf("车站【%s】钥匙【%s】UID不存在", stationId, keyId)
return fmt.Errorf("车站【%d】钥匙【%d】UID不存在", stationId, keyId)
}
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{})
return fi.SwitchKeyGear(sim.World, stationUid+"_"+uidMap.IbpKeyIds[keyId].Uid, gear)
}
// 根据平面布置图ID、列车ID获取IbpUid信息
func getIbpUidByMapIdAndStationId(mapId int32, stationId string) (*IBPUidStructure, error) {
func getIbpUidByMapIdAndStationId(mapId int32, stationId uint32) (*IBPUidStructure, error) {
giData := QueryGiData[*graphicData.RtssGraphicStorage](mapId)
var station *graphicData.Station
for _, s := range giData.Stations {
@ -48,7 +48,7 @@ func getIbpUidByMapIdAndStationId(mapId int32, stationId string) (*IBPUidStructu
}
}
if station == nil {
return nil, fmt.Errorf("地图【%d】车站【%s】不存在", mapId, stationId)
return nil, fmt.Errorf("地图【%d】车站【%d】不存在", mapId, stationId)
}
if station.RefIbpMapCode == "" {

View File

@ -3,6 +3,7 @@ package memory
import (
"fmt"
"log/slog"
"strconv"
"strings"
"sync"
@ -15,39 +16,37 @@ import (
var giUidMap sync.Map
type elementIdStructure struct {
CommonId string
Id uint32
CommonId uint32
Code string
Uid string
}
// 数组为Index为 common.ButtonCode, index, uid
type StationUidStructure struct {
AxlePointIds map[string]*elementIdStructure
TurnoutIds map[string]*elementIdStructure
PhysicalSectionIds map[string]*elementIdStructure
SignalIds map[string]*elementIdStructure
TransponderIds map[string]*elementIdStructure
SlopeIds map[string]*elementIdStructure
CurvatureIds map[string]*elementIdStructure
ButtonIds map[string]*elementIdStructure
StationIds map[string]*elementIdStructure
PlatformIds map[string]*elementIdStructure
PsdIds map[string]*elementIdStructure
GateBoxIds map[string]*elementIdStructure
SpksSwitchIds map[string]*elementIdStructure
AxlePointIds map[uint32]*elementIdStructure
TurnoutIds map[uint32]*elementIdStructure
PhysicalSectionIds map[uint32]*elementIdStructure
SignalIds map[uint32]*elementIdStructure
TransponderIds map[uint32]*elementIdStructure
SlopeIds map[uint32]*elementIdStructure
CurvatureIds map[uint32]*elementIdStructure
ButtonIds map[uint32]*elementIdStructure
StationIds map[uint32]*elementIdStructure
PlatformIds map[uint32]*elementIdStructure
PsdIds map[uint32]*elementIdStructure
GateBoxIds map[uint32]*elementIdStructure
SpksSwitchIds map[uint32]*elementIdStructure
}
type RelayUidStructure struct {
RelayCabinetIds map[string]*elementIdStructure
RelayIds map[string]*elementIdStructure
RelayIds map[uint32]*elementIdStructure
}
type IBPUidStructure struct {
IbpButtonIds map[string]*elementIdStructure
IbpAlarmIds map[string]*elementIdStructure
IbpKeyIds map[string]*elementIdStructure
IbpLightIds map[string]*elementIdStructure
IbpButtonIds map[uint32]*elementIdStructure
IbpAlarmIds map[uint32]*elementIdStructure
IbpKeyIds map[uint32]*elementIdStructure
IbpLightIds map[uint32]*elementIdStructure
}
// 获取继电器的关联关系
@ -59,31 +58,37 @@ type deviceRelateUidPriex struct {
}
// 获取地图元素ID
func GetMapElementId(common *graphicData.CommonInfo) string {
return common.Id
func GetMapElementId(common *graphicData.CommonInfo) uint32 {
if common.Id != 0 {
return common.Id
}
if common.Oldid != "" {
id, _ := strconv.Atoi(common.Oldid)
return uint32(id)
}
panic(sys_error.New("元素缺少主键"))
}
func getMapELementCode(code ...string) string {
func getMapELementCode(id uint32, code ...string) string {
for _, c := range code {
if c != "" {
return c
}
}
panic(sys_error.New("传入Code至少一个不为空"))
return strconv.Itoa(int(id))
}
// 获取关联的车站名
func handleRefStationName(stationMap map[string]*graphicData.Station, sid []string) []string {
func handleRefStationName(stationMap map[uint32]*graphicData.Station, sid []uint32) []string {
var stationNames []string
for _, id := range sid {
if id == "" {
if id == 0 {
continue
}
stationName := id
if stationMap[id] != nil {
stationName = stationMap[id].StationName
if stationMap[id] == nil {
continue
}
stationNames = append(stationNames, stationName)
stationNames = append(stationNames, stationMap[id].StationName)
}
return stationNames
}
@ -108,7 +113,7 @@ func getUIdPrefix(prefix interface{}) (string, string, string) {
// 过滤掉其他线路的设备
func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
otherDeviceIdMap := make(map[string]bool)
otherDeviceIdMap := make(map[uint32]bool)
for _, ods := range data.OtherLineList {
for _, id := range ods.Ids {
otherDeviceIdMap[id] = true
@ -137,7 +142,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
d.PbRef = nil
slog.Warn("区段[id:%v][code:%s]设备B端是其他线路设备已置空", did, d.Code)
}
var acs []string
var acs []uint32
for _, id := range d.AxleCountings {
if otherDeviceIdMap[id] {
continue
@ -146,7 +151,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
}
d.AxleCountings = acs
if otherDeviceIdMap[d.TrackSectionId] {
d.TrackSectionId = ""
d.TrackSectionId = 0
}
sections = append(sections, d)
}
@ -190,14 +195,14 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
d.PcRef = nil
slog.Warn("道岔[id:%v][code:%s]设备C端是其他线路设备已置空", did, d.Code)
}
if d.PaTrackSectionId != "" && otherDeviceIdMap[d.PaTrackSectionId] {
d.PaTrackSectionId = ""
if d.PaTrackSectionId != 0 && otherDeviceIdMap[d.PaTrackSectionId] {
d.PaTrackSectionId = 0
}
if d.PbTrackSectionId != "" && otherDeviceIdMap[d.PbTrackSectionId] {
d.PbTrackSectionId = ""
if d.PbTrackSectionId != 0 && otherDeviceIdMap[d.PbTrackSectionId] {
d.PbTrackSectionId = 0
}
if d.PcTrackSectionId != "" && otherDeviceIdMap[d.PcTrackSectionId] {
d.PcTrackSectionId = ""
if d.PcTrackSectionId != 0 && otherDeviceIdMap[d.PcTrackSectionId] {
d.PcTrackSectionId = 0
}
turnouts = append(turnouts, d)
}
@ -229,25 +234,26 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
// 初始化平面布置图 UID
func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
gus := &StationUidStructure{
AxlePointIds: make(map[string]*elementIdStructure, len(data.AxleCountings)),
TurnoutIds: make(map[string]*elementIdStructure, len(data.Turnouts)),
PhysicalSectionIds: make(map[string]*elementIdStructure, len(data.Section)),
SignalIds: make(map[string]*elementIdStructure, len(data.Signals)),
TransponderIds: make(map[string]*elementIdStructure, len(data.Transponders)),
SlopeIds: make(map[string]*elementIdStructure, len(data.Slopes)),
CurvatureIds: make(map[string]*elementIdStructure, len(data.Curvatures)),
ButtonIds: make(map[string]*elementIdStructure, len(data.EsbButtons)),
StationIds: make(map[string]*elementIdStructure, len(data.Stations)),
PlatformIds: make(map[string]*elementIdStructure, len(data.Platforms)),
PsdIds: make(map[string]*elementIdStructure, len(data.ScreenDoors)),
GateBoxIds: make(map[string]*elementIdStructure, len(data.GateBoxs)),
SpksSwitchIds: make(map[string]*elementIdStructure, len(data.SpksSwitchs)),
AxlePointIds: make(map[uint32]*elementIdStructure, len(data.AxleCountings)),
TurnoutIds: make(map[uint32]*elementIdStructure, len(data.Turnouts)),
PhysicalSectionIds: make(map[uint32]*elementIdStructure, len(data.Section)),
SignalIds: make(map[uint32]*elementIdStructure, len(data.Signals)),
TransponderIds: make(map[uint32]*elementIdStructure, len(data.Transponders)),
SlopeIds: make(map[uint32]*elementIdStructure, len(data.Slopes)),
CurvatureIds: make(map[uint32]*elementIdStructure, len(data.Curvatures)),
ButtonIds: make(map[uint32]*elementIdStructure, len(data.EsbButtons)),
StationIds: make(map[uint32]*elementIdStructure, len(data.Stations)),
PlatformIds: make(map[uint32]*elementIdStructure, len(data.Platforms)),
PsdIds: make(map[uint32]*elementIdStructure, len(data.ScreenDoors)),
GateBoxIds: make(map[uint32]*elementIdStructure, len(data.GateBoxs)),
SpksSwitchIds: make(map[uint32]*elementIdStructure, len(data.SpksSwitchs)),
}
city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix)
// 处理车站信息
stationMap := make(map[string]*graphicData.Station)
stationMap := make(map[uint32]*graphicData.Station)
for _, s := range data.Stations {
eid, stationName := GetMapElementId(s.Common), getMapELementCode(s.StationName, s.Code)
eid := GetMapElementId(s.Common)
stationName := getMapELementCode(eid, s.StationName, s.Code)
stationMap[eid] = s
gus.StationIds[eid] = &elementIdStructure{
CommonId: eid,
@ -258,7 +264,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化计轴信息
for _, a := range data.AxleCountings {
eid := GetMapElementId(a.Common)
code := getMapELementCode(a.Code, eid)
code := getMapELementCode(eid, a.Code)
stationNames := handleRefStationName(stationMap, a.CentralizedStations)
gus.AxlePointIds[eid] = &elementIdStructure{
CommonId: eid,
@ -269,7 +275,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化道岔信息
for _, t := range data.Turnouts {
eid := GetMapElementId(t.Common)
code := getMapELementCode(t.Code, eid)
code := getMapELementCode(eid, t.Code)
stationNames := handleRefStationName(stationMap, t.CentralizedStations)
gus.TurnoutIds[eid] = &elementIdStructure{
CommonId: eid,
@ -280,7 +286,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化物理区段信息
for _, s := range data.Section {
eid := GetMapElementId(s.Common)
code := getMapELementCode(s.Code, eid)
code := getMapELementCode(eid, s.Code)
stationNames := handleRefStationName(stationMap, s.CentralizedStations)
gus.PhysicalSectionIds[eid] = &elementIdStructure{
CommonId: eid,
@ -291,7 +297,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化信号机信息
for _, s := range data.Signals {
eid := GetMapElementId(s.Common)
code := getMapELementCode(s.Code, eid)
code := getMapELementCode(eid, s.Code)
stationNames := handleRefStationName(stationMap, s.CentralizedStations)
gus.SignalIds[eid] = &elementIdStructure{
CommonId: eid,
@ -302,7 +308,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化应答器
for _, t := range data.Transponders {
eid := GetMapElementId(t.Common)
code := getMapELementCode(t.Code, eid)
code := getMapELementCode(eid, t.Code)
stationNames := handleRefStationName(stationMap, t.CentralizedStations)
gus.TransponderIds[eid] = &elementIdStructure{
CommonId: eid,
@ -315,7 +321,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
eid := GetMapElementId(s.Common)
gus.SlopeIds[eid] = &elementIdStructure{
CommonId: eid,
Uid: GenerateElementUid(city, lineId, nil, eid),
Uid: GenerateElementUid(city, lineId, nil, strconv.Itoa(int(eid))),
}
}
// 初始化曲线
@ -323,11 +329,11 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
eid := GetMapElementId(c.Common)
gus.CurvatureIds[eid] = &elementIdStructure{
CommonId: eid,
Uid: GenerateElementUid(city, lineId, nil, eid),
Uid: GenerateElementUid(city, lineId, nil, strconv.Itoa(int(eid))),
}
}
//处理车站关联的组合信息
refMap := make(map[string]*deviceRelateUidPriex)
refMap := make(map[uint32]*deviceRelateUidPriex)
for _, s := range data.StationRelateDeviceList {
for _, c := range s.Combinationtypes {
p := &deviceRelateUidPriex{deviceCode: s.Code, typeCode: c.Code}
@ -351,7 +357,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
}
}
// 站台
platformMap := make(map[string]*graphicData.Platform)
platformMap := make(map[uint32]*graphicData.Platform)
for _, platform := range data.Platforms {
eid := GetMapElementId(platform.Common)
platformMap[eid] = platform
@ -362,7 +368,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
}
}
// 屏蔽门
psd_station_map := make(map[string]string)
psd_station_map := make(map[uint32]string)
for _, door := range data.ScreenDoors {
station := stationMap[platformMap[door.RefPlatformId].GetRefStationId()]
if station == nil { //线路数据有问题
@ -388,7 +394,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
}
// SPKS人员防护
for _, spk := range data.SpksSwitchs {
if spk.RefStand == "" {
if spk.RefStand == 0 {
continue
}
platform := platformMap[spk.RefStand]
@ -412,11 +418,10 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化继电器柜 UID
func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUidStructure {
rus := &RelayUidStructure{
RelayCabinetIds: make(map[string]*elementIdStructure, len(data.RelayCabinets)),
RelayIds: make(map[string]*elementIdStructure, len(data.Relays)),
RelayIds: make(map[uint32]*elementIdStructure, len(data.Relays)),
}
// 继电器所属设备
refMap := make(map[string]*deviceRelateUidPriex, len(data.Relays))
refMap := make(map[uint32]*deviceRelateUidPriex, len(data.Relays))
for _, r := range data.DeviceRelateRelayList {
isStation := r.DeviceType == graphicData.RelatedRef_station
isPsd := r.DeviceType == graphicData.RelatedRef_ScreenDoor
@ -429,14 +434,6 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
}
// 获取公共前缀
city, lineId, station := getUIdPrefix(data.UniqueIdPrefix)
for _, r := range data.RelayCabinets {
eid := GetMapElementId(r.Common)
rus.RelayCabinetIds[eid] = &elementIdStructure{
CommonId: eid,
Code: r.Code,
Uid: GenerateElementUid(city, lineId, []string{station}, eid),
}
}
// city+line+车站+设备code+继电器组合的code+继电器的code
for _, r := range data.Relays {
eid := GetMapElementId(r.Common)
@ -478,21 +475,21 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
// 初始化IBP地图UID
func initIBPUid(data *graphicData.IBPGraphicStorage) *IBPUidStructure {
rus := &IBPUidStructure{
IbpButtonIds: make(map[string]*elementIdStructure),
IbpAlarmIds: make(map[string]*elementIdStructure),
IbpKeyIds: make(map[string]*elementIdStructure),
IbpLightIds: make(map[string]*elementIdStructure),
IbpButtonIds: make(map[uint32]*elementIdStructure),
IbpAlarmIds: make(map[uint32]*elementIdStructure),
IbpKeyIds: make(map[uint32]*elementIdStructure),
IbpLightIds: make(map[uint32]*elementIdStructure),
}
//处理继电器关联信息
refMap := make(map[string]string)
refMap := make(map[uint32]string)
for _, s := range data.IbpRelatedDevices {
for _, c := range s.Combinationtypes {
for _, i := range c.RefDevices {
refMap[i] = c.Code
refMap[uint32(i)] = c.Code
}
}
}
codeFun := func(id, code string) string {
codeFun := func(id uint32, code string) string {
if refMap[id] != "" {
return refMap[id] + "_" + code
} else {
@ -544,7 +541,7 @@ func buildRepositoryAllUidsMap(mapIds []int32, repo *repository.Repository) map[
len(repo.TurnoutList()) + len(repo.ResponderList()) + len(repo.SlopeList()) +
len(repo.SectionalCurvatureList())
allUidMap := make(map[string]*elementIdStructure, mapLen)
saveToAllUidMap := func(es map[string]*elementIdStructure) {
saveToAllUidMap := func(es map[uint32]*elementIdStructure) {
for _, e := range es {
allUidMap[e.Uid] = e
}
@ -581,7 +578,7 @@ func QueryUidStructure[T *StationUidStructure | *RelayUidStructure | *IBPUidStru
}
// 获取设备类型获取对应字段
func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure {
func getUidMapByType(uidData any, m interface{}) map[uint32]*elementIdStructure {
switch m.(type) {
case *graphicData.AxleCounting:
return (uidData.(*StationUidStructure)).AxlePointIds
@ -597,8 +594,6 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
return (uidData.(*StationUidStructure)).SlopeIds
case *graphicData.Curvature:
return (uidData.(*StationUidStructure)).CurvatureIds
case *graphicData.RelayCabinet:
return (uidData.(*RelayUidStructure)).RelayCabinetIds
case *graphicData.Relay:
return (uidData.(*RelayUidStructure)).RelayIds
case *graphicData.EsbButton:
@ -615,7 +610,7 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
}
// 根据地图ID跟设备类型获取UID集合
func QueryMapUidMapByType(mapId int32, m interface{}) map[string]*elementIdStructure {
func QueryMapUidMapByType(mapId int32, m interface{}) map[uint32]*elementIdStructure {
uidData, ok := giUidMap.Load(mapId)
if !ok {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)})
@ -624,10 +619,10 @@ func QueryMapUidMapByType(mapId int32, m interface{}) map[string]*elementIdStruc
}
// 根据地图的comId获取UID
func QueryUidByMidAndComId(mapId int32, comId string, m interface{}) string {
func QueryUidByMidAndComId(mapId int32, comId uint32, m interface{}) string {
uidMap := QueryMapUidMapByType(mapId, m)
if uidMap[comId] != nil {
return uidMap[comId].Uid
}
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%s】缓存", mapId, comId)})
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%d】缓存", mapId, comId)})
}

View File

@ -5,7 +5,7 @@ import (
)
// 操作PSL按钮
func ChangePSLButtonState(sim *VerifySimulation, mapId int32, gateBoxId, btnCode string, pressDown bool) {
func ChangePSLButtonState(sim *VerifySimulation, mapId int32, gateBoxId uint32, btnCode string, pressDown bool) {
uid := QueryUidStructure[*StationUidStructure](mapId)
gateBoxUid := uid.GateBoxIds[gateBoxId].Uid
if pressDown {

View File

@ -6,7 +6,7 @@ import (
)
// 继电器操作方法
func ChangeRelayState(sim *VerifySimulation, mapId int32, id string, td bool) error {
func ChangeRelayState(sim *VerifySimulation, mapId int32, id uint32, td bool) error {
uid := QueryUidByMidAndComId(mapId, id, &graphicData.Relay{})
if td {
return fi.DriveRelayUp(sim.World, uid)

View File

@ -1,15 +1,15 @@
package memory
import (
"log/slog"
"joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/fi"
"log/slog"
)
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error {
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{})
slog.Debug("操作计轴区段", "axleSectionUid", sectionUid)
if req.TrainIn {
@ -18,7 +18,6 @@ func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOp
if req.TrainOut {
return fi.AxleSectionTrainDrive(simulation.World, sectionUid, false)
}
//
switch req.Operation {
case request_proto.Section_CancelDrst:
return fi.AxleSectionDrstDrive(simulation.World, sectionUid, false)

View File

@ -6,7 +6,7 @@ import (
)
// 操作esb按钮
func ChangeEsbButtonState(sim *VerifySimulation, mapId int32, btnId string, pressDown bool) error {
func ChangeEsbButtonState(sim *VerifySimulation, mapId int32, btnId uint32, pressDown bool) error {
uid := QueryUidByMidAndComId(mapId, btnId, &graphicData.EsbButton{})
if pressDown {
return fi.PressDownButton(sim.World, uid)

View File

@ -137,7 +137,7 @@ func (s *VerifySimulation) GetRunState() state.SimulationStatus_SimulationState
}
// 获取仿真世界信息
func (s *VerifySimulation) GetComIdByUid(uid string) string {
func (s *VerifySimulation) GetComIdByUid(uid string) uint32 {
es := s.uidMap
if es == nil {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "无映射信息"})
@ -226,15 +226,11 @@ func (s *VerifySimulation) CollectDynamicsTurnoutInfo() []*message.DynamicsTurno
if sta == nil {
continue
}
code64, err := strconv.ParseUint(sta.CommonId, 10, 16)
if err != nil {
slog.Error("id转uint16报错", err)
}
s := handlerDynamicsTurnoutState(s.World, o.Id())
if s == nil {
continue
}
s.Code = uint16(code64)
s.Code = uint16(sta.CommonId)
turnoutStates = append(turnoutStates, s)
}
return turnoutStates
@ -324,7 +320,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
}
info.LinkList = append(info.LinkList, link)
if model.ARelation() != nil {
turnoutId, _ := strconv.Atoi(s.GetComIdByUid(model.ARelation().Device().Id()))
turnoutId := s.GetComIdByUid(model.ARelation().Device().Id())
link.ARelTurnoutId = int32(turnoutId)
switch model.ARelation().Port() {
case proto.Port_A:
@ -336,7 +332,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
}
}
if model.BRelation() != nil {
turnoutId, _ := strconv.Atoi(s.GetComIdByUid(model.BRelation().Device().Id()))
turnoutId := s.GetComIdByUid(model.BRelation().Device().Id())
link.BRelTurnoutId = int32(turnoutId)
switch model.BRelation().Port() {
case proto.Port_A:
@ -349,7 +345,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
}
}
for _, model := range s.Repo.SlopeList() {
id, _ := strconv.Atoi(s.GetComIdByUid(model.Id()))
id := s.GetComIdByUid(model.Id())
slope := &message.Slope{
ID: int32(id),
StartLinkOffset: int32(model.StartLinkPosition().Offset()),
@ -363,7 +359,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
slope.EndLinkId = int32(endLinkId)
}
for _, model := range s.Repo.SectionalCurvatureList() {
id, _ := strconv.Atoi(s.GetComIdByUid(model.Id()))
id := s.GetComIdByUid(model.Id())
curve := &message.Curve{
ID: int32(id),
StartLinkOffset: int32(model.StartLinkPosition().Offset()),
@ -573,18 +569,17 @@ func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
buildSectionCodePoint(repo, stationGi, mapId)
}
}
//
return repo, nil
}
func buildSectionCodePoint(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
city := storage.UniqueIdPrefix.City
lineId := storage.UniqueIdPrefix.LineId
// city := storage.UniqueIdPrefix.City
// lineId := storage.UniqueIdPrefix.LineId
uidsMap := QueryUidStructure[*StationUidStructure](mapId)
for _, sscp := range storage.SectionCodePointList {
centralizedStation := sscp.CentralizedStation
sectionGIds := sscp.SectionIds
centralizedStationId := GenerateElementUid(city, lineId, nil, centralizedStation)
centralizedStationId := uidsMap.StationIds[centralizedStation].Uid // GenerateElementUid(city, lineId, nil, centralizedStation)
ref := queryCentralizedStationRef(centralizedStationId, repo)
var ccs []*proto.CiSectionCodePoint
for sectionPoint, sectionGId := range sectionGIds {
@ -881,7 +876,7 @@ func handlerRelayGiCj(uidsMap *RelayUidStructure, stationId string, ciCj *graphi
for _, j := range row.RefRelays {
u := uidsMap.RelayIds[j.RelayId]
if u == nil {
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%s】UID映射关系", stationId, j.RelayId)))
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%d】UID映射关系", stationId, j.RelayId)))
}
d := &proto.CjDataItem{RelayId: u.Uid}
if j.Position == graphicData.CjDataItem_H {
@ -918,7 +913,7 @@ func handlerRelayGiQd(uidsMap *RelayUidStructure, stationId string, ciQd *graphi
for _, j := range row.RefRelays {
u := uidsMap.RelayIds[j]
if u == nil {
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%s】UID映射关系", stationId, j)))
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%d】UID映射关系", stationId, j)))
}
r.RefRelays = append(r.RefRelays, u.Uid)
}
@ -957,7 +952,7 @@ func convertRelayModel(modelType graphicData.Relay_ModelType) proto.Relay_Model
func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
repo.MainCoordinateSystem = storage.UniqueIdPrefix.MainCoordinateSystem
axleCountingMap := make(map[string]*graphicData.AxleCounting)
axleCountingMap := make(map[uint32]*graphicData.AxleCounting)
uidsMap := QueryUidStructure[*StationUidStructure](mapId)
for _, data := range storage.AxleCountings {
id := GetMapElementId(data.Common)
@ -967,35 +962,38 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
cpType = proto.CheckPointType_Boundary
}
cp := &proto.CheckPoint{
Id: id,
Km: convertKm(data.KilometerSystem),
Type: cpType,
DevicePorts: convertDevicePorts(data.AxleCountingRef),
Id: uidsMap.AxlePointIds[id].Uid,
Km: convertKm(data.KilometerSystem),
Type: cpType,
}
repo.CheckPoints = append(repo.CheckPoints, converCheckPointUid(cp, uidsMap))
for _, ref := range data.AxleCountingRef {
cp.DevicePorts = append(cp.DevicePorts, convertDevicePort(ref, uidsMap))
}
repo.CheckPoints = append(repo.CheckPoints, cp)
}
for _, data := range storage.Section {
var turnoutIds []string
var turnoutUids []string
if data.SectionType == graphicData.Section_TurnoutPhysical {
turnoutIds = findTurnoutIds(axleCountingMap, data.AxleCountings)
turnoutIds := findTurnoutIds(axleCountingMap, data.AxleCountings)
for _, tid := range turnoutIds {
turnoutUids = append(turnoutUids, uidsMap.TurnoutIds[tid].Uid)
}
}
centralizedStation := ""
var centralizedStation string
if len(data.CentralizedStations) > 0 {
s := uidsMap.StationIds[data.CentralizedStations[0]]
if s != nil {
centralizedStation = s.Code
} else {
centralizedStation = data.CentralizedStations[0]
}
}
physicalSection := &proto.PhysicalSection{
Id: GetMapElementId(data.Common),
ADevicePort: convertDevicePort(data.PaRef),
BDevicePort: convertDevicePort(data.PbRef),
TurnoutIds: turnoutIds,
Id: uidsMap.PhysicalSectionIds[GetMapElementId(data.Common)].Uid,
ADevicePort: convertDevicePort(data.PaRef, uidsMap),
BDevicePort: convertDevicePort(data.PbRef, uidsMap),
TurnoutIds: turnoutUids,
CentralizedStation: centralizedStation,
}
repo.PhysicalSections = append(repo.PhysicalSections, converSectionUid(physicalSection, uidsMap))
repo.PhysicalSections = append(repo.PhysicalSections, physicalSection)
}
for _, data := range storage.Turnouts {
var km *proto.Kilometer
@ -1005,94 +1003,77 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
break
}
}
var switchMachineType proto.Turnout_SwitchMachineType
turnout := &proto.Turnout{
Id: uidsMap.TurnoutIds[GetMapElementId(data.Common)].Uid,
Km: km,
ADevicePort: convertDevicePort(data.PaRef, uidsMap),
BDevicePort: convertDevicePort(data.PbRef, uidsMap),
CDevicePort: convertDevicePort(data.PcRef, uidsMap),
}
switch data.SwitchMachineType {
case graphicData.Turnout_ZDJ9_Single:
switchMachineType = proto.Turnout_ZDJ9_Single
turnout.SwitchMachineType = proto.Turnout_ZDJ9_Single
case graphicData.Turnout_ZDJ9_Double:
switchMachineType = proto.Turnout_ZDJ9_Double
turnout.SwitchMachineType = proto.Turnout_ZDJ9_Double
}
turnout := &proto.Turnout{
Id: GetMapElementId(data.Common),
Km: km,
ADevicePort: convertDevicePort(data.PaRef),
BDevicePort: convertDevicePort(data.PbRef),
CDevicePort: convertDevicePort(data.PcRef),
SwitchMachineType: switchMachineType,
}
repo.Turnouts = append(repo.Turnouts, converTurnoutUid(turnout, uidsMap))
repo.Turnouts = append(repo.Turnouts, turnout)
}
for _, data := range storage.Signals {
var sectionId string
var turnoutPort *proto.DevicePort
signal := &proto.Signal{
Id: uidsMap.SignalIds[GetMapElementId(data.Common)].Uid,
Km: convertKm(data.KilometerSystem),
Model: convertToProtoSignalModel(data.Mt),
}
switch data.RefDev.DeviceType {
case graphicData.RelatedRef_Section:
sectionId = data.RefDev.Id
signal.SectionId = uidsMap.PhysicalSectionIds[data.RefDev.Id].Uid
case graphicData.RelatedRef_Turnout:
turnoutPort = convertDevicePort(data.RefDev)
signal.TurnoutPort = convertDevicePort(data.RefDev, uidsMap)
}
signal := &proto.Signal{
Id: GetMapElementId(data.Common),
Km: convertKm(data.KilometerSystem),
SectionId: sectionId,
TurnoutPort: turnoutPort,
Model: convertToProtoSignalModel(data.Mt),
}
repo.Signals = append(repo.Signals, converSignalUid(signal, uidsMap))
repo.Signals = append(repo.Signals, signal)
}
stm := make(map[string][]string)
for _, data := range storage.Transponders {
var sectionId string
var turnoutPort *proto.DevicePort
switch data.TransponderRef.DeviceType {
case graphicData.RelatedRef_Section:
sectionId = data.TransponderRef.Id
case graphicData.RelatedRef_Turnout:
turnoutPort = convertDevicePort(data.TransponderRef)
}
responder := &proto.Transponder{
Id: GetMapElementId(data.Common),
Id: uidsMap.TransponderIds[GetMapElementId(data.Common)].Uid,
Km: convertKm(data.KilometerSystem),
SectionId: sectionId,
TurnoutPort: turnoutPort,
FixedTelegram: data.FixedTelegram,
Type: convertToProtoBaliseType(data.Type),
}
repo.Transponders = append(repo.Transponders, converTransponderUid(responder, uidsMap))
switch data.TransponderRef.DeviceType {
case graphicData.RelatedRef_Section:
responder.SectionId = uidsMap.PhysicalSectionIds[data.TransponderRef.Id].Uid
case graphicData.RelatedRef_Turnout:
responder.TurnoutPort = convertDevicePort(data.TransponderRef, uidsMap)
}
for _, stationId := range data.CentralizedStations {
var stationName string
if uidsMap.StationIds[stationId] == nil {
stationName = stationId
} else {
stationName = uidsMap.StationIds[stationId].Code
}
if stm[stationName] == nil {
stm[stationName] = []string{responder.Id}
} else {
stm[stationName] = append(stm[stationName], responder.Id)
}
stm[stationName] = append(stm[stationName], responder.Id)
}
repo.Transponders = append(repo.Transponders, responder)
}
slopeKsMap := make(map[string]*graphicData.SlopeKiloMarker)
slopeKsMap := make(map[uint32]*graphicData.SlopeKiloMarker)
for _, data := range storage.SlopeKiloMarker {
slopeKsMap[GetMapElementId(data.Common)] = data
}
curveKsMap := make(map[string]*graphicData.CurvatureKiloMarker)
for _, data := range storage.CurvatureKiloMarker {
curveKsMap[GetMapElementId(data.Common)] = data
}
for _, data := range storage.Slopes {
var kms []*proto.Kilometer
for _, id := range data.RefDeviceId {
kms = append(kms, convertKm(slopeKsMap[id].KilometerSystem[0]))
}
slope := &proto.Slope{
Id: GetMapElementId(data.Common),
Id: uidsMap.SlopeIds[GetMapElementId(data.Common)].Uid,
Kms: kms,
Degree: data.SlopeNumber,
}
repo.Slopes = append(repo.Slopes, converSlopeUid(slope, uidsMap))
repo.Slopes = append(repo.Slopes, slope)
}
curveKsMap := make(map[uint32]*graphicData.CurvatureKiloMarker)
for _, data := range storage.CurvatureKiloMarker {
curveKsMap[GetMapElementId(data.Common)] = data
}
for _, data := range storage.Curvatures {
var kms []*proto.Kilometer
@ -1100,11 +1081,11 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
kms = append(kms, convertKm(curveKsMap[id].KilometerSystem[0]))
}
slope := &proto.SectionalCurvature{
Id: GetMapElementId(data.Common),
Id: uidsMap.CurvatureIds[GetMapElementId(data.Common)].Uid,
Kms: kms,
Radius: data.CurvatureNumber,
}
repo.SectionalCurvatures = append(repo.SectionalCurvatures, converCurvatureUid(slope, uidsMap))
repo.SectionalCurvatures = append(repo.SectionalCurvatures, slope)
}
for _, data := range storage.KilometerConvertList {
repo.KilometerConverts = append(repo.KilometerConverts, &proto.KilometerConvert{
@ -1190,7 +1171,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
}
}
//站台
platformMap := make(map[string]*graphicData.Platform)
platformMap := make(map[uint32]*graphicData.Platform)
for _, data := range storage.Platforms {
platformId := GetMapElementId(data.Common)
platformMap[platformId] = data
@ -1229,7 +1210,7 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
return
}
uidMap := QueryUidStructure[*IBPUidStructure](mapId)
deviceMap := make(map[string]*proto.ElectronicComponent) // 对应的设备类型
deviceMap := make(map[uint32]*proto.ElectronicComponent) // 对应的设备类型
for _, data := range storage.IbpButtons { // 处理按钮
id := GetMapElementId(data.Common)
b := &proto.Button{
@ -1300,102 +1281,6 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
}
}
func converCheckPointUid(data *proto.CheckPoint, uidsMap *StationUidStructure) *proto.CheckPoint {
data.Id = uidsMap.AxlePointIds[data.Id].Uid
for _, c := range data.DevicePorts {
c.DeviceId = converRefUid(c.DeviceId, c.DeviceType, uidsMap)
}
return data
}
func converSectionUid(data *proto.PhysicalSection, uidsMap *StationUidStructure) *proto.PhysicalSection {
data.Id = uidsMap.PhysicalSectionIds[data.Id].Uid
if data.ADevicePort != nil {
data.ADevicePort.DeviceId = converRefUid(data.ADevicePort.DeviceId, data.ADevicePort.DeviceType, uidsMap)
}
if data.BDevicePort != nil {
data.BDevicePort.DeviceId = converRefUid(data.BDevicePort.DeviceId, data.BDevicePort.DeviceType, uidsMap)
}
tids := make([]string, len(data.TurnoutIds))
for i, tid := range data.TurnoutIds {
tids[i] = converRefUid(tid, proto.DeviceType_DeviceType_Turnout, uidsMap)
}
data.TurnoutIds = tids
return data
}
func converTurnoutUid(data *proto.Turnout, uidsMap *StationUidStructure) *proto.Turnout {
data.Id = uidsMap.TurnoutIds[data.Id].Uid
if data.ADevicePort != nil {
data.ADevicePort.DeviceId = converRefUid(data.ADevicePort.DeviceId, data.ADevicePort.DeviceType, uidsMap)
}
if data.BDevicePort != nil {
data.BDevicePort.DeviceId = converRefUid(data.BDevicePort.DeviceId, data.BDevicePort.DeviceType, uidsMap)
}
if data.CDevicePort != nil {
data.CDevicePort.DeviceId = converRefUid(data.CDevicePort.DeviceId, data.CDevicePort.DeviceType, uidsMap)
}
return data
}
func converSignalUid(data *proto.Signal, uidsMap *StationUidStructure) *proto.Signal {
data.Id = uidsMap.SignalIds[data.Id].Uid
if data.SectionId != "" {
data.SectionId = converRefUid(data.SectionId, proto.DeviceType_DeviceType_PhysicalSection, uidsMap)
}
if data.TurnoutPort != nil {
data.TurnoutPort.DeviceId = converRefUid(data.TurnoutPort.DeviceId, data.TurnoutPort.DeviceType, uidsMap)
}
return data
}
func converTransponderUid(data *proto.Transponder, uidsMap *StationUidStructure) *proto.Transponder {
data.Id = uidsMap.TransponderIds[data.Id].Uid
if data.SectionId != "" {
data.SectionId = converRefUid(data.SectionId, proto.DeviceType_DeviceType_PhysicalSection, uidsMap)
}
if data.TurnoutPort != nil {
data.TurnoutPort.DeviceId = converRefUid(data.TurnoutPort.DeviceId, data.TurnoutPort.DeviceType, uidsMap)
}
return data
}
func converSlopeUid(data *proto.Slope, uidsMap *StationUidStructure) *proto.Slope {
data.Id = uidsMap.SlopeIds[data.Id].Uid
return data
}
func converCurvatureUid(data *proto.SectionalCurvature, uidsMap *StationUidStructure) *proto.SectionalCurvature {
data.Id = uidsMap.CurvatureIds[data.Id].Uid
return data
}
func converRefUid(id string, d proto.DeviceType, uidsMap *StationUidStructure) string {
var elementId *elementIdStructure
switch d {
case proto.DeviceType_DeviceType_CheckPoint:
elementId = uidsMap.AxlePointIds[id]
case proto.DeviceType_DeviceType_PhysicalSection:
elementId = uidsMap.PhysicalSectionIds[id]
case proto.DeviceType_DeviceType_SectionalCurvature:
elementId = uidsMap.CurvatureIds[id]
case proto.DeviceType_DeviceType_Signal:
elementId = uidsMap.SignalIds[id]
case proto.DeviceType_DeviceType_Slope:
elementId = uidsMap.SlopeIds[id]
case proto.DeviceType_DeviceType_Transponder:
elementId = uidsMap.TransponderIds[id]
case proto.DeviceType_DeviceType_Turnout:
elementId = uidsMap.TurnoutIds[id]
default:
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "异常的设备类型-" + d.String()})
}
if elementId == nil {
return ""
}
return elementId.Uid
}
func convertKm(ks *graphicData.KilometerSystem) *proto.Kilometer {
var dir proto.Direction
switch ks.Direction {
@ -1411,11 +1296,10 @@ func convertKm(ks *graphicData.KilometerSystem) *proto.Kilometer {
}
}
func convertDevicePort(ref *graphicData.RelatedRef) *proto.DevicePort {
func convertDevicePort(ref *graphicData.RelatedRef, uidsMap *StationUidStructure) *proto.DevicePort {
if ref == nil {
return nil
}
var deviceType proto.DeviceType
var port proto.Port
switch ref.DevicePort {
case graphicData.RelatedRef_A:
@ -1425,34 +1309,30 @@ func convertDevicePort(ref *graphicData.RelatedRef) *proto.DevicePort {
case graphicData.RelatedRef_C:
port = proto.Port_C
}
var elementId string
var deviceType proto.DeviceType
switch ref.DeviceType {
case graphicData.RelatedRef_Section:
deviceType = proto.DeviceType_DeviceType_PhysicalSection
elementId = uidsMap.PhysicalSectionIds[ref.Id].Uid
case graphicData.RelatedRef_Turnout:
deviceType = proto.DeviceType_DeviceType_Turnout
elementId = uidsMap.TurnoutIds[ref.Id].Uid
default:
panic(fmt.Sprintf("异常的设备类型-%s", ref.DeviceType))
}
return &proto.DevicePort{
DeviceId: ref.Id,
DeviceId: elementId,
DeviceType: deviceType,
Port: port,
}
}
func convertDevicePorts(refList []*graphicData.RelatedRef) []*proto.DevicePort {
var dps []*proto.DevicePort
for _, ref := range refList {
dps = append(dps, convertDevicePort(ref))
}
return dps
}
func findTurnoutIds(axleCountingMap map[string]*graphicData.AxleCounting, axleIds []string) []string {
func findTurnoutIds(axleCountingMap map[uint32]*graphicData.AxleCounting, axleIds []uint32) []uint32 {
if len(axleIds) <= 2 {
return nil
}
turnoutMap := make(map[string]int)
turnoutMap := make(map[uint32]int)
for _, axleId := range axleIds {
axle := axleCountingMap[axleId]
for _, ref := range axle.AxleCountingRef {
@ -1461,7 +1341,7 @@ func findTurnoutIds(axleCountingMap map[string]*graphicData.AxleCounting, axleId
}
}
}
var turnoutIds []string
var turnoutIds []uint32
for id, num := range turnoutMap {
if num > 1 {
turnoutIds = append(turnoutIds, id)