From 4e07b17e6c29d52abb16e382c8c9c8cc32c4e037 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 2 Aug 2023 15:47:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=A8=E5=8A=9B=E5=AD=A6?= =?UTF-8?q?=E9=80=9A=E4=BF=A1=E4=B8=8E=E4=BB=BF=E7=9C=9F=E7=9A=84=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../graphicData/stationLayoutGraphics.pb.go | 339 ++++++++++-------- ats/verify/simulation/simulation_manage.go | 65 ++++ .../wayside/memory/wayside_memory_train.go | 18 + dynamics/example_test.go | 15 +- dynamics/http.go | 11 +- dynamics/httpData.go | 5 +- dynamics/http_test.go | 21 +- dynamics/udp.go | 74 ++-- dynamics/udpData.go | 22 +- dynamics/udp_test.go | 24 +- main.go | 5 +- xiannccda.setting.yml | 4 +- 12 files changed, 391 insertions(+), 212 deletions(-) diff --git a/ats/verify/protos/graphicData/stationLayoutGraphics.pb.go b/ats/verify/protos/graphicData/stationLayoutGraphics.pb.go index d64f747..42e5876 100644 --- a/ats/verify/protos/graphicData/stationLayoutGraphics.pb.go +++ b/ats/verify/protos/graphicData/stationLayoutGraphics.pb.go @@ -1638,10 +1638,11 @@ type Transponder struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,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"` - Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,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"` + TransponderType int32 `protobuf:"varint,3,opt,name=transponderType,proto3" json:"transponderType,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() { @@ -1704,6 +1705,13 @@ func (x *Transponder) GetIndex() int32 { return 0 } +func (x *Transponder) GetKilometerSystem() *KilometerSystem { + if x != nil { + return x.KilometerSystem + } + return nil +} + type SimpleRef struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2057,11 +2065,12 @@ type StopPosition struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,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"` // 是否翻转(前端显示) - 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"` //索引 + Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,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"` // 是否翻转(前端显示) + 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"` //索引 + KilometerSystem *KilometerSystem `protobuf:"bytes,6,opt,name=kilometerSystem,proto3" json:"kilometerSystem,omitempty"` } func (x *StopPosition) Reset() { @@ -2131,15 +2140,24 @@ func (x *StopPosition) GetIndex() int32 { return 0 } +func (x *StopPosition) GetKilometerSystem() *KilometerSystem { + if x != nil { + return x.KilometerSystem + } + return nil +} + type SpksSwitch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,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"` // 是否翻转(前端显示) - Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,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"` + Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,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() { @@ -2202,15 +2220,30 @@ func (x *SpksSwitch) GetIndex() int32 { 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 { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,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"` // 是否翻转(前端显示) - Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,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"` + Flip bool `protobuf:"varint,3,opt,name=flip,proto3" json:"flip,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() { @@ -2273,6 +2306,13 @@ func (x *EsbButton) GetIndex() int32 { return 0 } +func (x *EsbButton) GetRefStand() int32 { + if x != nil { + return x.RefStand + } + return 0 +} + type GatedBox struct { state protoimpl.MessageState 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, 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, - 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, 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, @@ -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, 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, - 0x64, 0x65, 0x78, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, - 0x66, 0x12, 0x41, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, - 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x2e, 0x44, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x00, 0x12, - 0x10, 0x0a, 0x0c, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x10, - 0x01, 0x22, 0xe2, 0x02, 0x0a, 0x0b, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6e, - 0x6b, 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, 0x2a, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, - 0x18, 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, 0x0e, 0x0a, 0x02, 0x75, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, - 0x75, 0x70, 0x12, 0x30, 0x0a, 0x07, 0x61, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, - 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x07, 0x61, 0x53, 0x69, - 0x6d, 0x52, 0x65, 0x66, 0x12, 0x30, 0x0a, 0x07, 0x62, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, - 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x07, 0x62, - 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x12, 0x2b, 0x0a, 0x04, 0x61, 0x52, 0x65, 0x66, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, - 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x04, 0x61, - 0x52, 0x65, 0x66, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x52, 0x65, 0x66, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, - 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x04, 0x62, 0x52, 0x65, 0x66, - 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xb6, 0x02, 0x0a, 0x13, 0x41, 0x78, 0x6c, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x63, 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, 0x2a, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 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, - 0x2d, 0x0a, 0x05, 0x70, 0x61, 0x52, 0x65, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, - 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x05, 0x70, 0x61, 0x52, 0x65, 0x66, 0x12, 0x2d, - 0x0a, 0x05, 0x70, 0x62, 0x52, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, - 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x05, 0x70, 0x62, 0x52, 0x65, 0x66, 0x12, 0x3a, 0x0a, - 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, - 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x73, 0x52, 0x65, 0x66, 0x52, 0x0a, 0x74, - 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, - 0xd9, 0x01, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x53, 0x65, 0x63, 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, 0x2a, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, - 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, + 0x64, 0x65, 0x78, 0x12, 0x46, 0x0a, 0x0f, 0x6b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x05, 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, 0x8b, 0x01, 0x0a, 0x09, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, 0x41, 0x0a, 0x0a, 0x64, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, + 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x52, 0x65, 0x66, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x0a, + 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x75, + 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x78, 0x6c, 0x65, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x22, 0xe2, 0x02, 0x0a, 0x0b, 0x53, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6e, 0x6b, 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, 0x2a, + 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 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, 0x0e, 0x0a, 0x02, 0x75, 0x70, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x75, 0x70, 0x12, 0x30, 0x0a, 0x07, 0x61, 0x53, + 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72, + 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, + 0x52, 0x65, 0x66, 0x52, 0x07, 0x61, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x12, 0x30, 0x0a, 0x07, + 0x62, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x07, 0x62, 0x53, 0x69, 0x6d, 0x52, 0x65, 0x66, 0x12, 0x2b, + 0x0a, 0x04, 0x61, 0x52, 0x65, 0x66, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, + 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, + 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x04, 0x61, 0x52, 0x65, 0x66, 0x12, 0x2b, 0x0a, 0x04, 0x62, + 0x52, 0x65, 0x66, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, + 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, + 0x65, 0x66, 0x52, 0x04, 0x62, 0x52, 0x65, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xb6, + 0x02, 0x0a, 0x13, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53, + 0x65, 0x63, 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, 0x2a, 0x0a, 0x06, 0x70, + 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 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, 0x2d, 0x0a, 0x05, 0x70, 0x61, 0x52, 0x65, 0x66, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, + 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, + 0x05, 0x70, 0x61, 0x52, 0x65, 0x66, 0x12, 0x2d, 0x0a, 0x05, 0x70, 0x62, 0x52, 0x65, 0x66, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, + 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x52, 0x05, + 0x70, 0x62, 0x52, 0x65, 0x66, 0x12, 0x3a, 0x0a, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, + 0x50, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x61, 0x70, + 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, + 0x6f, 0x73, 0x52, 0x65, 0x66, 0x52, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xd9, 0x01, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, + 0x63, 0x53, 0x65, 0x63, 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, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x7a, 0x0a, 0x09, 0x45, 0x73, 0x62, 0x42, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2a, 0x0a, + 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 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, 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, 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, @@ -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, 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, 0x22, 0x79, 0x0a, 0x08, 0x47, 0x61, 0x74, 0x65, 0x64, 0x42, 0x6f, 0x78, 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, 0x42, 0x5d, - 0x0a, 0x25, 0x63, 0x6c, 0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, - 0x6a, 0x72, 0x74, 0x73, 0x73, 0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x13, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x47, - 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x1f, 0x2e, 0x2f, - 0x61, 0x74, 0x73, 0x2f, 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, + 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, 0x22, + 0x79, 0x0a, 0x08, 0x47, 0x61, 0x74, 0x65, 0x64, 0x42, 0x6f, 0x78, 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, 0x42, 0x5d, 0x0a, 0x25, 0x63, 0x6c, + 0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, + 0x73, 0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x42, 0x13, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, + 0x69, 0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x1f, 0x2e, 0x2f, 0x61, 0x74, 0x73, 0x2f, + 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 ( @@ -2822,30 +2877,32 @@ var file_stationLayoutGraphics_proto_depIdxs = []int32{ 2, // 47: graphicData.RelatedRef.devicePort:type_name -> graphicData.RelatedRef.DevicePort 10, // 48: graphicData.Separator.common:type_name -> graphicData.CommonInfo 10, // 49: graphicData.Transponder.common:type_name -> graphicData.CommonInfo - 3, // 50: graphicData.SimpleRef.deviceType:type_name -> graphicData.SimpleRef.DeviceType - 10, // 51: graphicData.SectionLink.common:type_name -> graphicData.CommonInfo - 7, // 52: graphicData.SectionLink.points:type_name -> graphicData.Point - 23, // 53: graphicData.SectionLink.aSimRef:type_name -> graphicData.SimpleRef - 23, // 54: graphicData.SectionLink.bSimRef:type_name -> graphicData.SimpleRef - 19, // 55: graphicData.SectionLink.aRef:type_name -> graphicData.RelatedRef - 19, // 56: graphicData.SectionLink.bRef:type_name -> graphicData.RelatedRef - 10, // 57: graphicData.AxleCountingSection.common:type_name -> graphicData.CommonInfo - 7, // 58: graphicData.AxleCountingSection.points:type_name -> graphicData.Point - 19, // 59: graphicData.AxleCountingSection.paRef:type_name -> graphicData.RelatedRef - 19, // 60: graphicData.AxleCountingSection.pbRef:type_name -> graphicData.RelatedRef - 20, // 61: graphicData.AxleCountingSection.turnoutPos:type_name -> graphicData.TurnoutPosRef - 10, // 62: graphicData.LogicSection.common:type_name -> graphicData.CommonInfo - 7, // 63: graphicData.LogicSection.points:type_name -> graphicData.Point - 10, // 64: graphicData.StopPosition.common:type_name -> graphicData.CommonInfo - 4, // 65: graphicData.StopPosition.coachNum:type_name -> graphicData.StopPosition.CoachNum - 10, // 66: graphicData.SpksSwitch.common:type_name -> graphicData.CommonInfo - 10, // 67: graphicData.EsbButton.common:type_name -> graphicData.CommonInfo - 10, // 68: graphicData.GatedBox.common:type_name -> graphicData.CommonInfo - 69, // [69:69] is the sub-list for method output_type - 69, // [69:69] is the sub-list for method input_type - 69, // [69:69] is the sub-list for extension type_name - 69, // [69:69] is the sub-list for extension extendee - 0, // [0:69] is the sub-list for field type_name + 16, // 50: graphicData.Transponder.kilometerSystem:type_name -> graphicData.KilometerSystem + 3, // 51: graphicData.SimpleRef.deviceType:type_name -> graphicData.SimpleRef.DeviceType + 10, // 52: graphicData.SectionLink.common:type_name -> graphicData.CommonInfo + 7, // 53: graphicData.SectionLink.points:type_name -> graphicData.Point + 23, // 54: graphicData.SectionLink.aSimRef:type_name -> graphicData.SimpleRef + 23, // 55: graphicData.SectionLink.bSimRef:type_name -> graphicData.SimpleRef + 19, // 56: graphicData.SectionLink.aRef:type_name -> graphicData.RelatedRef + 19, // 57: graphicData.SectionLink.bRef:type_name -> graphicData.RelatedRef + 10, // 58: graphicData.AxleCountingSection.common:type_name -> graphicData.CommonInfo + 7, // 59: graphicData.AxleCountingSection.points:type_name -> graphicData.Point + 19, // 60: graphicData.AxleCountingSection.paRef:type_name -> graphicData.RelatedRef + 19, // 61: graphicData.AxleCountingSection.pbRef:type_name -> graphicData.RelatedRef + 20, // 62: graphicData.AxleCountingSection.turnoutPos:type_name -> graphicData.TurnoutPosRef + 10, // 63: graphicData.LogicSection.common:type_name -> graphicData.CommonInfo + 7, // 64: graphicData.LogicSection.points:type_name -> graphicData.Point + 10, // 65: graphicData.StopPosition.common:type_name -> graphicData.CommonInfo + 4, // 66: graphicData.StopPosition.coachNum:type_name -> graphicData.StopPosition.CoachNum + 16, // 67: graphicData.StopPosition.kilometerSystem:type_name -> graphicData.KilometerSystem + 10, // 68: graphicData.SpksSwitch.common:type_name -> graphicData.CommonInfo + 10, // 69: graphicData.EsbButton.common:type_name -> graphicData.CommonInfo + 10, // 70: graphicData.GatedBox.common:type_name -> graphicData.CommonInfo + 71, // [71:71] is the sub-list for method output_type + 71, // [71:71] is the sub-list for method input_type + 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() } diff --git a/ats/verify/simulation/simulation_manage.go b/ats/verify/simulation/simulation_manage.go index 4533bbc..7295910 100644 --- a/ats/verify/simulation/simulation_manage.go +++ b/ats/verify/simulation/simulation_manage.go @@ -1,6 +1,9 @@ package simulation import ( + "go.uber.org/zap" + "joylink.club/bj-rtsts-server/ats/verify/protos/state" + "joylink.club/bj-rtsts-server/dynamics" "strconv" "sync" @@ -8,6 +11,47 @@ import ( "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 @@ -18,6 +62,25 @@ func CreateSimulation(mapId int32) string { if !e { verifySimulation := memory.CreateSimulation(mapId, simulationId) 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 } @@ -25,6 +88,8 @@ func CreateSimulation(mapId int32) string { // 删除仿真对象 func DestroySimulation(simulationId string) { simulationMap.Delete(simulationId) + //移除道岔状态发送 + dynamics.RemoveTurnoutInfoFunc(simulationId) } // 创建时生成仿真Id diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_train.go b/ats/verify/simulation/wayside/memory/wayside_memory_train.go index d462109..02e9c91 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_train.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_train.go @@ -2,6 +2,11 @@ package memory import ( "fmt" + "joylink.club/bj-rtsts-server/dto" + "joylink.club/bj-rtsts-server/dynamics" + "math" + "net/http" + "strconv" "sync" "github.com/golang/protobuf/proto" @@ -15,6 +20,19 @@ func AddTrainState(simulation *VerifySimulation, status *state.TrainState) { if ok { 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) // 将变更信息放入变更状态队列中 diff --git a/dynamics/example_test.go b/dynamics/example_test.go index f566759..651cc91 100644 --- a/dynamics/example_test.go +++ b/dynamics/example_test.go @@ -19,7 +19,10 @@ import ( func TestAll(t *testing.T) { loadAndChangeConfig() //注册列车信息处理逻辑 - RegisterTrainInfoHandler(&ExampleTrainInfoHandler{}) + RegisterTrainInfoHandler(func(info *TrainInfo) { + fmt.Println("处理列车信息...") + fmt.Println(info) + }) //启动udp服务 go RunUdpServer() ////启动仅用于的测试的模拟远程udp服务 @@ -32,7 +35,7 @@ func TestAll(t *testing.T) { //向远程udp服务发送数据 _ = SendTurnoutInfo(&TurnoutInfo{Code: 02}) //发送http请求 - _, _, _ = SendTrainInitReq(&InitTrainInfo{Speed: 10}) + _, _, _ = SendInitTrainReq(&InitTrainInfo{Speed: 10}) } func loadAndChangeConfig() { @@ -91,11 +94,3 @@ func (server *testUdpServer) OnTraffic(c gnet.Conn) gnet.Action { fmt.Println(buf) return gnet.None } - -type ExampleTrainInfoHandler struct { -} - -func (handler *ExampleTrainInfoHandler) HandleTrainInfo(info TrainInfo) { - fmt.Println("处理列车信息...") - fmt.Println(info) -} diff --git a/dynamics/http.go b/dynamics/http.go index 78ba398..2caf576 100644 --- a/dynamics/http.go +++ b/dynamics/http.go @@ -9,7 +9,7 @@ import ( "net/http" ) -func SendTrainInitReq(info *InitTrainInfo) (int, *[]byte, error) { +func SendInitTrainReq(info *InitTrainInfo) (int, *[]byte, error) { defer func() { if r := recover(); r != nil { zap.S().Error("发送列车初始化请求失败", r) @@ -24,9 +24,14 @@ func SendTrainInitReq(info *InitTrainInfo) (int, *[]byte, error) { url := "http://" + ip + port + uri 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 - _, err := resp.Body.Read(buf) + _, err = resp.Body.Read(buf) if err != nil { return resp.StatusCode, nil, err } diff --git a/dynamics/httpData.go b/dynamics/httpData.go index e226d20..bc43511 100644 --- a/dynamics/httpData.go +++ b/dynamics/httpData.go @@ -4,6 +4,7 @@ type InitTrainInfo struct { TrainIndex uint16 `json:"trainIndex"` LinkIndex uint16 `json:"linkIndex"` LinkOffset uint16 `json:"linkOffset"` - Speed uint16 `json:"speed"` - Up bool `json:"up"` + //单位0.1km/h + Speed uint16 `json:"speed"` + Up bool `json:"up"` } diff --git a/dynamics/http_test.go b/dynamics/http_test.go index f6012a5..9ec79f6 100644 --- a/dynamics/http_test.go +++ b/dynamics/http_test.go @@ -1,17 +1,24 @@ package dynamics import ( + "github.com/spf13/viper" "joylink.club/bj-rtsts-server/config" "testing" + "time" ) func TestSendTrainInitReq(t *testing.T) { + viper.AddConfigPath("../") config.LoadConfig() - SendTrainInitReq(&InitTrainInfo{ - TrainIndex: 1, - LinkIndex: 2, - LinkOffset: 3, - Speed: 4, - Up: true, - }) + for i := 1; i <= 5; i++ { + info := InitTrainInfo{ + TrainIndex: uint16(i), + LinkIndex: 2, + LinkOffset: 3, + Speed: 4, + Up: true, + } + time.Sleep(time.Second) + SendInitTrainReq(&info) + } } diff --git a/dynamics/udp.go b/dynamics/udp.go index 6bb92b8..861e4dd 100644 --- a/dynamics/udp.go +++ b/dynamics/udp.go @@ -1,33 +1,53 @@ package dynamics import ( + "container/list" "encoding/binary" "fmt" "github.com/panjf2000/gnet/v2" "go.uber.org/zap" "joylink.club/bj-rtsts-server/config" "net" + "sync" "time" ) +func init() { + runSendTurnoutStateTask() +} + var ( - // TurnoutInfoChan 用来存放要发送的道岔信息 - TurnoutInfoChan = make(chan *TurnoutInfo, 1000) + m sync.Map ) -func RunSendTurnoutInfoTask() { +type TurnoutInfoFunc func() []*TurnoutInfo + +func runSendTurnoutStateTask() { go func() { - tick := time.Tick(10 * time.Millisecond) + tick := time.Tick(50 * time.Millisecond) for range tick { - info := <-TurnoutInfoChan - err := SendTurnoutInfo(info) - if err != nil { - zap.S().Error(err) - } + m.Range(func(key, value any) bool { + slice := value.(TurnoutInfoFunc)() + for _, turnoutInfo := range slice { + 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 发送道岔信息 func SendTurnoutInfo(info *TurnoutInfo) error { defer func() { @@ -75,6 +95,7 @@ type udpServer struct { func (server *udpServer) OnBoot(eng gnet.Engine) gnet.Action { 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) return gnet.None } @@ -97,33 +118,32 @@ func (server *udpServer) OnTraffic(c gnet.Conn) gnet.Action { b := buf[11] trainInfo.UpSlope = (b & (1 << 7)) != 0 trainInfo.Up = (b & (1 << 6)) != 0 - trainInfo.TotalResistance = binary.BigEndian.Uint16(buf[13:15]) - trainInfo.Resistance1 = binary.BigEndian.Uint16(buf[15:17]) - trainInfo.Resistance2 = binary.BigEndian.Uint16(buf[17:19]) - trainInfo.Resistance3 = binary.BigEndian.Uint16(buf[19:21]) - trainInfo.Speed = binary.BigEndian.Uint16(buf[21:23]) - trainInfo.HeadSpeed1 = binary.BigEndian.Uint16(buf[23:25]) - trainInfo.HeadSpeed2 = binary.BigEndian.Uint16(buf[25:27]) - trainInfo.TailSpeed1 = binary.BigEndian.Uint16(buf[27:29]) - trainInfo.TailSpeed2 = binary.BigEndian.Uint16(buf[29:31]) - trainInfo.HeadRadarSpeed = binary.BigEndian.Uint16(buf[31:33]) - trainInfo.TailRadarSpeed = binary.BigEndian.Uint16(buf[33:35]) + trainInfo.TotalResistance = float32(binary.BigEndian.Uint16(buf[13:15])) / 100 + trainInfo.AirResistance = float32(binary.BigEndian.Uint16(buf[15:17])) / 100 + trainInfo.SlopeResistance = float32(binary.BigEndian.Uint16(buf[17:19])) / 100 + trainInfo.CurveResistance = float32(binary.BigEndian.Uint16(buf[19:21])) / 100 + trainInfo.Speed = float32(binary.BigEndian.Uint16(buf[21:23])) / 10 + trainInfo.HeadSpeed1 = float32(binary.BigEndian.Uint16(buf[23:25])) / 10 + trainInfo.HeadSpeed2 = float32(binary.BigEndian.Uint16(buf[25:27])) / 10 + trainInfo.TailSpeed1 = float32(binary.BigEndian.Uint16(buf[27:29])) / 10 + trainInfo.TailSpeed2 = float32(binary.BigEndian.Uint16(buf[29:31])) / 10 + trainInfo.HeadRadarSpeed = float32(binary.BigEndian.Uint16(buf[31:33])) / 10 + trainInfo.TailRadarSpeed = float32(binary.BigEndian.Uint16(buf[33:35])) / 10 - for _, handler := range trainInfoHandlers { - handler.HandleTrainInfo(trainInfo) + for e := handlerList.Front(); e != nil; e = e.Next() { + handler := e.Value.(TrainInfoHandler) + handler(&trainInfo) } return gnet.None } -var trainInfoHandlers []TrainInfoHandler +var handlerList list.List -type TrainInfoHandler interface { - HandleTrainInfo(info TrainInfo) -} +type TrainInfoHandler func(info *TrainInfo) func RegisterTrainInfoHandler(handler TrainInfoHandler) { - trainInfoHandlers = append(trainInfoHandlers, handler) + handlerList.PushBack(handler) } func RunUdpServer() { diff --git a/dynamics/udpData.go b/dynamics/udpData.go index ecaa93d..f0ce87b 100644 --- a/dynamics/udpData.go +++ b/dynamics/udpData.go @@ -24,25 +24,25 @@ type TrainInfo struct { //列车当前运行方向(上/下行) Up bool //实际运行阻力(总)(KN) - TotalResistance uint16 + TotalResistance float32 //阻力1(空气阻力)(KN) - Resistance1 uint16 + AirResistance float32 //阻力2(坡道阻力)(KN) - Resistance2 uint16 + SlopeResistance float32 //阻力3(曲线阻力)(KN) - Resistance3 uint16 + CurveResistance float32 //列车运行速度(km/h) - Speed uint16 + Speed float32 //头车速传1速度值(km/h) - HeadSpeed1 uint16 + HeadSpeed1 float32 //头车速度2速度值 - HeadSpeed2 uint16 + HeadSpeed2 float32 //尾车速传1速度值 - TailSpeed1 uint16 + TailSpeed1 float32 //尾车速度2速度值 - TailSpeed2 uint16 + TailSpeed2 float32 //头车雷达速度值 - HeadRadarSpeed uint16 + HeadRadarSpeed float32 //尾车雷达速度值 - TailRadarSpeed uint16 + TailRadarSpeed float32 } diff --git a/dynamics/udp_test.go b/dynamics/udp_test.go index bf5a54d..bc6d757 100644 --- a/dynamics/udp_test.go +++ b/dynamics/udp_test.go @@ -2,7 +2,9 @@ package dynamics import ( "encoding/hex" + "fmt" "github.com/panjf2000/gnet/v2" + "github.com/spf13/viper" "io" "joylink.club/bj-rtsts-server/config" "net" @@ -12,18 +14,28 @@ import ( ) func TestRunUdpServer(t *testing.T) { + viper.AddConfigPath("../") config.LoadConfig() - RegisterTrainInfoHandler(&ExampleTrainInfoHandler{}) + RegisterTrainInfoHandler(func(info *TrainInfo) { + fmt.Println("处理列车信息...") + fmt.Println(info) + }) RunUdpServer() } func TestSendTurnoutInfo(t *testing.T) { + viper.AddConfigPath("../") config.LoadConfig() - SendTurnoutInfo(&TurnoutInfo{ - Code: 2, - NPosition: true, - RPosition: false, - }) + tick := time.Tick(50 * time.Millisecond) + for range tick { + for i := 1; i <= 9; i++ { + SendTurnoutInfo(&TurnoutInfo{ + Code: uint16(i), + NPosition: true, + RPosition: false, + }) + } + } } func BenchmarkUdpServer_OnTraffic(b *testing.B) { diff --git a/main.go b/main.go index fde8a86..7d64740 100644 --- a/main.go +++ b/main.go @@ -2,13 +2,12 @@ package main import ( "fmt" - "joylink.club/bj-rtsts-server/dynamics" - swaggerFiles "github.com/swaggo/files" // swagger embed files ginSwagger "github.com/swaggo/gin-swagger" // gin-swagger middleware "joylink.club/bj-rtsts-server/api" "joylink.club/bj-rtsts-server/config" "joylink.club/bj-rtsts-server/docs" + "joylink.club/bj-rtsts-server/dynamics" "joylink.club/bj-rtsts-server/middleware" ) @@ -36,7 +35,7 @@ func main() { docs.SwaggerInfo.Title = "CBTC测试系统API" engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) - dynamics.RunSendTurnoutInfoTask() + go dynamics.RunUdpServer() serverConfig := config.Config.Server if serverConfig.Port == 0 { diff --git a/xiannccda.setting.yml b/xiannccda.setting.yml index 3e71442..54c6129 100644 --- a/xiannccda.setting.yml +++ b/xiannccda.setting.yml @@ -6,10 +6,10 @@ server: port: 9091 # 动力学端口配置 dynamics: - ip: 192.168.3.5 + ip: 192.168.3.94 udpLocalPort: 4000 udpRemotePort: 3000 - httpPort: 9092 + httpPort: 7800 # 数据源 datasource: