增加屏蔽门操作接口;实现屏蔽门操作

This commit is contained in:
joylink_zhangsai 2023-11-02 15:50:03 +08:00
parent 8598553359
commit b9d25e8c7f
20 changed files with 991 additions and 527 deletions

View File

@ -38,6 +38,7 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
authed.POST("/ibp/key/operation", ibpKeyOperation) authed.POST("/ibp/key/operation", ibpKeyOperation)
authed.GET("/:id/getMapKilometerRange", getMapKilometerRange) authed.GET("/:id/getMapKilometerRange", getMapKilometerRange)
authed.POST("/psl/operation", pslBtnOperation) authed.POST("/psl/operation", pslBtnOperation)
authed.POST("/psd/operation", psdOperation)
// 初始化地图信息 // 初始化地图信息
initPublishMapInfo() initPublishMapInfo()
@ -397,7 +398,7 @@ func ibpKeyOperation(c *gin.Context) {
c.JSON(http.StatusOK, "ok") c.JSON(http.StatusOK, "ok")
} }
// PSL操作 // PSL按钮操作
// //
// @Summary PSL操作 // @Summary PSL操作
// //
@ -412,7 +413,7 @@ func ibpKeyOperation(c *gin.Context) {
// //
// @Success 200 {object} string // @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/ibp/operation [post] // @Router /api/v1/simulation/psl/operation [post]
func pslBtnOperation(c *gin.Context) { func pslBtnOperation(c *gin.Context) {
req := &dto.PslOperationReqDto{} req := &dto.PslOperationReqDto{}
if err := c.ShouldBind(&req); err != nil { if err := c.ShouldBind(&req); err != nil {
@ -424,6 +425,35 @@ func pslBtnOperation(c *gin.Context) {
c.JSON(http.StatusOK, "ok") c.JSON(http.StatusOK, "ok")
} }
// 屏蔽门操作
//
// @Summary 屏蔽门操作
//
// @Security JwtAuth
//
// @Description 屏蔽门操作
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param PsdOperationReq body request_proto.PsdOperationReq true "屏蔽门操作"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/psd/operation [post]
func psdOperation(c *gin.Context) {
req := &request_proto.PsdOperationReq{}
if err := c.ShouldBind(&req); err != nil {
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
if err := memory.HandlePsdOperation(simulation, req); err != nil {
panic(dto.ErrorDto{Code: dto.ArgumentError, Message: err.Error()})
}
c.JSON(http.StatusOK, "ok")
}
// 获取仿真地图的公里标范围 // 获取仿真地图的公里标范围
// //
// @Summary 获取仿真地图的公里标范围 // @Summary 获取仿真地图的公里标范围

@ -1 +1 @@
Subproject commit ebfb67be9c57e2bf9b3e4b8887f028911b9dba96 Subproject commit 92c5696b7eb3b47b387f48e094f5c8644ddb7da8

View File

@ -3536,7 +3536,105 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/simulation/ibp/operation": { "/api/v1/simulation/list": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "获取ATS测试系统所有仿真实例的基本信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SimulationInfoRspDto"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/psd/operation": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "屏蔽门操作",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "屏蔽门操作",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "屏蔽门操作",
"name": "PsdOperationReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request_proto.PsdOperationReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/psl/operation": {
"post": { "post": {
"security": [ "security": [
{ {
@ -3588,52 +3686,6 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/simulation/list": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "获取ATS测试系统所有仿真实例的基本信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SimulationInfoRspDto"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/relay/operation": { "/api/v1/simulation/relay/operation": {
"post": { "post": {
"security": [ "security": [
@ -5301,6 +5353,12 @@ const docTemplate = `{
}, },
"simulationId": { "simulationId": {
"type": "string" "type": "string"
},
"trainIn": {
"type": "boolean"
},
"trainOut": {
"type": "boolean"
} }
} }
}, },
@ -6058,6 +6116,69 @@ const docTemplate = `{
} }
} }
}, },
"request_proto.PsdOperationReq": {
"type": "object",
"properties": {
"deviceId": {
"description": "设备id",
"type": "string"
},
"mapId": {
"description": "图id",
"type": "integer"
},
"operation": {
"description": "操作",
"allOf": [
{
"$ref": "#/definitions/request_proto.Psd_Operation"
}
]
},
"simulationId": {
"description": "仿真id",
"type": "string"
}
}
},
"request_proto.Psd_Operation": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
],
"x-enum-comments": {
"Psd_CancelGm": "取消关门",
"Psd_CancelKm4": "取消四编组开门",
"Psd_CancelKm8": "取消八编组开门",
"Psd_ForceGm": "强制关门",
"Psd_ForceKm4": "强制四编组开门",
"Psd_ForceKm8": "强制八编组开门",
"Psd_Gm": "关门",
"Psd_Km4": "四编组开门",
"Psd_Km8": "八编组开门"
},
"x-enum-varnames": [
"Psd_Undefined",
"Psd_Km4",
"Psd_CancelKm4",
"Psd_Km8",
"Psd_CancelKm8",
"Psd_Gm",
"Psd_CancelGm",
"Psd_ForceKm4",
"Psd_ForceKm8",
"Psd_ForceGm"
]
},
"request_proto.Section_Operation": { "request_proto.Section_Operation": {
"type": "integer", "type": "integer",
"enum": [ "enum": [

View File

@ -3529,7 +3529,105 @@
} }
} }
}, },
"/api/v1/simulation/ibp/operation": { "/api/v1/simulation/list": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "获取ATS测试系统所有仿真实例的基本信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SimulationInfoRspDto"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/psd/operation": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "屏蔽门操作",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "屏蔽门操作",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "屏蔽门操作",
"name": "PsdOperationReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request_proto.PsdOperationReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/psl/operation": {
"post": { "post": {
"security": [ "security": [
{ {
@ -3581,52 +3679,6 @@
} }
} }
}, },
"/api/v1/simulation/list": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "获取ATS测试系统所有仿真实例的基本信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SimulationInfoRspDto"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/relay/operation": { "/api/v1/simulation/relay/operation": {
"post": { "post": {
"security": [ "security": [
@ -5294,6 +5346,12 @@
}, },
"simulationId": { "simulationId": {
"type": "string" "type": "string"
},
"trainIn": {
"type": "boolean"
},
"trainOut": {
"type": "boolean"
} }
} }
}, },
@ -6051,6 +6109,69 @@
} }
} }
}, },
"request_proto.PsdOperationReq": {
"type": "object",
"properties": {
"deviceId": {
"description": "设备id",
"type": "string"
},
"mapId": {
"description": "图id",
"type": "integer"
},
"operation": {
"description": "操作",
"allOf": [
{
"$ref": "#/definitions/request_proto.Psd_Operation"
}
]
},
"simulationId": {
"description": "仿真id",
"type": "string"
}
}
},
"request_proto.Psd_Operation": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
],
"x-enum-comments": {
"Psd_CancelGm": "取消关门",
"Psd_CancelKm4": "取消四编组开门",
"Psd_CancelKm8": "取消八编组开门",
"Psd_ForceGm": "强制关门",
"Psd_ForceKm4": "强制四编组开门",
"Psd_ForceKm8": "强制八编组开门",
"Psd_Gm": "关门",
"Psd_Km4": "四编组开门",
"Psd_Km8": "八编组开门"
},
"x-enum-varnames": [
"Psd_Undefined",
"Psd_Km4",
"Psd_CancelKm4",
"Psd_Km8",
"Psd_CancelKm8",
"Psd_Gm",
"Psd_CancelGm",
"Psd_ForceKm4",
"Psd_ForceKm8",
"Psd_ForceGm"
]
},
"request_proto.Section_Operation": { "request_proto.Section_Operation": {
"type": "integer", "type": "integer",
"enum": [ "enum": [

View File

@ -70,6 +70,10 @@ definitions:
$ref: '#/definitions/request_proto.Section_Operation' $ref: '#/definitions/request_proto.Section_Operation'
simulationId: simulationId:
type: string type: string
trainIn:
type: boolean
trainOut:
type: boolean
required: required:
- id - id
- mapId - mapId
@ -598,6 +602,56 @@ definitions:
description: 名称 description: 名称
type: string type: string
type: object type: object
request_proto.Psd_Operation:
enum:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
type: integer
x-enum-comments:
Psd_CancelGm: 取消关门
Psd_CancelKm4: 取消四编组开门
Psd_CancelKm8: 取消八编组开门
Psd_ForceGm: 强制关门
Psd_ForceKm4: 强制四编组开门
Psd_ForceKm8: 强制八编组开门
Psd_Gm: 关门
Psd_Km4: 四编组开门
Psd_Km8: 八编组开门
x-enum-varnames:
- Psd_Undefined
- Psd_Km4
- Psd_CancelKm4
- Psd_Km8
- Psd_CancelKm8
- Psd_Gm
- Psd_CancelGm
- Psd_ForceKm4
- Psd_ForceKm8
- Psd_ForceGm
request_proto.PsdOperationReq:
properties:
deviceId:
description: 设备id
type: string
mapId:
description: 图id
type: integer
operation:
allOf:
- $ref: '#/definitions/request_proto.Psd_Operation'
description: 操作
simulationId:
description: 仿真id
type: string
type: object
request_proto.Section_Operation: request_proto.Section_Operation:
enum: enum:
- 0 - 0
@ -2985,7 +3039,69 @@ paths:
summary: ATS测试-IBP钥匙操作 summary: ATS测试-IBP钥匙操作
tags: tags:
- ATS测试仿真Api - ATS测试仿真Api
/api/v1/simulation/ibp/operation: /api/v1/simulation/list:
get:
consumes:
- application/json
description: 获取ATS测试系统所有仿真实例的基本信息
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.SimulationInfoRspDto'
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 获取ATS测试系统所有仿真实例的基本信息
tags:
- ATS测试仿真Api
/api/v1/simulation/psd/operation:
post:
consumes:
- application/json
description: 屏蔽门操作
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 屏蔽门操作
in: body
name: PsdOperationReq
required: true
schema:
$ref: '#/definitions/request_proto.PsdOperationReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 屏蔽门操作
tags:
- ATS测试仿真Api
/api/v1/simulation/psl/operation:
post: post:
consumes: consumes:
- application/json - application/json
@ -3018,35 +3134,6 @@ paths:
summary: PSL操作 summary: PSL操作
tags: tags:
- ATS测试仿真Api - ATS测试仿真Api
/api/v1/simulation/list:
get:
consumes:
- application/json
description: 获取ATS测试系统所有仿真实例的基本信息
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.SimulationInfoRspDto'
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 获取ATS测试系统所有仿真实例的基本信息
tags:
- ATS测试仿真Api
/api/v1/simulation/relay/operation: /api/v1/simulation/relay/operation:
post: post:
consumes: consumes:

View File

@ -13,6 +13,7 @@ const (
// DataOperationError 数据操作错误(增删改查操作出了意料之外的错误都算) // DataOperationError 数据操作错误(增删改查操作出了意料之外的错误都算)
DataOperationError = 2002 DataOperationError = 2002
ArgumentParseError = 3000 ArgumentParseError = 3000
ArgumentError = 3001 //参数错误。指参数对应的数据不存在等情况
NoAuthOperationError = 4001 NoAuthOperationError = 4001

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: request.proto // source: request.proto
@ -233,6 +233,76 @@ func (Section_Operation) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{3, 0} return file_request_proto_rawDescGZIP(), []int{3, 0}
} }
type Psd_Operation int32
const (
Psd_Undefined Psd_Operation = 0
Psd_Km4 Psd_Operation = 1 //四编组开门
Psd_CancelKm4 Psd_Operation = 2 //取消四编组开门
Psd_Km8 Psd_Operation = 3 //八编组开门
Psd_CancelKm8 Psd_Operation = 4 //取消八编组开门
Psd_Gm Psd_Operation = 5 //关门
Psd_CancelGm Psd_Operation = 6 //取消关门
Psd_ForceKm4 Psd_Operation = 7 //强制四编组开门
Psd_ForceKm8 Psd_Operation = 8 //强制八编组开门
Psd_ForceGm Psd_Operation = 9 //强制关门
)
// Enum value maps for Psd_Operation.
var (
Psd_Operation_name = map[int32]string{
0: "Undefined",
1: "Km4",
2: "CancelKm4",
3: "Km8",
4: "CancelKm8",
5: "Gm",
6: "CancelGm",
7: "ForceKm4",
8: "ForceKm8",
9: "ForceGm",
}
Psd_Operation_value = map[string]int32{
"Undefined": 0,
"Km4": 1,
"CancelKm4": 2,
"Km8": 3,
"CancelKm8": 4,
"Gm": 5,
"CancelGm": 6,
"ForceKm4": 7,
"ForceKm8": 8,
"ForceGm": 9,
}
)
func (x Psd_Operation) Enum() *Psd_Operation {
p := new(Psd_Operation)
*p = x
return p
}
func (x Psd_Operation) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Psd_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[3].Descriptor()
}
func (Psd_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[3]
}
func (x Psd_Operation) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Psd_Operation.Descriptor instead.
func (Psd_Operation) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{4, 0}
}
// 道岔 // 道岔
type Turnout struct { type Turnout struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -422,6 +492,117 @@ func (*Section) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{3} return file_request_proto_rawDescGZIP(), []int{3}
} }
// 屏蔽门
type Psd struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Psd) Reset() {
*x = Psd{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Psd) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Psd) ProtoMessage() {}
func (x *Psd) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[4]
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 Psd.ProtoReflect.Descriptor instead.
func (*Psd) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{4}
}
// 屏蔽门操作请求
type PsdOperationReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id
DeviceId string `protobuf:"bytes,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
Operation Psd_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Psd_Operation" json:"operation,omitempty"` // 操作
}
func (x *PsdOperationReq) Reset() {
*x = PsdOperationReq{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PsdOperationReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PsdOperationReq) ProtoMessage() {}
func (x *PsdOperationReq) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PsdOperationReq.ProtoReflect.Descriptor instead.
func (*PsdOperationReq) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{5}
}
func (x *PsdOperationReq) GetSimulationId() string {
if x != nil {
return x.SimulationId
}
return ""
}
func (x *PsdOperationReq) GetMapId() int32 {
if x != nil {
return x.MapId
}
return 0
}
func (x *PsdOperationReq) GetDeviceId() string {
if x != nil {
return x.DeviceId
}
return ""
}
func (x *PsdOperationReq) GetOperation() Psd_Operation {
if x != nil {
return x.Operation
}
return Psd_Undefined
}
var File_request_proto protoreflect.FileDescriptor var File_request_proto protoreflect.FileDescriptor
var file_request_proto_rawDesc = []byte{ var file_request_proto_rawDesc = []byte{
@ -471,9 +652,28 @@ var file_request_proto_rawDesc = []byte{
0x0b, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x64, 0x72, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0f, 0x0b, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x64, 0x72, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0f,
0x0a, 0x0b, 0x53, 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x63, 0x63, 0x10, 0x04, 0x12, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x63, 0x63, 0x10, 0x04, 0x12,
0x12, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x63, 0x12, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x63,
0x63, 0x10, 0x05, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x63, 0x10, 0x05, 0x22, 0x91, 0x01, 0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0x89, 0x01, 0x0a, 0x09,
0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64,
0x6f, 0x33, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4b, 0x6d, 0x34, 0x10,
0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4b, 0x6d, 0x34, 0x10, 0x02,
0x12, 0x07, 0x0a, 0x03, 0x4b, 0x6d, 0x38, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x61, 0x6e,
0x63, 0x65, 0x6c, 0x4b, 0x6d, 0x38, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x6d, 0x10, 0x05,
0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x47, 0x6d, 0x10, 0x06, 0x12, 0x0c,
0x0a, 0x08, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x4b, 0x6d, 0x34, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08,
0x46, 0x6f, 0x72, 0x63, 0x65, 0x4b, 0x6d, 0x38, 0x10, 0x08, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x6f,
0x72, 0x63, 0x65, 0x47, 0x6d, 0x10, 0x09, 0x22, 0x9d, 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, 0x09, 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, 0x42, 0x15, 0x5a, 0x13, 0x2e, 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 ( var (
@ -488,24 +688,28 @@ func file_request_proto_rawDescGZIP() []byte {
return file_request_proto_rawDescData return file_request_proto_rawDescData
} }
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_request_proto_goTypes = []interface{}{ var file_request_proto_goTypes = []interface{}{
(Turnout_Operation)(0), // 0: request.Turnout.Operation (Turnout_Operation)(0), // 0: request.Turnout.Operation
(Signal_Operation)(0), // 1: request.Signal.Operation (Signal_Operation)(0), // 1: request.Signal.Operation
(Section_Operation)(0), // 2: request.Section.Operation (Section_Operation)(0), // 2: request.Section.Operation
(*Turnout)(nil), // 3: request.Turnout (Psd_Operation)(0), // 3: request.Psd.Operation
(*TurnoutOperationReq)(nil), // 4: request.TurnoutOperationReq (*Turnout)(nil), // 4: request.Turnout
(*Signal)(nil), // 5: request.Signal (*TurnoutOperationReq)(nil), // 5: request.TurnoutOperationReq
(*Section)(nil), // 6: request.Section (*Signal)(nil), // 6: request.Signal
(*Section)(nil), // 7: request.Section
(*Psd)(nil), // 8: request.Psd
(*PsdOperationReq)(nil), // 9: request.PsdOperationReq
} }
var file_request_proto_depIdxs = []int32{ var file_request_proto_depIdxs = []int32{
0, // 0: request.TurnoutOperationReq.operation:type_name -> request.Turnout.Operation 0, // 0: request.TurnoutOperationReq.operation:type_name -> request.Turnout.Operation
1, // [1:1] is the sub-list for method output_type 3, // 1: request.PsdOperationReq.operation:type_name -> request.Psd.Operation
1, // [1:1] is the sub-list for method input_type 2, // [2:2] is the sub-list for method output_type
1, // [1:1] is the sub-list for extension type_name 2, // [2:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension extendee 2, // [2:2] is the sub-list for extension type_name
0, // [0:1] is the sub-list for field type_name 2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
} }
func init() { file_request_proto_init() } func init() { file_request_proto_init() }
@ -562,14 +766,38 @@ func file_request_proto_init() {
return nil return nil
} }
} }
file_request_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Psd); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_request_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PsdOperationReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_request_proto_rawDesc, RawDescriptor: file_request_proto_rawDesc,
NumEnums: 3, NumEnums: 4,
NumMessages: 4, NumMessages: 6,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -104,8 +104,9 @@ func (ms *SfpMs) collectPsdStates() ([]*state.PsdState, error) {
} }
} }
psdStateArr = append(psdStateArr, &state.PsdState{ psdStateArr = append(psdStateArr, &state.PsdState{
Id: door.Common.Id, Id: door.Common.Id,
OpenDoorCodes: openSubDoor, Close: component.PsdStateType.Get(psdEntry).Close,
OpenAsdCodes: openSubDoor,
}) })
} }
} }

Binary file not shown.

View File

@ -1,280 +0,0 @@
package protobuf
import (
"fmt"
"os"
"testing"
"google.golang.org/protobuf/proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
proto2 "joylink.club/rtsssimulation/repository/model/proto"
)
func TestBuildRepository(t *testing.T) {
bytes, err := os.ReadFile("./file.bin")
dir, _ := os.Getwd()
println(dir)
if err != nil {
panic(err)
}
storage := &graphicData.RtssGraphicStorage{}
err = proto.Unmarshal(bytes, storage)
if err != nil {
panic(err)
}
repo := &proto2.Repository{}
//todo 数据中id为379的区段B端无计轴临时在代码里修改后续删除
storage.AxleCountings = append(storage.AxleCountings, &graphicData.AxleCounting{
Common: &graphicData.CommonInfo{
Id: "10000",
},
KilometerSystem: &graphicData.KilometerSystem{
Kilometer: 13403549,
CoordinateSystem: "MAIN_LINE",
Direction: graphicData.Direction_RIGHT,
},
AxleCountingRef: []*graphicData.RelatedRef{{
DeviceType: graphicData.RelatedRef_Section,
Id: "379",
DevicePort: graphicData.RelatedRef_B,
}},
Index: 0,
// Invent: false,
Type: 0,
})
axleCountingMap := make(map[string]*graphicData.AxleCounting)
for _, data := range storage.AxleCountings {
if data.KilometerSystem == nil {
println(fmt.Sprintf("计轴[%s]缺少公里标", data.Common.Id))
continue
}
axleCountingMap[data.Common.Id] = data
cpType := proto2.CheckPointType_AxleCounter
// if data.Invent {
// cpType = proto2.CheckPointType_Boundary
// }
cp := &proto2.CheckPoint{
Id: data.Common.Id,
Km: convertKm(data.KilometerSystem),
Type: cpType,
DevicePorts: convertDevicePorts(data.AxleCountingRef),
}
repo.CheckPoints = append(repo.CheckPoints, cp)
}
for _, data := range storage.Section {
var turnoutIds []string
if data.SectionType == graphicData.Section_TurnoutPhysical {
turnoutIds = findTurnoutIds(axleCountingMap, data.AxleCountings)
}
physicalSection := &proto2.PhysicalSection{
Id: data.Common.Id,
ADevicePort: convertDevicePort(data.PaRef),
BDevicePort: convertDevicePort(data.PbRef),
TurnoutIds: turnoutIds,
}
repo.PhysicalSections = append(repo.PhysicalSections, physicalSection)
}
for _, data := range storage.Turnouts {
var km *proto2.Kilometer
for _, ks := range data.KilometerSystem {
if ks.Kilometer != 0 {
km = convertKm(ks)
break
}
}
for _, kc := range buildKmConverts(data.KilometerSystem) {
repo.KilometerConverts = append(repo.KilometerConverts, kc)
}
turnout := &proto2.Turnout{
Id: data.Common.Id,
Km: km,
ADevicePort: convertDevicePort(data.PaRef),
BDevicePort: convertDevicePort(data.PbRef),
CDevicePort: convertDevicePort(data.PcRef),
}
repo.Turnouts = append(repo.Turnouts, turnout)
}
for _, data := range storage.Signals {
var sectionId string
var turnoutPort *proto2.DevicePort
switch data.RefDev.DeviceType {
case graphicData.RelatedRef_Section:
sectionId = data.RefDev.Id
case graphicData.RelatedRef_Turnout:
turnoutPort = convertDevicePort(data.RefDev)
}
signal := &proto2.Signal{
Id: data.Common.Id,
Km: convertKm(data.KilometerSystem),
SectionId: sectionId,
TurnoutPort: turnoutPort,
}
repo.Signals = append(repo.Signals, signal)
}
for _, data := range storage.Transponders {
var sectionId string
var turnoutPort *proto2.DevicePort
switch data.TransponderRef.DeviceType {
case graphicData.RelatedRef_Section:
sectionId = data.TransponderRef.Id
case graphicData.RelatedRef_Turnout:
turnoutPort = convertDevicePort(data.TransponderRef)
}
responder := &proto2.Transponder{
Id: data.Common.Id,
Km: convertKm(data.KilometerSystem),
SectionId: sectionId,
TurnoutPort: turnoutPort,
}
repo.Transponders = append(repo.Transponders, responder)
}
slopeKsMap := make(map[string]*graphicData.SlopeKiloMarker)
for _, data := range storage.SlopeKiloMarker {
slopeKsMap[data.Common.Id] = data
for _, kc := range buildKmConverts(data.KilometerSystem) {
repo.KilometerConverts = append(repo.KilometerConverts, kc)
}
}
curveKsMap := make(map[string]*graphicData.CurvatureKiloMarker)
for _, data := range storage.CurvatureKiloMarker {
curveKsMap[data.Common.Id] = data
for _, kc := range buildKmConverts(data.KilometerSystem) {
repo.KilometerConverts = append(repo.KilometerConverts, kc)
}
}
for _, data := range storage.Slopes {
var kms []*proto2.Kilometer
for _, id := range data.RefDeviceId {
kms = append(kms, convertKm(slopeKsMap[id].KilometerSystem[0]))
}
slope := &proto2.Slope{
Id: data.Common.Id,
Kms: kms,
Degree: data.SlopeNumber,
}
repo.Slopes = append(repo.Slopes, slope)
}
for _, data := range storage.Curvatures {
var kms []*proto2.Kilometer
for _, id := range data.RefDeviceId {
kms = append(kms, convertKm(curveKsMap[id].KilometerSystem[0]))
}
slope := &proto2.SectionalCurvature{
Id: data.Common.Id,
Kms: kms,
Radius: data.CurvatureNumber,
}
repo.SectionalCurvatures = append(repo.SectionalCurvatures, slope)
}
repoBytes, err := proto.Marshal(repo)
if err != nil {
panic(err)
}
err = os.WriteFile("./repo.bin", repoBytes, os.ModePerm)
println(err)
}
func convertKm(ks *graphicData.KilometerSystem) *proto2.Kilometer {
var dir proto2.Direction
switch ks.Direction {
case graphicData.Direction_LEFT:
dir = proto2.Direction_LEFT
case graphicData.Direction_RIGHT:
dir = proto2.Direction_RIGHT
}
return &proto2.Kilometer{
Value: ks.Kilometer,
CoordinateSystem: ks.CoordinateSystem,
Direction: dir,
}
}
func convertDevicePort(ref *graphicData.RelatedRef) *proto2.DevicePort {
if ref == nil {
return nil
}
var deviceType proto2.DeviceType
var port proto2.Port
switch ref.DevicePort {
case graphicData.RelatedRef_A:
port = proto2.Port_A
case graphicData.RelatedRef_B:
port = proto2.Port_B
case graphicData.RelatedRef_C:
port = proto2.Port_C
}
switch ref.DeviceType {
case graphicData.RelatedRef_Section:
deviceType = proto2.DeviceType_DeviceType_PhysicalSection
case graphicData.RelatedRef_Turnout:
deviceType = proto2.DeviceType_DeviceType_Turnout
default:
panic(fmt.Sprintf("异常的设备类型-%s", ref.DeviceType))
}
return &proto2.DevicePort{
DeviceId: ref.Id,
DeviceType: deviceType,
Port: port,
}
}
func convertDevicePorts(refList []*graphicData.RelatedRef) []*proto2.DevicePort {
var dps []*proto2.DevicePort
for _, ref := range refList {
dps = append(dps, convertDevicePort(ref))
}
return dps
}
func findTurnoutIds(axleCountingMap map[string]*graphicData.AxleCounting, axleIds []string) []string {
if len(axleIds) <= 2 {
return nil
}
turnoutMap := make(map[string]bool)
for _, axleId := range axleIds {
axle := axleCountingMap[axleId]
relTurnoutCount := 0
var turnoutId string
for _, ref := range axle.AxleCountingRef {
if ref.DeviceType == graphicData.RelatedRef_Turnout {
relTurnoutCount++
turnoutId = ref.Id
}
}
if relTurnoutCount == 1 {
turnoutMap[turnoutId] = true
}
}
var turnoutIds []string
for id, _ := range turnoutMap {
turnoutIds = append(turnoutIds, id)
}
return turnoutIds
}
func buildKmConverts(ksList []*graphicData.KilometerSystem) []*proto2.KilometerConvert {
var kmConvers []*proto2.KilometerConvert
for i, ks := range ksList {
if ks.Kilometer == 0 {
continue
}
for j := i + 1; j < len(ksList); j++ {
if ks.Kilometer == 0 {
continue
}
kmConvers = append(kmConvers, buildKmConvert(ks, ksList[j]))
}
}
return kmConvers
}
func buildKmConvert(ks1 *graphicData.KilometerSystem, ks2 *graphicData.KilometerSystem) *proto2.KilometerConvert {
return &proto2.KilometerConvert{
KmA: convertKm(ks1),
KmB: convertKm(ks2),
SameTrend: false,
}
}

@ -1 +1 @@
Subproject commit ec3297327025acb20e33268705d600be0c1f87fb Subproject commit d77c37055ba841091f417b1c36fd8d3f6beb15c5

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: ibpGraphics.proto // source: ibpGraphics.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: picture.proto // source: picture.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: pslGraphics.proto // source: pslGraphics.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: relayCabinetLayoutGraphics.proto // source: relayCabinetLayoutGraphics.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: stationLayoutGraphics.proto // source: stationLayoutGraphics.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: device_state.proto // source: device_state.proto
@ -1643,8 +1643,9 @@ type PsdState struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id
OpenDoorCodes []int32 `protobuf:"varint,2,rep,packed,name=openDoorCodes,proto3" json:"openDoorCodes,omitempty"` //开启的小门的编号 OpenAsdCodes []int32 `protobuf:"varint,2,rep,packed,name=openAsdCodes,proto3" json:"openAsdCodes,omitempty"` //开启的滑动门的编号
Close bool `protobuf:"varint,3,opt,name=close,proto3" json:"close,omitempty"` //屏蔽门整体的关闭(继电器)状态
} }
func (x *PsdState) Reset() { func (x *PsdState) Reset() {
@ -1686,13 +1687,20 @@ func (x *PsdState) GetId() string {
return "" return ""
} }
func (x *PsdState) GetOpenDoorCodes() []int32 { func (x *PsdState) GetOpenAsdCodes() []int32 {
if x != nil { if x != nil {
return x.OpenDoorCodes return x.OpenAsdCodes
} }
return nil return nil
} }
func (x *PsdState) GetClose() bool {
if x != nil {
return x.Close
}
return false
}
// 钥匙状态 // 钥匙状态
type KeyState struct { type KeyState struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -2309,98 +2317,99 @@ var file_device_state_proto_rawDesc = []byte{
0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x40, 0x0a, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x54, 0x0a,
0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x70, 0x65, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x70, 0x65,
0x6e, 0x44, 0x6f, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x6e, 0x41, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52,
0x52, 0x0d, 0x6f, 0x70, 0x65, 0x6e, 0x44, 0x6f, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x0c, 0x6f, 0x70, 0x65, 0x6e, 0x41, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a,
0x2e, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x6c,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x6f, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x65, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x65, 0x61, 0x72, 0x22, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x9e, 0x02, 0x0a, 0x0f, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x12, 0x0a, 0x04, 0x67, 0x65, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67,
0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x65, 0x61, 0x72, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f,
0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x26,
0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64,
0x49, 0x64, 0x12, 0x38, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54,
0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x75, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x3b, 0x0a, 0x0e,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79,
0x22, 0x93, 0x04, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x74, 0x72,
0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x77, 0x69, 0x74,
0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74,
0x65, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x37, 0x65, 0x52, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
0x0a, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x12, 0x3b, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x75,
0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x05, 0x20,
0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c,
0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x69, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52,
0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x93, 0x04, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69,
0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, 0x61,
0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x12, 0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x75, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b,
0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28,
0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x41, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x73,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72,
0x52, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61,
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x74, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34,
0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x74, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08, 0x4b, 0x65, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53,
0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x50, 0x75, 0x73, 0x68, 0x65, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74,
0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x61, 0x6c, 0x6c, 0x65, 0x2e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62,
0x12, 0x34, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x41, 0x6c,
0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x76, 0x61, 0x72, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x65, 0x52, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a,
0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28,
0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53,
0x75, 0x73, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xd8, 0x01, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65,
0x0a, 0x10, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x03,
0x75, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x73, 0x64, 0x53, 0x74,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x61, 0x74, 0x65, 0x52, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a,
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65,
0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x52, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x50,
0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x75, 0x73, 0x68, 0x65, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74,
0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x75, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x03, 0x61, 0x6c, 0x6c, 0x12, 0x34, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75,
0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3f, 0x0a, 0x0f, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x41, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
0x55, 0x53, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x01, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x61, 0x6c,
0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x03, 0x2a, 0x37, 0x0a, 0x0b, 0x53, 0x65, 0x63, 0x74, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73,
0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x10, 0x00, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75,
0x12, 0x08, 0x0a, 0x04, 0x41, 0x78, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x6f, 0x73, 0x22, 0xd8, 0x01, 0x0a, 0x10, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x67, 0x69, 0x63, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x10, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
0x03, 0x42, 0x4c, 0x0a, 0x25, 0x63, 0x6c, 0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69,
0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, 0x73, 0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76, 0x65, 0x72, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x05, 0x73, 0x74,
0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x10, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x11, 0x2e, 0x2f, 0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74,
0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x62, 0x75, 0x73, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73,
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3f, 0x0a, 0x0f, 0x53,
0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x09,
0x0a, 0x05, 0x50, 0x41, 0x55, 0x53, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41,
0x52, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x12,
0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x03, 0x2a, 0x37, 0x0a, 0x0b,
0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x41,
0x6e, 0x79, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x41, 0x78, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x09,
0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x68, 0x79,
0x73, 0x69, 0x63, 0x10, 0x03, 0x42, 0x4c, 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, 0x10,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x5a, 0x11, 0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74,
0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -327,6 +327,8 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
return (uidData.(*StationUidStructure)).ButtonIds return (uidData.(*StationUidStructure)).ButtonIds
case *graphicData.Station: case *graphicData.Station:
return (uidData.(*StationUidStructure)).StationIds return (uidData.(*StationUidStructure)).StationIds
case *graphicData.ScreenDoor:
return (uidData.(*StationUidStructure)).PsdIds
default: default:
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"}) panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
} }

View File

@ -1 +1,35 @@
package memory package memory
import (
"fmt"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/fi"
)
// 处理道岔操作
func HandlePsdOperation(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error {
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.ScreenDoor{})
switch req.Operation {
case request_proto.Psd_Km4:
return fi.SetInterlockKm4(simulation.World, uid)
case request_proto.Psd_CancelKm4:
return fi.CancelInterlockKm4(simulation.World, uid)
case request_proto.Psd_Km8:
return fi.SetInterlockKm8(simulation.World, uid)
case request_proto.Psd_CancelKm8:
return fi.CancelInterlockKm8(simulation.World, uid)
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_ForceKm4:
case request_proto.Psd_ForceKm8:
case request_proto.Psd_ForceGm:
default:
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
}
return nil
}

View File

@ -0,0 +1,110 @@
package memory
import (
"fmt"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/entity"
"testing"
"time"
)
// 先创建一个仿真再调
func TestHandlePsdOperation(t *testing.T) {
simInfo := ts.ListAllSimulations()[0]
simId := simInfo.SimulationId
var mapId int32
for _, id := range simInfo.MapIds {
if QueryGiType(id) == graphicData.PictureType_StationLayout {
mapId = id
}
}
if mapId == 0 {
fmt.Println("无信号布置图")
return
}
data := QueryGiData[*graphicData.RtssGraphicStorage](mapId)
deviceId := data.ScreenDoors[0].Common.Id
simulation := ts.FindSimulation(simId)
wantErr := false
uid := QueryUidByMidAndComId(mapId, deviceId, &graphicData.Turnout{})
entry, _ := entity.GetEntityByUid(simulation.World, uid)
asdList := component.AsdListType.Get(entry)
psdModel := entity.GetWorldData(simulation.World).Repo.FindPsd(uid)
for key, value := range request_proto.Psd_Operation_value {
name := fmt.Sprintf("执行操作:%s", key)
req := &request_proto.PsdOperationReq{
SimulationId: "",
MapId: mapId,
DeviceId: deviceId,
Operation: request_proto.Psd_Operation(value),
}
t.Run(name, func(t *testing.T) {
if err := HandlePsdOperation(simulation, req); (err != nil) != wantErr {
t.Errorf("HandlePsdOperation() error = %v, wantErr %v", err, wantErr)
}
tick := time.Tick(5 * time.Second)
<-tick
switch req.Operation {
case request_proto.Psd_Km4:
group := psdModel.FindAsdGroup(4)
for i, asd := range asdList.List {
pos := component.TwoPositionTransformType.Get(asd).Pos
if int32(i) < group.Start || int32(i) > group.End {
if pos != consts.TwoPosMin {
t.Errorf("4编组开门操作[编号:%d]的滑动门位置[%d]不正确", i, pos)
}
} else {
if pos != consts.TwoPosMax {
t.Errorf(fmt.Sprintf("4编组开门操作[编号:%d]的滑动门位置[%d]不正确", i, pos))
}
}
}
case request_proto.Psd_CancelKm4:
if component.PscType.Get(entry).InterlockKM4 == true {
t.Errorf("取消4编组开门失败")
}
case request_proto.Psd_Km8:
group := psdModel.FindAsdGroup(8)
for i, asd := range asdList.List {
pos := component.TwoPositionTransformType.Get(asd).Pos
if int32(i) < group.Start || int32(i) > group.End {
if pos != consts.TwoPosMin {
t.Errorf("8编组开门操作[编号:%d]的滑动门位置[%d]不正确", i, pos)
}
} else {
if pos != consts.TwoPosMax {
t.Errorf("8编组开门操作[编号:%d]的滑动门位置[%d]不正确", i, pos)
}
}
}
case request_proto.Psd_CancelKm8:
if component.PscType.Get(entry).InterlockKM8 == true {
t.Errorf("取消8编组开门失败")
}
case request_proto.Psd_Gm:
for i, asd := range asdList.List {
pos := component.TwoPositionTransformType.Get(asd).Pos
if pos != consts.TwoPosMin {
t.Errorf("4编组开门操作[编号:%d]的滑动门位置[%d]不正确", i, pos)
}
}
case request_proto.Psd_CancelGm:
if component.PscType.Get(entry).InterlockGM == true {
t.Errorf("取消关门失败")
}
case request_proto.Psd_ForceKm4:
case request_proto.Psd_ForceKm8:
case request_proto.Psd_ForceGm:
}
})
}
}