增加应答器停止发送报文故障;增加应答器工作状态状态;增加列车车尾位置(仅数据结构,无赋值逻辑)

This commit is contained in:
thesai 2024-02-06 09:30:58 +08:00
parent 93dba75d9b
commit 46f8eba8c2
10 changed files with 562 additions and 195 deletions

View File

@ -46,6 +46,8 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
authed.PUT("/balise/position/reset", transponderPositionReset)
authed.PUT("/balise/telegram/modify", baliseTelegramModify)
authed.PUT("/balise/telegram/reset", baliseTelegramReset)
authed.PUT("/balise/telegram/stop", baliseTelegramStop)
authed.PUT("/balise/telegram/send", baliseTelegramSend)
authed.PUT("/balise/reset", baliseReset)
authed.POST("/bypass/operation", bypassBtnOrKeyOperation)
@ -759,9 +761,67 @@ func baliseTelegramReset(c *gin.Context) {
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
err := memory.BaliseTelegramReset(simulation, req)
var err *sys_error.BusinessError = memory.BaliseTelegramReset(simulation, req)
if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器重置报文操作失败,%s", err.Error()), err))
panic(err)
}
c.JSON(http.StatusOK, "ok")
}
// 应答器报文停止发送
//
// @Summary 应答器报文停止发送
//
// @Security JwtAuth
//
// @Description 应答器报文停止发送
// @Tags ATS测试仿真Api
// @Accept json
// @Param Authorization header string true "JWT Token"
// @Param BaliseReqDto body dto.BaliseReqDto true "应答器报文停止发送"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/balise/telegram/stop [put]
func baliseTelegramStop(c *gin.Context) {
req := &dto.BaliseReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器停止报文操作失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
var err *sys_error.BusinessError = memory.BaliseTelegramStop(simulation, req)
if err != nil {
panic(err)
}
c.JSON(http.StatusOK, "ok")
}
// 应答器报文重新开始发送
//
// @Summary 应答器报文重新开始发送
//
// @Security JwtAuth
//
// @Description 应答器报文停止发送
// @Tags ATS测试仿真Api
// @Accept json
// @Param Authorization header string true "JWT Token"
// @Param BaliseReqDto body dto.BaliseReqDto true "应答器报文重新开始发送"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/balise/telegram/send [put]
func baliseTelegramSend(c *gin.Context) {
req := &dto.BaliseReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器停止报文操作失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
var err *sys_error.BusinessError = memory.BaliseTelegramSend(simulation, req)
if err != nil {
panic(err)
}
c.JSON(http.StatusOK, "ok")
}

View File

