Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtsts-server-go
# Conflicts: # ts/simulation/wayside/memory/wayside_memory_map_init.go
This commit is contained in:
commit
d9e7a130d3
@ -29,7 +29,7 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
|||||||
authed.POST("/check/data", checkSimMapData)
|
authed.POST("/check/data", checkSimMapData)
|
||||||
authed.POST("/train/add", addTrain)
|
authed.POST("/train/add", addTrain)
|
||||||
authed.POST("/train/remove", removeTrain)
|
authed.POST("/train/remove", removeTrain)
|
||||||
authed.POST("/switch/operation", switchOperation)
|
authed.POST("/switch/operation", turnoutOperation)
|
||||||
authed.POST("/relay/operation", relayOperation)
|
authed.POST("/relay/operation", relayOperation)
|
||||||
authed.POST("/signal/operation", signalOperation)
|
authed.POST("/signal/operation", signalOperation)
|
||||||
authed.POST("/axleSection/operation", axleSectionOperation)
|
authed.POST("/axleSection/operation", axleSectionOperation)
|
||||||
@ -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()
|
||||||
@ -248,7 +249,7 @@ func removeTrain(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/switch/operation [post]
|
// @Router /api/v1/simulation/switch/operation [post]
|
||||||
func switchOperation(c *gin.Context) {
|
func turnoutOperation(c *gin.Context) {
|
||||||
req := &request_proto.TurnoutOperationReq{}
|
req := &request_proto.TurnoutOperationReq{}
|
||||||
if err := c.ShouldBind(&req); err != nil {
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
panic(sys_error.New("道岔操作失败,请求参数异常", err))
|
panic(sys_error.New("道岔操作失败,请求参数异常", err))
|
||||||
@ -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 获取仿真地图的公里标范围
|
||||||
|
215
docs/docs.go
215
docs/docs.go
@ -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": [
|
||||||
|
@ -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": [
|
||||||
|
@ -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:
|
||||||
|
@ -13,6 +13,7 @@ const (
|
|||||||
// DataOperationError 数据操作错误(增删改查操作出了意料之外的错误都算)
|
// DataOperationError 数据操作错误(增删改查操作出了意料之外的错误都算)
|
||||||
DataOperationError = 2002
|
DataOperationError = 2002
|
||||||
ArgumentParseError = 3000
|
ArgumentParseError = 3000
|
||||||
|
ArgumentError = 3001 //参数错误。指参数对应的数据不存在等情况
|
||||||
|
|
||||||
NoAuthOperationError = 4001
|
NoAuthOperationError = 4001
|
||||||
|
|
||||||
|
@ -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,
|
||||||
},
|
},
|
||||||
|
@ -109,8 +109,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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,6 +263,21 @@ func (ms *SfpMs) collectTurnoutStates() ([]*state.SwitchState, error) {
|
|||||||
Dw: pos.Dw,
|
Dw: pos.Dw,
|
||||||
Fw: pos.Fw,
|
Fw: pos.Fw,
|
||||||
}
|
}
|
||||||
|
// 强制(联锁驱动无效)
|
||||||
|
s.Force = entry.HasComponent(component.TurnoutFaultCiqdType)
|
||||||
|
// 失表
|
||||||
|
s.Sb = entry.HasComponent(component.TurnoutFaultSbType)
|
||||||
|
// 定位失表
|
||||||
|
s.Dwsb = entry.HasComponent(component.TurnoutFaultDwsbType)
|
||||||
|
// 反位失表
|
||||||
|
s.Fwsb = entry.HasComponent(component.TurnoutFaultFwsbType)
|
||||||
|
// 挤岔
|
||||||
|
s.Jc = entry.HasComponent(component.TurnoutFaultJcType)
|
||||||
|
|
||||||
|
// if entry.HasComponent(component.Zdj9TwoElectronicType) {
|
||||||
|
// elec := component.Zdj9TwoElectronicType.Get(entry)
|
||||||
|
|
||||||
|
// }
|
||||||
switchArr = append(switchArr, s)
|
switchArr = append(switchArr, s)
|
||||||
}
|
}
|
||||||
return switchArr, nil
|
return switchArr, nil
|
||||||
|
Binary file not shown.
@ -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 8cf9e419b8a67ce1102870e0a8342cb3fb2f2a6c
|
29
third_party/balise/codec.go
vendored
Normal file
29
third_party/balise/codec.go
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package balise
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// 应答器数据编解码器
|
||||||
|
type Codec interface {
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
Bytes1023 = 128
|
||||||
|
Bytes341 = 43
|
||||||
|
)
|
||||||
|
|
||||||
|
// 解码应答器数据,1023/341位解码
|
||||||
|
// bys - 128/43字节数据
|
||||||
|
// return - 830/210位数据
|
||||||
|
func Decode(bys []byte) ([]int, error) {
|
||||||
|
size := len(bys)
|
||||||
|
|
||||||
|
if size == Bytes1023 {
|
||||||
|
// 1023应答器解码
|
||||||
|
return nil, nil
|
||||||
|
} else if size == Bytes341 {
|
||||||
|
// 341应答器解码
|
||||||
|
return nil, nil
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("不支持的应答器类型")
|
||||||
|
}
|
||||||
|
}
|
173
third_party/balise/conv.go
vendored
Normal file
173
third_party/balise/conv.go
vendored
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
package balise
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ConvWords = []uint16{
|
||||||
|
0o0101, 0o0102, 0o0103, 0o0104, 0o0105, 0o0106, 0o0107, 0o0110, 0o0111, 0o0112,
|
||||||
|
0o0113, 0o0114, 0o0115, 0o0116, 0o0117, 0o0120, 0o0121, 0o0122, 0o0123, 0o0124,
|
||||||
|
0o0125, 0o0126, 0o0127, 0o0130, 0o0131, 0o0132, 0o0133, 0o0134, 0o0135, 0o0141,
|
||||||
|
0o0142, 0o0143, 0o0144, 0o0145, 0o0146, 0o0147, 0o0150, 0o0151, 0o0152, 0o0153,
|
||||||
|
0o0154, 0o0155, 0o0156, 0o0157, 0o0160, 0o0161, 0o0162, 0o0163, 0o0164, 0o0165,
|
||||||
|
0o0166, 0o0167, 0o0170, 0o0171, 0o0172, 0o0173, 0o0174, 0o0175, 0o0176, 0o0201,
|
||||||
|
0o0206, 0o0211, 0o0214, 0o0216, 0o0217, 0o0220, 0o0222, 0o0223, 0o0224, 0o0225,
|
||||||
|
0o0226, 0o0231, 0o0233, 0o0244, 0o0245, 0o0246, 0o0253, 0o0257, 0o0260, 0o0261,
|
||||||
|
0o0272, 0o0273, 0o0274, 0o0275, 0o0276, 0o0301, 0o0303, 0o0315, 0o0317, 0o0320,
|
||||||
|
0o0321, 0o0332, 0o0334, 0o0341, 0o0342, 0o0343, 0o0344, 0o0346, 0o0352, 0o0353,
|
||||||
|
0o0357, 0o0360, 0o0374, 0o0376, 0o0401, 0o0403, 0o0404, 0o0405, 0o0406, 0o0407,
|
||||||
|
0o0410, 0o0411, 0o0412, 0o0413, 0o0416, 0o0417, 0o0420, 0o0424, 0o0425, 0o0426,
|
||||||
|
0o0427, 0o0432, 0o0433, 0o0442, 0o0443, 0o0445, 0o0456, 0o0457, 0o0460, 0o0461,
|
||||||
|
0o0464, 0o0465, 0o0470, 0o0471, 0o0472, 0o0474, 0o0475, 0o0476, 0o0501, 0o0502,
|
||||||
|
0o0503, 0o0504, 0o0505, 0o0506, 0o0507, 0o0516, 0o0517, 0o0520, 0o0521, 0o0522,
|
||||||
|
0o0523, 0o0524, 0o0525, 0o0530, 0o0531, 0o0532, 0o0533, 0o0534, 0o0535, 0o0544,
|
||||||
|
0o0545, 0o0546, 0o0547, 0o0550, 0o0551, 0o0552, 0o0553, 0o0554, 0o0555, 0o0556,
|
||||||
|
0o0557, 0o0560, 0o0561, 0o0562, 0o0563, 0o0571, 0o0573, 0o0576, 0o0601, 0o0602,
|
||||||
|
0o0604, 0o0605, 0o0610, 0o0611, 0o0612, 0o0613, 0o0614, 0o0615, 0o0616, 0o0617,
|
||||||
|
0o0620, 0o0621, 0o0622, 0o0623, 0o0624, 0o0625, 0o0626, 0o0627, 0o0630, 0o0634,
|
||||||
|
0o0635, 0o0644, 0o0645, 0o0646, 0o0647, 0o0650, 0o0651, 0o0652, 0o0653, 0o0654,
|
||||||
|
0o0655, 0o0656, 0o0657, 0o0660, 0o0661, 0o0662, 0o0663, 0o0666, 0o0667, 0o0672,
|
||||||
|
0o0674, 0o0675, 0o0676, 0o0701, 0o0712, 0o0713, 0o0716, 0o0717, 0o0720, 0o0721,
|
||||||
|
0o0722, 0o0723, 0o0730, 0o0731, 0o0732, 0o0733, 0o0734, 0o0735, 0o0742, 0o0743,
|
||||||
|
0o0744, 0o0745, 0o0746, 0o0747, 0o0750, 0o0751, 0o0752, 0o0753, 0o0754, 0o0755,
|
||||||
|
0o0756, 0o0757, 0o0760, 0o0761, 0o0764, 0o0765, 0o0766, 0o0767, 0o0772, 0o0773,
|
||||||
|
0o0776, 0o1001, 0o1004, 0o1005, 0o1016, 0o1017, 0o1020, 0o1021, 0o1022, 0o1023,
|
||||||
|
0o1024, 0o1025, 0o1030, 0o1031, 0o1032, 0o1033, 0o1034, 0o1035, 0o1043, 0o1044,
|
||||||
|
0o1045, 0o1046, 0o1047, 0o1054, 0o1057, 0o1060, 0o1061, 0o1062, 0o1075, 0o1076,
|
||||||
|
0o1101, 0o1102, 0o1103, 0o1110, 0o1114, 0o1115, 0o1116, 0o1117, 0o1120, 0o1121,
|
||||||
|
0o1122, 0o1123, 0o1124, 0o1125, 0o1126, 0o1127, 0o1130, 0o1131, 0o1132, 0o1133,
|
||||||
|
0o1142, 0o1143, 0o1144, 0o1145, 0o1146, 0o1147, 0o1151, 0o1152, 0o1153, 0o1154,
|
||||||
|
0o1155, 0o1156, 0o1157, 0o1160, 0o1164, 0o1166, 0o1167, 0o1176, 0o1201, 0o1214,
|
||||||
|
0o1217, 0o1220, 0o1221, 0o1222, 0o1223, 0o1224, 0o1225, 0o1226, 0o1227, 0o1230,
|
||||||
|
0o1231, 0o1232, 0o1233, 0o1243, 0o1244, 0o1245, 0o1253, 0o1254, 0o1255, 0o1256,
|
||||||
|
0o1257, 0o1260, 0o1261, 0o1272, 0o1273, 0o1274, 0o1275, 0o1276, 0o1301, 0o1302,
|
||||||
|
0o1303, 0o1305, 0o1306, 0o1307, 0o1317, 0o1320, 0o1321, 0o1332, 0o1334, 0o1335,
|
||||||
|
0o1342, 0o1343, 0o1344, 0o1345, 0o1350, 0o1351, 0o1352, 0o1353, 0o1355, 0o1356,
|
||||||
|
0o1357, 0o1360, 0o1361, 0o1364, 0o1365, 0o1370, 0o1371, 0o1372, 0o1373, 0o1374,
|
||||||
|
0o1376, 0o1401, 0o1403, 0o1406, 0o1407, 0o1414, 0o1415, 0o1416, 0o1417, 0o1420,
|
||||||
|
0o1424, 0o1425, 0o1431, 0o1433, 0o1434, 0o1435, 0o1443, 0o1445, 0o1456, 0o1457,
|
||||||
|
0o1460, 0o1462, 0o1474, 0o1475, 0o1476, 0o1501, 0o1502, 0o1503, 0o1504, 0o1505,
|
||||||
|
0o1516, 0o1517, 0o1520, 0o1524, 0o1532, 0o1533, 0o1544, 0o1546, 0o1550, 0o1551,
|
||||||
|
0o1552, 0o1553, 0o1554, 0o1557, 0o1560, 0o1561, 0o1562, 0o1563, 0o1566, 0o1567,
|
||||||
|
0o1576, 0o1601, 0o1603, 0o1604, 0o1605, 0o1606, 0o1607, 0o1610, 0o1611, 0o1612,
|
||||||
|
0o1613, 0o1614, 0o1615, 0o1616, 0o1617, 0o1620, 0o1621, 0o1622, 0o1623, 0o1624,
|
||||||
|
0o1625, 0o1626, 0o1630, 0o1631, 0o1632, 0o1633, 0o1635, 0o1643, 0o1644, 0o1645,
|
||||||
|
0o1650, 0o1651, 0o1652, 0o1653, 0o1654, 0o1655, 0o1656, 0o1657, 0o1660, 0o1661,
|
||||||
|
0o1672, 0o1674, 0o1675, 0o1676, 0o1701, 0o1720, 0o1744, 0o1745, 0o1746, 0o1747,
|
||||||
|
0o1750, 0o1751, 0o1752, 0o1753, 0o1754, 0o1755, 0o1756, 0o1757, 0o1760, 0o1761,
|
||||||
|
0o1762, 0o1763, 0o1764, 0o1765, 0o1766, 0o1767, 0o1770, 0o1771, 0o1772, 0o1773,
|
||||||
|
0o1774, 0o1775, 0o2002, 0o2003, 0o2004, 0o2005, 0o2006, 0o2007, 0o2010, 0o2011,
|
||||||
|
0o2012, 0o2013, 0o2014, 0o2015, 0o2016, 0o2017, 0o2020, 0o2021, 0o2022, 0o2023,
|
||||||
|
0o2024, 0o2025, 0o2026, 0o2027, 0o2030, 0o2031, 0o2032, 0o2033, 0o2057, 0o2076,
|
||||||
|
0o2101, 0o2102, 0o2103, 0o2105, 0o2116, 0o2117, 0o2120, 0o2121, 0o2122, 0o2123,
|
||||||
|
0o2124, 0o2125, 0o2126, 0o2127, 0o2132, 0o2133, 0o2134, 0o2142, 0o2144, 0o2145,
|
||||||
|
0o2146, 0o2147, 0o2151, 0o2152, 0o2153, 0o2154, 0o2155, 0o2156, 0o2157, 0o2160,
|
||||||
|
0o2161, 0o2162, 0o2163, 0o2164, 0o2165, 0o2166, 0o2167, 0o2170, 0o2171, 0o2172,
|
||||||
|
0o2173, 0o2174, 0o2176, 0o2201, 0o2210, 0o2211, 0o2214, 0o2215, 0o2216, 0o2217,
|
||||||
|
0o2220, 0o2223, 0o2224, 0o2225, 0o2226, 0o2227, 0o2231, 0o2233, 0o2244, 0o2245,
|
||||||
|
0o2253, 0o2257, 0o2260, 0o2261, 0o2272, 0o2273, 0o2274, 0o2275, 0o2276, 0o2301,
|
||||||
|
0o2302, 0o2303, 0o2315, 0o2317, 0o2320, 0o2321, 0o2332, 0o2334, 0o2342, 0o2343,
|
||||||
|
0o2344, 0o2346, 0o2352, 0o2353, 0o2357, 0o2360, 0o2361, 0o2362, 0o2363, 0o2370,
|
||||||
|
0o2371, 0o2374, 0o2376, 0o2401, 0o2403, 0o2404, 0o2405, 0o2406, 0o2407, 0o2412,
|
||||||
|
0o2413, 0o2416, 0o2417, 0o2420, 0o2421, 0o2422, 0o2424, 0o2425, 0o2426, 0o2427,
|
||||||
|
0o2432, 0o2433, 0o2434, 0o2435, 0o2442, 0o2443, 0o2445, 0o2456, 0o2457, 0o2460,
|
||||||
|
0o2470, 0o2471, 0o2472, 0o2474, 0o2475, 0o2476, 0o2501, 0o2502, 0o2503, 0o2504,
|
||||||
|
0o2505, 0o2516, 0o2517, 0o2520, 0o2521, 0o2522, 0o2523, 0o2524, 0o2532, 0o2533,
|
||||||
|
0o2534, 0o2544, 0o2545, 0o2546, 0o2547, 0o2550, 0o2551, 0o2552, 0o2553, 0o2554,
|
||||||
|
0o2555, 0o2556, 0o2557, 0o2560, 0o2563, 0o2576, 0o2601, 0o2610, 0o2611, 0o2613,
|
||||||
|
0o2617, 0o2620, 0o2621, 0o2622, 0o2623, 0o2624, 0o2625, 0o2626, 0o2630, 0o2631,
|
||||||
|
0o2632, 0o2633, 0o2634, 0o2635, 0o2644, 0o2645, 0o2646, 0o2647, 0o2650, 0o2651,
|
||||||
|
0o2652, 0o2653, 0o2654, 0o2655, 0o2656, 0o2657, 0o2660, 0o2661, 0o2662, 0o2663,
|
||||||
|
0o2667, 0o2674, 0o2675, 0o2676, 0o2701, 0o2702, 0o2715, 0o2716, 0o2717, 0o2720,
|
||||||
|
0o2723, 0o2730, 0o2731, 0o2732, 0o2733, 0o2734, 0o2742, 0o2743, 0o2744, 0o2745,
|
||||||
|
0o2746, 0o2747, 0o2752, 0o2753, 0o2754, 0o2755, 0o2756, 0o2757, 0o2760, 0o2761,
|
||||||
|
0o2772, 0o2773, 0o2776, 0o3001, 0o3004, 0o3005, 0o3010, 0o3011, 0o3012, 0o3013,
|
||||||
|
0o3016, 0o3017, 0o3020, 0o3021, 0o3022, 0o3023, 0o3024, 0o3025, 0o3026, 0o3027,
|
||||||
|
0o3030, 0o3031, 0o3032, 0o3033, 0o3034, 0o3035, 0o3042, 0o3043, 0o3044, 0o3045,
|
||||||
|
0o3046, 0o3047, 0o3054, 0o3055, 0o3056, 0o3057, 0o3060, 0o3061, 0o3064, 0o3065,
|
||||||
|
0o3076, 0o3101, 0o3102, 0o3103, 0o3105, 0o3110, 0o3111, 0o3114, 0o3115, 0o3116,
|
||||||
|
0o3117, 0o3120, 0o3121, 0o3122, 0o3123, 0o3124, 0o3125, 0o3126, 0o3127, 0o3130,
|
||||||
|
0o3131, 0o3132, 0o3133, 0o3142, 0o3143, 0o3147, 0o3150, 0o3151, 0o3152, 0o3153,
|
||||||
|
0o3154, 0o3155, 0o3156, 0o3157, 0o3160, 0o3161, 0o3162, 0o3163, 0o3164, 0o3165,
|
||||||
|
0o3166, 0o3167, 0o3172, 0o3173, 0o3175, 0o3176, 0o3201, 0o3204, 0o3206, 0o3214,
|
||||||
|
0o3215, 0o3216, 0o3217, 0o3220, 0o3221, 0o3222, 0o3223, 0o3224, 0o3225, 0o3226,
|
||||||
|
0o3227, 0o3230, 0o3231, 0o3232, 0o3233, 0o3242, 0o3243, 0o3244, 0o3245, 0o3246,
|
||||||
|
0o3247, 0o3252, 0o3253, 0o3254, 0o3255, 0o3256, 0o3257, 0o3260, 0o3261, 0o3270,
|
||||||
|
0o3271, 0o3272, 0o3273, 0o3274, 0o3275, 0o3276, 0o3301, 0o3302, 0o3303, 0o3305,
|
||||||
|
0o3306, 0o3307, 0o3312, 0o3313, 0o3316, 0o3317, 0o3320, 0o3321, 0o3332, 0o3334,
|
||||||
|
0o3335, 0o3344, 0o3345, 0o3350, 0o3351, 0o3352, 0o3353, 0o3357, 0o3360, 0o3361,
|
||||||
|
0o3364, 0o3365, 0o3366, 0o3367, 0o3370, 0o3371, 0o3372, 0o3373, 0o3374, 0o3376,
|
||||||
|
0o3401, 0o3403, 0o3417, 0o3420, 0o3424, 0o3425, 0o3431, 0o3433, 0o3434, 0o3435,
|
||||||
|
0o3436, 0o3443, 0o3445, 0o3456, 0o3457, 0o3460, 0o3462, 0o3474, 0o3476, 0o3501,
|
||||||
|
0o3502, 0o3503, 0o3504, 0o3505, 0o3516, 0o3517, 0o3520, 0o3524, 0o3531, 0o3532,
|
||||||
|
0o3533, 0o3544, 0o3546, 0o3551, 0o3552, 0o3553, 0o3554, 0o3555, 0o3557, 0o3560,
|
||||||
|
0o3561, 0o3563, 0o3566, 0o3571, 0o3576, 0o3601, 0o3602, 0o3603, 0o3604, 0o3605,
|
||||||
|
0o3606, 0o3607, 0o3610, 0o3611, 0o3612, 0o3613, 0o3614, 0o3615, 0o3616, 0o3617,
|
||||||
|
0o3620, 0o3621, 0o3622, 0o3623, 0o3624, 0o3625, 0o3626, 0o3627, 0o3630, 0o3631,
|
||||||
|
0o3632, 0o3633, 0o3634, 0o3635, 0o3636, 0o3642, 0o3643, 0o3644, 0o3645, 0o3646,
|
||||||
|
0o3647, 0o3650, 0o3651, 0o3652, 0o3653, 0o3654, 0o3655, 0o3656, 0o3657, 0o3660,
|
||||||
|
0o3661, 0o3662, 0o3663, 0o3664, 0o3665, 0o3666, 0o3667, 0o3670, 0o3671, 0o3672,
|
||||||
|
0o3673, 0o3674, 0o3675, 0o3676,
|
||||||
|
}
|
||||||
|
|
||||||
|
var convWordMap = make(map[uint16]int, 1024)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
for i, v := range ConvWords {
|
||||||
|
convWordMap[v] = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// bit数组转换为数字,左边为最高有效位
|
||||||
|
// v - 0/1数组,数组的每个值都只能是0或1
|
||||||
|
func ToVal(v []int) uint16 {
|
||||||
|
if len(v) > 15 {
|
||||||
|
panic(fmt.Errorf("不支持15位以上"))
|
||||||
|
}
|
||||||
|
val := uint16(0)
|
||||||
|
l := len(v)
|
||||||
|
for i := 0; i < l; i++ {
|
||||||
|
if v[i] == 1 {
|
||||||
|
val += (1 << (l - i - 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数字转换为bit数组,左边为最高有效位
|
||||||
|
func ToBits(val int, count int) []int {
|
||||||
|
bs := make([]int, count)
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
tmp := 1 << (count - 1 - i)
|
||||||
|
if (val & (tmp)) == (tmp) {
|
||||||
|
bs[i] = 1
|
||||||
|
} else {
|
||||||
|
bs[i] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bs
|
||||||
|
}
|
||||||
|
|
||||||
|
// 11位字转换回10位字
|
||||||
|
func From11(b11 []int) ([]int, error) {
|
||||||
|
v11 := ToVal(b11)
|
||||||
|
v10, ok := convWordMap[uint16(v11)]
|
||||||
|
if ok {
|
||||||
|
return ToBits(v10, 10), nil
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("错误的11位字")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 10位字转换为11位字
|
||||||
|
func To11(b10 []int) []int {
|
||||||
|
if len(b10) != 10 {
|
||||||
|
panic(fmt.Errorf("应答器编码10位字转换为11位字参数异常: 位数不是10, len=%d", len(b10)))
|
||||||
|
}
|
||||||
|
v10 := ToVal(b10)
|
||||||
|
if v10 > 1023 {
|
||||||
|
panic(fmt.Errorf("应答器编码10位字转换为11位字参数异常: 10位字转为整数不能大于1023, v10=%d", v10))
|
||||||
|
}
|
||||||
|
v11 := ConvWords[v10]
|
||||||
|
return ToBits(int(v11), 11)
|
||||||
|
}
|
44
third_party/balise/conv_test.go
vendored
Normal file
44
third_party/balise/conv_test.go
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package balise_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"joylink.club/bj-rtsts-server/third_party/balise"
|
||||||
|
)
|
||||||
|
|
||||||
|
var by830 = []int{
|
||||||
|
0x90, 0x02, 0x7F, 0xC7, 0x8C, 0x0A, 0xC5, 0x40, 0x7B, 0x20, 0x00, 0x21, 0x68, 0x05, 0x9A, 0x04, 0x09, 0x61, 0x0B, 0x0A,
|
||||||
|
0xF0, 0x05, 0x0B, 0xB9, 0x05, 0x0E, 0xD8, 0x03, 0x1E, 0xDD, 0x09, 0x09, 0xC4, 0x09, 0x0D, 0x4E, 0xFF, 0x1B, 0x00, 0xAC,
|
||||||
|
0x80, 0x00, 0x64, 0x00, 0x5A, 0x9A, 0x7F, 0x00, 0xB0, 0x0D, 0x68, 0x04, 0x0C, 0xB2, 0x00, 0x00, 0xC2, 0x00, 0x75, 0xC0,
|
||||||
|
0x30, 0x74, 0x86, 0x10, 0x74, 0xA0, 0x30, 0x78, 0x66, 0x10, 0x78, 0x60, 0x30, 0x75, 0x26, 0x10, 0x75, 0x20, 0x30, 0x79,
|
||||||
|
0x86, 0x10, 0x79, 0x80, 0x30, 0x7A, 0x06, 0x10, 0x7A, 0x00, 0x30, 0x7C, 0x46, 0x10, 0x7C, 0x60, 0x30, 0x7C, 0xA6, 0x10,
|
||||||
|
0x82, 0x9F, 0xFF, 0xFF,
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestConvList(t *testing.T) {
|
||||||
|
// 数量
|
||||||
|
assert.Equal(t, 1024, len(balise.ConvWords))
|
||||||
|
// 后面的数比前面大
|
||||||
|
for i := 0; i < 1023; i++ {
|
||||||
|
assert.Less(t, balise.ConvWords[i], balise.ConvWords[i+1])
|
||||||
|
}
|
||||||
|
// 前512项和
|
||||||
|
sum_q := 0
|
||||||
|
for i := 0; i < 512; i++ {
|
||||||
|
sum_q += int(balise.ConvWords[i])
|
||||||
|
}
|
||||||
|
assert.Equal(t, 267528, sum_q)
|
||||||
|
// 后512项和
|
||||||
|
sum_b := 0
|
||||||
|
for i := 512; i < 1024; i++ {
|
||||||
|
sum_b += int(balise.ConvWords[i])
|
||||||
|
}
|
||||||
|
// 总1024项和
|
||||||
|
assert.Equal(t, 1048064, sum_q+sum_b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTo11(t *testing.T) {
|
||||||
|
b10 := []int{0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
|
||||||
|
balise.To11(b10)
|
||||||
|
}
|
23
third_party/example/main.go
vendored
23
third_party/example/main.go
vendored
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"time"
|
|
||||||
|
|
||||||
"joylink.club/bj-rtsts-server/third_party/udp"
|
"joylink.club/bj-rtsts-server/third_party/balise"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestMsg struct {
|
type TestMsg struct {
|
||||||
@ -29,7 +29,7 @@ func handleUdpMsg(b []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
udp.NewServer("127.0.0.1:6666", handleUdpMsg).Listen()
|
// udp.NewServer("127.0.0.1:6666", handleUdpMsg).Listen()
|
||||||
|
|
||||||
// client := udp.NewClient("127.0.0.1:7777")
|
// client := udp.NewClient("127.0.0.1:7777")
|
||||||
// for i := 0; i < 1000; i++ {
|
// for i := 0; i < 1000; i++ {
|
||||||
@ -39,5 +39,20 @@ func main() {
|
|||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|
||||||
time.Sleep(time.Second * 60)
|
// time.Sleep(time.Second * 60)
|
||||||
|
// for i, v := range balise.ConvWords {
|
||||||
|
// fmt.Printf("0%o,", v)
|
||||||
|
// if i%10 == 9 {
|
||||||
|
// fmt.Println()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
v10 := balise.ToVal([]int{
|
||||||
|
1, 1, 1,
|
||||||
|
1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1})
|
||||||
|
fmt.Println(v10)
|
||||||
|
bs := balise.ToBits(1982, 11)
|
||||||
|
fmt.Println(bs)
|
||||||
|
// fmt.Printf("%o\n", balise.ConvWords[511])
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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 (
|
||||||
|
@ -350,6 +350,8 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
|
|||||||
return (uidData.(*StationUidStructure)).StationIds
|
return (uidData.(*StationUidStructure)).StationIds
|
||||||
case *graphicData.SpksSwitch:
|
case *graphicData.SpksSwitch:
|
||||||
return (uidData.(*StationUidStructure)).SpksSwitchIds
|
return (uidData.(*StationUidStructure)).SpksSwitchIds
|
||||||
|
case *graphicData.ScreenDoor:
|
||||||
|
return (uidData.(*StationUidStructure)).PsdIds
|
||||||
default:
|
default:
|
||||||
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
|
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
110
ts/simulation/wayside/memory/wayside_memory_psd_test.go
Normal file
110
ts/simulation/wayside/memory/wayside_memory_psd_test.go
Normal 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:
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -34,6 +34,12 @@ func HandleTurnoutOperation(simulation *VerifySimulation, req *request_proto.Tur
|
|||||||
fi.SetTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
fi.SetTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
||||||
case request_proto.Turnout_CancelJC:
|
case request_proto.Turnout_CancelJC:
|
||||||
fi.CancelTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
fi.CancelTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
||||||
|
case request_proto.Turnout_ForceDw:
|
||||||
|
fi.ForceTurnoutDw(simulation.World, uid)
|
||||||
|
case request_proto.Turnout_ForceFw:
|
||||||
|
fi.ForceTurnoutFw(simulation.World, uid)
|
||||||
|
case request_proto.Turnout_CancelForce:
|
||||||
|
fi.CancelTurnoutForce(simulation.World, uid)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
|
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
|
||||||
}
|
}
|
||||||
|
@ -481,12 +481,14 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
|
|||||||
city := relayGi.UniqueIdPrefix.City
|
city := relayGi.UniqueIdPrefix.City
|
||||||
lineId := relayGi.UniqueIdPrefix.LineId
|
lineId := relayGi.UniqueIdPrefix.LineId
|
||||||
station := relayGi.UniqueIdPrefix.BelongsConcentrationStation
|
station := relayGi.UniqueIdPrefix.BelongsConcentrationStation
|
||||||
|
stationUid := GenerateElementUid(city, lineId, nil, station)
|
||||||
relayMap := make(map[string]*proto.Relay)
|
relayMap := make(map[string]*proto.Relay)
|
||||||
for _, relay := range relayGi.Relays {
|
for _, relay := range relayGi.Relays {
|
||||||
repoRelay := &proto.Relay{
|
repoRelay := &proto.Relay{
|
||||||
Id: uidsMap.RelayIds[relay.Common.Id].Uid,
|
Id: uidsMap.RelayIds[relay.Common.Id].Uid,
|
||||||
Code: relay.Code,
|
Code: relay.Code,
|
||||||
Model: convertRelayModel(relay.NewModel),
|
Model: convertRelayModel(relay.NewModel),
|
||||||
|
StationId: stationUid,
|
||||||
}
|
}
|
||||||
repo.Relays = append(repo.Relays, repoRelay)
|
repo.Relays = append(repo.Relays, repoRelay)
|
||||||
relayMap[repoRelay.Id] = repoRelay
|
relayMap[repoRelay.Id] = repoRelay
|
||||||
|
Loading…
Reference in New Issue
Block a user