增加动力学通信与仿真的交互

This commit is contained in:
joylink_zhangsai 2023-08-02 15:47:48 +08:00
parent d04df7f731
commit 4e07b17e6c
12 changed files with 391 additions and 212 deletions

View File

@ -1638,10 +1638,11 @@ type Transponder struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
TransponderType int32 `protobuf:"varint,3,opt,name=transponderType,proto3" json:"transponderType,omitempty"` TransponderType int32 `protobuf:"varint,3,opt,name=transponderType,proto3" json:"transponderType,omitempty"`
Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` // 索引编号 Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` // 索引编号
KilometerSystem *KilometerSystem `protobuf:"bytes,5,opt,name=kilometerSystem,proto3" json:"kilometerSystem,omitempty"` //公里标
} }
func (x *Transponder) Reset() { func (x *Transponder) Reset() {
@ -1704,6 +1705,13 @@ func (x *Transponder) GetIndex() int32 {
return 0 return 0
} }
func (x *Transponder) GetKilometerSystem() *KilometerSystem {
if x != nil {
return x.KilometerSystem
}
return nil
}
type SimpleRef struct { type SimpleRef struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -2057,11 +2065,12 @@ type StopPosition struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,omitempty"` // 是否翻转(前端显示) Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,omitempty"` // 是否翻转(前端显示)
CoachNum StopPosition_CoachNum `protobuf:"varint,4,opt,name=coachNum,proto3,enum=graphicData.StopPosition_CoachNum" json:"coachNum,omitempty"` //编组数量 CoachNum StopPosition_CoachNum `protobuf:"varint,4,opt,name=coachNum,proto3,enum=graphicData.StopPosition_CoachNum" json:"coachNum,omitempty"` //编组数量
Index int32 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"` //索引 Index int32 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"` //索引
KilometerSystem *KilometerSystem `protobuf:"bytes,6,opt,name=kilometerSystem,proto3" json:"kilometerSystem,omitempty"`
} }
func (x *StopPosition) Reset() { func (x *StopPosition) Reset() {
@ -2131,15 +2140,24 @@ func (x *StopPosition) GetIndex() int32 {
return 0 return 0
} }
func (x *StopPosition) GetKilometerSystem() *KilometerSystem {
if x != nil {
return x.KilometerSystem
}
return nil
}
type SpksSwitch struct { type SpksSwitch struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,omitempty"` // 是否翻转(前端显示) Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,omitempty"` // 是否翻转(前端显示)
Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` //索引 Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` //索引
RefStand int32 `protobuf:"varint,5,opt,name=refStand,proto3" json:"refStand,omitempty"` //关联站台索引
RefSections []string `protobuf:"bytes,6,rep,name=refSections,proto3" json:"refSections,omitempty"` // 关联物理区段id
} }
func (x *SpksSwitch) Reset() { func (x *SpksSwitch) Reset() {
@ -2202,15 +2220,30 @@ func (x *SpksSwitch) GetIndex() int32 {
return 0 return 0
} }
func (x *SpksSwitch) GetRefStand() int32 {
if x != nil {
return x.RefStand
}
return 0
}
func (x *SpksSwitch) GetRefSections() []string {
if x != nil {
return x.RefSections
}
return nil
}
type EsbButton struct { type EsbButton struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,omitempty"` // 是否翻转(前端显示) Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,omitempty"` // 是否翻转(前端显示)
Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` //索引 Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` //索引
RefStand int32 `protobuf:"varint,5,opt,name=refStand,proto3" json:"refStand,omitempty"` // 关联站台索引
} }
func (x *EsbButton) Reset() { func (x *EsbButton) Reset() {
@ -2273,6 +2306,13 @@ func (x *EsbButton) GetIndex() int32 {
return 0 return 0
} }
func (x *EsbButton) GetRefStand() int32 {
if x != nil {
return x.RefStand
}
return 0
}
type GatedBox struct { type GatedBox struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -2603,7 +2643,7 @@ var file_stationLayoutGraphics_proto_rawDesc = []byte{
0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x65, 0x70, 0x61, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x65, 0x70, 0x61,
0x72, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0d, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0x92, 0x0d, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0xda,
0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x2f, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x2f,
0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,
0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d,
@ -2613,93 +2653,106 @@ var file_stationLayoutGraphics_proto_rawDesc = []byte{
0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x74, 0x72, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x74, 0x72,
0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x64, 0x65, 0x78, 0x12, 0x46, 0x0a, 0x0f, 0x6b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72,
0x66, 0x12, 0x41, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67,
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d,
0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x2e, 0x44, 0x65, 0x65, 0x74, 0x65, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x0f, 0x6b, 0x69, 0x6c, 0x6f,
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x22, 0x8b, 0x01, 0x0a, 0x09,
0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, 0x41, 0x0a, 0x0a, 0x64, 0x65, 0x76,
0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e,
0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x00, 0x12, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70,
0x10, 0x0a, 0x0c, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x01, 0x22, 0xe2, 0x02, 0x0a, 0x0b, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6e, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02,
0x6b, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x0a,
0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x75,
0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x78, 0x6c, 0x65, 0x43,
0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x22, 0xe2, 0x02, 0x0a, 0x0b, 0x53, 0x65,
0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70,
0x44, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e,
0x74, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x75, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
0x75, 0x70, 0x12, 0x30, 0x0a, 0x07, 0x61, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, 0x05, 0x20, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2a,
0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12,
0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x07, 0x61, 0x53, 0x69, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x6f, 0x69,
0x6d, 0x52, 0x65, 0x66, 0x12, 0x30, 0x0a, 0x07, 0x62, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, 0x6e, 0x74, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x75, 0x70,
0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x75, 0x70, 0x12, 0x30, 0x0a, 0x07, 0x61, 0x53,
0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x07, 0x62, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72,
0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x12, 0x2b, 0x0a, 0x04, 0x61, 0x52, 0x65, 0x66, 0x18, 0x07, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x52, 0x65, 0x66, 0x52, 0x07, 0x61, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x12, 0x30, 0x0a, 0x07,
0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x04, 0x61, 0x62, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x52, 0x65, 0x66, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x52, 0x65, 0x66, 0x18, 0x08, 0x20, 0x01, 0x28, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70,
0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x07, 0x62, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x12, 0x2b,
0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x04, 0x62, 0x52, 0x65, 0x66, 0x0a, 0x04, 0x61, 0x52, 0x65, 0x66, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67,
0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74,
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xb6, 0x02, 0x0a, 0x13, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x04, 0x61, 0x52, 0x65, 0x66, 0x12, 0x2b, 0x0a, 0x04, 0x62,
0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x52, 0x65, 0x66, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70,
0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52,
0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x65, 0x66, 0x52, 0x04, 0x62, 0x52, 0x65, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65,
0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xb6,
0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x02, 0x0a, 0x13, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53,
0x6f, 0x64, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63,
0x61, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x2d, 0x0a, 0x05, 0x70, 0x61, 0x52, 0x65, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x70,
0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x05, 0x70, 0x61, 0x52, 0x65, 0x66, 0x12, 0x2d, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x72,
0x0a, 0x05, 0x70, 0x62, 0x52, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52,
0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x70, 0x61, 0x52, 0x65, 0x66,
0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x05, 0x70, 0x62, 0x52, 0x65, 0x66, 0x12, 0x3a, 0x0a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63,
0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52,
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x05, 0x70, 0x61, 0x52, 0x65, 0x66, 0x12, 0x2d, 0x0a, 0x05, 0x70, 0x62, 0x52, 0x65, 0x66, 0x18,
0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x73, 0x52, 0x65, 0x66, 0x52, 0x0a, 0x74, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44,
0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x05,
0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x70, 0x62, 0x52, 0x65, 0x66, 0x12, 0x3a, 0x0a, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74,
0xd9, 0x01, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x61, 0x70,
0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50,
0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x73, 0x52, 0x65, 0x66, 0x52, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xd9, 0x01, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69,
0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x63, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d,
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44,
0x61, 0x74, 0x61, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74,
0x73, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x78, 0x6c, 0x65, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x78, 0x6c, 0x65, 0x53, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78,
0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1c, 0x0a,
0x09, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x22, 0xdc, 0x01, 0x0a, 0x0c,
0x53, 0x74, 0x6f, 0x70, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x06,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a,
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
0x04, 0x66, 0x6c, 0x69, 0x70, 0x12, 0x3e, 0x0a, 0x08, 0x63, 0x6f, 0x61, 0x63, 0x68, 0x4e, 0x75,
0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69,
0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x61, 0x63, 0x68, 0x4e, 0x75, 0x6d, 0x52, 0x08, 0x63, 0x6f, 0x61,
0x63, 0x68, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x1d, 0x0a, 0x08, 0x43,
0x6f, 0x61, 0x63, 0x68, 0x4e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x6f, 0x75, 0x72, 0x10,
0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x69, 0x78, 0x10, 0x01, 0x22, 0x7b, 0x0a, 0x0a, 0x53, 0x70,
0x6b, 0x73, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68,
0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2a, 0x0a,
0x04, 0x66, 0x6c, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x69, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x70, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x6f, 0x69, 0x6e,
0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x7a, 0x0a, 0x09, 0x45, 0x73, 0x62, 0x42, 0x75, 0x74, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x78, 0x6c,
0x65, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0d, 0x61, 0x78, 0x6c, 0x65, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12,
0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74,
0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75,
0x74, 0x49, 0x64, 0x22, 0xa4, 0x02, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x70, 0x50, 0x6f, 0x73, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61,
0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x69,
0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x12, 0x3e, 0x0a,
0x08, 0x63, 0x6f, 0x61, 0x63, 0x68, 0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x22, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74,
0x6f, 0x70, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x61, 0x63, 0x68,
0x4e, 0x75, 0x6d, 0x52, 0x08, 0x63, 0x6f, 0x61, 0x63, 0x68, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a,
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x12, 0x46, 0x0a, 0x0f, 0x6b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72,
0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d,
0x65, 0x74, 0x65, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x0f, 0x6b, 0x69, 0x6c, 0x6f,
0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x22, 0x1d, 0x0a, 0x08, 0x43,
0x6f, 0x61, 0x63, 0x68, 0x4e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x6f, 0x75, 0x72, 0x10,
0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x69, 0x78, 0x10, 0x01, 0x22, 0xb9, 0x01, 0x0a, 0x0a, 0x53,
0x70, 0x6b, 0x73, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70,
0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e,
0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12,
0x0a, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c,
0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28,
0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x66, 0x53,
0x74, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x66, 0x53,
0x74, 0x61, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x66, 0x53, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x66, 0x53, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x96, 0x01, 0x0a, 0x09, 0x45, 0x73, 0x62, 0x42, 0x75,
0x74, 0x74, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61,
0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63,
@ -2707,21 +2760,23 @@ var file_stationLayoutGraphics_proto_rawDesc = []byte{
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x69, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x69,
0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x12, 0x14, 0x0a,
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x22, 0x79, 0x0a, 0x08, 0x47, 0x61, 0x74, 0x65, 0x64, 0x42, 0x6f, 0x78, 0x12, 0x64, 0x65, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x66, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x18,
0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x66, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x22,
0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x79, 0x0a, 0x08, 0x47, 0x61, 0x74, 0x65, 0x64, 0x42, 0x6f, 0x78, 0x12, 0x2f, 0x0a, 0x06, 0x63,
0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72,
0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x5d, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
0x0a, 0x25, 0x63, 0x6c, 0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x66, 0x6c, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20,
0x6a, 0x72, 0x74, 0x73, 0x73, 0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x5d, 0x0a, 0x25, 0x63, 0x6c,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x13, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x47, 0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x1f, 0x2e, 0x2f, 0x73, 0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f,
0x61, 0x74, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x13, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68,
0x73, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x69, 0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x1f, 0x2e, 0x2f, 0x61, 0x74, 0x73, 0x2f,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x72,
0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
} }
var ( var (
@ -2822,30 +2877,32 @@ var file_stationLayoutGraphics_proto_depIdxs = []int32{
2, // 47: graphicData.RelatedRef.devicePort:type_name -> graphicData.RelatedRef.DevicePort 2, // 47: graphicData.RelatedRef.devicePort:type_name -> graphicData.RelatedRef.DevicePort
10, // 48: graphicData.Separator.common:type_name -> graphicData.CommonInfo 10, // 48: graphicData.Separator.common:type_name -> graphicData.CommonInfo
10, // 49: graphicData.Transponder.common:type_name -> graphicData.CommonInfo 10, // 49: graphicData.Transponder.common:type_name -> graphicData.CommonInfo
3, // 50: graphicData.SimpleRef.deviceType:type_name -> graphicData.SimpleRef.DeviceType 16, // 50: graphicData.Transponder.kilometerSystem:type_name -> graphicData.KilometerSystem
10, // 51: graphicData.SectionLink.common:type_name -> graphicData.CommonInfo 3, // 51: graphicData.SimpleRef.deviceType:type_name -> graphicData.SimpleRef.DeviceType
7, // 52: graphicData.SectionLink.points:type_name -> graphicData.Point 10, // 52: graphicData.SectionLink.common:type_name -> graphicData.CommonInfo
23, // 53: graphicData.SectionLink.aSimRef:type_name -> graphicData.SimpleRef 7, // 53: graphicData.SectionLink.points:type_name -> graphicData.Point
23, // 54: graphicData.SectionLink.bSimRef:type_name -> graphicData.SimpleRef 23, // 54: graphicData.SectionLink.aSimRef:type_name -> graphicData.SimpleRef
19, // 55: graphicData.SectionLink.aRef:type_name -> graphicData.RelatedRef 23, // 55: graphicData.SectionLink.bSimRef:type_name -> graphicData.SimpleRef
19, // 56: graphicData.SectionLink.bRef:type_name -> graphicData.RelatedRef 19, // 56: graphicData.SectionLink.aRef:type_name -> graphicData.RelatedRef
10, // 57: graphicData.AxleCountingSection.common:type_name -> graphicData.CommonInfo 19, // 57: graphicData.SectionLink.bRef:type_name -> graphicData.RelatedRef
7, // 58: graphicData.AxleCountingSection.points:type_name -> graphicData.Point 10, // 58: graphicData.AxleCountingSection.common:type_name -> graphicData.CommonInfo
19, // 59: graphicData.AxleCountingSection.paRef:type_name -> graphicData.RelatedRef 7, // 59: graphicData.AxleCountingSection.points:type_name -> graphicData.Point
19, // 60: graphicData.AxleCountingSection.pbRef:type_name -> graphicData.RelatedRef 19, // 60: graphicData.AxleCountingSection.paRef:type_name -> graphicData.RelatedRef
20, // 61: graphicData.AxleCountingSection.turnoutPos:type_name -> graphicData.TurnoutPosRef 19, // 61: graphicData.AxleCountingSection.pbRef:type_name -> graphicData.RelatedRef
10, // 62: graphicData.LogicSection.common:type_name -> graphicData.CommonInfo 20, // 62: graphicData.AxleCountingSection.turnoutPos:type_name -> graphicData.TurnoutPosRef
7, // 63: graphicData.LogicSection.points:type_name -> graphicData.Point 10, // 63: graphicData.LogicSection.common:type_name -> graphicData.CommonInfo
10, // 64: graphicData.StopPosition.common:type_name -> graphicData.CommonInfo 7, // 64: graphicData.LogicSection.points:type_name -> graphicData.Point
4, // 65: graphicData.StopPosition.coachNum:type_name -> graphicData.StopPosition.CoachNum 10, // 65: graphicData.StopPosition.common:type_name -> graphicData.CommonInfo
10, // 66: graphicData.SpksSwitch.common:type_name -> graphicData.CommonInfo 4, // 66: graphicData.StopPosition.coachNum:type_name -> graphicData.StopPosition.CoachNum
10, // 67: graphicData.EsbButton.common:type_name -> graphicData.CommonInfo 16, // 67: graphicData.StopPosition.kilometerSystem:type_name -> graphicData.KilometerSystem
10, // 68: graphicData.GatedBox.common:type_name -> graphicData.CommonInfo 10, // 68: graphicData.SpksSwitch.common:type_name -> graphicData.CommonInfo
69, // [69:69] is the sub-list for method output_type 10, // 69: graphicData.EsbButton.common:type_name -> graphicData.CommonInfo
69, // [69:69] is the sub-list for method input_type 10, // 70: graphicData.GatedBox.common:type_name -> graphicData.CommonInfo
69, // [69:69] is the sub-list for extension type_name 71, // [71:71] is the sub-list for method output_type
69, // [69:69] is the sub-list for extension extendee 71, // [71:71] is the sub-list for method input_type
0, // [0:69] is the sub-list for field type_name 71, // [71:71] is the sub-list for extension type_name
71, // [71:71] is the sub-list for extension extendee
0, // [0:71] is the sub-list for field type_name
} }
func init() { file_stationLayoutGraphics_proto_init() } func init() { file_stationLayoutGraphics_proto_init() }

View File

@ -1,6 +1,9 @@
package simulation package simulation
import ( import (
"go.uber.org/zap"
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
"joylink.club/bj-rtsts-server/dynamics"
"strconv" "strconv"
"sync" "sync"
@ -8,6 +11,47 @@ import (
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
) )
func init() {
dynamics.RegisterTrainInfoHandler(func(info *dynamics.TrainInfo) {
for _, simulation := range GetSimulationArr() {
sta, ok := simulation.Memory.Status.TrainStateMap.Load(strconv.Itoa(int(info.Number)))
if ok {
memory.UpdateTrainState(simulation, convert(info, *sta.(*state.TrainState)))
break
}
}
//simulationMap.Range(func(key, value any) bool {
// simulation := value.(*memory.VerifySimulation)
// sta, ok := simulation.Memory.Status.TrainStateMap.Load(strconv.Itoa(int(info.Number)))
// if ok {
// memory.UpdateTrainState(simulation, convert(info, *sta.(*state.TrainState)))
// return false
// }
// return true
//})
})
}
func convert(info *dynamics.TrainInfo, sta state.TrainState) *state.TrainState {
sta.HeadLinkId = strconv.Itoa(int(info.Link))
sta.HeadLinkOffset = int64(info.LinkOffset * 10)
sta.Slope = int32(info.Slope)
sta.Upslope = info.UpSlope
sta.RunningUp = info.Up
sta.RunningResistanceSum = info.TotalResistance
sta.AirResistance = info.AirResistance
sta.RampResistance = info.SlopeResistance
sta.CurveResistance = info.CurveResistance
sta.Speed = info.Speed
sta.HeadSensorSpeed1 = info.HeadSpeed1
sta.HeadSensorSpeed2 = info.HeadSpeed2
sta.TailSensorSpeed1 = info.TailSpeed1
sta.TailSensorSpeed2 = info.TailSpeed2
sta.HeadRadarSpeed = info.HeadRadarSpeed
sta.TailRadarSpeed = info.TailRadarSpeed
return &sta
}
// 仿真存储集合 // 仿真存储集合
var simulationMap sync.Map var simulationMap sync.Map
@ -18,6 +62,25 @@ func CreateSimulation(mapId int32) string {
if !e { if !e {
verifySimulation := memory.CreateSimulation(mapId, simulationId) verifySimulation := memory.CreateSimulation(mapId, simulationId)
simulationMap.Store(simulationId, verifySimulation) simulationMap.Store(simulationId, verifySimulation)
//道岔状态发送
dynamics.AddTurnoutInfoFunc(simulationId, func() []*dynamics.TurnoutInfo {
stateSlice := memory.GetAllTurnoutState(verifySimulation)
var turnoutInfoSlice []*dynamics.TurnoutInfo
for _, sta := range stateSlice {
code64, err := strconv.ParseUint(sta.Id, 10, 16)
if err != nil {
zap.S().Error("id转uint16报错", err)
}
info := dynamics.TurnoutInfo{
Code: uint16(code64),
NPosition: sta.Normal,
RPosition: sta.Reverse,
}
turnoutInfoSlice = append(turnoutInfoSlice, &info)
}
return turnoutInfoSlice
})
//
} }
return simulationId return simulationId
} }
@ -25,6 +88,8 @@ func CreateSimulation(mapId int32) string {
// 删除仿真对象 // 删除仿真对象
func DestroySimulation(simulationId string) { func DestroySimulation(simulationId string) {
simulationMap.Delete(simulationId) simulationMap.Delete(simulationId)
//移除道岔状态发送
dynamics.RemoveTurnoutInfoFunc(simulationId)
} }
// 创建时生成仿真Id // 创建时生成仿真Id

View File

@ -2,6 +2,11 @@ package memory
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dynamics"
"math"
"net/http"
"strconv"
"sync" "sync"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
@ -15,6 +20,19 @@ func AddTrainState(simulation *VerifySimulation, status *state.TrainState) {
if ok { if ok {
panic(fmt.Sprintf("列车【%s】已存在", status.Id)) panic(fmt.Sprintf("列车【%s】已存在", status.Id))
} }
//向动力学发送初始化请求
trainIndex, _ := strconv.ParseUint(status.Id, 10, 16)
linkIndex, _ := strconv.ParseUint(status.HeadLinkId, 10, 16)
httpCode, _, err := dynamics.SendInitTrainReq(&dynamics.InitTrainInfo{
TrainIndex: uint16(trainIndex),
LinkIndex: uint16(linkIndex),
LinkOffset: uint16(status.HeadLinkOffset / 10),
Speed: uint16(math.Round(float64(status.Speed * 10))),
Up: status.Up,
})
if err != nil || httpCode != http.StatusOK {
panic(dto.ErrorDto{Code: dto.LogicError, Message: fmt.Sprintf("动力学接口调用失败:%s", err.Error())})
}
// 将信息合并到当前设备状态中 // 将信息合并到当前设备状态中
allTrainMap.Store(status.Id, status) allTrainMap.Store(status.Id, status)
// 将变更信息放入变更状态队列中 // 将变更信息放入变更状态队列中

View File

@ -19,7 +19,10 @@ import (
func TestAll(t *testing.T) { func TestAll(t *testing.T) {
loadAndChangeConfig() loadAndChangeConfig()
//注册列车信息处理逻辑 //注册列车信息处理逻辑
RegisterTrainInfoHandler(&ExampleTrainInfoHandler{}) RegisterTrainInfoHandler(func(info *TrainInfo) {
fmt.Println("处理列车信息...")
fmt.Println(info)
})
//启动udp服务 //启动udp服务
go RunUdpServer() go RunUdpServer()
////启动仅用于的测试的模拟远程udp服务 ////启动仅用于的测试的模拟远程udp服务
@ -32,7 +35,7 @@ func TestAll(t *testing.T) {
//向远程udp服务发送数据 //向远程udp服务发送数据
_ = SendTurnoutInfo(&TurnoutInfo{Code: 02}) _ = SendTurnoutInfo(&TurnoutInfo{Code: 02})
//发送http请求 //发送http请求
_, _, _ = SendTrainInitReq(&InitTrainInfo{Speed: 10}) _, _, _ = SendInitTrainReq(&InitTrainInfo{Speed: 10})
} }
func loadAndChangeConfig() { func loadAndChangeConfig() {
@ -91,11 +94,3 @@ func (server *testUdpServer) OnTraffic(c gnet.Conn) gnet.Action {
fmt.Println(buf) fmt.Println(buf)
return gnet.None return gnet.None
} }
type ExampleTrainInfoHandler struct {
}
func (handler *ExampleTrainInfoHandler) HandleTrainInfo(info TrainInfo) {
fmt.Println("处理列车信息...")
fmt.Println(info)
}

View File

@ -9,7 +9,7 @@ import (
"net/http" "net/http"
) )
func SendTrainInitReq(info *InitTrainInfo) (int, *[]byte, error) { func SendInitTrainReq(info *InitTrainInfo) (int, *[]byte, error) {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
zap.S().Error("发送列车初始化请求失败", r) zap.S().Error("发送列车初始化请求失败", r)
@ -24,9 +24,14 @@ func SendTrainInitReq(info *InitTrainInfo) (int, *[]byte, error) {
url := "http://" + ip + port + uri url := "http://" + ip + port + uri
data, _ := json.Marshal(info) data, _ := json.Marshal(info)
resp, _ := http.Post(url, "application/json", bytes.NewBuffer(data)) resp, err := http.Post(url, "application/json", bytes.NewBuffer(data))
if err != nil {
s := err.Error()
println(s)
return 0, nil, err
}
var buf []byte var buf []byte
_, err := resp.Body.Read(buf) _, err = resp.Body.Read(buf)
if err != nil { if err != nil {
return resp.StatusCode, nil, err return resp.StatusCode, nil, err
} }

View File

@ -4,6 +4,7 @@ type InitTrainInfo struct {
TrainIndex uint16 `json:"trainIndex"` TrainIndex uint16 `json:"trainIndex"`
LinkIndex uint16 `json:"linkIndex"` LinkIndex uint16 `json:"linkIndex"`
LinkOffset uint16 `json:"linkOffset"` LinkOffset uint16 `json:"linkOffset"`
Speed uint16 `json:"speed"` //单位0.1km/h
Up bool `json:"up"` Speed uint16 `json:"speed"`
Up bool `json:"up"`
} }

View File

@ -1,17 +1,24 @@
package dynamics package dynamics
import ( import (
"github.com/spf13/viper"
"joylink.club/bj-rtsts-server/config" "joylink.club/bj-rtsts-server/config"
"testing" "testing"
"time"
) )
func TestSendTrainInitReq(t *testing.T) { func TestSendTrainInitReq(t *testing.T) {
viper.AddConfigPath("../")
config.LoadConfig() config.LoadConfig()
SendTrainInitReq(&InitTrainInfo{ for i := 1; i <= 5; i++ {
TrainIndex: 1, info := InitTrainInfo{
LinkIndex: 2, TrainIndex: uint16(i),
LinkOffset: 3, LinkIndex: 2,
Speed: 4, LinkOffset: 3,
Up: true, Speed: 4,
}) Up: true,
}
time.Sleep(time.Second)
SendInitTrainReq(&info)
}
} }

View File

@ -1,33 +1,53 @@
package dynamics package dynamics
import ( import (
"container/list"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/panjf2000/gnet/v2" "github.com/panjf2000/gnet/v2"
"go.uber.org/zap" "go.uber.org/zap"
"joylink.club/bj-rtsts-server/config" "joylink.club/bj-rtsts-server/config"
"net" "net"
"sync"
"time" "time"
) )
func init() {
runSendTurnoutStateTask()
}
var ( var (
// TurnoutInfoChan 用来存放要发送的道岔信息 m sync.Map
TurnoutInfoChan = make(chan *TurnoutInfo, 1000)
) )
func RunSendTurnoutInfoTask() { type TurnoutInfoFunc func() []*TurnoutInfo
func runSendTurnoutStateTask() {
go func() { go func() {
tick := time.Tick(10 * time.Millisecond) tick := time.Tick(50 * time.Millisecond)
for range tick { for range tick {
info := <-TurnoutInfoChan m.Range(func(key, value any) bool {
err := SendTurnoutInfo(info) slice := value.(TurnoutInfoFunc)()
if err != nil { for _, turnoutInfo := range slice {
zap.S().Error(err) err := SendTurnoutInfo(turnoutInfo)
} if err != nil {
zap.S().Error(err)
}
}
return true
})
} }
}() }()
} }
func AddTurnoutInfoFunc(simId string, tiFunc TurnoutInfoFunc) {
m.Store(simId, tiFunc)
}
func RemoveTurnoutInfoFunc(simId string) {
m.Delete(simId)
}
// SendTurnoutInfo 发送道岔信息 // SendTurnoutInfo 发送道岔信息
func SendTurnoutInfo(info *TurnoutInfo) error { func SendTurnoutInfo(info *TurnoutInfo) error {
defer func() { defer func() {
@ -75,6 +95,7 @@ type udpServer struct {
func (server *udpServer) OnBoot(eng gnet.Engine) gnet.Action { func (server *udpServer) OnBoot(eng gnet.Engine) gnet.Action {
server.eng = eng server.eng = eng
println("udp server with multi-core=%t is listening on %s\n", server.multicore, server.addr)
zap.S().Infof("udp server with multi-core=%t is listening on %s\n", server.multicore, server.addr) zap.S().Infof("udp server with multi-core=%t is listening on %s\n", server.multicore, server.addr)
return gnet.None return gnet.None
} }
@ -97,33 +118,32 @@ func (server *udpServer) OnTraffic(c gnet.Conn) gnet.Action {
b := buf[11] b := buf[11]
trainInfo.UpSlope = (b & (1 << 7)) != 0 trainInfo.UpSlope = (b & (1 << 7)) != 0
trainInfo.Up = (b & (1 << 6)) != 0 trainInfo.Up = (b & (1 << 6)) != 0
trainInfo.TotalResistance = binary.BigEndian.Uint16(buf[13:15]) trainInfo.TotalResistance = float32(binary.BigEndian.Uint16(buf[13:15])) / 100
trainInfo.Resistance1 = binary.BigEndian.Uint16(buf[15:17]) trainInfo.AirResistance = float32(binary.BigEndian.Uint16(buf[15:17])) / 100
trainInfo.Resistance2 = binary.BigEndian.Uint16(buf[17:19]) trainInfo.SlopeResistance = float32(binary.BigEndian.Uint16(buf[17:19])) / 100
trainInfo.Resistance3 = binary.BigEndian.Uint16(buf[19:21]) trainInfo.CurveResistance = float32(binary.BigEndian.Uint16(buf[19:21])) / 100
trainInfo.Speed = binary.BigEndian.Uint16(buf[21:23]) trainInfo.Speed = float32(binary.BigEndian.Uint16(buf[21:23])) / 10
trainInfo.HeadSpeed1 = binary.BigEndian.Uint16(buf[23:25]) trainInfo.HeadSpeed1 = float32(binary.BigEndian.Uint16(buf[23:25])) / 10
trainInfo.HeadSpeed2 = binary.BigEndian.Uint16(buf[25:27]) trainInfo.HeadSpeed2 = float32(binary.BigEndian.Uint16(buf[25:27])) / 10
trainInfo.TailSpeed1 = binary.BigEndian.Uint16(buf[27:29]) trainInfo.TailSpeed1 = float32(binary.BigEndian.Uint16(buf[27:29])) / 10
trainInfo.TailSpeed2 = binary.BigEndian.Uint16(buf[29:31]) trainInfo.TailSpeed2 = float32(binary.BigEndian.Uint16(buf[29:31])) / 10
trainInfo.HeadRadarSpeed = binary.BigEndian.Uint16(buf[31:33]) trainInfo.HeadRadarSpeed = float32(binary.BigEndian.Uint16(buf[31:33])) / 10
trainInfo.TailRadarSpeed = binary.BigEndian.Uint16(buf[33:35]) trainInfo.TailRadarSpeed = float32(binary.BigEndian.Uint16(buf[33:35])) / 10
for _, handler := range trainInfoHandlers { for e := handlerList.Front(); e != nil; e = e.Next() {
handler.HandleTrainInfo(trainInfo) handler := e.Value.(TrainInfoHandler)
handler(&trainInfo)
} }
return gnet.None return gnet.None
} }
var trainInfoHandlers []TrainInfoHandler var handlerList list.List
type TrainInfoHandler interface { type TrainInfoHandler func(info *TrainInfo)
HandleTrainInfo(info TrainInfo)
}
func RegisterTrainInfoHandler(handler TrainInfoHandler) { func RegisterTrainInfoHandler(handler TrainInfoHandler) {
trainInfoHandlers = append(trainInfoHandlers, handler) handlerList.PushBack(handler)
} }
func RunUdpServer() { func RunUdpServer() {

View File

@ -24,25 +24,25 @@ type TrainInfo struct {
//列车当前运行方向(上/下行) //列车当前运行方向(上/下行)
Up bool Up bool
//实际运行阻力KN //实际运行阻力KN
TotalResistance uint16 TotalResistance float32
//阻力1空气阻力KN //阻力1空气阻力KN
Resistance1 uint16 AirResistance float32
//阻力2坡道阻力KN //阻力2坡道阻力KN
Resistance2 uint16 SlopeResistance float32
//阻力3曲线阻力KN //阻力3曲线阻力KN
Resistance3 uint16 CurveResistance float32
//列车运行速度km/h //列车运行速度km/h
Speed uint16 Speed float32
//头车速传1速度值km/h //头车速传1速度值km/h
HeadSpeed1 uint16 HeadSpeed1 float32
//头车速度2速度值 //头车速度2速度值
HeadSpeed2 uint16 HeadSpeed2 float32
//尾车速传1速度值 //尾车速传1速度值
TailSpeed1 uint16 TailSpeed1 float32
//尾车速度2速度值 //尾车速度2速度值
TailSpeed2 uint16 TailSpeed2 float32
//头车雷达速度值 //头车雷达速度值
HeadRadarSpeed uint16 HeadRadarSpeed float32
//尾车雷达速度值 //尾车雷达速度值
TailRadarSpeed uint16 TailRadarSpeed float32
} }

View File

@ -2,7 +2,9 @@ package dynamics
import ( import (
"encoding/hex" "encoding/hex"
"fmt"
"github.com/panjf2000/gnet/v2" "github.com/panjf2000/gnet/v2"
"github.com/spf13/viper"
"io" "io"
"joylink.club/bj-rtsts-server/config" "joylink.club/bj-rtsts-server/config"
"net" "net"
@ -12,18 +14,28 @@ import (
) )
func TestRunUdpServer(t *testing.T) { func TestRunUdpServer(t *testing.T) {
viper.AddConfigPath("../")
config.LoadConfig() config.LoadConfig()
RegisterTrainInfoHandler(&ExampleTrainInfoHandler{}) RegisterTrainInfoHandler(func(info *TrainInfo) {
fmt.Println("处理列车信息...")
fmt.Println(info)
})
RunUdpServer() RunUdpServer()
} }
func TestSendTurnoutInfo(t *testing.T) { func TestSendTurnoutInfo(t *testing.T) {
viper.AddConfigPath("../")
config.LoadConfig() config.LoadConfig()
SendTurnoutInfo(&TurnoutInfo{ tick := time.Tick(50 * time.Millisecond)
Code: 2, for range tick {
NPosition: true, for i := 1; i <= 9; i++ {
RPosition: false, SendTurnoutInfo(&TurnoutInfo{
}) Code: uint16(i),
NPosition: true,
RPosition: false,
})
}
}
} }
func BenchmarkUdpServer_OnTraffic(b *testing.B) { func BenchmarkUdpServer_OnTraffic(b *testing.B) {

View File

@ -2,13 +2,12 @@ package main
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dynamics"
swaggerFiles "github.com/swaggo/files" // swagger embed files swaggerFiles "github.com/swaggo/files" // swagger embed files
ginSwagger "github.com/swaggo/gin-swagger" // gin-swagger middleware ginSwagger "github.com/swaggo/gin-swagger" // gin-swagger middleware
"joylink.club/bj-rtsts-server/api" "joylink.club/bj-rtsts-server/api"
"joylink.club/bj-rtsts-server/config" "joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/docs" "joylink.club/bj-rtsts-server/docs"
"joylink.club/bj-rtsts-server/dynamics"
"joylink.club/bj-rtsts-server/middleware" "joylink.club/bj-rtsts-server/middleware"
) )
@ -36,7 +35,7 @@ func main() {
docs.SwaggerInfo.Title = "CBTC测试系统API" docs.SwaggerInfo.Title = "CBTC测试系统API"
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
dynamics.RunSendTurnoutInfoTask() go dynamics.RunUdpServer()
serverConfig := config.Config.Server serverConfig := config.Config.Server
if serverConfig.Port == 0 { if serverConfig.Port == 0 {

View File

@ -6,10 +6,10 @@ server:
port: 9091 port: 9091
# 动力学端口配置 # 动力学端口配置
dynamics: dynamics:
ip: 192.168.3.5 ip: 192.168.3.94
udpLocalPort: 4000 udpLocalPort: 4000
udpRemotePort: 3000 udpRemotePort: 3000
httpPort: 9092 httpPort: 7800
# 数据源 # 数据源
datasource: datasource: