From 4dfe1376584902cec96b50a7543186250d6d8dcc Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 23 Jan 2024 18:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B1=8F=E8=94=BD=E9=97=A8?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bj-rtss-message | 2 +- dto/request_proto/request.pb.go | 362 ++++++++++++------ rtss_simulation | 2 +- ts/simulation/app_component/component.go | 1 + .../wayside/memory/wayside_memory_psd.go | 96 +++-- 5 files changed, 304 insertions(+), 159 deletions(-) diff --git a/bj-rtss-message b/bj-rtss-message index 54a5be2..ed7e060 160000 --- a/bj-rtss-message +++ b/bj-rtss-message @@ -1 +1 @@ -Subproject commit 54a5be2850fd4d1adccc6d155a2f9db0fac70d2f +Subproject commit ed7e0605c52ba9e6234cc750c4adf9d7e1525cac diff --git a/dto/request_proto/request.pb.go b/dto/request_proto/request.pb.go index 736bf24..d9c1acc 100644 --- a/dto/request_proto/request.pb.go +++ b/dto/request_proto/request.pb.go @@ -398,73 +398,18 @@ type Psd_Operation int32 const ( Psd_Undefined Psd_Operation = 0 - // 屏蔽门控制 - // - // Km4 = 1; //四编组开门 - // CancelKm4 = 2; //取消四编组开门 - // Km8 = 3; //八编组开门 - // CancelKm8 = 4; //取消八编组开门 - // Gm = 5; //关门 - // CancelGm = 6; //取消关门 - // ForceKm4 = 7; //强制四编组开门 - // ForceKm8 = 8; //强制八编组开门 - // ForceGm = 9; //强制关门 - Psd_Km Psd_Operation = 1 //开门 - Psd_CancelKm Psd_Operation = 2 //取消开门 - Psd_Gm Psd_Operation = 3 //关门 - Psd_CancelGm Psd_Operation = 4 //取消关门 - Psd_ForceKm Psd_Operation = 5 //强制开门 - Psd_ForceGm Psd_Operation = 6 //强制关门 - Psd_CancelForce Psd_Operation = 10 //取消强制 - // 屏蔽门故障 - Psd_AsdCannotOpen Psd_Operation = 11 //滑动门无法开门 - Psd_CancelAsdCannotOpen Psd_Operation = 12 //取消滑动门无法开门 - Psd_AsdCannotClose Psd_Operation = 13 //滑动门无法关闭 - Psd_CancelAsdCannotClose Psd_Operation = 14 //取消滑动门无法关闭 - // 间隙探测 - Psd_QDTC Psd_Operation = 15 //启动探测 - Psd_CancelQDTC Psd_Operation = 16 //取消启动探测 - Psd_TZTC Psd_Operation = 17 //停止探测 - Psd_CancelTZTC Psd_Operation = 18 //取消停止探测 + Psd_SetParams Psd_Operation = 1 // 设置参数 ) // Enum value maps for Psd_Operation. var ( Psd_Operation_name = map[int32]string{ - 0: "Undefined", - 1: "Km", - 2: "CancelKm", - 3: "Gm", - 4: "CancelGm", - 5: "ForceKm", - 6: "ForceGm", - 10: "CancelForce", - 11: "AsdCannotOpen", - 12: "CancelAsdCannotOpen", - 13: "AsdCannotClose", - 14: "CancelAsdCannotClose", - 15: "QDTC", - 16: "CancelQDTC", - 17: "TZTC", - 18: "CancelTZTC", + 0: "Undefined", + 1: "SetParams", } Psd_Operation_value = map[string]int32{ - "Undefined": 0, - "Km": 1, - "CancelKm": 2, - "Gm": 3, - "CancelGm": 4, - "ForceKm": 5, - "ForceGm": 6, - "CancelForce": 10, - "AsdCannotOpen": 11, - "CancelAsdCannotOpen": 12, - "AsdCannotClose": 13, - "CancelAsdCannotClose": 14, - "QDTC": 15, - "CancelQDTC": 16, - "TZTC": 17, - "CancelTZTC": 18, + "Undefined": 0, + "SetParams": 1, } ) @@ -495,6 +440,101 @@ func (Psd_Operation) EnumDescriptor() ([]byte, []int) { return file_request_proto_rawDescGZIP(), []int{11, 0} } +type Psd_Force int32 + +const ( + Psd_F_NONE Psd_Force = 0 //无强制 + Psd_F_ASD_KM Psd_Force = 1 //滑动门强制开门 + Psd_F_ASD_GM Psd_Force = 2 //滑动门强制关门 +) + +// Enum value maps for Psd_Force. +var ( + Psd_Force_name = map[int32]string{ + 0: "F_NONE", + 1: "F_ASD_KM", + 2: "F_ASD_GM", + } + Psd_Force_value = map[string]int32{ + "F_NONE": 0, + "F_ASD_KM": 1, + "F_ASD_GM": 2, + } +) + +func (x Psd_Force) Enum() *Psd_Force { + p := new(Psd_Force) + *p = x + return p +} + +func (x Psd_Force) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Psd_Force) Descriptor() protoreflect.EnumDescriptor { + return file_request_proto_enumTypes[8].Descriptor() +} + +func (Psd_Force) Type() protoreflect.EnumType { + return &file_request_proto_enumTypes[8] +} + +func (x Psd_Force) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Psd_Force.Descriptor instead. +func (Psd_Force) EnumDescriptor() ([]byte, []int) { + return file_request_proto_rawDescGZIP(), []int{11, 1} +} + +type Psd_Fault int32 + +const ( + Psd_FA_NONE Psd_Fault = 0 //无故障 + Psd_FA_Obstacle Psd_Fault = 1 //设置故障物 +) + +// Enum value maps for Psd_Fault. +var ( + Psd_Fault_name = map[int32]string{ + 0: "FA_NONE", + 1: "FA_Obstacle", + } + Psd_Fault_value = map[string]int32{ + "FA_NONE": 0, + "FA_Obstacle": 1, + } +) + +func (x Psd_Fault) Enum() *Psd_Fault { + p := new(Psd_Fault) + *p = x + return p +} + +func (x Psd_Fault) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Psd_Fault) Descriptor() protoreflect.EnumDescriptor { + return file_request_proto_enumTypes[9].Descriptor() +} + +func (Psd_Fault) Type() protoreflect.EnumType { + return &file_request_proto_enumTypes[9] +} + +func (x Psd_Fault) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Psd_Fault.Descriptor instead. +func (Psd_Fault) EnumDescriptor() ([]byte, []int) { + return file_request_proto_rawDescGZIP(), []int{11, 2} +} + // 继电器 type Relay struct { state protoimpl.MessageState @@ -1169,8 +1209,7 @@ type PsdOperationReq struct { MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id Operation Psd_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Psd_Operation" json:"operation,omitempty"` // 操作 - AsdCodes []int32 `protobuf:"varint,5,rep,packed,name=asdCodes,proto3" json:"asdCodes,omitempty"` //无法关闭/无法开启故障涉及的滑动门的编号 - Group int32 `protobuf:"varint,6,opt,name=group,proto3" json:"group,omitempty"` //开门操作的编组 + Param *PsdParam `protobuf:"bytes,5,opt,name=param,proto3" json:"param,omitempty"` // 屏蔽门参数,当operation为SetParams时有效 } func (x *PsdOperationReq) Reset() { @@ -1233,18 +1272,74 @@ func (x *PsdOperationReq) GetOperation() Psd_Operation { return Psd_Undefined } -func (x *PsdOperationReq) GetAsdCodes() []int32 { +func (x *PsdOperationReq) GetParam() *PsdParam { + if x != nil { + return x.Param + } + return nil +} + +type PsdParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AsdCodes []int32 `protobuf:"varint,1,rep,packed,name=asdCodes,proto3" json:"asdCodes,omitempty"` // 涉及的滑动门的编号 + Force Psd_Force `protobuf:"varint,2,opt,name=force,proto3,enum=request.Psd_Force" json:"force,omitempty"` // 屏蔽门强制设置 + Fault Psd_Fault `protobuf:"varint,3,opt,name=fault,proto3,enum=request.Psd_Fault" json:"fault,omitempty"` // 屏蔽门故障设置 +} + +func (x *PsdParam) Reset() { + *x = PsdParam{} + if protoimpl.UnsafeEnabled { + mi := &file_request_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PsdParam) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PsdParam) ProtoMessage() {} + +func (x *PsdParam) ProtoReflect() protoreflect.Message { + mi := &file_request_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PsdParam.ProtoReflect.Descriptor instead. +func (*PsdParam) Descriptor() ([]byte, []int) { + return file_request_proto_rawDescGZIP(), []int{13} +} + +func (x *PsdParam) GetAsdCodes() []int32 { if x != nil { return x.AsdCodes } return nil } -func (x *PsdOperationReq) GetGroup() int32 { +func (x *PsdParam) GetForce() Psd_Force { if x != nil { - return x.Group + return x.Force } - return 0 + return Psd_F_NONE +} + +func (x *PsdParam) GetFault() Psd_Fault { + if x != nil { + return x.Fault + } + return Psd_FA_NONE } var File_request_proto protoreflect.FileDescriptor @@ -1346,40 +1441,39 @@ var file_request_proto_rawDesc = []byte{ 0x72, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x6f, 0x63, 0x6b, 0x44, 0x72, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x6f, 0x63, 0x6b, 0x50, 0x64, 0x72, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6d, 0x6f, 0x63, 0x6b, 0x50, 0x64, 0x72, 0x73, - 0x74, 0x22, 0x87, 0x02, 0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0xff, 0x01, 0x0a, 0x09, 0x4f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, - 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x4b, 0x6d, 0x10, 0x01, 0x12, 0x0c, - 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4b, 0x6d, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, - 0x47, 0x6d, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x47, 0x6d, - 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x4b, 0x6d, 0x10, 0x05, 0x12, - 0x0b, 0x0a, 0x07, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x47, 0x6d, 0x10, 0x06, 0x12, 0x0f, 0x0a, 0x0b, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x11, 0x0a, - 0x0d, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x4f, 0x70, 0x65, 0x6e, 0x10, 0x0b, - 0x12, 0x17, 0x0a, 0x13, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x4f, 0x70, 0x65, 0x6e, 0x10, 0x0c, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x73, 0x64, - 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x0d, 0x12, 0x18, 0x0a, - 0x14, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x0e, 0x12, 0x08, 0x0a, 0x04, 0x51, 0x44, 0x54, 0x43, 0x10, - 0x0f, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x51, 0x44, 0x54, 0x43, 0x10, - 0x10, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x5a, 0x54, 0x43, 0x10, 0x11, 0x12, 0x0e, 0x0a, 0x0a, 0x43, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x54, 0x5a, 0x54, 0x43, 0x10, 0x12, 0x22, 0xcf, 0x01, 0x0a, 0x0f, - 0x50, 0x73, 0x64, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, - 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x61, - 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x61, - 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x30, 0x5a, - 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, - 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, - 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x22, 0x88, 0x01, 0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, + 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x10, 0x01, 0x22, 0x2f, 0x0a, 0x05, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x0a, 0x0a, + 0x06, 0x46, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x5f, 0x41, + 0x53, 0x44, 0x5f, 0x4b, 0x4d, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x5f, 0x41, 0x53, 0x44, + 0x5f, 0x47, 0x4d, 0x10, 0x02, 0x22, 0x25, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0b, + 0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x46, + 0x41, 0x5f, 0x4f, 0x62, 0x73, 0x74, 0x61, 0x63, 0x6c, 0x65, 0x10, 0x01, 0x22, 0xc6, 0x01, 0x0a, + 0x0f, 0x50, 0x73, 0x64, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x05, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x05, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x7a, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x05, 0x52, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x28, 0x0a, + 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x46, 0x6f, 0x72, 0x63, 0x65, + 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, + 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1394,8 +1488,8 @@ func file_request_proto_rawDescGZIP() []byte { return file_request_proto_rawDescData } -var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 8) -var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 10) +var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_request_proto_goTypes = []interface{}{ (Relay_Operation)(0), // 0: request.Relay.Operation (Points_Operation)(0), // 1: request.Points.Operation @@ -1405,37 +1499,43 @@ var file_request_proto_goTypes = []interface{}{ (Signal_Force)(0), // 5: request.Signal.Force (Section_Operation)(0), // 6: request.Section.Operation (Psd_Operation)(0), // 7: request.Psd.Operation - (*Relay)(nil), // 8: request.Relay - (*RelayOperationReq)(nil), // 9: request.RelayOperationReq - (*Points)(nil), // 10: request.Points - (*PointsOperationReq)(nil), // 11: request.PointsOperationReq - (*PointsParam)(nil), // 12: request.PointsParam - (*Signal)(nil), // 13: request.Signal - (*SignalOperationReq)(nil), // 14: request.SignalOperationReq - (*SignalParam)(nil), // 15: request.SignalParam - (*Section)(nil), // 16: request.Section - (*SectionOperationReq)(nil), // 17: request.SectionOperationReq - (*SectionParam)(nil), // 18: request.SectionParam - (*Psd)(nil), // 19: request.Psd - (*PsdOperationReq)(nil), // 20: request.PsdOperationReq + (Psd_Force)(0), // 8: request.Psd.Force + (Psd_Fault)(0), // 9: request.Psd.Fault + (*Relay)(nil), // 10: request.Relay + (*RelayOperationReq)(nil), // 11: request.RelayOperationReq + (*Points)(nil), // 12: request.Points + (*PointsOperationReq)(nil), // 13: request.PointsOperationReq + (*PointsParam)(nil), // 14: request.PointsParam + (*Signal)(nil), // 15: request.Signal + (*SignalOperationReq)(nil), // 16: request.SignalOperationReq + (*SignalParam)(nil), // 17: request.SignalParam + (*Section)(nil), // 18: request.Section + (*SectionOperationReq)(nil), // 19: request.SectionOperationReq + (*SectionParam)(nil), // 20: request.SectionParam + (*Psd)(nil), // 21: request.Psd + (*PsdOperationReq)(nil), // 22: request.PsdOperationReq + (*PsdParam)(nil), // 23: request.PsdParam } var file_request_proto_depIdxs = []int32{ 0, // 0: request.RelayOperationReq.operation:type_name -> request.Relay.Operation 1, // 1: request.PointsOperationReq.operation:type_name -> request.Points.Operation - 12, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam + 14, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam 2, // 3: request.PointsParam.forcePosition:type_name -> request.Points.Force 3, // 4: request.SignalOperationReq.operation:type_name -> request.Signal.Operation - 15, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam + 17, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam 5, // 6: request.SignalParam.force:type_name -> request.Signal.Force 4, // 7: request.SignalParam.dsList:type_name -> request.Signal.DS 6, // 8: request.SectionOperationReq.operation:type_name -> request.Section.Operation - 18, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam + 20, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam 7, // 10: request.PsdOperationReq.operation:type_name -> request.Psd.Operation - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 23, // 11: request.PsdOperationReq.param:type_name -> request.PsdParam + 8, // 12: request.PsdParam.force:type_name -> request.Psd.Force + 9, // 13: request.PsdParam.fault:type_name -> request.Psd.Fault + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_request_proto_init() } @@ -1600,14 +1700,26 @@ func file_request_proto_init() { return nil } } + file_request_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PsdParam); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_request_proto_rawDesc, - NumEnums: 8, - NumMessages: 13, + NumEnums: 10, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/rtss_simulation b/rtss_simulation index fa7211d..2879914 160000 --- a/rtss_simulation +++ b/rtss_simulation @@ -1 +1 @@ -Subproject commit fa7211d7bdf68be1df571f222a047ddd6cd764b0 +Subproject commit 2879914757c66add547e417131f7127a7db856ee diff --git a/ts/simulation/app_component/component.go b/ts/simulation/app_component/component.go index e6ad5aa..eb24545 100644 --- a/ts/simulation/app_component/component.go +++ b/ts/simulation/app_component/component.go @@ -9,4 +9,5 @@ var ( PointsParamType = ecs.NewComponentType[request_proto.PointsParam]() SignalParamType = ecs.NewComponentType[request_proto.SignalParam]() SectionParamType = ecs.NewComponentType[request_proto.SectionParam]() + PsdParamType = ecs.NewComponentType[request_proto.PsdParam]() ) diff --git a/ts/simulation/wayside/memory/wayside_memory_psd.go b/ts/simulation/wayside/memory/wayside_memory_psd.go index ddf60d9..ad0b8cc 100644 --- a/ts/simulation/wayside/memory/wayside_memory_psd.go +++ b/ts/simulation/wayside/memory/wayside_memory_psd.go @@ -4,43 +4,75 @@ import ( "fmt" "joylink.club/bj-rtsts-server/dto/data_proto" "joylink.club/bj-rtsts-server/dto/request_proto" - "joylink.club/rtsssimulation/component/component_proto" - "joylink.club/rtsssimulation/fi" + "joylink.club/bj-rtsts-server/sys_error" + appcomponent "joylink.club/bj-rtsts-server/ts/simulation/app_component" + "joylink.club/ecs" + "joylink.club/rtsssimulation/component" + "joylink.club/rtsssimulation/entity" + "unsafe" ) -// 处理道岔操作 +// HandlePsdOperation 处理屏蔽门操作 func HandlePsdOperation(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error { - uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.ScreenDoor{}) switch req.Operation { - case request_proto.Psd_Km: - return fi.SetInterlockKm(simulation.World, uid, req.Group) - case request_proto.Psd_CancelKm: - return fi.CancelInterlockKm(simulation.World, uid, req.Group) - case request_proto.Psd_Gm: - return fi.SetInterlockGm(simulation.World, uid) - case request_proto.Psd_CancelGm: - return fi.CancelInterlockGm(simulation.World, uid) - case request_proto.Psd_ForceKm: - case request_proto.Psd_ForceGm: - case request_proto.Psd_CancelForce: - case request_proto.Psd_AsdCannotClose: - return fi.SetPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotClose, req.AsdCodes) - case request_proto.Psd_CancelAsdCannotClose: - return fi.CancelPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotClose, req.AsdCodes) - case request_proto.Psd_AsdCannotOpen: - return fi.SetPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotOpen, req.AsdCodes) - case request_proto.Psd_CancelAsdCannotOpen: - return fi.CancelPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotOpen, req.AsdCodes) - case request_proto.Psd_QDTC: - return fi.SetQDTC(simulation.World, uid) - case request_proto.Psd_CancelQDTC: - return fi.CancelQDTC(simulation.World, uid) - case request_proto.Psd_TZTC: - return fi.SetTZTC(simulation.World, uid) - case request_proto.Psd_CancelTZTC: - return fi.CancelTZTC(simulation.World, uid) + case request_proto.Psd_SetParams: + return setPsdParams(simulation, req) default: - panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation)) + panic(fmt.Sprintf("未知的屏蔽门操作:%s", req.Operation)) } return nil } + +func setPsdParams(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error { + uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.ScreenDoor{}) + result := <-ecs.Request[ecs.EmptyType](simulation.World, func() ecs.Result[ecs.EmptyType] { + wd := entity.GetWorldData(simulation.World) + entry, ok := wd.EntityMap[uid] + if ok { + if !entry.HasComponent(component.AsdListType) { + return ecs.NewErrResult(fmt.Errorf("屏蔽门[%s]没有滑动门", uid)) + } + err := getEcsRequest(req)(entry) + if err != nil { + return ecs.NewErrResult(err) + } + } else { + return ecs.NewErrResult(fmt.Errorf("未找到id=%s的实体", uid)) + } + return ecs.NewOkEmptyResult() + }) + return result.Err +} + +func getEcsRequest(req *request_proto.PsdOperationReq) func(e *ecs.Entry) error { + return func(e *ecs.Entry) error { + e.AddComponent(appcomponent.PsdParamType, unsafe.Pointer(req.Param)) + asdList := component.AsdListType.Get(e) + asdMap := make(map[int32]bool) + for _, code := range req.Param.AsdCodes { + asdMap[code] = true + } + for i, asdEntry := range asdList.List { + if asdMap[int32(i+1)] == true { + if request_proto.Psd_FA_Obstacle == req.Param.Fault { + asdEntry.AddComponent(component.AsdHasObstacleTag) + } else if request_proto.Psd_FA_NONE == req.Param.Fault { + asdEntry.RemoveComponent(component.AsdHasObstacleTag) + } else { + return sys_error.New(fmt.Sprintf("未知的屏蔽门故障设置[%s]", req.Param.Fault.String())) + } + if request_proto.Psd_F_ASD_KM == req.Param.Force { + asdEntry.AddComponent(component.AsdForceType, unsafe.Pointer(&component.BitState{Val: true})) + } else if request_proto.Psd_F_ASD_GM == req.Param.Force { + asdEntry.AddComponent(component.AsdForceType, unsafe.Pointer(&component.BitState{Val: false})) + } else if request_proto.Psd_F_NONE == req.Param.Force { + asdEntry.RemoveComponent(component.AsdForceType) + } + } else { + asdEntry.RemoveComponent(component.AsdHasObstacleTag) + asdEntry.RemoveComponent(component.AsdForceType) + } + } + return nil + } +}