diff --git a/components/cstate/status.pb.go b/components/cstate/status.pb.go index 90241b8..3533a5d 100644 --- a/components/cstate/status.pb.go +++ b/components/cstate/status.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.31.0 // protoc v4.23.1 -// source: status.proto +// source: component/status.proto package cstate @@ -105,11 +105,11 @@ func (x SignalAspect) String() string { } func (SignalAspect) Descriptor() protoreflect.EnumDescriptor { - return file_status_proto_enumTypes[0].Descriptor() + return file_component_status_proto_enumTypes[0].Descriptor() } func (SignalAspect) Type() protoreflect.EnumType { - return &file_status_proto_enumTypes[0] + return &file_component_status_proto_enumTypes[0] } func (x SignalAspect) Number() protoreflect.EnumNumber { @@ -118,7 +118,7 @@ func (x SignalAspect) Number() protoreflect.EnumNumber { // Deprecated: Use SignalAspect.Descriptor instead. func (SignalAspect) EnumDescriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{0} + return file_component_status_proto_rawDescGZIP(), []int{0} } // 列车激活的枚举 @@ -158,11 +158,11 @@ func (x TrainActiveEnum) String() string { } func (TrainActiveEnum) Descriptor() protoreflect.EnumDescriptor { - return file_status_proto_enumTypes[1].Descriptor() + return file_component_status_proto_enumTypes[1].Descriptor() } func (TrainActiveEnum) Type() protoreflect.EnumType { - return &file_status_proto_enumTypes[1] + return &file_component_status_proto_enumTypes[1] } func (x TrainActiveEnum) Number() protoreflect.EnumNumber { @@ -171,7 +171,7 @@ func (x TrainActiveEnum) Number() protoreflect.EnumNumber { // Deprecated: Use TrainActiveEnum.Descriptor instead. func (TrainActiveEnum) EnumDescriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{1} + return file_component_status_proto_rawDescGZIP(), []int{1} } // 设备身份信息 @@ -187,7 +187,7 @@ type DeviceIdentity struct { func (x *DeviceIdentity) Reset() { *x = DeviceIdentity{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[0] + mi := &file_component_status_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -200,7 +200,7 @@ func (x *DeviceIdentity) String() string { func (*DeviceIdentity) ProtoMessage() {} func (x *DeviceIdentity) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[0] + mi := &file_component_status_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -213,7 +213,7 @@ func (x *DeviceIdentity) ProtoReflect() protoreflect.Message { // Deprecated: Use DeviceIdentity.ProtoReflect.Descriptor instead. func (*DeviceIdentity) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{0} + return file_component_status_proto_rawDescGZIP(), []int{0} } func (x *DeviceIdentity) GetId() string { @@ -247,7 +247,7 @@ type SwitchRelayState struct { func (x *SwitchRelayState) Reset() { *x = SwitchRelayState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[1] + mi := &file_component_status_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -260,7 +260,7 @@ func (x *SwitchRelayState) String() string { func (*SwitchRelayState) ProtoMessage() {} func (x *SwitchRelayState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[1] + mi := &file_component_status_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -273,7 +273,7 @@ func (x *SwitchRelayState) ProtoReflect() protoreflect.Message { // Deprecated: Use SwitchRelayState.ProtoReflect.Descriptor instead. func (*SwitchRelayState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{1} + return file_component_status_proto_rawDescGZIP(), []int{1} } func (x *SwitchRelayState) GetDcJ() bool { @@ -317,7 +317,7 @@ type PhysicalSectionState struct { func (x *PhysicalSectionState) Reset() { *x = PhysicalSectionState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[2] + mi := &file_component_status_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -330,7 +330,7 @@ func (x *PhysicalSectionState) String() string { func (*PhysicalSectionState) ProtoMessage() {} func (x *PhysicalSectionState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[2] + mi := &file_component_status_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -343,7 +343,7 @@ func (x *PhysicalSectionState) ProtoReflect() protoreflect.Message { // Deprecated: Use PhysicalSectionState.ProtoReflect.Descriptor instead. func (*PhysicalSectionState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{2} + return file_component_status_proto_rawDescGZIP(), []int{2} } func (x *PhysicalSectionState) GetOccupied() bool { @@ -366,7 +366,7 @@ type SignalState struct { func (x *SignalState) Reset() { *x = SignalState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[3] + mi := &file_component_status_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -379,7 +379,7 @@ func (x *SignalState) String() string { func (*SignalState) ProtoMessage() {} func (x *SignalState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[3] + mi := &file_component_status_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -392,7 +392,7 @@ func (x *SignalState) ProtoReflect() protoreflect.Message { // Deprecated: Use SignalState.ProtoReflect.Descriptor instead. func (*SignalState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{3} + return file_component_status_proto_rawDescGZIP(), []int{3} } func (x *SignalState) GetDisplay() SignalAspect { @@ -419,7 +419,7 @@ type PsdState struct { func (x *PsdState) Reset() { *x = PsdState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[4] + mi := &file_component_status_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -432,7 +432,7 @@ func (x *PsdState) String() string { func (*PsdState) ProtoMessage() {} func (x *PsdState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[4] + mi := &file_component_status_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -445,7 +445,7 @@ func (x *PsdState) ProtoReflect() protoreflect.Message { // Deprecated: Use PsdState.ProtoReflect.Descriptor instead. func (*PsdState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{4} + return file_component_status_proto_rawDescGZIP(), []int{4} } func (x *PsdState) GetAllClosed() bool { @@ -484,7 +484,7 @@ type PercentageDeviceState struct { func (x *PercentageDeviceState) Reset() { *x = PercentageDeviceState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[5] + mi := &file_component_status_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -497,7 +497,7 @@ func (x *PercentageDeviceState) String() string { func (*PercentageDeviceState) ProtoMessage() {} func (x *PercentageDeviceState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[5] + mi := &file_component_status_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -510,7 +510,7 @@ func (x *PercentageDeviceState) ProtoReflect() protoreflect.Message { // Deprecated: Use PercentageDeviceState.ProtoReflect.Descriptor instead. func (*PercentageDeviceState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{5} + return file_component_status_proto_rawDescGZIP(), []int{5} } func (x *PercentageDeviceState) GetRate() int64 { @@ -545,7 +545,7 @@ type MovableDeviceState struct { func (x *MovableDeviceState) Reset() { *x = MovableDeviceState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[6] + mi := &file_component_status_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -558,7 +558,7 @@ func (x *MovableDeviceState) String() string { func (*MovableDeviceState) ProtoMessage() {} func (x *MovableDeviceState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[6] + mi := &file_component_status_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -571,7 +571,7 @@ func (x *MovableDeviceState) ProtoReflect() protoreflect.Message { // Deprecated: Use MovableDeviceState.ProtoReflect.Descriptor instead. func (*MovableDeviceState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{6} + return file_component_status_proto_rawDescGZIP(), []int{6} } func (x *MovableDeviceState) GetToH() bool { @@ -608,7 +608,7 @@ type BaliseState struct { func (x *BaliseState) Reset() { *x = BaliseState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[7] + mi := &file_component_status_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -621,7 +621,7 @@ func (x *BaliseState) String() string { func (*BaliseState) ProtoMessage() {} func (x *BaliseState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[7] + mi := &file_component_status_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -634,7 +634,7 @@ func (x *BaliseState) ProtoReflect() protoreflect.Message { // Deprecated: Use BaliseState.ProtoReflect.Descriptor instead. func (*BaliseState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{7} + return file_component_status_proto_rawDescGZIP(), []int{7} } func (x *BaliseState) GetContent() *BaliseContent { @@ -661,7 +661,7 @@ type BaliseContent struct { func (x *BaliseContent) Reset() { *x = BaliseContent{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[8] + mi := &file_component_status_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -674,7 +674,7 @@ func (x *BaliseContent) String() string { func (*BaliseContent) ProtoMessage() {} func (x *BaliseContent) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[8] + mi := &file_component_status_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -687,7 +687,7 @@ func (x *BaliseContent) ProtoReflect() protoreflect.Message { // Deprecated: Use BaliseContent.ProtoReflect.Descriptor instead. func (*BaliseContent) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{8} + return file_component_status_proto_rawDescGZIP(), []int{8} } func (x *BaliseContent) GetId() string { @@ -729,7 +729,7 @@ type OccupiedLinkPosition struct { func (x *OccupiedLinkPosition) Reset() { *x = OccupiedLinkPosition{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[9] + mi := &file_component_status_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -742,7 +742,7 @@ func (x *OccupiedLinkPosition) String() string { func (*OccupiedLinkPosition) ProtoMessage() {} func (x *OccupiedLinkPosition) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[9] + mi := &file_component_status_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -755,7 +755,7 @@ func (x *OccupiedLinkPosition) ProtoReflect() protoreflect.Message { // Deprecated: Use OccupiedLinkPosition.ProtoReflect.Descriptor instead. func (*OccupiedLinkPosition) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{9} + return file_component_status_proto_rawDescGZIP(), []int{9} } func (x *OccupiedLinkPosition) GetLinkId() string { @@ -794,7 +794,7 @@ type TrainState struct { func (x *TrainState) Reset() { *x = TrainState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[10] + mi := &file_component_status_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -807,7 +807,7 @@ func (x *TrainState) String() string { func (*TrainState) ProtoMessage() {} func (x *TrainState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[10] + mi := &file_component_status_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -820,7 +820,7 @@ func (x *TrainState) ProtoReflect() protoreflect.Message { // Deprecated: Use TrainState.ProtoReflect.Descriptor instead. func (*TrainState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{10} + return file_component_status_proto_rawDescGZIP(), []int{10} } func (x *TrainState) GetActiveHead() TrainActiveEnum { @@ -855,7 +855,7 @@ type TowPositionButtonState struct { func (x *TowPositionButtonState) Reset() { *x = TowPositionButtonState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[11] + mi := &file_component_status_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -868,7 +868,7 @@ func (x *TowPositionButtonState) String() string { func (*TowPositionButtonState) ProtoMessage() {} func (x *TowPositionButtonState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[11] + mi := &file_component_status_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -881,7 +881,7 @@ func (x *TowPositionButtonState) ProtoReflect() protoreflect.Message { // Deprecated: Use TowPositionButtonState.ProtoReflect.Descriptor instead. func (*TowPositionButtonState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{11} + return file_component_status_proto_rawDescGZIP(), []int{11} } func (x *TowPositionButtonState) GetPos1() bool { @@ -911,7 +911,7 @@ type RelayState struct { func (x *RelayState) Reset() { *x = RelayState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[12] + mi := &file_component_status_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -924,7 +924,7 @@ func (x *RelayState) String() string { func (*RelayState) ProtoMessage() {} func (x *RelayState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[12] + mi := &file_component_status_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -937,7 +937,7 @@ func (x *RelayState) ProtoReflect() protoreflect.Message { // Deprecated: Use RelayState.ProtoReflect.Descriptor instead. func (*RelayState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{12} + return file_component_status_proto_rawDescGZIP(), []int{12} } func (x *RelayState) GetActive() bool { @@ -961,7 +961,7 @@ type EmpState struct { func (x *EmpState) Reset() { *x = EmpState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[13] + mi := &file_component_status_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -974,7 +974,7 @@ func (x *EmpState) String() string { func (*EmpState) ProtoMessage() {} func (x *EmpState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[13] + mi := &file_component_status_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -987,7 +987,7 @@ func (x *EmpState) ProtoReflect() protoreflect.Message { // Deprecated: Use EmpState.ProtoReflect.Descriptor instead. func (*EmpState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{13} + return file_component_status_proto_rawDescGZIP(), []int{13} } func (x *EmpState) GetPressed() bool { @@ -1010,7 +1010,7 @@ type ButtonState struct { func (x *ButtonState) Reset() { *x = ButtonState{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[14] + mi := &file_component_status_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1023,7 +1023,7 @@ func (x *ButtonState) String() string { func (*ButtonState) ProtoMessage() {} func (x *ButtonState) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[14] + mi := &file_component_status_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1036,7 +1036,7 @@ func (x *ButtonState) ProtoReflect() protoreflect.Message { // Deprecated: Use ButtonState.ProtoReflect.Descriptor instead. func (*ButtonState) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{14} + return file_component_status_proto_rawDescGZIP(), []int{14} } func (x *ButtonState) GetPressDown() bool { @@ -1065,7 +1065,7 @@ type ButtonPressOperating struct { func (x *ButtonPressOperating) Reset() { *x = ButtonPressOperating{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[15] + mi := &file_component_status_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1078,7 +1078,7 @@ func (x *ButtonPressOperating) String() string { func (*ButtonPressOperating) ProtoMessage() {} func (x *ButtonPressOperating) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[15] + mi := &file_component_status_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1091,7 +1091,7 @@ func (x *ButtonPressOperating) ProtoReflect() protoreflect.Message { // Deprecated: Use ButtonPressOperating.ProtoReflect.Descriptor instead. func (*ButtonPressOperating) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{15} + return file_component_status_proto_rawDescGZIP(), []int{15} } func (x *ButtonPressOperating) GetStart() bool { @@ -1137,7 +1137,7 @@ type ButtonConfirmOperating struct { func (x *ButtonConfirmOperating) Reset() { *x = ButtonConfirmOperating{} if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[16] + mi := &file_component_status_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1150,7 +1150,7 @@ func (x *ButtonConfirmOperating) String() string { func (*ButtonConfirmOperating) ProtoMessage() {} func (x *ButtonConfirmOperating) ProtoReflect() protoreflect.Message { - mi := &file_status_proto_msgTypes[16] + mi := &file_component_status_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1163,7 +1163,7 @@ func (x *ButtonConfirmOperating) ProtoReflect() protoreflect.Message { // Deprecated: Use ButtonConfirmOperating.ProtoReflect.Descriptor instead. func (*ButtonConfirmOperating) Descriptor() ([]byte, []int) { - return file_status_proto_rawDescGZIP(), []int{16} + return file_component_status_proto_rawDescGZIP(), []int{16} } func (x *ButtonConfirmOperating) GetConfirm() bool { @@ -1180,123 +1180,124 @@ func (x *ButtonConfirmOperating) GetCancel() bool { return false } -var File_status_proto protoreflect.FileDescriptor +var File_component_status_proto protoreflect.FileDescriptor -var file_status_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x20, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5a, 0x0a, 0x10, 0x53, 0x77, 0x69, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x64, 0x63, 0x4a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x63, 0x4a, 0x12, 0x10, - 0x0a, 0x03, 0x66, 0x63, 0x4a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x66, 0x63, 0x4a, - 0x12, 0x10, 0x0a, 0x03, 0x64, 0x62, 0x4a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, - 0x62, 0x4a, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x62, 0x4a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x03, 0x66, 0x62, 0x4a, 0x22, 0x32, 0x0a, 0x14, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, - 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, - 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, - 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x07, - 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x74, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, - 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0x43, 0x0a, - 0x15, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x72, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x22, 0x58, 0x0a, 0x12, 0x4d, 0x6f, 0x76, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x6f, 0x48, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x74, 0x6f, 0x48, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, - 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x0a, 0x0b, - 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x0d, - 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x6e, 0x0a, 0x14, 0x4f, - 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, - 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x0a, - 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, - 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, - 0x65, 0x61, 0x64, 0x12, 0x42, 0x0a, 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, - 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, - 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x22, 0x40, 0x0a, 0x16, 0x54, 0x6f, 0x77, 0x50, 0x6f, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x04, 0x70, 0x6f, 0x73, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x32, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x6f, 0x73, 0x32, 0x22, 0x24, 0x0a, 0x0a, 0x52, 0x65, 0x6c, - 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, - 0x24, 0x0a, 0x08, 0x45, 0x6d, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, - 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, - 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x2b, 0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, - 0x77, 0x6e, 0x22, 0x84, 0x01, 0x0a, 0x14, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x50, 0x72, 0x65, - 0x73, 0x73, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x65, - 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x22, 0x4a, 0x0a, 0x16, 0x42, 0x75, 0x74, - 0x74, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, - 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, - 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10, 0x00, 0x12, 0x05, - 0x0a, 0x01, 0x52, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x47, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, - 0x59, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x57, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, - 0x05, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x59, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x57, 0x10, - 0x07, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x47, 0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x59, 0x10, - 0x09, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x59, 0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x46, 0x10, - 0x0b, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x46, 0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x46, 0x10, - 0x0d, 0x12, 0x06, 0x0a, 0x02, 0x57, 0x46, 0x10, 0x0e, 0x2a, 0x35, 0x0a, 0x0f, 0x54, 0x72, 0x61, - 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0a, 0x0a, 0x06, - 0x48, 0x45, 0x41, 0x44, 0x5f, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, - 0x5f, 0x41, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x42, 0x10, 0x02, - 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, +var file_component_status_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x22, 0x20, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x5a, 0x0a, 0x10, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x63, 0x4a, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x63, 0x4a, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x63, 0x4a, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x66, 0x63, 0x4a, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x62, + 0x4a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x62, 0x4a, 0x12, 0x10, 0x0a, 0x03, + 0x66, 0x62, 0x4a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x66, 0x62, 0x4a, 0x22, 0x32, + 0x0a, 0x14, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, + 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, + 0x65, 0x64, 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, + 0x79, 0x22, 0x74, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0x43, 0x0a, 0x15, 0x50, 0x65, 0x72, 0x63, 0x65, + 0x6e, 0x74, 0x61, 0x67, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, + 0x72, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x58, 0x0a, 0x12, + 0x4d, 0x6f, 0x76, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x6f, 0x48, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x03, 0x74, 0x6f, 0x48, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x0a, 0x0b, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, + 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x0d, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x6e, 0x0a, 0x14, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, + 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, + 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, + 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, + 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x75, + 0x6d, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x64, 0x12, 0x42, 0x0a, + 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x63, + 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, + 0x73, 0x22, 0x40, 0x0a, 0x16, 0x54, 0x6f, 0x77, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x6f, 0x73, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x6f, 0x73, 0x31, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, + 0x6f, 0x73, 0x32, 0x22, 0x24, 0x0a, 0x0a, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x24, 0x0a, 0x08, 0x45, 0x6d, 0x70, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, + 0x2b, 0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x22, 0x84, 0x01, 0x0a, + 0x14, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x73, 0x73, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, + 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12, + 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x72, 0x6d, 0x22, 0x4a, 0x0a, 0x16, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x72, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x2a, + 0x81, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, + 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x52, 0x10, 0x01, 0x12, + 0x05, 0x0a, 0x01, 0x47, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x59, 0x10, 0x03, 0x12, 0x05, 0x0a, + 0x01, 0x57, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x52, + 0x59, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x57, 0x10, 0x07, 0x12, 0x06, 0x0a, 0x02, 0x47, + 0x47, 0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x59, 0x10, 0x09, 0x12, 0x06, 0x0a, 0x02, 0x59, + 0x59, 0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x46, 0x10, 0x0b, 0x12, 0x06, 0x0a, 0x02, 0x59, + 0x46, 0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x46, 0x10, 0x0d, 0x12, 0x06, 0x0a, 0x02, 0x57, + 0x46, 0x10, 0x0e, 0x2a, 0x35, 0x0a, 0x0f, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x4e, + 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x41, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x42, 0x10, 0x02, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, + 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x63, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_status_proto_rawDescOnce sync.Once - file_status_proto_rawDescData = file_status_proto_rawDesc + file_component_status_proto_rawDescOnce sync.Once + file_component_status_proto_rawDescData = file_component_status_proto_rawDesc ) -func file_status_proto_rawDescGZIP() []byte { - file_status_proto_rawDescOnce.Do(func() { - file_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_status_proto_rawDescData) +func file_component_status_proto_rawDescGZIP() []byte { + file_component_status_proto_rawDescOnce.Do(func() { + file_component_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_component_status_proto_rawDescData) }) - return file_status_proto_rawDescData + return file_component_status_proto_rawDescData } -var file_status_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 17) -var file_status_proto_goTypes = []interface{}{ +var file_component_status_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_component_status_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_component_status_proto_goTypes = []interface{}{ (SignalAspect)(0), // 0: cstate.SignalAspect (TrainActiveEnum)(0), // 1: cstate.TrainActiveEnum (*DeviceIdentity)(nil), // 2: cstate.DeviceIdentity @@ -1317,7 +1318,7 @@ var file_status_proto_goTypes = []interface{}{ (*ButtonPressOperating)(nil), // 17: cstate.ButtonPressOperating (*ButtonConfirmOperating)(nil), // 18: cstate.ButtonConfirmOperating } -var file_status_proto_depIdxs = []int32{ +var file_component_status_proto_depIdxs = []int32{ 0, // 0: cstate.SignalState.display:type_name -> cstate.SignalAspect 10, // 1: cstate.BaliseState.content:type_name -> cstate.BaliseContent 1, // 2: cstate.TrainState.activeHead:type_name -> cstate.TrainActiveEnum @@ -1329,13 +1330,13 @@ var file_status_proto_depIdxs = []int32{ 0, // [0:4] is the sub-list for field type_name } -func init() { file_status_proto_init() } -func file_status_proto_init() { - if File_status_proto != nil { +func init() { file_component_status_proto_init() } +func file_component_status_proto_init() { + if File_component_status_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceIdentity); i { case 0: return &v.state @@ -1347,7 +1348,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SwitchRelayState); i { case 0: return &v.state @@ -1359,7 +1360,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PhysicalSectionState); i { case 0: return &v.state @@ -1371,7 +1372,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignalState); i { case 0: return &v.state @@ -1383,7 +1384,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PsdState); i { case 0: return &v.state @@ -1395,7 +1396,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PercentageDeviceState); i { case 0: return &v.state @@ -1407,7 +1408,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MovableDeviceState); i { case 0: return &v.state @@ -1419,7 +1420,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BaliseState); i { case 0: return &v.state @@ -1431,7 +1432,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BaliseContent); i { case 0: return &v.state @@ -1443,7 +1444,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OccupiedLinkPosition); i { case 0: return &v.state @@ -1455,7 +1456,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TrainState); i { case 0: return &v.state @@ -1467,7 +1468,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TowPositionButtonState); i { case 0: return &v.state @@ -1479,7 +1480,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RelayState); i { case 0: return &v.state @@ -1491,7 +1492,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EmpState); i { case 0: return &v.state @@ -1503,7 +1504,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ButtonState); i { case 0: return &v.state @@ -1515,7 +1516,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ButtonPressOperating); i { case 0: return &v.state @@ -1527,7 +1528,7 @@ func file_status_proto_init() { return nil } } - file_status_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_component_status_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ButtonConfirmOperating); i { case 0: return &v.state @@ -1544,19 +1545,19 @@ func file_status_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_status_proto_rawDesc, + RawDescriptor: file_component_status_proto_rawDesc, NumEnums: 2, NumMessages: 17, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_status_proto_goTypes, - DependencyIndexes: file_status_proto_depIdxs, - EnumInfos: file_status_proto_enumTypes, - MessageInfos: file_status_proto_msgTypes, + GoTypes: file_component_status_proto_goTypes, + DependencyIndexes: file_component_status_proto_depIdxs, + EnumInfos: file_component_status_proto_enumTypes, + MessageInfos: file_component_status_proto_msgTypes, }.Build() - File_status_proto = out.File - file_status_proto_rawDesc = nil - file_status_proto_goTypes = nil - file_status_proto_depIdxs = nil + File_component_status_proto = out.File + file_component_status_proto_rawDesc = nil + file_component_status_proto_goTypes = nil + file_component_status_proto_depIdxs = nil } diff --git a/examples/basic/main.go b/examples/basic/main.go index f9e501f..b3deabe 100644 --- a/examples/basic/main.go +++ b/examples/basic/main.go @@ -5,21 +5,20 @@ import ( "time" "joylink.club/rtsssimulation/repository" - "joylink.club/rtsssimulation/repository/model" "joylink.club/rtsssimulation/repository/model/proto" ) var Repo *repository.Repository func main() { - link := model.NewLink("1") + link := repository.NewLink("1") fmt.Println(link) - lp := model.NewLinkPort(&link, proto.Port_A) + lp := repository.NewLinkPort(link, proto.Port_A) fmt.Println(lp) Repo = repository.NewRepository("1" /* id */, "0.1" /* version */) - section := model.NewPhysicalSection("s1") + section := repository.NewPhysicalSection("s1") fmt.Println(section) Repo.AddPhysicalSection(section) fmt.Println(Repo) diff --git a/proto/src/model.proto b/proto/src/model.proto index 01b5e56..6362ad6 100644 --- a/proto/src/model.proto +++ b/proto/src/model.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package model; -option go_package = "./model/proto"; +option go_package = "./repository/model/proto"; message Repository { string id = 1; @@ -13,12 +13,16 @@ message Repository { repeated Signal signals = 6; repeated Responder responders = 7; repeated Slope slopes = 8; - repeated Curve curves = 9; + repeated SectionalCurvature sectionalCurvatures = 9; + repeated KilometerConvert kilometerConverts = 10; } //物理区段 message PhysicalSection { string id = 1; + repeated string turnoutIds = 2; //道岔物理区段关联的道岔 + DevicePort aDevicePort = 3; //非道岔物理区段A端关联的设备端口 + DevicePort bDevicePort = 4; } //区段检测点 @@ -26,26 +30,32 @@ message CheckPoint{ string id = 1; Kilometer km = 2; CheckPointType type = 3; - repeated DevicePort relDevicePorts = 4; //检测点连接的设备端点 + repeated DevicePort devicePorts = 4; } //道岔 message Turnout { string id = 1; Kilometer km = 2; + DevicePort aDevicePort = 3; + DevicePort bDevicePort = 4; + DevicePort cDevicePort = 5; } //信号机 message Signal { string id = 1; Kilometer km = 2; - DevicePort relDevice = 3; //关联的设备,区段或道岔 + string sectionId = 3; //关联的区段 + DevicePort turnoutPort = 4; //关联的区段端口 } //应答器 message Responder { string id = 1; Kilometer km = 2; + string sectionId = 3; //关联的区段 + DevicePort turnoutPort = 4; //关联的区段端口 } //坡度 @@ -55,8 +65,8 @@ message Slope { int32 degree = 3; //坡度角的sin * 1000 } -//曲线 -message Curve { +//分段曲率 +message SectionalCurvature { string id = 1; repeated Kilometer kms = 2; int32 radius = 3; //半径 mm @@ -65,7 +75,21 @@ message Curve { //设备及端口 message DevicePort { string deviceId = 1; - Port port = 2; + DeviceType deviceType = 2; + Port port = 3; +} + +enum DeviceType { + DeviceType_Unknown = 0; + DeviceType_PhysicalSection = 1; + DeviceType_CheckPoint = 2; + DeviceType_Turnout = 3; + DeviceType_Signal = 4; + DeviceType_Responder = 5; + DeviceType_Slope = 6; + DeviceType_SectionalCurvature = 7; + DeviceType_Link = 8; + DeviceType_LinkNode = 9; } enum Port { @@ -97,7 +121,7 @@ enum Direction { //检测点类型 enum CheckPointType{ - VirtualAxle = 0; //虚拟计轴器 + Boundary = 0; //区段边界 AxleCounter = 1; //计轴器 InsulatedJoint = 2; //绝缘节 } \ No newline at end of file diff --git a/repository/calculate.go b/repository/calculate.go new file mode 100644 index 0000000..5a852bc --- /dev/null +++ b/repository/calculate.go @@ -0,0 +1,44 @@ +package repository + +import ( + "errors" + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" +) + +// 转换公里标 +func convertKilometer(repo *Repository, km *proto.Kilometer, cs string, dir proto.Direction) (*proto.Kilometer, error) { + if km.CoordinateSystem == cs && km.Direction == dir { + return km, nil + } + + kc, err := repo.getKilometerConvert(km.CoordinateSystem, cs, km.Direction, dir) + if err != nil { + return nil, err + } + + var sourceCsKm *proto.Kilometer + var targetCsKm *proto.Kilometer + if kc.KmA.CoordinateSystem == km.CoordinateSystem { + sourceCsKm = kc.KmA + targetCsKm = kc.KmB + } else { + sourceCsKm = kc.KmB + targetCsKm = kc.KmA + } + offset := km.Value - sourceCsKm.Value + var value int64 + if kc.SameTrend { + value = targetCsKm.Value + offset + } else { + value = targetCsKm.Value - offset + } + if value < 0 { + return nil, errors.New(fmt.Sprintf("公里标[%s]转换为坐标系[%s]的公里标的值[%d]小于0", km, cs, value)) + } + return &proto.Kilometer{ + Value: value, + CoordinateSystem: cs, + Direction: dir, + }, nil +} diff --git a/repository/check_point.go b/repository/check_point.go new file mode 100644 index 0000000..a4575fa --- /dev/null +++ b/repository/check_point.go @@ -0,0 +1,24 @@ +package repository + +import "joylink.club/rtsssimulation/repository/model/proto" + +// 检测点 +type CheckPoint struct { + Identity + + km *proto.Kilometer + pointType proto.CheckPointType //检测点类型 + devicePorts []DevicePort //检测点关联的设备及其端口 +} + +func NewCheckPoint(id string, km *proto.Kilometer, pointType proto.CheckPointType) *CheckPoint { + return &CheckPoint{ + Identity: identity{id, proto.DeviceType_DeviceType_CheckPoint}, + km: km, + pointType: pointType, + } +} + +func (c *CheckPoint) bindDevicePort(devicePort DevicePort) { + c.devicePorts = append(c.devicePorts, devicePort) +} diff --git a/repository/device_port.go b/repository/device_port.go new file mode 100644 index 0000000..beb944e --- /dev/null +++ b/repository/device_port.go @@ -0,0 +1,21 @@ +package repository + +import "joylink.club/rtsssimulation/repository/model/proto" + +type PortedDevice interface { + Identity + + // PortNum 端口数量 + PortNum() int + // 关联设备端口 + bindDevicePort(port proto.Port, devicePort DevicePort) error + //// 下一个设备端口 + //Next(port proto.Port) DevicePort + //// 其他设备端口 + //Others(port proto.Port) []DevicePort +} + +type DevicePort interface { + Port() proto.Port + Device() PortedDevice +} diff --git a/repository/link.go b/repository/link.go new file mode 100644 index 0000000..0041628 --- /dev/null +++ b/repository/link.go @@ -0,0 +1,152 @@ +package repository + +import ( + "errors" + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" +) + +type Link struct { + Identity + + length int64 + + aRelation LinkNodePort + bRelation LinkNodePort + + //Link关联的模型,包含LinkNode + devicePositions []*DeviceLinkPosition +} + +var _ Identity = &Link{} + +func NewLink(id string) *Link { + return &Link{Identity: identity{id, proto.DeviceType_DeviceType_Link}} +} + +func (l *Link) PortNum() int { + return 2 +} + +func (l *Link) bindDevicePort(port proto.Port, devicePort DevicePort) error { + linkNodePort, isLinkNodePort := devicePort.(LinkNodePort) + if !isLinkNodePort { + return errors.New(fmt.Sprintf("Link不能与[%s]类型的设备关联", devicePort.Device().Type())) + } + switch port { + case proto.Port_A: + l.aRelation = linkNodePort + case proto.Port_B: + l.bRelation = linkNodePort + default: + return errors.New(fmt.Sprintf("Link没有端口[%s]", port)) + } + return nil +} + +func (l *Link) bindDevicesLinkPositions(dlps ...*DeviceLinkPosition) { + for _, dlp := range dlps { + l.devicePositions = append(l.devicePositions, dlp) + } +} + +// LinkPosition link位置 +type LinkPosition struct { + link *Link + offset int64 +} + +// DeviceLinkPosition device在link上的位置 +type DeviceLinkPosition struct { + device Identity + position LinkPosition +} + +// SlopeLinkSegment Slope在Link上的区间 +type SlopeLinkSegment struct { + slope *Slope + start LinkPosition + end LinkPosition +} + +type SectionalCurvatureLinkSegment struct { + sectionalCurvature *SectionalCurvature + start LinkPosition + end LinkPosition +} + +// LinkNode link节点 +type LinkNode struct { + Identity + turnout *Turnout + aRelation LinkPort + bRelation LinkPort + cRelation LinkPort +} + +func (ln LinkNode) Id() string { + return ln.turnout.Id() +} + +func (ln LinkNode) PortNum() int { + return 3 +} + +func (ln LinkNode) bindDevicePort(port proto.Port, devicePort DevicePort) error { + linkPort, isLinkPort := devicePort.(*LinkPort) + if !isLinkPort { + return errors.New(fmt.Sprintf("Link节点不能与[%s]类型的设备关联", devicePort.Device().Type())) + } + switch port { + case proto.Port_A: + ln.aRelation = *linkPort + case proto.Port_B: + ln.bRelation = *linkPort + case proto.Port_C: + ln.cRelation = *linkPort + default: + return errors.New(fmt.Sprintf("Link节点没有端口[%s]", port)) + } + return nil +} + +// link端口 +type LinkPort struct { + link *Link + port proto.Port +} + +func NewLinkPort(link *Link, port proto.Port) LinkPort { + return LinkPort{ + link: link, + port: port, + } +} + +func (l *LinkPort) Port() proto.Port { + return l.port +} + +func (l *LinkPort) Device() PortedDevice { + return l.link +} + +type LinkNodePort struct { + node *LinkNode + port proto.Port +} + +func NewLinkNodePort(node *LinkNode, port proto.Port) LinkNodePort { + return LinkNodePort{ + node: node, + port: port, + } +} + +func (lp LinkNodePort) Port() proto.Port { + return lp.port +} + +func (lp LinkNodePort) Device() PortedDevice { + return lp.node +} diff --git a/repository/model/model.go b/repository/model.go similarity index 50% rename from repository/model/model.go rename to repository/model.go index 85da20b..c8fb5d8 100644 --- a/repository/model/model.go +++ b/repository/model.go @@ -1,33 +1,23 @@ -package model +package repository import "joylink.club/rtsssimulation/repository/model/proto" // 身份信息 type Identity interface { Id() string + Type() proto.DeviceType } // 身份信息 type identity struct { - id string + id string + deviceType proto.DeviceType } func (m identity) Id() string { return m.id } -type Signal struct { - Identity - km proto.Kilometer -} -type Responder struct { - Identity -} -type Slope struct { - Identity - devicePositions []*LinkPosition -} - -type Curve struct { - Identity +func (m identity) Type() proto.DeviceType { + return m.deviceType } diff --git a/repository/model/check_point.go b/repository/model/check_point.go deleted file mode 100644 index f56bbb3..0000000 --- a/repository/model/check_point.go +++ /dev/null @@ -1,13 +0,0 @@ -package model - -import "joylink.club/rtsssimulation/repository/model/proto" - -// 检测点 -type CheckPoint struct { - Identity - - km proto.Kilometer - t proto.CheckPointType //检测点类型 - devicePorts []*DevicePort //检测点关联的设备及其端口 - devicePositions []*LinkPosition //检测点所在的设备位置 -} diff --git a/repository/model/device_port.go b/repository/model/device_port.go deleted file mode 100644 index 2f7feac..0000000 --- a/repository/model/device_port.go +++ /dev/null @@ -1,19 +0,0 @@ -package model - -import "joylink.club/rtsssimulation/repository/model/proto" - -type PortedDevice interface { - Identity - - // 端口数量 - PortNum() int - // 下一个设备端口 - Next(port proto.Port) DevicePort - // 其他设备端口 - Others(port proto.Port) []DevicePort -} - -type DevicePort interface { - Port() proto.Port - Device() PortedDevice -} diff --git a/repository/model/link.go b/repository/model/link.go deleted file mode 100644 index e85aa6d..0000000 --- a/repository/model/link.go +++ /dev/null @@ -1,71 +0,0 @@ -package model - -import "joylink.club/rtsssimulation/repository/model/proto" - -type Link struct { - Identity - - aRelation LinkNodePort - bRelation LinkNodePort -} - -var _ Identity = &Link{} - -func NewLink(id string) Link { - return Link{Identity: identity{id: id}} -} - -// link位置 -type LinkPosition struct { - link *Link - offset int -} - -// link节点 -type LinkNode struct { - turnout *Turnout - aRelation LinkPort - bRelation LinkPort - cRelation LinkPort -} - -func (ln LinkNode) Id() string { - return ln.turnout.Id() -} - -// link端口 -type LinkPort struct { - DevicePort - - link *Link - port proto.Port -} - -func NewLinkPort(link *Link, port proto.Port) LinkPort { - return LinkPort{ - link: link, - port: port, - } -} - -func (lp LinkPort) Device() Identity { - return lp.link -} - -type LinkNodePort struct { - DevicePort - - node *LinkNode - port proto.Port -} - -func NewLinkNodePort(node *LinkNode, port proto.Port) LinkNodePort { - return LinkNodePort{ - node: node, - port: port, - } -} - -func (lp LinkNodePort) Device() Identity { - return lp.node -} diff --git a/repository/model/physical_section.go b/repository/model/physical_section.go deleted file mode 100644 index 0619fc4..0000000 --- a/repository/model/physical_section.go +++ /dev/null @@ -1,42 +0,0 @@ -package model - -import "joylink.club/rtsssimulation/repository/model/proto" - -// 物理区段 -type PhysicalSection struct { - Identity - - len int32 //长度 mm - checkPoints []*CheckPoint //将此区段分隔出来的所有检测点 - // A/B端关联的设备端 - aRelation DevicePort - bRelation DevicePort - - // A/B/C端口关联的检测点 - aCheckPoint CheckPoint - bCheckPoint CheckPoint - - // 关联的设备 - devices []Identity -} - -func NewPhysicalSection(id string) *PhysicalSection { - return &PhysicalSection{ - Identity: identity{id}, - } -} - -func (s *PhysicalSection) ARelation() DevicePort { - return s.aRelation -} - -func (s *PhysicalSection) BRelation() DevicePort { - return s.bRelation -} - -type PhysicalSectionPort struct { - DevicePort - - section *PhysicalSection - port proto.Port -} diff --git a/repository/model/proto/model.pb.go b/repository/model/proto/model.pb.go index ff8ac62..e380e9c 100644 --- a/repository/model/proto/model.pb.go +++ b/repository/model/proto/model.pb.go @@ -20,6 +20,76 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type DeviceType int32 + +const ( + DeviceType_DeviceType_Unknown DeviceType = 0 + DeviceType_DeviceType_PhysicalSection DeviceType = 1 + DeviceType_DeviceType_CheckPoint DeviceType = 2 + DeviceType_DeviceType_Turnout DeviceType = 3 + DeviceType_DeviceType_Signal DeviceType = 4 + DeviceType_DeviceType_Responder DeviceType = 5 + DeviceType_DeviceType_Slope DeviceType = 6 + DeviceType_DeviceType_SectionalCurvature DeviceType = 7 + DeviceType_DeviceType_Link DeviceType = 8 + DeviceType_DeviceType_LinkNode DeviceType = 9 +) + +// Enum value maps for DeviceType. +var ( + DeviceType_name = map[int32]string{ + 0: "DeviceType_Unknown", + 1: "DeviceType_PhysicalSection", + 2: "DeviceType_CheckPoint", + 3: "DeviceType_Turnout", + 4: "DeviceType_Signal", + 5: "DeviceType_Responder", + 6: "DeviceType_Slope", + 7: "DeviceType_SectionalCurvature", + 8: "DeviceType_Link", + 9: "DeviceType_LinkNode", + } + DeviceType_value = map[string]int32{ + "DeviceType_Unknown": 0, + "DeviceType_PhysicalSection": 1, + "DeviceType_CheckPoint": 2, + "DeviceType_Turnout": 3, + "DeviceType_Signal": 4, + "DeviceType_Responder": 5, + "DeviceType_Slope": 6, + "DeviceType_SectionalCurvature": 7, + "DeviceType_Link": 8, + "DeviceType_LinkNode": 9, + } +) + +func (x DeviceType) Enum() *DeviceType { + p := new(DeviceType) + *p = x + return p +} + +func (x DeviceType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DeviceType) Descriptor() protoreflect.EnumDescriptor { + return file_model_proto_enumTypes[0].Descriptor() +} + +func (DeviceType) Type() protoreflect.EnumType { + return &file_model_proto_enumTypes[0] +} + +func (x DeviceType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DeviceType.Descriptor instead. +func (DeviceType) EnumDescriptor() ([]byte, []int) { + return file_model_proto_rawDescGZIP(), []int{0} +} + type Port int32 const ( @@ -56,11 +126,11 @@ func (x Port) String() string { } func (Port) Descriptor() protoreflect.EnumDescriptor { - return file_model_proto_enumTypes[0].Descriptor() + return file_model_proto_enumTypes[1].Descriptor() } func (Port) Type() protoreflect.EnumType { - return &file_model_proto_enumTypes[0] + return &file_model_proto_enumTypes[1] } func (x Port) Number() protoreflect.EnumNumber { @@ -69,7 +139,7 @@ func (x Port) Number() protoreflect.EnumNumber { // Deprecated: Use Port.Descriptor instead. func (Port) EnumDescriptor() ([]byte, []int) { - return file_model_proto_rawDescGZIP(), []int{0} + return file_model_proto_rawDescGZIP(), []int{1} } // 左右行 @@ -103,11 +173,11 @@ func (x Direction) String() string { } func (Direction) Descriptor() protoreflect.EnumDescriptor { - return file_model_proto_enumTypes[1].Descriptor() + return file_model_proto_enumTypes[2].Descriptor() } func (Direction) Type() protoreflect.EnumType { - return &file_model_proto_enumTypes[1] + return &file_model_proto_enumTypes[2] } func (x Direction) Number() protoreflect.EnumNumber { @@ -116,14 +186,14 @@ func (x Direction) Number() protoreflect.EnumNumber { // Deprecated: Use Direction.Descriptor instead. func (Direction) EnumDescriptor() ([]byte, []int) { - return file_model_proto_rawDescGZIP(), []int{1} + return file_model_proto_rawDescGZIP(), []int{2} } // 检测点类型 type CheckPointType int32 const ( - CheckPointType_VirtualAxle CheckPointType = 0 //虚拟计轴器 + CheckPointType_Boundary CheckPointType = 0 //区段边界 CheckPointType_AxleCounter CheckPointType = 1 //计轴器 CheckPointType_InsulatedJoint CheckPointType = 2 //绝缘节 ) @@ -131,12 +201,12 @@ const ( // Enum value maps for CheckPointType. var ( CheckPointType_name = map[int32]string{ - 0: "VirtualAxle", + 0: "Boundary", 1: "AxleCounter", 2: "InsulatedJoint", } CheckPointType_value = map[string]int32{ - "VirtualAxle": 0, + "Boundary": 0, "AxleCounter": 1, "InsulatedJoint": 2, } @@ -153,11 +223,11 @@ func (x CheckPointType) String() string { } func (CheckPointType) Descriptor() protoreflect.EnumDescriptor { - return file_model_proto_enumTypes[2].Descriptor() + return file_model_proto_enumTypes[3].Descriptor() } func (CheckPointType) Type() protoreflect.EnumType { - return &file_model_proto_enumTypes[2] + return &file_model_proto_enumTypes[3] } func (x CheckPointType) Number() protoreflect.EnumNumber { @@ -166,7 +236,7 @@ func (x CheckPointType) Number() protoreflect.EnumNumber { // Deprecated: Use CheckPointType.Descriptor instead. func (CheckPointType) EnumDescriptor() ([]byte, []int) { - return file_model_proto_rawDescGZIP(), []int{2} + return file_model_proto_rawDescGZIP(), []int{3} } type Repository struct { @@ -174,15 +244,16 @@ type Repository struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - PhysicalSections []*PhysicalSection `protobuf:"bytes,3,rep,name=physicalSections,proto3" json:"physicalSections,omitempty"` - CheckPoints []*CheckPoint `protobuf:"bytes,4,rep,name=checkPoints,proto3" json:"checkPoints,omitempty"` - Turnouts []*Turnout `protobuf:"bytes,5,rep,name=turnouts,proto3" json:"turnouts,omitempty"` - Signals []*Signal `protobuf:"bytes,6,rep,name=signals,proto3" json:"signals,omitempty"` - Responders []*Responder `protobuf:"bytes,7,rep,name=responders,proto3" json:"responders,omitempty"` - Slopes []*Slope `protobuf:"bytes,8,rep,name=slopes,proto3" json:"slopes,omitempty"` - Curves []*Curve `protobuf:"bytes,9,rep,name=curves,proto3" json:"curves,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + PhysicalSections []*PhysicalSection `protobuf:"bytes,3,rep,name=physicalSections,proto3" json:"physicalSections,omitempty"` + CheckPoints []*CheckPoint `protobuf:"bytes,4,rep,name=checkPoints,proto3" json:"checkPoints,omitempty"` + Turnouts []*Turnout `protobuf:"bytes,5,rep,name=turnouts,proto3" json:"turnouts,omitempty"` + Signals []*Signal `protobuf:"bytes,6,rep,name=signals,proto3" json:"signals,omitempty"` + Responders []*Responder `protobuf:"bytes,7,rep,name=responders,proto3" json:"responders,omitempty"` + Slopes []*Slope `protobuf:"bytes,8,rep,name=slopes,proto3" json:"slopes,omitempty"` + SectionalCurvatures []*SectionalCurvature `protobuf:"bytes,9,rep,name=sectionalCurvatures,proto3" json:"sectionalCurvatures,omitempty"` + KilometerConverts []*KilometerConvert `protobuf:"bytes,10,rep,name=kilometerConverts,proto3" json:"kilometerConverts,omitempty"` } func (x *Repository) Reset() { @@ -273,9 +344,16 @@ func (x *Repository) GetSlopes() []*Slope { return nil } -func (x *Repository) GetCurves() []*Curve { +func (x *Repository) GetSectionalCurvatures() []*SectionalCurvature { if x != nil { - return x.Curves + return x.SectionalCurvatures + } + return nil +} + +func (x *Repository) GetKilometerConverts() []*KilometerConvert { + if x != nil { + return x.KilometerConverts } return nil } @@ -286,7 +364,10 @@ type PhysicalSection struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + TurnoutIds []string `protobuf:"bytes,2,rep,name=turnoutIds,proto3" json:"turnoutIds,omitempty"` //道岔物理区段关联的道岔 + ADevicePort *DevicePort `protobuf:"bytes,3,opt,name=aDevicePort,proto3" json:"aDevicePort,omitempty"` //非道岔物理区段A端关联的设备端口 + BDevicePort *DevicePort `protobuf:"bytes,4,opt,name=bDevicePort,proto3" json:"bDevicePort,omitempty"` } func (x *PhysicalSection) Reset() { @@ -328,16 +409,37 @@ func (x *PhysicalSection) GetId() string { return "" } +func (x *PhysicalSection) GetTurnoutIds() []string { + if x != nil { + return x.TurnoutIds + } + return nil +} + +func (x *PhysicalSection) GetADevicePort() *DevicePort { + if x != nil { + return x.ADevicePort + } + return nil +} + +func (x *PhysicalSection) GetBDevicePort() *DevicePort { + if x != nil { + return x.BDevicePort + } + return nil +} + // 区段检测点 type CheckPoint struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` - Type CheckPointType `protobuf:"varint,3,opt,name=type,proto3,enum=model.CheckPointType" json:"type,omitempty"` - RelDevicePorts []*DevicePort `protobuf:"bytes,4,rep,name=relDevicePorts,proto3" json:"relDevicePorts,omitempty"` //检测点连接的设备端点 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` + Type CheckPointType `protobuf:"varint,3,opt,name=type,proto3,enum=model.CheckPointType" json:"type,omitempty"` + DevicePorts []*DevicePort `protobuf:"bytes,4,rep,name=devicePorts,proto3" json:"devicePorts,omitempty"` } func (x *CheckPoint) Reset() { @@ -390,68 +492,12 @@ func (x *CheckPoint) GetType() CheckPointType { if x != nil { return x.Type } - return CheckPointType_VirtualAxle + return CheckPointType_Boundary } -func (x *CheckPoint) GetRelDevicePorts() []*DevicePort { +func (x *CheckPoint) GetDevicePorts() []*DevicePort { if x != nil { - return x.RelDevicePorts - } - return nil -} - -// 应答器 -type Responder struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` -} - -func (x *Responder) Reset() { - *x = Responder{} - if protoimpl.UnsafeEnabled { - mi := &file_model_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Responder) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Responder) ProtoMessage() {} - -func (x *Responder) ProtoReflect() protoreflect.Message { - mi := &file_model_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Responder.ProtoReflect.Descriptor instead. -func (*Responder) Descriptor() ([]byte, []int) { - return file_model_proto_rawDescGZIP(), []int{3} -} - -func (x *Responder) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Responder) GetKm() *Kilometer { - if x != nil { - return x.Km + return x.DevicePorts } return nil } @@ -462,14 +508,17 @@ type Turnout struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` + ADevicePort *DevicePort `protobuf:"bytes,3,opt,name=aDevicePort,proto3" json:"aDevicePort,omitempty"` + BDevicePort *DevicePort `protobuf:"bytes,4,opt,name=bDevicePort,proto3" json:"bDevicePort,omitempty"` + CDevicePort *DevicePort `protobuf:"bytes,5,opt,name=cDevicePort,proto3" json:"cDevicePort,omitempty"` } func (x *Turnout) Reset() { *x = Turnout{} if protoimpl.UnsafeEnabled { - mi := &file_model_proto_msgTypes[4] + mi := &file_model_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -482,7 +531,7 @@ func (x *Turnout) String() string { func (*Turnout) ProtoMessage() {} func (x *Turnout) ProtoReflect() protoreflect.Message { - mi := &file_model_proto_msgTypes[4] + mi := &file_model_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -495,7 +544,7 @@ func (x *Turnout) ProtoReflect() protoreflect.Message { // Deprecated: Use Turnout.ProtoReflect.Descriptor instead. func (*Turnout) Descriptor() ([]byte, []int) { - return file_model_proto_rawDescGZIP(), []int{4} + return file_model_proto_rawDescGZIP(), []int{3} } func (x *Turnout) GetId() string { @@ -512,21 +561,43 @@ func (x *Turnout) GetKm() *Kilometer { return nil } +func (x *Turnout) GetADevicePort() *DevicePort { + if x != nil { + return x.ADevicePort + } + return nil +} + +func (x *Turnout) GetBDevicePort() *DevicePort { + if x != nil { + return x.BDevicePort + } + return nil +} + +func (x *Turnout) GetCDevicePort() *DevicePort { + if x != nil { + return x.CDevicePort + } + return nil +} + // 信号机 type Signal struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` - RelDevice *DevicePort `protobuf:"bytes,3,opt,name=relDevice,proto3" json:"relDevice,omitempty"` //关联的设备,区段或道岔 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` + SectionId string `protobuf:"bytes,3,opt,name=sectionId,proto3" json:"sectionId,omitempty"` //关联的区段 + TurnoutPort *DevicePort `protobuf:"bytes,4,opt,name=turnoutPort,proto3" json:"turnoutPort,omitempty"` //关联的区段端口 } func (x *Signal) Reset() { *x = Signal{} if protoimpl.UnsafeEnabled { - mi := &file_model_proto_msgTypes[5] + mi := &file_model_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -539,7 +610,7 @@ func (x *Signal) String() string { func (*Signal) ProtoMessage() {} func (x *Signal) ProtoReflect() protoreflect.Message { - mi := &file_model_proto_msgTypes[5] + mi := &file_model_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -552,7 +623,7 @@ func (x *Signal) ProtoReflect() protoreflect.Message { // Deprecated: Use Signal.ProtoReflect.Descriptor instead. func (*Signal) Descriptor() ([]byte, []int) { - return file_model_proto_rawDescGZIP(), []int{5} + return file_model_proto_rawDescGZIP(), []int{4} } func (x *Signal) GetId() string { @@ -569,9 +640,88 @@ func (x *Signal) GetKm() *Kilometer { return nil } -func (x *Signal) GetRelDevice() *DevicePort { +func (x *Signal) GetSectionId() string { if x != nil { - return x.RelDevice + return x.SectionId + } + return "" +} + +func (x *Signal) GetTurnoutPort() *DevicePort { + if x != nil { + return x.TurnoutPort + } + return nil +} + +// 应答器 +type Responder struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` + SectionId string `protobuf:"bytes,3,opt,name=sectionId,proto3" json:"sectionId,omitempty"` //关联的区段 + TurnoutPort *DevicePort `protobuf:"bytes,4,opt,name=turnoutPort,proto3" json:"turnoutPort,omitempty"` //关联的区段端口 +} + +func (x *Responder) Reset() { + *x = Responder{} + if protoimpl.UnsafeEnabled { + mi := &file_model_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Responder) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Responder) ProtoMessage() {} + +func (x *Responder) ProtoReflect() protoreflect.Message { + mi := &file_model_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Responder.ProtoReflect.Descriptor instead. +func (*Responder) Descriptor() ([]byte, []int) { + return file_model_proto_rawDescGZIP(), []int{5} +} + +func (x *Responder) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Responder) GetKm() *Kilometer { + if x != nil { + return x.Km + } + return nil +} + +func (x *Responder) GetSectionId() string { + if x != nil { + return x.SectionId + } + return "" +} + +func (x *Responder) GetTurnoutPort() *DevicePort { + if x != nil { + return x.TurnoutPort } return nil } @@ -640,8 +790,8 @@ func (x *Slope) GetDegree() int32 { return 0 } -// 曲线 -type Curve struct { +// 分段曲率 +type SectionalCurvature struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -651,8 +801,8 @@ type Curve struct { Radius int32 `protobuf:"varint,3,opt,name=radius,proto3" json:"radius,omitempty"` //半径 mm } -func (x *Curve) Reset() { - *x = Curve{} +func (x *SectionalCurvature) Reset() { + *x = SectionalCurvature{} if protoimpl.UnsafeEnabled { mi := &file_model_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -660,13 +810,13 @@ func (x *Curve) Reset() { } } -func (x *Curve) String() string { +func (x *SectionalCurvature) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Curve) ProtoMessage() {} +func (*SectionalCurvature) ProtoMessage() {} -func (x *Curve) ProtoReflect() protoreflect.Message { +func (x *SectionalCurvature) ProtoReflect() protoreflect.Message { mi := &file_model_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -678,26 +828,26 @@ func (x *Curve) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Curve.ProtoReflect.Descriptor instead. -func (*Curve) Descriptor() ([]byte, []int) { +// Deprecated: Use SectionalCurvature.ProtoReflect.Descriptor instead. +func (*SectionalCurvature) Descriptor() ([]byte, []int) { return file_model_proto_rawDescGZIP(), []int{7} } -func (x *Curve) GetId() string { +func (x *SectionalCurvature) GetId() string { if x != nil { return x.Id } return "" } -func (x *Curve) GetKms() []*Kilometer { +func (x *SectionalCurvature) GetKms() []*Kilometer { if x != nil { return x.Kms } return nil } -func (x *Curve) GetRadius() int32 { +func (x *SectionalCurvature) GetRadius() int32 { if x != nil { return x.Radius } @@ -710,8 +860,9 @@ type DevicePort struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - DeviceId string `protobuf:"bytes,1,opt,name=deviceId,proto3" json:"deviceId,omitempty"` - Port Port `protobuf:"varint,2,opt,name=port,proto3,enum=model.Port" json:"port,omitempty"` + DeviceId string `protobuf:"bytes,1,opt,name=deviceId,proto3" json:"deviceId,omitempty"` + DeviceType DeviceType `protobuf:"varint,2,opt,name=deviceType,proto3,enum=model.DeviceType" json:"deviceType,omitempty"` + Port Port `protobuf:"varint,3,opt,name=port,proto3,enum=model.Port" json:"port,omitempty"` } func (x *DevicePort) Reset() { @@ -753,6 +904,13 @@ func (x *DevicePort) GetDeviceId() string { return "" } +func (x *DevicePort) GetDeviceType() DeviceType { + if x != nil { + return x.DeviceType + } + return DeviceType_DeviceType_Unknown +} + func (x *DevicePort) GetPort() Port { if x != nil { return x.Port @@ -892,7 +1050,7 @@ var File_model_proto protoreflect.FileDescriptor var file_model_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x22, 0x82, 0x03, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x64, 0x65, 0x6c, 0x22, 0xf0, 0x03, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, @@ -914,78 +1072,132 @@ var file_model_proto_rawDesc = []byte{ 0x72, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x6c, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x06, 0x73, 0x6c, 0x6f, - 0x70, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x76, 0x65, 0x73, 0x18, 0x09, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x43, 0x75, 0x72, 0x76, - 0x65, 0x52, 0x06, 0x63, 0x75, 0x72, 0x76, 0x65, 0x73, 0x22, 0x21, 0x0a, 0x0f, 0x50, 0x68, 0x79, - 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xa4, 0x01, 0x0a, - 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, - 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, - 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x29, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, 0x6f, - 0x64, 0x65, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x0e, 0x72, 0x65, 0x6c, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x70, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x13, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x13, 0x73, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x12, 0x45, 0x0a, 0x11, 0x6b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x74, 0x52, 0x11, 0x6b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x0f, 0x50, 0x68, 0x79, 0x73, + 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, + 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x73, 0x12, 0x33, 0x0a, 0x0b, 0x61, + 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, - 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x72, 0x65, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, - 0x72, 0x74, 0x73, 0x22, 0x3d, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, - 0x6b, 0x6d, 0x22, 0x3b, 0x0a, 0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, - 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x22, - 0x6b, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, - 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x2f, 0x0a, 0x09, 0x72, - 0x65, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, + 0x12, 0x33, 0x0a, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, + 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x22, 0xda, 0x01, 0x0a, 0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f, + 0x75, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x33, 0x0a, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, + 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x61, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x62, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, - 0x74, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x53, 0x0a, 0x05, - 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x67, - 0x72, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, - 0x65, 0x22, 0x53, 0x0a, 0x05, 0x43, 0x75, 0x72, 0x76, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, - 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, - 0x0a, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x22, 0x49, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, - 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x04, 0x70, 0x6f, 0x72, - 0x74, 0x22, 0x7d, 0x0a, 0x09, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, - 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x12, 0x2e, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x78, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x41, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x42, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, - 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x42, 0x12, 0x1c, 0x0a, 0x09, - 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x2a, 0x25, 0x0a, 0x04, 0x50, 0x6f, - 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, - 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, - 0x03, 0x2a, 0x20, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, - 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, - 0x54, 0x10, 0x01, 0x2a, 0x46, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, - 0x41, 0x78, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, - 0x61, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, - 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, + 0x0a, 0x0b, 0x63, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x63, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, + 0x6f, 0x72, 0x74, 0x22, 0x8d, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, + 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, + 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, + 0x6f, 0x72, 0x74, 0x22, 0x90, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, + 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, + 0x02, 0x6b, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, + 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x53, 0x0a, 0x05, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, + 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x22, 0x60, 0x0a, 0x12, 0x53, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x22, 0x7c, 0x0a, + 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x7d, 0x0a, 0x09, 0x4b, + 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, + 0x0a, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, + 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x10, 0x4b, 0x69, + 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x22, + 0x0a, 0x03, 0x6b, 0x6d, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, + 0x6d, 0x41, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x42, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, + 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, + 0x72, 0x65, 0x6e, 0x64, 0x2a, 0x8f, 0x02, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, + 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, + 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x03, 0x12, 0x15, + 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x10, 0x05, 0x12, + 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x6c, + 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, + 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x10, 0x08, 0x12, 0x17, 0x0a, + 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, + 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09, 0x2a, 0x25, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, + 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, + 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, 0x03, 0x2a, 0x20, 0x0a, + 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, + 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x2a, + 0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x10, 0x00, 0x12, + 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x10, 0x01, + 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x69, + 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1000,50 +1212,59 @@ func file_model_proto_rawDescGZIP() []byte { return file_model_proto_rawDescData } -var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_model_proto_goTypes = []interface{}{ - (Port)(0), // 0: model.Port - (Direction)(0), // 1: model.Direction - (CheckPointType)(0), // 2: model.CheckPointType - (*Repository)(nil), // 3: model.Repository - (*PhysicalSection)(nil), // 4: model.PhysicalSection - (*CheckPoint)(nil), // 5: model.CheckPoint - (*Responder)(nil), // 6: model.Responder - (*Turnout)(nil), // 7: model.Turnout - (*Signal)(nil), // 8: model.Signal - (*Slope)(nil), // 9: model.Slope - (*Curve)(nil), // 10: model.Curve - (*DevicePort)(nil), // 11: model.DevicePort - (*Kilometer)(nil), // 12: model.Kilometer - (*KilometerConvert)(nil), // 13: model.KilometerConvert + (DeviceType)(0), // 0: model.DeviceType + (Port)(0), // 1: model.Port + (Direction)(0), // 2: model.Direction + (CheckPointType)(0), // 3: model.CheckPointType + (*Repository)(nil), // 4: model.Repository + (*PhysicalSection)(nil), // 5: model.PhysicalSection + (*CheckPoint)(nil), // 6: model.CheckPoint + (*Turnout)(nil), // 7: model.Turnout + (*Signal)(nil), // 8: model.Signal + (*Responder)(nil), // 9: model.Responder + (*Slope)(nil), // 10: model.Slope + (*SectionalCurvature)(nil), // 11: model.SectionalCurvature + (*DevicePort)(nil), // 12: model.DevicePort + (*Kilometer)(nil), // 13: model.Kilometer + (*KilometerConvert)(nil), // 14: model.KilometerConvert } var file_model_proto_depIdxs = []int32{ - 4, // 0: model.Repository.physicalSections:type_name -> model.PhysicalSection - 5, // 1: model.Repository.checkPoints:type_name -> model.CheckPoint + 5, // 0: model.Repository.physicalSections:type_name -> model.PhysicalSection + 6, // 1: model.Repository.checkPoints:type_name -> model.CheckPoint 7, // 2: model.Repository.turnouts:type_name -> model.Turnout 8, // 3: model.Repository.signals:type_name -> model.Signal - 6, // 4: model.Repository.responders:type_name -> model.Responder - 9, // 5: model.Repository.slopes:type_name -> model.Slope - 10, // 6: model.Repository.curves:type_name -> model.Curve - 12, // 7: model.CheckPoint.km:type_name -> model.Kilometer - 2, // 8: model.CheckPoint.type:type_name -> model.CheckPointType - 11, // 9: model.CheckPoint.relDevicePorts:type_name -> model.DevicePort - 12, // 10: model.Responder.km:type_name -> model.Kilometer - 12, // 11: model.Turnout.km:type_name -> model.Kilometer - 12, // 12: model.Signal.km:type_name -> model.Kilometer - 11, // 13: model.Signal.relDevice:type_name -> model.DevicePort - 12, // 14: model.Slope.kms:type_name -> model.Kilometer - 12, // 15: model.Curve.kms:type_name -> model.Kilometer - 0, // 16: model.DevicePort.port:type_name -> model.Port - 1, // 17: model.Kilometer.direction:type_name -> model.Direction - 12, // 18: model.KilometerConvert.kmA:type_name -> model.Kilometer - 12, // 19: model.KilometerConvert.kmB:type_name -> model.Kilometer - 20, // [20:20] is the sub-list for method output_type - 20, // [20:20] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 9, // 4: model.Repository.responders:type_name -> model.Responder + 10, // 5: model.Repository.slopes:type_name -> model.Slope + 11, // 6: model.Repository.sectionalCurvatures:type_name -> model.SectionalCurvature + 14, // 7: model.Repository.kilometerConverts:type_name -> model.KilometerConvert + 12, // 8: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort + 12, // 9: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort + 13, // 10: model.CheckPoint.km:type_name -> model.Kilometer + 3, // 11: model.CheckPoint.type:type_name -> model.CheckPointType + 12, // 12: model.CheckPoint.devicePorts:type_name -> model.DevicePort + 13, // 13: model.Turnout.km:type_name -> model.Kilometer + 12, // 14: model.Turnout.aDevicePort:type_name -> model.DevicePort + 12, // 15: model.Turnout.bDevicePort:type_name -> model.DevicePort + 12, // 16: model.Turnout.cDevicePort:type_name -> model.DevicePort + 13, // 17: model.Signal.km:type_name -> model.Kilometer + 12, // 18: model.Signal.turnoutPort:type_name -> model.DevicePort + 13, // 19: model.Responder.km:type_name -> model.Kilometer + 12, // 20: model.Responder.turnoutPort:type_name -> model.DevicePort + 13, // 21: model.Slope.kms:type_name -> model.Kilometer + 13, // 22: model.SectionalCurvature.kms:type_name -> model.Kilometer + 0, // 23: model.DevicePort.deviceType:type_name -> model.DeviceType + 1, // 24: model.DevicePort.port:type_name -> model.Port + 2, // 25: model.Kilometer.direction:type_name -> model.Direction + 13, // 26: model.KilometerConvert.kmA:type_name -> model.Kilometer + 13, // 27: model.KilometerConvert.kmB:type_name -> model.Kilometer + 28, // [28:28] is the sub-list for method output_type + 28, // [28:28] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_model_proto_init() } @@ -1089,18 +1310,6 @@ func file_model_proto_init() { } } file_model_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Responder); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_model_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Turnout); i { case 0: return &v.state @@ -1112,7 +1321,7 @@ func file_model_proto_init() { return nil } } - file_model_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_model_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Signal); i { case 0: return &v.state @@ -1124,6 +1333,18 @@ func file_model_proto_init() { return nil } } + file_model_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Responder); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } file_model_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Slope); i { case 0: @@ -1137,7 +1358,7 @@ func file_model_proto_init() { } } file_model_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Curve); i { + switch v := v.(*SectionalCurvature); i { case 0: return &v.state case 1: @@ -1190,7 +1411,7 @@ func file_model_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_model_proto_rawDesc, - NumEnums: 3, + NumEnums: 4, NumMessages: 11, NumExtensions: 0, NumServices: 0, diff --git a/repository/model/turnout.go b/repository/model/turnout.go deleted file mode 100644 index 847fb28..0000000 --- a/repository/model/turnout.go +++ /dev/null @@ -1,31 +0,0 @@ -package model - -import "joylink.club/rtsssimulation/repository/model/proto" - -type Turnout struct { - Identity - - km proto.Kilometer - - // A/B/C端口关联的设备端口 - aDevicePort DevicePort - bDevicePort DevicePort - cDevicePort DevicePort - - // A/B/C端口关联的检测点 - aCheckPoint CheckPoint - bCheckPoint CheckPoint - cCheckPoint CheckPoint - - // A/B/C方向关联的设备 - aDevices []Identity - bDevices []Identity - cDevices []Identity -} - -type TurnoutPort struct { - DevicePort - - turnout *Turnout - port proto.Port -} diff --git a/repository/physical_section.go b/repository/physical_section.go new file mode 100644 index 0000000..4c607d7 --- /dev/null +++ b/repository/physical_section.go @@ -0,0 +1,139 @@ +package repository + +import ( + "errors" + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" +) + +// 物理区段 +type PhysicalSection struct { + Identity + + len int32 //长度 mm + checkPoints []*CheckPoint //将此区段分隔出来的所有(非区段边界)检测点 + + // A/B端关联的设备端口(非道岔物理区段/道岔) + aRelation DevicePort + bRelation DevicePort + + // 非道岔物理区段A/B端区段边界的公里标 + aKm *proto.Kilometer + bKm *proto.Kilometer + + turnouts []*Turnout //道岔物理区段关联的道岔 + + // 关联的设备(目前有信号机、应答器、(非区段边界)检测点) + devices []Identity +} + +func NewPhysicalSection(id string) *PhysicalSection { + return &PhysicalSection{ + Identity: identity{id, proto.DeviceType_DeviceType_PhysicalSection}, + } +} + +func (s *PhysicalSection) PortNum() int { + return 2 +} + +func (s *PhysicalSection) bindDevicePort(port proto.Port, devicePort DevicePort) error { + _, isSectionPort := devicePort.(*PhysicalSectionPort) + _, isTurnoutPort := devicePort.(*TurnoutPort) + if !isSectionPort && !isTurnoutPort { + return errors.New(fmt.Sprintf("物理区段不能与[%s]类型的设备端口关联", devicePort.Device().Type())) + } + switch port { + case proto.Port_A: + s.aRelation = devicePort + case proto.Port_B: + s.bRelation = devicePort + default: + return errors.New(fmt.Sprintf("物理区段无端口[%s]", port)) + } + return nil +} + +// 绑定区段边界公里标。(仅限非道岔物理区段调用) +func (s *PhysicalSection) bindBoundaryKm(km *proto.Kilometer, port proto.Port) error { + switch port { + case proto.Port_A: + s.aKm = km + case proto.Port_B: + s.bKm = km + default: + return errors.New(fmt.Sprintf("区段无端口[%s]", port)) + } + return nil +} + +// 道岔物理区段绑定道岔 +func (s *PhysicalSection) bindTurnouts(turnouts ...*Turnout) { + for _, turnout := range turnouts { + s.turnouts = append(s.turnouts, turnout) + for _, cp := range turnout.checkPoints() { + s.bindDevices(cp) + } + } +} + +func (s *PhysicalSection) bindDevices(devices ...Identity) { + for _, device := range devices { + s.devices = append(s.devices, device) + cp, ok := device.(*CheckPoint) + if ok { + s.checkPoints = append(s.checkPoints, cp) + } + } +} + +func (s *PhysicalSection) ARelation() DevicePort { + return s.aRelation +} + +func (s *PhysicalSection) BRelation() DevicePort { + return s.bRelation +} + +func (s *PhysicalSection) findOtherDevicePort(port proto.Port) DevicePort { + switch port { + case proto.Port_A: + return s.bRelation + case proto.Port_B: + return s.aRelation + } + return nil +} + +func (s *PhysicalSection) findOtherBoundaryKmByPort(port proto.Port) *proto.Kilometer { + switch port { + case proto.Port_A: + return s.bKm + case proto.Port_B: + return s.aKm + } + return nil +} + +func (s *PhysicalSection) findBoundaryKmByPort(port proto.Port) *proto.Kilometer { + switch port { + case proto.Port_A: + return s.aKm + case proto.Port_B: + return s.bKm + } + return nil +} + +type PhysicalSectionPort struct { + section *PhysicalSection + port proto.Port +} + +func (p *PhysicalSectionPort) Port() proto.Port { + return p.port +} + +func (p *PhysicalSectionPort) Device() PortedDevice { + return p.section +} diff --git a/repository/repository.go b/repository/repository.go index 13a99d9..8485d63 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -1,47 +1,128 @@ package repository -import "joylink.club/rtsssimulation/repository/model" +import ( + "errors" + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" +) type Repository struct { - id string - version string - modelMap map[string]model.Identity - physicalSections []*model.PhysicalSection - checkPoints []*model.CheckPoint - turnouts []*model.Turnout - signals []*model.Signal - responders []*model.Responder - slopes []*model.Slope - curves []*model.Curve + id string + version string + physicalSectionMap map[string]*PhysicalSection + //这里不包含区段边界 + checkPointMap map[string]*CheckPoint + turnoutMap map[string]*Turnout + signalMap map[string]*Signal + responderMap map[string]*Responder + slopeMap map[string]*Slope + sectionalCurvatureMap map[string]*SectionalCurvature + + kilometerConvertMap map[string]*proto.KilometerConvert } func NewRepository(id string, version string) *Repository { return &Repository{ - id: id, - version: version, - modelMap: make(map[string]model.Identity), - physicalSections: make([]*model.PhysicalSection, 0), - turnouts: make([]*model.Turnout, 0), + id: id, + version: version, + //modelMap: make(map[string]model.Identity), + physicalSectionMap: make(map[string]*PhysicalSection), + turnoutMap: make(map[string]*Turnout), + signalMap: make(map[string]*Signal), + responderMap: make(map[string]*Responder), + slopeMap: make(map[string]*Slope), + sectionalCurvatureMap: make(map[string]*SectionalCurvature), } } -func (repo *Repository) PhysicalSectionList() []*model.PhysicalSection { - return repo.physicalSections +func (repo *Repository) getModel(deviceId string, deviceType proto.DeviceType) (Identity, error) { + switch deviceType { + case proto.DeviceType_DeviceType_PhysicalSection: + return repo.physicalSectionMap[deviceId], nil + case proto.DeviceType_DeviceType_CheckPoint: + return repo.checkPointMap[deviceId], nil + case proto.DeviceType_DeviceType_Turnout: + return repo.turnoutMap[deviceId], nil + case proto.DeviceType_DeviceType_Signal: + return repo.signalMap[deviceId], nil + case proto.DeviceType_DeviceType_Responder: + return repo.responderMap[deviceId], nil + case proto.DeviceType_DeviceType_Slope: + return repo.slopeMap[deviceId], nil + case proto.DeviceType_DeviceType_SectionalCurvature: + return repo.sectionalCurvatureMap[deviceId], nil + default: + return nil, errors.New(fmt.Sprintf("仓库中不存在[%s]类型的模型", deviceType)) + } } -func (repo *Repository) TurnoutList() []*model.Turnout { - return repo.turnouts +func (repo *Repository) PhysicalSectionList() []*PhysicalSection { + list := make([]*PhysicalSection, len(repo.physicalSectionMap)) + for _, m := range repo.physicalSectionMap { + list = append(list, m) + } + return list } -func (repo *Repository) AddPhysicalSection(section *model.PhysicalSection) { - repo.physicalSections = append(repo.physicalSections, section) - repo.modelMap[section.Id()] = section +func (repo *Repository) TurnoutList() []*Turnout { + list := make([]*Turnout, len(repo.turnoutMap)) + for _, m := range repo.turnoutMap { + list = append(list, m) + } + return list } -// func (r Repository) GetById(id string) (*model.Turnout, error) { +func (repo *Repository) SignalList() []*Signal { + list := make([]*Signal, len(repo.signalMap)) + for _, m := range repo.signalMap { + list = append(list, m) + } + return list +} -// } +func (repo *Repository) ResponderList() []*Responder { + list := make([]*Responder, len(repo.responderMap)) + for _, m := range repo.responderMap { + list = append(list, m) + } + return list +} -// func GetById[T any](r *Repository) (*T, error) { +func (repo *Repository) SlopeList() []*Slope { + list := make([]*Slope, len(repo.slopeMap)) + for _, m := range repo.slopeMap { + list = append(list, m) + } + return list +} -// } +func (repo *Repository) SectionalCurvatureList() []*SectionalCurvature { + list := make([]*SectionalCurvature, len(repo.sectionalCurvatureMap)) + for _, m := range repo.sectionalCurvatureMap { + list = append(list, m) + } + return list +} + +func (repo *Repository) AddPhysicalSection(section *PhysicalSection) { + repo.physicalSectionMap[section.Id()] = section + //repo.modelMap[section.Id()] = section + +} + +func buildKilometerConvertKey(cs1 string, cs2 string, dir1 proto.Direction, dir2 proto.Direction) string { + return cs1 + dir1.String() + cs2 + dir2.String() +} + +func (repo *Repository) addKilometerConvert(kc *proto.KilometerConvert) { + repo.kilometerConvertMap[buildKilometerConvertKey(kc.KmA.CoordinateSystem, kc.KmB.CoordinateSystem, kc.KmA.Direction, kc.KmB.Direction)] = kc + repo.kilometerConvertMap[buildKilometerConvertKey(kc.KmB.CoordinateSystem, kc.KmA.CoordinateSystem, kc.KmB.Direction, kc.KmA.Direction)] = kc +} + +func (repo *Repository) getKilometerConvert(cs1, cs2 string, dir1, dir2 proto.Direction) (*proto.KilometerConvert, error) { + convert := repo.kilometerConvertMap[buildKilometerConvertKey(cs1, cs2, dir1, dir2)] + if convert == nil { + return nil, errors.New(fmt.Sprintf("没有[%s-%s]的公里标转换数据", cs1, cs2)) + } + return convert, nil +} diff --git a/repository/repository_builder.go b/repository/repository_builder.go new file mode 100644 index 0000000..bf468f1 --- /dev/null +++ b/repository/repository_builder.go @@ -0,0 +1,311 @@ +package repository + +import ( + "errors" + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" +) + +var repositoryMap = make(map[string]*Repository) + +func BuildRepository(source *proto.Repository) (*Repository, error) { + repository := NewRepository(source.Id, source.Version) + buildModels(source, repository) + err := buildModelRelationship(source, repository) + if err == nil { + repositoryMap[buildRepositoryKey(source.Id, source.Version)] = repository + } + return repository, err +} + +func buildRepositoryKey(id string, version string) string { + return id + "_" + version +} + +func getRepository(id string, version string) (*Repository, error) { + repository := repositoryMap[buildRepositoryKey(id, version)] + if repository == nil { + return repository, errors.New(fmt.Sprintf("%s-%s的仓库未找到", id, version)) + } + return repository, nil +} + +func buildModels(source *proto.Repository, repository *Repository) { + for _, protoData := range source.KilometerConverts { + repository.addKilometerConvert(protoData) + } + for _, protoData := range source.PhysicalSections { + m := NewPhysicalSection(protoData.Id) + repository.physicalSectionMap[m.Id()] = m + } + for _, protoData := range source.CheckPoints { + if protoData.Type != proto.CheckPointType_Boundary { + m := NewCheckPoint(protoData.Id, protoData.Km, protoData.Type) + repository.checkPointMap[m.Id()] = m + } + } + for _, protoData := range source.Turnouts { + m := NewTurnout(protoData.Id, protoData.Km) + repository.turnoutMap[m.Id()] = m + } + for _, protoData := range source.Signals { + m := NewSignal(protoData.Id, protoData.Km) + repository.signalMap[m.Id()] = m + } + for _, protoData := range source.Responders { + m := NewResponder(protoData.Id, protoData.Km) + repository.responderMap[m.Id()] = m + } + for _, protoData := range source.Slopes { + m := NewSlope(protoData.Id, protoData.Kms, protoData.Degree) + repository.slopeMap[m.Id()] = m + } + for _, protoData := range source.SectionalCurvatures { + m := NewSectionalCurvature(protoData.Id, protoData.Kms, protoData.Radius) + repository.sectionalCurvatureMap[m.Id()] = m + } +} + +func buildModelRelationship(source *proto.Repository, repository *Repository) error { + err := buildCheckPointRelationShip(source, repository) + if err != nil { + return err + } + err = buildPhysicalSectionRelationShip(source, repository) + if err != nil { + return err + } + err = buildTurnoutRelationShip(source, repository) + if err != nil { + return err + } + err = buildSignalRelationShip(source, repository) + if err != nil { + return err + } + err = buildResponderRelationShip(source, repository) + if err != nil { + return err + } + return err +} + +func buildCheckPointRelationShip(source *proto.Repository, repo *Repository) error { + for _, protoData := range source.CheckPoints { + cp := repo.checkPointMap[protoData.Id] + isBoundary := cp.pointType == proto.CheckPointType_Boundary + for _, protoDp := range protoData.DevicePorts { + switch protoDp.DeviceType { + case proto.DeviceType_DeviceType_PhysicalSection: + section := repo.physicalSectionMap[protoDp.DeviceId] + if isBoundary { //是区段边界 + err := section.bindBoundaryKm(cp.km, protoDp.Port) + if err != nil { + return err + } + } else { + //检测点关联区段端口 + cp.bindDevicePort(&PhysicalSectionPort{ + section: section, + port: protoDp.Port, + }) + //区段关联检测点 + section.bindDevices(cp) + } + case proto.DeviceType_DeviceType_Turnout: + turnout := repo.turnoutMap[protoDp.DeviceId] + if isBoundary { //是区段边界 + err := turnout.bindBoundaryKm(cp.km, protoDp.Port) + if err != nil { + return err + } + } else { + //检测点关联道岔端口 + cp.bindDevicePort(&TurnoutPort{ + turnout: turnout, + port: protoDp.Port, + }) + //道岔关联检测点 + turnout.bindDevice(cp, protoDp.Port) + } + } + } + } + return nil +} + +func buildResponderRelationShip(source *proto.Repository, repository *Repository) error { + for _, protoData := range source.Responders { + responder := repository.responderMap[protoData.Id] + //应答器和区段相互关联 + interrelateResponderAndPhysicalSection(responder, repository.physicalSectionMap[protoData.SectionId]) + //应答器和道岔相互关联 + tp := protoData.TurnoutPort + if tp != nil { + if tp.DeviceType != proto.DeviceType_DeviceType_Turnout { + return errors.New(fmt.Sprintf("应答器[%s]关联的[%s-%s-%s]并非道岔端口", + responder.Id(), tp.DeviceId, tp.DeviceType, tp.Port)) + } + interrelateResponderAndTurnout(responder, repository.turnoutMap[tp.DeviceId], tp.Port) + } + } + return nil +} + +func buildSignalRelationShip(source *proto.Repository, repository *Repository) error { + for _, protoData := range source.Signals { + signal := repository.signalMap[protoData.Id] + //信号机和区段相互关联 + interrelateSignalAndPhysicalSection(signal, repository.physicalSectionMap[protoData.SectionId]) + //信号机和道岔相互关联 + tp := protoData.TurnoutPort + if tp != nil { + if tp.DeviceType != proto.DeviceType_DeviceType_Turnout { + return errors.New(fmt.Sprintf("信号机[%s]关联的[%s-%s-%s]并非道岔端口", + signal.Id(), tp.DeviceId, tp.DeviceType, tp.Port)) + } + interrelateSignalAndTurnout(signal, repository.turnoutMap[tp.DeviceId], tp.Port) + } + } + return nil +} + +func buildTurnoutRelationShip(source *proto.Repository, repo *Repository) error { + for _, protoData := range source.Turnouts { + turnout := repo.turnoutMap[protoData.Id] + err := buildTurnoutPortRelation(repo, turnout, proto.Port_A, protoData.ADevicePort) + if err != nil { + return err + } + err = buildTurnoutPortRelation(repo, turnout, proto.Port_B, protoData.BDevicePort) + if err != nil { + return err + } + err = buildTurnoutPortRelation(repo, turnout, proto.Port_C, protoData.CDevicePort) + return err + } + return nil +} + +func buildTurnoutPortRelation(repo *Repository, turnout *Turnout, port proto.Port, protoDp *proto.DevicePort) error { + model, err := repo.getModel(protoDp.DeviceId, protoDp.DeviceType) + if err != nil { + return err + } + dp, err := buildDevicePort(model, protoDp.Port) + if err != nil { + return err + } + err = turnout.bindDevicePort(port, dp) + return err +} + +func buildPhysicalSectionRelationShip(source *proto.Repository, repository *Repository) error { + for _, protoData := range source.PhysicalSections { + section := repository.physicalSectionMap[protoData.Id] + //A端关联 + if protoData.ADevicePort != nil { + err := buildSectionPortRelation(repository, section, proto.Port_A, protoData.ADevicePort) + if err != nil { + return err + } + } + //B端关联 + if protoData.BDevicePort != nil { + err := buildSectionPortRelation(repository, section, proto.Port_B, protoData.BDevicePort) + if err != nil { + return err + } + } + } + return nil +} + +// 构建物理区段指定端口的关联关系。区段{section}的{port}端口关联{protoDp} +func buildSectionPortRelation(repo *Repository, section *PhysicalSection, port proto.Port, protoDp *proto.DevicePort) error { + model, err := repo.getModel(protoDp.DeviceId, protoDp.DeviceType) + if err != nil { + return err + } + dp, err := buildDevicePort(model, protoDp.Port) + if err != nil { + return err + } + err = section.bindDevicePort(port, dp) + if err != nil { + return err + } + return nil +} + +func buildDevicePort(device Identity, port proto.Port) (DevicePort, error) { + var dp DevicePort + switch device.Type() { + case proto.DeviceType_DeviceType_PhysicalSection: + section := device.(*PhysicalSection) + dp = &PhysicalSectionPort{ + section: section, + port: port, + } + case proto.DeviceType_DeviceType_Turnout: + turnout := device.(*Turnout) + dp = &TurnoutPort{ + turnout: turnout, + port: port, + } + case proto.DeviceType_DeviceType_Link: + link := device.(*Link) + dp = &LinkPort{ + link: link, + port: port, + } + case proto.DeviceType_DeviceType_LinkNode: + linkNode := device.(*LinkNode) + dp = &LinkNodePort{ + node: linkNode, + port: port, + } + default: + return nil, errors.New(fmt.Sprintf("[%s]类型设备没有端口", device.Type())) + } + return dp, nil +} + +// 相互关联道岔和检测点 +func interrelateTurnoutAndCheckPoints(turnout *Turnout, point *CheckPoint, port proto.Port) { + turnout.bindDevice(point, port) + point.bindDevicePort(&TurnoutPort{ + turnout: turnout, + port: port, + }) +} + +// 相互关联物理区段和信号机 +func interrelateSignalAndPhysicalSection(signal *Signal, section *PhysicalSection) { + section.bindDevices(signal) + signal.bindSection(section) +} + +// 相互关联信号机和道岔 +func interrelateSignalAndTurnout(signal *Signal, turnout *Turnout, port proto.Port) { + signal.bindTurnoutPort(TurnoutPort{ + turnout: turnout, + port: port, + }) + turnout.bindDevice(signal, port) +} + +// 相互关联应答器和物理区段 +func interrelateResponderAndPhysicalSection(responder *Responder, section *PhysicalSection) { + responder.bindSection(section) + section.bindDevices(responder) +} + +// 相互关联应答器和道岔 +func interrelateResponderAndTurnout(responder *Responder, turnout *Turnout, port proto.Port) { + responder.bindTurnoutPort(TurnoutPort{ + turnout: turnout, + port: port, + }) + turnout.bindDevice(responder, port) +} diff --git a/repository/responder.go b/repository/responder.go new file mode 100644 index 0000000..9052bbe --- /dev/null +++ b/repository/responder.go @@ -0,0 +1,26 @@ +package repository + +import "joylink.club/rtsssimulation/repository/model/proto" + +type Responder struct { + Identity + + km *proto.Kilometer + section *PhysicalSection + turnoutPort TurnoutPort +} + +func NewResponder(id string, km *proto.Kilometer) *Responder { + return &Responder{ + Identity: identity{id, proto.DeviceType_DeviceType_Responder}, + km: km, + } +} + +func (r *Responder) bindSection(section *PhysicalSection) { + r.section = section +} + +func (r *Responder) bindTurnoutPort(turnoutPort TurnoutPort) { + r.turnoutPort = turnoutPort +} diff --git a/repository/sectional_curvature.go b/repository/sectional_curvature.go new file mode 100644 index 0000000..9a747ff --- /dev/null +++ b/repository/sectional_curvature.go @@ -0,0 +1,17 @@ +package repository + +import "joylink.club/rtsssimulation/repository/model/proto" + +type SectionalCurvature struct { + Identity + kms []*proto.Kilometer + radius int32 //半径 mm +} + +func NewSectionalCurvature(id string, kms []*proto.Kilometer, radius int32) *SectionalCurvature { + return &SectionalCurvature{ + Identity: identity{id, proto.DeviceType_DeviceType_SectionalCurvature}, + kms: kms, + radius: radius, + } +} diff --git a/repository/signal.go b/repository/signal.go new file mode 100644 index 0000000..6fa9df4 --- /dev/null +++ b/repository/signal.go @@ -0,0 +1,26 @@ +package repository + +import "joylink.club/rtsssimulation/repository/model/proto" + +type Signal struct { + Identity + + km *proto.Kilometer + section *PhysicalSection + turnoutPort TurnoutPort +} + +func NewSignal(id string, km *proto.Kilometer) *Signal { + return &Signal{ + Identity: identity{id, proto.DeviceType_DeviceType_Signal}, + km: km, + } +} + +func (s *Signal) bindSection(section *PhysicalSection) { + s.section = section +} + +func (s *Signal) bindTurnoutPort(tp TurnoutPort) { + s.turnoutPort = tp +} diff --git a/repository/simulation.go b/repository/simulation.go new file mode 100644 index 0000000..e49db6a --- /dev/null +++ b/repository/simulation.go @@ -0,0 +1,339 @@ +package repository + +import ( + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" + "math" + "strconv" +) + +var simId = 1 + +func BuildSimulation(id string, version string) (*Simulation, error) { + repository, err := getRepository(id, version) + if err != nil { + return nil, err + } + simulation := newSimulation(repository) + //构建link + err = buildLinks(simulation) + if err != nil { + return nil, err + } + //构建Slope的Link区间 + err = buildSlopeLinkSegments(simulation) + if err != nil { + return nil, err + } + //构建SectionalCurvature的Link区间 + err = buildSectionalCurvatureLinkSegments(simulation) + if err != nil { + return nil, err + } + return simulation, nil +} + +func getASimulationId() string { + id := strconv.Itoa(simId) + simId++ + return id +} + +type Simulation struct { + id string + idGenerator int + repository *Repository + linkMap map[string]*Link + devicePositionMap map[string]*DeviceLinkPosition //key为device的id + linkNodeMap map[string]*LinkNode //LinkNode的id应该没什么意义,所以此处key用LinkNode中Turnout的id + slopeLinkSegmentMap map[string]SlopeLinkSegment + sectionalCurvatureLinkSegmentMap map[string]SectionalCurvatureLinkSegment +} + +func newSimulation(repository *Repository) *Simulation { + return &Simulation{ + id: getASimulationId(), + idGenerator: 1, + repository: repository, + linkMap: make(map[string]*Link), + devicePositionMap: make(map[string]*DeviceLinkPosition), + linkNodeMap: make(map[string]*LinkNode), + slopeLinkSegmentMap: make(map[string]SlopeLinkSegment), + sectionalCurvatureLinkSegmentMap: make(map[string]SectionalCurvatureLinkSegment), + } +} + +func (s *Simulation) getAId() string { + id := strconv.Itoa(s.idGenerator) + s.idGenerator++ + return id +} + +func buildLinks(sim *Simulation) error { + visitedTurnoutPortMap := make(map[string]bool) + allTurnouts := sim.repository.TurnoutList() + for { + //找一个未遍历过的道岔端口 + startTp := getATurnoutPort(allTurnouts, visitedTurnoutPortMap) + if startTp == nil { + break + } + //以始端道岔的公里标作为公里标换算的基准 + baseKm := startTp.turnout.km + //创建基础Link + link := &Link{Identity: identity{sim.getAId(), proto.DeviceType_DeviceType_Link}} + //以此道岔端口作为Link的A端节点 + err := buildAndRelateLinkNode(sim, startTp, link, proto.Port_A) + if err != nil { + return err + } + //沿着道岔端口方向,一直寻找到轨道尽头或者下一个道岔端口。构建并关联中间的设备在link上的位置 + endTp, endKm, err := findEndTurnoutPortOrEndKm(sim, link, startTp, baseKm) + if err != nil { + return err + } + //以下一个道岔端口作为Link的B端节点 + if endTp != nil { + visitedTurnoutPortMap[buildTurnoutPortKey(endTp)] = true + endKm = endTp.turnout.km + err = buildAndRelateLinkNode(sim, endTp, link, proto.Port_B) + if err != nil { + return err + } + } + //计算Link长度 + convertedKm, err := convertKilometer(sim.repository, endKm, baseKm.CoordinateSystem, baseKm.Direction) + if err != nil { + return err + } + link.length = int64(math.Abs(float64(convertedKm.Value - baseKm.Value))) + + sim.linkMap[link.Id()] = link + } + return nil +} + +func findEndTurnoutPortOrEndKm(sim *Simulation, link *Link, startTp *TurnoutPort, + baseKm *proto.Kilometer) (*TurnoutPort, *proto.Kilometer, error) { + + var endTp *TurnoutPort + var endKm *proto.Kilometer + var err error + + visitedModelMap := make(map[string]bool) + var currentDp DevicePort = startTp + devices := startTp.turnout.getDevicesByPort(startTp.port) + for { + //遍历设备并构建、关联其在Link上的位置 + err = buildAndRelateDeviceLinkPositions(sim, link, baseKm, visitedModelMap, devices...) + if err != nil { + return nil, nil, err + } + //顺着端口寻找下一个设备端口 + var nextDp DevicePort + switch currentDp.Device().Type() { + case proto.DeviceType_DeviceType_PhysicalSection: + section := currentDp.Device().(*PhysicalSection) + nextDp = section.findOtherDevicePort(currentDp.Port()) + if nextDp == nil { + endKm = section.findOtherBoundaryKmByPort(currentDp.Port()) + } + case proto.DeviceType_DeviceType_Turnout: + turnout := currentDp.Device().(*Turnout) + nextDp = turnout.getDevicePortByPort(currentDp.Port()) + if nextDp == nil { + endKm = turnout.findBoundaryKmByPort(currentDp.Port()) + } + } + //根据下一个端口设备的信息决定是否结束循环 + if nextDp == nil { + break + } + currentDp = nextDp + var nextIsTp bool + switch nextDp.Device().Type() { + case proto.DeviceType_DeviceType_PhysicalSection: + devices = nextDp.Device().(*PhysicalSection).devices + case proto.DeviceType_DeviceType_Turnout: + nextIsTp = true + endTp = nextDp.(*TurnoutPort) + devices = nextDp.Device().(*Turnout).getDevicesByPort(nextDp.Port()) + err = buildAndRelateDeviceLinkPositions(sim, link, baseKm, visitedModelMap, devices...) + if err != nil { + return nil, nil, err + } + } + if nextIsTp { + break + } + } + + return endTp, endKm, err +} + +func getATurnoutPort(turnouts []*Turnout, visitedTurnoutMap map[string]bool) *TurnoutPort { + portSlice := []proto.Port{proto.Port_A, proto.Port_B, proto.Port_C} + for _, turnout := range turnouts { + for _, port := range portSlice { + tp := &TurnoutPort{ + turnout: turnout, + port: port, + } + key := buildTurnoutPortKey(tp) + if !visitedTurnoutMap[key] { + visitedTurnoutMap[key] = true + return tp + } + } + } + return nil +} + +func buildTurnoutPortKey(tp *TurnoutPort) string { + return fmt.Sprintf("%v-%s", tp.turnout, tp.port) +} + +func buildAndRelateDeviceLinkPositions(sim *Simulation, link *Link, startKm *proto.Kilometer, visitedModelMap map[string]bool, devices ...Identity) error { + + for _, device := range devices { + if visitedModelMap[device.Id()] { + continue + } + km := findModelKm(device) + if km == nil { + continue + } + convertedKm, err := convertKilometer(sim.repository, km, startKm.CoordinateSystem, startKm.Direction) + if err != nil { + return err + } + offset := int64(math.Abs(float64(convertedKm.Value - startKm.Value))) + dlps := &DeviceLinkPosition{ + device: device, + position: LinkPosition{ + link: link, + offset: offset, + }, + } + sim.devicePositionMap[dlps.device.Id()] = dlps + link.bindDevicesLinkPositions(dlps) + } + return nil +} + +func buildAndRelateLinkNode(sim *Simulation, tp *TurnoutPort, link *Link, port proto.Port) error { + ln := sim.linkNodeMap[tp.turnout.Id()] + if ln == nil { + ln = &LinkNode{ + Identity: identity{sim.getAId(), proto.DeviceType_DeviceType_LinkNode}, + turnout: tp.turnout, + } + } + //LinkNode关联Link + err := ln.bindDevicePort(port, &LinkPort{ + link: link, + port: port, + }) + if err != nil { + return err + } + //Link关联LinkNode + err = link.bindDevicePort(port, &LinkNodePort{ + node: ln, + port: tp.port, + }) + return err +} + +func findModelKm(model Identity) *proto.Kilometer { + signal, ok := model.(*Signal) + if ok { + return signal.km + } + responder, ok := model.(*Responder) + if ok { + return responder.km + } + cp, ok := model.(*CheckPoint) + if ok { + return cp.km + } + turnout, ok := model.(*Turnout) + if ok { + return turnout.km + } + return nil +} + +func buildSlopeLinkSegments(simulation *Simulation) error { + repo := simulation.repository + slopeMap := repo.slopeMap + for _, slope := range slopeMap { + start, end, err := calculateLinkSegment(simulation, slope.kms[0], slope.kms[1]) + if err != nil { + return err + } + simulation.slopeLinkSegmentMap[slope.Id()] = SlopeLinkSegment{ + slope: slope, + start: start, + end: end, + } + } + return nil +} + +func calculateLinkSegment(simulation *Simulation, aKm *proto.Kilometer, + bKm *proto.Kilometer) (LinkPosition, LinkPosition, error) { + + repo := simulation.repository + bKm, err := convertKilometer(repo, bKm, aKm.CoordinateSystem, aKm.Direction) + if err != nil { + return LinkPosition{}, LinkPosition{}, err + } + var start LinkPosition + var end LinkPosition + for _, link := range simulation.linkMap { + aTKm := link.aRelation.node.turnout.km + aTKm, err := convertKilometer(repo, aTKm, aKm.CoordinateSystem, aKm.Direction) + if err != nil { + continue + } + bTKm := link.bRelation.node.turnout.km + bTKm, err = convertKilometer(repo, bTKm, aKm.CoordinateSystem, aKm.Direction) + if err != nil { + continue + } + if aTKm.Value >= aTKm.Value && aTKm.Value <= bTKm.Value { + start = LinkPosition{ + link: link, + offset: aTKm.Value - aTKm.Value, + } + } + if bKm.Value >= aTKm.Value && bKm.Value <= bTKm.Value { + end = LinkPosition{ + link: link, + offset: bKm.Value - aTKm.Value, + } + } + if start.link != nil && end.link != link { + break + } + } + return start, end, nil +} + +func buildSectionalCurvatureLinkSegments(sim *Simulation) error { + repo := sim.repository + for _, curvature := range repo.sectionalCurvatureMap { + start, end, err := calculateLinkSegment(sim, curvature.kms[0], curvature.kms[1]) + if err != nil { + return err + } + sim.sectionalCurvatureLinkSegmentMap[curvature.Id()] = SectionalCurvatureLinkSegment{ + sectionalCurvature: curvature, + start: start, + end: end, + } + } + return nil +} diff --git a/repository/slope.go b/repository/slope.go new file mode 100644 index 0000000..3138e7b --- /dev/null +++ b/repository/slope.go @@ -0,0 +1,18 @@ +package repository + +import "joylink.club/rtsssimulation/repository/model/proto" + +type Slope struct { + Identity + + kms []*proto.Kilometer + degree int32 +} + +func NewSlope(id string, kms []*proto.Kilometer, degree int32) *Slope { + return &Slope{ + Identity: identity{id, proto.DeviceType_DeviceType_Slope}, + kms: kms, + degree: degree, + } +} diff --git a/repository/turnout.go b/repository/turnout.go new file mode 100644 index 0000000..1456a7c --- /dev/null +++ b/repository/turnout.go @@ -0,0 +1,165 @@ +package repository + +import ( + "errors" + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" +) + +type Turnout struct { + Identity + + // 岔心的公里标 + km *proto.Kilometer + + // 道岔关联的道岔物理区段 + section *PhysicalSection + + // A/B/C端口关联的设备端口 + aDevicePort DevicePort + bDevicePort DevicePort + cDevicePort DevicePort + + // A/B/C端口的区段边界的公里标 + aKm *proto.Kilometer + bKm *proto.Kilometer + cKm *proto.Kilometer + + // A/B/C方向关联的设备(目前有信号机、应答器、(非区段边界)检测点) + aDevices []Identity + bDevices []Identity + cDevices []Identity +} + +func NewTurnout(id string, km *proto.Kilometer) *Turnout { + return &Turnout{ + Identity: identity{id, proto.DeviceType_DeviceType_Turnout}, + km: km, + } +} + +func (t *Turnout) PortNum() int { + return 3 +} + +func (t *Turnout) bindPhysicalSection(section *PhysicalSection) { + t.section = section +} + +func (t *Turnout) bindDevicePort(port proto.Port, devicePort DevicePort) error { + _, isSectionPort := devicePort.(*PhysicalSectionPort) + _, isTurnoutPort := devicePort.(*TurnoutPort) + if !isSectionPort && !isTurnoutPort { + return errors.New(fmt.Sprintf("道岔不能与[%s]类型的设备端口关联", devicePort.Device().Type())) + } + switch port { + case proto.Port_A: + t.aDevicePort = devicePort + case proto.Port_B: + t.bDevicePort = devicePort + case proto.Port_C: + t.cDevicePort = devicePort + default: + return errors.New(fmt.Sprintf("道岔无端口[%s]", port)) + } + return nil +} + +func (t *Turnout) bindBoundaryKm(km *proto.Kilometer, port proto.Port) error { + switch port { + case proto.Port_A: + t.aKm = km + case proto.Port_B: + t.bKm = km + case proto.Port_C: + t.cKm = km + default: + return errors.New(fmt.Sprintf("道岔无端口[%s]", port)) + } + return nil +} + +func (t *Turnout) bindDevice(device Identity, port proto.Port) { + switch port { + case proto.Port_A: + t.aDevices = append(t.aDevices, device) + case proto.Port_B: + t.bDevices = append(t.bDevices, device) + case proto.Port_C: + t.cDevices = append(t.cDevices, device) + } +} + +func (t *Turnout) checkPoints() []*CheckPoint { + var cps []*CheckPoint + for _, device := range t.aDevices { + cp, ok := device.(*CheckPoint) + if ok { + cps = append(cps, cp) + } + } + for _, device := range t.bDevices { + cp, ok := device.(*CheckPoint) + if ok { + cps = append(cps, cp) + } + } + for _, device := range t.cDevices { + cp, ok := device.(*CheckPoint) + if ok { + cps = append(cps, cp) + } + } + return cps +} + +// 获取指定端口连接的设备端口 +func (t *Turnout) getDevicePortByPort(port proto.Port) DevicePort { + switch port { + case proto.Port_A: + return t.aDevicePort + case proto.Port_B: + return t.bDevicePort + case proto.Port_C: + return t.cDevicePort + default: + return nil + } +} + +func (t *Turnout) findBoundaryKmByPort(port proto.Port) *proto.Kilometer { + switch port { + case proto.Port_A: + return t.aKm + case proto.Port_B: + return t.bKm + case proto.Port_C: + return t.cKm + } + return nil +} + +func (t *Turnout) getDevicesByPort(port proto.Port) []Identity { + switch port { + case proto.Port_A: + return t.aDevices + case proto.Port_B: + return t.bDevices + case proto.Port_C: + return t.cDevices + } + return nil +} + +type TurnoutPort struct { + turnout *Turnout + port proto.Port +} + +func (t *TurnoutPort) Port() proto.Port { + return t.port +} + +func (t *TurnoutPort) Device() PortedDevice { + return t.turnout +}