@ -3506,6 +3506,104 @@ const docTemplate = `{
}
}
},
"/api/v1/simulation/balise/telegram/send": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器报文停止发送",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器报文重新开始发送",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器报文重新开始发送",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/telegram/stop": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器报文停止发送",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器报文停止发送",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器报文停止发送",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/bypass/operation": {
"post": {
"security": [

View File

@ -3500,6 +3500,104 @@
}
}
},
"/api/v1/simulation/balise/telegram/send": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器报文停止发送",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器报文重新开始发送",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器报文重新开始发送",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/telegram/stop": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器报文停止发送",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器报文停止发送",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器报文停止发送",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/bypass/operation": {
"post": {
"security": [

View File

@ -3291,6 +3291,68 @@ paths:
summary: 重置应答器报文
tags:
- ATS测试仿真Api
/api/v1/simulation/balise/telegram/send:
put:
consumes:
- application/json
description: 应答器报文停止发送
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 应答器报文重新开始发送
in: body
name: BaliseReqDto
required: true
schema:
$ref: '#/definitions/dto.BaliseReqDto'
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/balise/telegram/stop:
put:
consumes:
- application/json
description: 应答器报文停止发送
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 应答器报文停止发送
in: body
name: BaliseReqDto
required: true
schema:
$ref: '#/definitions/dto.BaliseReqDto'
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/bypass/operation:
post:
consumes:

View File

@ -3054,6 +3054,7 @@ type BaliseState struct {
FixedUserTelegram string `protobuf:"bytes,4,opt,name=fixedUserTelegram,proto3" json:"fixedUserTelegram,omitempty"` //固定用户报文
VariableTelegram string `protobuf:"bytes,5,opt,name=variableTelegram,proto3" json:"variableTelegram,omitempty"` //可变报文
VariableUserTelegram string `protobuf:"bytes,6,opt,name=variableUserTelegram,proto3" json:"variableUserTelegram,omitempty"` //可变用户报文
Work bool `protobuf:"varint,7,opt,name=work,proto3" json:"work,omitempty"` //是否正常工作
}
func (x *BaliseState) Reset() {
@ -3130,6 +3131,13 @@ func (x *BaliseState) GetVariableUserTelegram() string {
return ""
}
func (x *BaliseState) GetWork() bool {
if x != nil {
return x.Work
}
return false
}
// 车站联锁驱采状态
type StationQc struct {
state protoimpl.MessageState
@ -4223,7 +4231,7 @@ var file_device_state_proto_rawDesc = []byte{
0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65,
0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53,
0x74, 0x61, 0x74, 0x65, 0x22, 0xff, 0x01, 0x0a, 0x0b, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53,
0x74, 0x61, 0x74, 0x65, 0x22, 0x93, 0x02, 0x0a, 0x0b, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53,
0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1c, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x4b,
@ -4239,135 +4247,136 @@ var file_device_state_proto_rawDesc = []byte{
0x61, 0x6d, 0x12, 0x32, 0x0a, 0x14, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x73,
0x65, 0x72, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x14, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x54, 0x65,
0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x22, 0xb0, 0x01, 0x0a, 0x09, 0x53, 0x74, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x51, 0x63, 0x12, 0x32, 0x0a, 0x08, 0x71, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53,
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08,
0x71, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x63, 0x6a, 0x53, 0x74,
0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61,
0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x07,
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x77, 0x6f, 0x72, 0x6b, 0x22, 0xb0, 0x01, 0x0a, 0x09, 0x53,
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63, 0x12, 0x32, 0x0a, 0x08, 0x71, 0x64, 0x53, 0x74,
0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63, 0x2e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x08, 0x63, 0x6a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x3b, 0x0a, 0x05,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x72, 0x6f, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6f, 0x6c, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x6f, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6e, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6e, 0x22, 0xa1, 0x02, 0x0a, 0x0f, 0x56, 0x61,
0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x38, 0x0a,
0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69,
0x6e, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76,
0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52,
0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12,
0x38, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53,
0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x75, 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, 0xb8, 0x05,
0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54,
0x72, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x70, 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,
0x65, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x37,
0x0a, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03,
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, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a,
0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x69,
0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x75,
0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f,
0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53,
0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x41,
0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x4c, 0x69, 0x67,
0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x08,
0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x4b, 0x65, 0x79,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08, 0x4b, 0x65,
0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3a, 0x0a, 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f,
0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x62, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74,
0x65, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62, 0x61, 0x6c,
0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x51, 0x63, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63, 0x52, 0x09, 0x73,
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x50, 0x75, 0x73,
0x68, 0x65, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x61,
0x6c, 0x6c, 0x12, 0x34, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x56, 0x61,
0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x76,
0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
0xc2, 0x01, 0x0a, 0x10, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 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, 0x3d, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x4b, 0x0a, 0x0f, 0x53, 0x69, 0x6d, 0x75, 0x6c,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x6e,
0x69, 0x74, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x10,
0x01, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x61, 0x75, 0x73, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05,
0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x65, 0x73, 0x74, 0x72,
0x6f, 0x79, 0x10, 0x04, 0x22, 0xc0, 0x01, 0x0a, 0x1e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x41, 0x70, 0x69,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x65,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x74, 0x65, 0x52, 0x08, 0x71, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x08,
0x63, 0x6a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63,
0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08, 0x63, 0x6a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73,
0x1a, 0x3b, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x6f, 0x77,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x6f, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x63,
0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x6f, 0x6c, 0x12, 0x0e, 0x0a,
0x02, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6e, 0x22, 0xa1, 0x02,
0x0a, 0x0f, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x38, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69,
0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x54, 0x72, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x72,
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20,
0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69,
0x6e, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77,
0x69, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d,
0x75, 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, 0xb8, 0x05, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53,
0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x70, 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, 0x65, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x18, 0x03, 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, 0x0c, 0x73,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72,
0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34,
0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53,
0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62,
0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x41, 0x6c,
0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74,
0x65, 0x52, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a,
0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53,
0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x2b, 0x0a, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x73, 0x64, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a,
0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3a, 0x0a, 0x0d, 0x70, 0x6c,
0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f,
0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72,
0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x62, 0x61, 0x6c, 0x69, 0x73, 0x65,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
0x0b, 0x62, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x09,
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x10, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51,
0x63, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x63, 0x22, 0x94, 0x01, 0x0a,
0x13, 0x50, 0x75, 0x73, 0x68, 0x65, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,
0x08, 0x52, 0x03, 0x61, 0x6c, 0x6c, 0x12, 0x34, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x52, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x09,
0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x17, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x22, 0xc2, 0x01, 0x0a, 0x10, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 0x3d, 0x0a, 0x05,
0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53,
0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x4b, 0x0a, 0x0f, 0x53,
0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x08,
0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x75, 0x6e, 0x6e,
0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x61, 0x75, 0x73, 0x65, 0x10, 0x02,
0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x44,
0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x10, 0x04, 0x22, 0xc0, 0x01, 0x0a, 0x1e, 0x53, 0x69, 0x6d,
0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74,
0x79, 0x41, 0x70, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x73,
0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x68,
0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x41, 0x70, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x22,
0x3a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66,
0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69,
0x63, 0x73, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x65, 0x6d, 0x69, 0x50, 0x68, 0x79, 0x73,
0x69, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x10, 0x02, 0x22, 0x1e, 0x0a, 0x05, 0x53,
0x74, 0x61, 0x74, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x10, 0x00,
0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x23,
0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50,
0x61, 0x72, 0x74, 0x79, 0x41, 0x70, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x22, 0x3a, 0x0a, 0x04, 0x54,
0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64,
0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x73, 0x10, 0x01,
0x12, 0x15, 0x0a, 0x11, 0x53, 0x65, 0x6d, 0x69, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c,
0x54, 0x72, 0x61, 0x69, 0x6e, 0x10, 0x02, 0x22, 0x1e, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05,
0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x23, 0x53, 0x69, 0x6d, 0x75,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79,
0x41, 0x70, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x3e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x41, 0x70, 0x69, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
0x41, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b,
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x41, 0x70, 0x69, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61,
0x74, 0x65, 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, 0x67, 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, 0x2c, 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, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x2a, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x41, 0x70,
0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74,
0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x41,
0x70, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 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,
0x67, 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, 0x2c, 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, 0x73, 0x74, 0x61,
0x74, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

38
main.go
View File

@ -1,17 +1,6 @@
package main
import (
"fmt"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"joylink.club/bj-rtsts-server/api"
"joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/docs"
"joylink.club/bj-rtsts-server/middleware"
"joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/third_party"
)
import "joylink.club/bj-rtsts-server/starter"
// @title CBTC测试系统API
// @version 1.0
@ -25,28 +14,5 @@ import (
// @name Authorization
func main() {
engine := InitServer()
mqtt.Startup(mqtt.NewMqttOptions(config.Config.Messaging.Mqtt.Address, config.Config.Messaging.Mqtt.Username, config.Config.Messaging.Mqtt.Password))
third_party.Init()
authMiddleware := middleware.InitGinJwtMiddleware()
router := engine.Group("/api")
api.InitUserRouter(router, authMiddleware)
api.InitDraftingRouter(router, authMiddleware)
api.InitPublishedGiRouter(router, authMiddleware)
api.InitSimulationRouter(router, authMiddleware)
api.InitCategoryRouter(router, authMiddleware)
api.InitProjectRouter(router, authMiddleware)
api.InitTrainManageRouter(router, authMiddleware)
api.InitProjectLinkRouter(router, authMiddleware)
api.InitAuthRouter(router, authMiddleware)
api.InitProjectRunConfigRouter(router, authMiddleware)
docs.SwaggerInfo.Title = "CBTC测试系统API"
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
serverConfig := config.Config.Server
if serverConfig.Port == 0 {
serverConfig.Port = 8080
}
engine.Run(fmt.Sprintf(":%d", config.Config.Server.Port))
starter.Start()
}

View File

@ -84,10 +84,12 @@ func collectBaliseStates(world ecs.World, mapId int32) ([]*state_proto.BaliseSta
entry, ok := entity.GetEntityByUid(world, structure.Uid)
if ok {
baliseFixedTelegram := component.BaliseFixedTelegramType.Get(entry)
baliseWorkState := component.BaliseWorkStateType.Get(entry)
baliseState := &state_proto.BaliseState{
Id: id,
FixedTelegram: fmt.Sprintf("%X", baliseFixedTelegram.Telegram),
FixedUserTelegram: fmt.Sprintf("%X", baliseFixedTelegram.UserTelegram),
Work: baliseWorkState.Work,
}
if entry.HasComponent(component.BaliseVariableTelegramType) {
baliseVariableTelegram := component.BaliseVariableTelegramType.Get(entry)

View File

@ -1,7 +1,14 @@
package main
package starter
import (
"fmt"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"joylink.club/bj-rtsts-server/api"
"joylink.club/bj-rtsts-server/docs"
"joylink.club/bj-rtsts-server/middleware"
"joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/third_party"
"log/slog"
"net"
"net/http"
@ -21,7 +28,33 @@ import (
"joylink.club/bj-rtsts-server/logger"
)
func InitServer() *gin.Engine {
func Start() {
engine := initServer()
mqtt.Startup(mqtt.NewMqttOptions(config.Config.Messaging.Mqtt.Address, config.Config.Messaging.Mqtt.Username, config.Config.Messaging.Mqtt.Password))
third_party.Init()
authMiddleware := middleware.InitGinJwtMiddleware()
router := engine.Group("/api")
api.InitUserRouter(router, authMiddleware)
api.InitDraftingRouter(router, authMiddleware)
api.InitPublishedGiRouter(router, authMiddleware)
api.InitSimulationRouter(router, authMiddleware)
api.InitCategoryRouter(router, authMiddleware)
api.InitProjectRouter(router, authMiddleware)
api.InitTrainManageRouter(router, authMiddleware)
api.InitProjectLinkRouter(router, authMiddleware)
api.InitAuthRouter(router, authMiddleware)
api.InitProjectRunConfigRouter(router, authMiddleware)
docs.SwaggerInfo.Title = "CBTC测试系统API"
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
serverConfig := config.Config.Server
if serverConfig.Port == 0 {
serverConfig.Port = 8080
}
engine.Run(fmt.Sprintf(":%d", config.Config.Server.Port))
}
func initServer() *gin.Engine {
config.LoadConfig()
err := logger.InitLogger()
if err != nil {
@ -42,7 +75,7 @@ func InitServer() *gin.Engine {
engine.Use(sloggin.New(slog.Default()))
engine.Use(cors.New(conf))
// gin panic 异常处理,默认处理为
engine.Use(CustomRecoveryWithSlog(slog.Default(), true, func(c *gin.Context, e interface{}) {
engine.Use(customRecoveryWithSlog(slog.Default(), true, func(c *gin.Context, e interface{}) {
be, ok := e.(*sys_error.BusinessError)
if !ok {
e, ok := e.(error)
@ -63,7 +96,7 @@ func InitServer() *gin.Engine {
return engine
}
func CustomRecoveryWithSlog(logger *slog.Logger, stack bool, recovery gin.RecoveryFunc) gin.HandlerFunc {
func customRecoveryWithSlog(logger *slog.Logger, stack bool, recovery gin.RecoveryFunc) gin.HandlerFunc {
return func(c *gin.Context) {
defer func() {
if err := recover(); err != nil {

View File

@ -118,11 +118,12 @@ func (t *BaliseDetector) baliseMessageCounterAdd1() {
// BTM天线接收应答器报文(线程不安全)
func (t *BaliseDetector) rcvTelegram(wd *component.WorldData, baliseId string) []byte {
entry, ok := wd.EntityMap[baliseId]
if !ok {
return nil
} else {
if ok {
if component.BaliseWorkStateType.Get(entry).Work {
return component.BaliseFixedTelegramType.Get(entry).Telegram
}
}
return nil
}
// true-新增false-更新

View File

@ -112,16 +112,6 @@ func BalisePositionReset(simulation *VerifySimulation, req *dto.BaliseReqDto) *s
return balisePositionReset(simulation, balise)
}
func balisePositionReset(simulation *VerifySimulation, balise *repository.Transponder) *sys_error.BusinessError {
entry, _ := entity.GetEntityByUid(simulation.World, balise.Id())
component.KmType.Set(entry, balise.Km())
component.LinkPositionType.SetValue(entry, component_data.LinkPosition{
LinkId: balise.LinkPosition().Link().Id(),
Offset: balise.LinkPosition().Offset(),
})
return nil
}
// BaliseTelegramModify 修改应答器报文
func BaliseTelegramModify(simulation *VerifySimulation, req *dto.BaliseModifyTelegramReqDto) *sys_error.BusinessError {
uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
@ -154,12 +144,12 @@ func BaliseTelegramModify(simulation *VerifySimulation, req *dto.BaliseModifyTel
return sys_error.New("可变用户报文解析出错", err)
}
return sendEcsRequest(simulation.World, func() error {
component.BaliseFixedTelegramType.SetValue(entry, component.BaliseState{
component.BaliseFixedTelegramType.SetValue(entry, component.BaliseTelegram{
Telegram: ft,
UserTelegram: fut,
})
if entry.HasComponent(component.BaliseVariableTelegramType) {
component.BaliseVariableTelegramType.SetValue(entry, component.BaliseState{
component.BaliseVariableTelegramType.SetValue(entry, component.BaliseTelegram{
Telegram: vt,
UserTelegram: vut,
})
@ -179,20 +169,32 @@ func BaliseTelegramReset(simulation *VerifySimulation, req *dto.BaliseReqDto) *s
return baliseTelegramReset(simulation, balise)
}
func baliseTelegramReset(simulation *VerifySimulation, balise *repository.Transponder) *sys_error.BusinessError {
// BaliseTelegramStop 应答器报文停止发送
func BaliseTelegramStop(simulation *VerifySimulation, req *dto.BaliseReqDto) *sys_error.BusinessError {
uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
worldData := entity.GetWorldData(simulation.World)
balise := worldData.Repo.FindTransponder(uid)
if balise == nil {
return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
}
entry, _ := entity.GetEntityByUid(simulation.World, balise.Id())
return sendEcsRequest(simulation.World, func() error {
component.BaliseFixedTelegramType.SetValue(entry, component.BaliseState{
Telegram: balise.FixedTelegram(),
UserTelegram: balise.FixedUserTelegram(),
})
if entry.HasComponent(component.BaliseVariableTelegramType) {
component.BaliseVariableTelegramType.SetValue(entry, component.BaliseState{})
}
component.BaliseWorkStateType.SetValue(entry, component.BaliseWorkState{Work: false})
return nil
})
}
// BaliseTelegramSend 应答器报文重新开始发送
func BaliseTelegramSend(simulation *VerifySimulation, req *dto.BaliseReqDto) *sys_error.BusinessError {
uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
worldData := entity.GetWorldData(simulation.World)
balise := worldData.Repo.FindTransponder(uid)
if balise == nil {
return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
}
return baliseTelegramSend(simulation, balise)
}
// BaliseReset 重置应答器所有状态
func BaliseReset(simulation *VerifySimulation) *sys_error.BusinessError {
var errs []error
@ -205,6 +207,10 @@ func BaliseReset(simulation *VerifySimulation) *sys_error.BusinessError {
if err != nil {
errs = append(errs, err)
}
err = baliseTelegramSend(simulation, balise)
if err != nil {
errs = append(errs, err)
}
}
if len(errs) > 0 {
var userMsg []string
@ -219,9 +225,41 @@ func BaliseReset(simulation *VerifySimulation) *sys_error.BusinessError {
return nil
}
func sendEcsRequest(w ecs.World, handler func() error) *sys_error.BusinessError {
func baliseTelegramSend(simulation *VerifySimulation, balise *repository.Transponder) *sys_error.BusinessError {
entry, _ := entity.GetEntityByUid(simulation.World, balise.Id())
return sendEcsRequest(simulation.World, func() error {
component.BaliseWorkStateType.SetValue(entry, component.BaliseWorkState{Work: false})
return nil
})
}
func balisePositionReset(simulation *VerifySimulation, balise *repository.Transponder) *sys_error.BusinessError {
entry, _ := entity.GetEntityByUid(simulation.World, balise.Id())
component.KmType.Set(entry, balise.Km())
component.LinkPositionType.SetValue(entry, component_data.LinkPosition{
LinkId: balise.LinkPosition().Link().Id(),
Offset: balise.LinkPosition().Offset(),
})
return nil
}
func baliseTelegramReset(simulation *VerifySimulation, balise *repository.Transponder) *sys_error.BusinessError {
entry, _ := entity.GetEntityByUid(simulation.World, balise.Id())
return sendEcsRequest(simulation.World, func() error {
component.BaliseFixedTelegramType.SetValue(entry, component.BaliseTelegram{
Telegram: balise.FixedTelegram(),
UserTelegram: balise.FixedUserTelegram(),
})
if entry.HasComponent(component.BaliseVariableTelegramType) {
component.BaliseVariableTelegramType.SetValue(entry, component.BaliseTelegram{})
}
return nil
})
}
func sendEcsRequest(w ecs.World, request func() error) *sys_error.BusinessError {
result := <-ecs.Request(w, func() ecs.Result[ecs.EmptyType] {
err := handler()
err := request()
if err != nil {
return ecs.NewErrResult(err)
}