修改proto文件编译逻辑;修改proto文件编译位置并修改其它文件对生成的文件的引用

This commit is contained in:
joylink_zhangsai 2024-01-11 10:24:56 +08:00
parent d4f8d3416f
commit 49ec42e546
39 changed files with 561 additions and 447 deletions

View File

@ -11,13 +11,13 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/middleware" "joylink.club/bj-rtsts-server/middleware"
"joylink.club/bj-rtsts-server/service" "joylink.club/bj-rtsts-server/service"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/ts" "joylink.club/bj-rtsts-server/ts"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory" "joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
) )
@ -85,7 +85,7 @@ func createByProjectId(c *gin.Context) {
} }
var mapIds []int32 var mapIds []int32
for _, mapInfo := range mapInfos { for _, mapInfo := range mapInfos {
if mapInfo.Type == graphicData.PictureType_value[graphicData.PictureType_TrainData.String()] { if mapInfo.Type == data_proto.PictureType_value[data_proto.PictureType_TrainData.String()] {
continue continue
} }
mapIds = append(mapIds, mapInfo.ID) mapIds = append(mapIds, mapInfo.ID)
@ -167,7 +167,7 @@ func checkSimMapData(c *gin.Context) {
if err := c.ShouldBind(&rt); nil != err { if err := c.ShouldBind(&rt); nil != err {
panic(sys_error.New("请求参数异常", err)) panic(sys_error.New("请求参数异常", err))
} }
err := proto.Unmarshal(rt.Data, &graphicData.RtssGraphicStorage{}) err := proto.Unmarshal(rt.Data, &data_proto.RtssGraphicStorage{})
if err != nil { if err != nil {
panic(sys_error.New("非平面布置图数据")) panic(sys_error.New("非平面布置图数据"))
} }
@ -199,7 +199,7 @@ func addTrain(c *gin.Context) {
if id == -1 { if id == -1 {
panic(sys_error.New("添加列车失败,已有列车在运行")) panic(sys_error.New("添加列车失败,已有列车在运行"))
} }
rsp := &state.TrainState{ rsp := &state_proto.TrainState{
Id: strconv.Itoa(id), Id: strconv.Itoa(id),
HeadDeviceId: req.Id, HeadDeviceId: req.Id,
HeadOffset: req.HeadOffset, HeadOffset: req.HeadOffset,
@ -233,7 +233,7 @@ func updateTrain(c *gin.Context) {
panic(sys_error.New("添加列车失败,请求参数异常", err)) panic(sys_error.New("添加列车失败,请求参数异常", err))
} }
simulation := checkDeviceDataAndReturn(req.SimulationId) simulation := checkDeviceDataAndReturn(req.SimulationId)
rsp := &state.TrainState{ rsp := &state_proto.TrainState{
Id: req.Id, Id: req.Id,
TrainLength: req.TrainLength, TrainLength: req.TrainLength,
WheelDiameter: req.WheelDiameter, WheelDiameter: req.WheelDiameter,
@ -683,19 +683,19 @@ func baliseTelegramReset(c *gin.Context) {
// @Tags ATS测试仿真Api // @Tags ATS测试仿真Api
// @Accept json // @Accept json
// @Param Authorization header string true "JWT Token" // @Param Authorization header string true "JWT Token"
// @Param BaliseReqDto body dto.BaliseReqDto true "重置应答器状态" // @Param simulationId query string true "重置应答器状态"
// //
// @Success 200 {object} string // @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/balise/reset [put] // @Router /api/v1/simulation/balise/reset [put]
func baliseReset(c *gin.Context) { func baliseReset(c *gin.Context) {
req := &dto.BaliseReqDto{} //req := &dto.BaliseReqDto{}
if err := c.ShouldBind(&req); err != nil { //if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器状态重置操作失败,请求参数异常", err)) // panic(sys_error.New("应答器状态重置操作失败,请求参数异常", err))
} //}
simulation := checkDeviceDataAndReturn(req.SimulationId) simulationId := c.Query("simulationId")
slog.Info("传入状态参数", req) simulation := checkDeviceDataAndReturn(simulationId)
err := memory.BaliseReset(simulation, req) err := memory.BaliseReset(simulation)
if err != nil { if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器状态重置操作失败,%s", err.Error()), err)) panic(sys_error.New(fmt.Sprintf("应答器状态重置操作失败,%s", err.Error()), err))
} }

@ -1 +1 @@
Subproject commit 19d48ccabcf1aa93ba5c65e61f7b623fe584bb77 Subproject commit 1a21f13ccef1c7b274b9b5b7d704dc3bfe8660a5

View File

@ -3397,13 +3397,11 @@ const docTemplate = `{
"required": true "required": true
}, },
{ {
"type": "string",
"description": "重置应答器状态", "description": "重置应答器状态",
"name": "BaliseReqDto", "name": "simulationId",
"in": "body", "in": "query",
"required": true, "required": true
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
} }
], ],
"responses": { "responses": {

View File

@ -3390,13 +3390,11 @@
"required": true "required": true
}, },
{ {
"type": "string",
"description": "重置应答器状态", "description": "重置应答器状态",
"name": "BaliseReqDto", "name": "simulationId",
"in": "body", "in": "query",
"required": true, "required": true
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
} }
], ],
"responses": { "responses": {

View File

@ -3038,11 +3038,10 @@ paths:
required: true required: true
type: string type: string
- description: 重置应答器状态 - description: 重置应答器状态
in: body in: query
name: BaliseReqDto name: simulationId
required: true required: true
schema: type: string
$ref: '#/definitions/dto.BaliseReqDto'
responses: responses:
"200": "200":
description: OK description: OK

View File

@ -4,7 +4,7 @@
// protoc v4.23.1 // protoc v4.23.1
// source: ibpGraphics.proto // source: ibpGraphics.proto
package graphicData package data_proto
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -986,9 +986,11 @@ var file_ibpGraphics_proto_rawDesc = []byte{
0x10, 0x02, 0x22, 0x36, 0x0a, 0x13, 0x49, 0x62, 0x70, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x02, 0x22, 0x36, 0x0a, 0x13, 0x49, 0x62, 0x70, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x54, 0x65, 0x78, 0x74, 0x41, 0x6c, 0x69, 0x67, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x65, 0x78, 0x74, 0x41, 0x6c, 0x69, 0x67, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46,
0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x12, 0x0a,
0x0a, 0x06, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x02, 0x42, 0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x0a, 0x06, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x02, 0x42, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f,
0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74,
0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64,
0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
} }
var ( var (

View File

@ -4,7 +4,7 @@
// protoc v4.23.1 // protoc v4.23.1
// source: picture.proto // source: picture.proto
package graphicData package data_proto
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -89,9 +89,11 @@ var file_picture_proto_rawDesc = []byte{
0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x73, 0x6c, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x65, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x73, 0x6c, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x65,
0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74,
0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x42, 0x50, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x42, 0x50, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x54,
0x72, 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x10, 0x04, 0x42, 0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x72, 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x10, 0x04, 0x42, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f,
0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74,
0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64,
0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
} }
var ( var (

View File

@ -4,7 +4,7 @@
// protoc v4.23.1 // protoc v4.23.1
// source: pslGraphics.proto // source: pslGraphics.proto
package graphicData package data_proto
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -499,9 +499,10 @@ var file_pslGraphics_proto_rawDesc = []byte{
0x0a, 0x0f, 0x50, 0x73, 0x6c, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x0a, 0x0f, 0x50, 0x73, 0x6c, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6c, 0x6f,
0x72, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x67, 0x72, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x67, 0x72,
0x65, 0x65, 0x6e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x42, 0x65, 0x65, 0x6e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x42,
0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f,
0x6f, 0x33, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -4,7 +4,7 @@
// protoc v4.23.1 // protoc v4.23.1
// source: relayCabinetLayoutGraphics.proto // source: relayCabinetLayoutGraphics.proto
package graphicData package data_proto
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -1215,9 +1215,10 @@ var file_relayCabinetLayoutGraphics_proto_rawDesc = []byte{
0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x6c, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x6c, 0x64,
0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66,
0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65,
0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x42, 0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x42, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f, 0x79, 0x6c, 0x69,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73,
0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61,
0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -4,7 +4,7 @@
// protoc v4.23.1 // protoc v4.23.1
// source: stationLayoutGraphics.proto // source: stationLayoutGraphics.proto
package graphicData package data_proto
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -6115,12 +6115,14 @@ var file_stationLayoutGraphics_proto_rawDesc = []byte{
0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x03, 0x69, 0x64, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x03, 0x69, 0x64,
0x73, 0x2a, 0x1d, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x06, 0x73, 0x2a, 0x1d, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x06,
0x0a, 0x02, 0x55, 0x50, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x01, 0x0a, 0x02, 0x55, 0x50, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x01,
0x42, 0x55, 0x0a, 0x25, 0x63, 0x6c, 0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x42, 0x69, 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, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, 0x73, 0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76, 0x65, 0x72, 0x69,
0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x13, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x13, 0x4c, 0x61, 0x79, 0x6f, 0x75,
0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x17, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x2b,
0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d,
0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f,
0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -3,7 +3,7 @@ package dto
import ( import (
"time" "time"
"joylink.club/bj-rtsts-server/ts/protos/graphicData" "joylink.club/bj-rtsts-server/dto/data_proto"
) )
type PageDraftingReqDto struct { type PageDraftingReqDto struct {
@ -16,11 +16,11 @@ type ListDraftingReqDto struct {
} }
type DraftingDto struct { type DraftingDto struct {
Id int `json:"id" form:"id"` Id int `json:"id" form:"id"`
Name string `json:"name" form:"name"` Name string `json:"name" form:"name"`
Category string `json:"category" form:"category"` Category string `json:"category" form:"category"`
Type graphicData.PictureType `json:"type" form:"type"` Type data_proto.PictureType `json:"type" form:"type"`
Proto []byte `json:"proto" from:"proto"` Proto []byte `json:"proto" from:"proto"`
} }
type DraftingMapDataDto struct { type DraftingMapDataDto struct {

View File

@ -908,9 +908,10 @@ var file_request_proto_rawDesc = []byte{
0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20,
0x03, 0x28, 0x05, 0x52, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x03, 0x28, 0x05, 0x52, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a,
0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72,
0x6f, 0x75, 0x70, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x6f, 0x75, 0x70, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63,
0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72,
0x6f, 0x33, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -1,9 +1,9 @@
package dto package dto
import ( import (
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData" "joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/ts/protos/state"
) )
// 创建仿真请求 // 创建仿真请求
@ -97,7 +97,7 @@ type SignalOperationReqDto struct {
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
DeviceId uint32 `form:"id" json:"id" binding:"required"` DeviceId uint32 `form:"id" json:"id" binding:"required"`
Operation request_proto.Signal_Operation `form:"operation" json:"operation" binding:"required"` //信号机操作类型 Operation request_proto.Signal_Operation `form:"operation" json:"operation" binding:"required"` //信号机操作类型
Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` // 当操作为Operation.Display时有效表示显示的信号 Aspect state_proto.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` // 当操作为Operation.Display时有效表示显示的信号
} }
// AxleSectionOperationReqDto 计轴区段操作 // AxleSectionOperationReqDto 计轴区段操作
@ -172,10 +172,10 @@ type RelayOperationReqDto struct {
// BaliseMoveReqDto 应答器移位请求 // BaliseMoveReqDto 应答器移位请求
type BaliseMoveReqDto struct { type BaliseMoveReqDto struct {
SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID
MapId int32 `json:"mapId" form:"mapId"` //地图ID MapId int32 `json:"mapId" form:"mapId"` //地图ID
BaliseId uint32 `json:"baliseId" form:"baliseId"` //应答器ID BaliseId uint32 `json:"baliseId" form:"baliseId"` //应答器ID
Km graphicData.KilometerSystem `json:"km" form:"km"` //公里标 Km data_proto.KilometerSystem `json:"km" form:"km"` //公里标
} }
// BaliseModifyTelegramReqDto 修改应答器报文 // BaliseModifyTelegramReqDto 修改应答器报文

View File

@ -4,12 +4,12 @@
// protoc v4.23.1 // protoc v4.23.1
// source: device_state.proto // source: device_state.proto
package state package state_proto
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
graphicData "joylink.club/bj-rtsts-server/ts/protos/graphicData" data_proto "joylink.club/bj-rtsts-server/dto/data_proto"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
) )
@ -2529,9 +2529,9 @@ type BaliseState struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Km *graphicData.KilometerSystem `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` //当前公里标 Km *data_proto.KilometerSystem `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` //当前公里标
Telegram []byte `protobuf:"bytes,3,opt,name=telegram,proto3" json:"telegram,omitempty"` //当前报文 Telegram []byte `protobuf:"bytes,3,opt,name=telegram,proto3" json:"telegram,omitempty"` //当前报文
} }
func (x *BaliseState) Reset() { func (x *BaliseState) Reset() {
@ -2573,7 +2573,7 @@ func (x *BaliseState) GetId() uint32 {
return 0 return 0
} }
func (x *BaliseState) GetKm() *graphicData.KilometerSystem { func (x *BaliseState) GetKm() *data_proto.KilometerSystem {
if x != nil { if x != nil {
return x.Km return x.Km
} }
@ -3433,13 +3433,14 @@ var file_device_state_proto_rawDesc = []byte{
0x03, 0x2a, 0x37, 0x0a, 0x0b, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 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, 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, 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, 0x51, 0x0a, 0x25, 0x63, 0x6c, 0x0a, 0x06, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x10, 0x03, 0x42, 0x67, 0x0a, 0x25, 0x63, 0x6c,
0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, 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, 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, 0x74, 0x6f, 0x73, 0x42, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x16, 0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x2c, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63,
0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -3484,7 +3485,7 @@ var file_device_state_proto_goTypes = []interface{}{
(*AllDevicesStatus)(nil), // 24: state.AllDevicesStatus (*AllDevicesStatus)(nil), // 24: state.AllDevicesStatus
(*PushedDevicesStatus)(nil), // 25: state.PushedDevicesStatus (*PushedDevicesStatus)(nil), // 25: state.PushedDevicesStatus
(*SimulationStatus)(nil), // 26: state.SimulationStatus (*SimulationStatus)(nil), // 26: state.SimulationStatus
(*graphicData.KilometerSystem)(nil), // 27: graphicData.KilometerSystem (*data_proto.KilometerSystem)(nil), // 27: graphicData.KilometerSystem
} }
var file_device_state_proto_depIdxs = []int32{ var file_device_state_proto_depIdxs = []int32{
1, // 0: state.SignalState.aspect:type_name -> state.Signal.Aspect 1, // 0: state.SignalState.aspect:type_name -> state.Signal.Aspect

View File

@ -2,7 +2,7 @@ package dto
import ( import (
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData" "joylink.club/bj-rtsts-server/dto/data_proto"
) )
type PageTrainInfoReqDto struct { type PageTrainInfoReqDto struct {
@ -36,7 +36,7 @@ func ConvertToTrainDto(trailInfos []*PublishedDto) []*TrainInfoDto {
} }
func ConvertDtoFromTrain(t *PublishedDto) *TrainInfoDto { func ConvertDtoFromTrain(t *PublishedDto) *TrainInfoDto {
message := &graphicData.Train{} message := &data_proto.Train{}
proto.Unmarshal(t.Proto, message) proto.Unmarshal(t.Proto, message)
return &TrainInfoDto{ return &TrainInfoDto{
Id: t.ID, Id: t.ID,

View File

@ -40,6 +40,7 @@ cloud.google.com/go/dataform v0.9.1/go.mod h1:pWTg+zGQ7i16pyn0bS1ruqIE91SdL2FDMv
cloud.google.com/go/datafusion v1.7.4/go.mod h1:BBs78WTOLYkT4GVZIXQCZT3GFpkpDN4aBY4NDX/jVlM= cloud.google.com/go/datafusion v1.7.4/go.mod h1:BBs78WTOLYkT4GVZIXQCZT3GFpkpDN4aBY4NDX/jVlM=
cloud.google.com/go/datalabeling v0.8.4/go.mod h1:Z1z3E6LHtffBGrNUkKwbwbDxTiXEApLzIgmymj8A3S8= cloud.google.com/go/datalabeling v0.8.4/go.mod h1:Z1z3E6LHtffBGrNUkKwbwbDxTiXEApLzIgmymj8A3S8=
cloud.google.com/go/dataplex v1.11.1/go.mod h1:mHJYQQ2VEJHsyoC0OdNyy988DvEbPhqFs5OOLffLX0c= cloud.google.com/go/dataplex v1.11.1/go.mod h1:mHJYQQ2VEJHsyoC0OdNyy988DvEbPhqFs5OOLffLX0c=
cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4=
cloud.google.com/go/dataproc/v2 v2.2.3/go.mod h1:G5R6GBc9r36SXv/RtZIVfB8SipI+xVn0bX5SxUzVYbY= cloud.google.com/go/dataproc/v2 v2.2.3/go.mod h1:G5R6GBc9r36SXv/RtZIVfB8SipI+xVn0bX5SxUzVYbY=
cloud.google.com/go/dataqna v0.8.4/go.mod h1:mySRKjKg5Lz784P6sCov3p1QD+RZQONRMRjzGNcFd0c= cloud.google.com/go/dataqna v0.8.4/go.mod h1:mySRKjKg5Lz784P6sCov3p1QD+RZQONRMRjzGNcFd0c=
cloud.google.com/go/datastore v1.15.0/go.mod h1:GAeStMBIt9bPS7jMJA85kgkpsMkvseWWXiaHya9Jes8= cloud.google.com/go/datastore v1.15.0/go.mod h1:GAeStMBIt9bPS7jMJA85kgkpsMkvseWWXiaHya9Jes8=
@ -60,6 +61,7 @@ cloud.google.com/go/gkebackup v1.3.4/go.mod h1:gLVlbM8h/nHIs09ns1qx3q3eaXcGSELgN
cloud.google.com/go/gkeconnect v0.8.4/go.mod h1:84hZz4UMlDCKl8ifVW8layK4WHlMAFeq8vbzjU0yJkw= cloud.google.com/go/gkeconnect v0.8.4/go.mod h1:84hZz4UMlDCKl8ifVW8layK4WHlMAFeq8vbzjU0yJkw=
cloud.google.com/go/gkehub v0.14.4/go.mod h1:Xispfu2MqnnFt8rV/2/3o73SK1snL8s9dYJ9G2oQMfc= cloud.google.com/go/gkehub v0.14.4/go.mod h1:Xispfu2MqnnFt8rV/2/3o73SK1snL8s9dYJ9G2oQMfc=
cloud.google.com/go/gkemulticloud v1.0.3/go.mod h1:7NpJBN94U6DY1xHIbsDqB2+TFZUfjLUKLjUX8NGLor0= cloud.google.com/go/gkemulticloud v1.0.3/go.mod h1:7NpJBN94U6DY1xHIbsDqB2+TFZUfjLUKLjUX8NGLor0=
cloud.google.com/go/grafeas v0.3.0/go.mod h1:P7hgN24EyONOTMyeJH6DxG4zD7fwiYa5Q6GUgyFSOU8=
cloud.google.com/go/gsuiteaddons v1.6.4/go.mod h1:rxtstw7Fx22uLOXBpsvb9DUbC+fiXs7rF4U29KHM/pE= cloud.google.com/go/gsuiteaddons v1.6.4/go.mod h1:rxtstw7Fx22uLOXBpsvb9DUbC+fiXs7rF4U29KHM/pE=
cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU=
cloud.google.com/go/iam v1.1.3/go.mod h1:3khUlaBXfPKKe7huYgEpDn6FtgRyMEqbkvBxrQyY5SE= cloud.google.com/go/iam v1.1.3/go.mod h1:3khUlaBXfPKKe7huYgEpDn6FtgRyMEqbkvBxrQyY5SE=
@ -126,12 +128,19 @@ cloud.google.com/go/vpcaccess v1.7.4/go.mod h1:lA0KTvhtEOb/VOdnH/gwPuOzGgM+CWsmG
cloud.google.com/go/webrisk v1.9.4/go.mod h1:w7m4Ib4C+OseSr2GL66m0zMBywdrVNTDKsdEsfMl7X0= cloud.google.com/go/webrisk v1.9.4/go.mod h1:w7m4Ib4C+OseSr2GL66m0zMBywdrVNTDKsdEsfMl7X0=
cloud.google.com/go/websecurityscanner v1.6.4/go.mod h1:mUiyMQ+dGpPPRkHgknIZeCzSHJ45+fY4F52nZFDHm2o= cloud.google.com/go/websecurityscanner v1.6.4/go.mod h1:mUiyMQ+dGpPPRkHgknIZeCzSHJ45+fY4F52nZFDHm2o=
cloud.google.com/go/workflows v1.12.3/go.mod h1:fmOUeeqEwPzIU81foMjTRQIdwQHADi/vEr1cx9R1m5g= cloud.google.com/go/workflows v1.12.3/go.mod h1:fmOUeeqEwPzIU81foMjTRQIdwQHADi/vEr1cx9R1m5g=
github.com/ClickHouse/ch-go v0.48.0/go.mod h1:KBY72ltlOlHelc4Jn4hlReP8Caek8d6RG4ZkoPsWxzc=
github.com/ClickHouse/clickhouse-go/v2 v2.3.0/go.mod h1:f2kb1LPopJdIyt0Y0vxNk9aiQCyhCmeVcyvOOaPCT4Q=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg=
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
@ -155,6 +164,10 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/ebitengine/purego v0.1.0/go.mod h1:Eh8I3yvknDYZeCuXH9kRNaPuHEwvXDCk378o9xszmHg=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g=
@ -164,6 +177,9 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw=
github.com/go-faster/errors v0.6.1/go.mod h1:5MGV2/2T9yvlrbhe9pD9LO5Z/2zCSq2T8j+Jpi2LAyY=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20220806181222-55e207c401ad/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
@ -177,6 +193,8 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4er
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-pkcs11 v0.2.1-0.20230907215043-c6f79328ddf9/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= github.com/google/go-pkcs11 v0.2.1-0.20230907215043-c6f79328ddf9/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY=
@ -190,35 +208,50 @@ github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU=
github.com/googleapis/google-cloud-go-testing v0.0.0-20210719221736-1c9a4c676720/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/googleapis/google-cloud-go-testing v0.0.0-20210719221736-1c9a4c676720/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/hajimehoshi/ebiten/v2 v2.4.13/go.mod h1:BZcqCU4XHmScUi+lsKexocWcf4offMFwfp8dVGIB/G4=
github.com/hajimehoshi/file2byteslice v1.0.0/go.mod h1:CqqAHp7Dk/AqQiwuhV1yT2334qbA/tFWQW0MD2dGqUE=
github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g= github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g=
github.com/hashicorp/consul/sdk v0.14.1/go.mod h1:vFt03juSzocLRFo59NkeQHHmQa6+g7oU0pfzdI1mUhg=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=
github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0=
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/jezek/xgb v1.0.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
@ -233,6 +266,8 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY=
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
@ -244,6 +279,8 @@ github.com/nats-io/nkeys v0.4.6/go.mod h1:4DxZNzenSVd1cYQoAa8948QY3QDjrHfcfVADym
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/paulmach/orb v0.7.1/go.mod h1:FWRlTgl88VI1RBx/MkrwWDRhQ96ctqMCh8boXhmqB/A=
github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk=
@ -252,18 +289,26 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sagikazarmark/crypt v0.17.0/go.mod h1:SMtHTvdmsZMuY/bpZoqokSoChIrcJ/epOxZN58PbZDg= github.com/sagikazarmark/crypt v0.17.0/go.mod h1:SMtHTvdmsZMuY/bpZoqokSoChIrcJ/epOxZN58PbZDg=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@ -271,13 +316,18 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI= go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI=
go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U= go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U=
go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA= go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA=
go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc= go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ=
go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
@ -292,6 +342,9 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20221012134814-c746ac228303/go.mod h1:M32cGdzp91A8Ex9qQtyZinr19EYxzkFqDjW2oyHzTDQ=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -382,3 +435,5 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gorm.io/driver/clickhouse v0.5.0/go.mod h1:cIKAlFw+IVK75g0bDcm0M9qRA4EAgsn23Si+zCXQ1Lc=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

View File

@ -2,12 +2,12 @@ package message_server
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/data_proto"
"time" "time"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt" "joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory" "joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
@ -16,7 +16,7 @@ import (
// 综合后备盘IBP消息服务 // 综合后备盘IBP消息服务
func NewIBPMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask { func NewIBPMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
mapData := memory.QueryGiData[*graphicData.RtssGraphicStorage](mapId) mapData := memory.QueryGiData[*data_proto.RtssGraphicStorage](mapId)
return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]综合后备盘IBP", mapId), func() error { return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]综合后备盘IBP", mapId), func() error {
for _, station := range mapData.Stations { for _, station := range mapData.Stations {
sid := memory.GetMapElementId(station.Common) sid := memory.GetMapElementId(station.Common)
@ -30,13 +30,13 @@ func NewIBPMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
}, 200*time.Millisecond) }, 200*time.Millisecond)
} }
func collectStationIbpState(mapId int32, world ecs.World, station *graphicData.Station) (*state.PushedDevicesStatus, error) { func collectStationIbpState(mapId int32, world ecs.World, station *data_proto.Station) (*state_proto.PushedDevicesStatus, error) {
if station.RefIbpMapCode == "" { if station.RefIbpMapCode == "" {
return nil, nil return nil, nil
} }
sid := memory.GetMapElementId(station.Common) sid := memory.GetMapElementId(station.Common)
stationUid := memory.QueryUidByMidAndComId(mapId, sid, &graphicData.Station{}) stationUid := memory.QueryUidByMidAndComId(mapId, sid, &data_proto.Station{})
ibpMapId, ibpStorage := memory.QueryGiDataByName[*graphicData.IBPGraphicStorage](station.RefIbpMapCode) ibpMapId, ibpStorage := memory.QueryGiDataByName[*data_proto.IBPGraphicStorage](station.RefIbpMapCode)
ibpUidsMap := memory.QueryUidStructure[*memory.IBPUidStructure](ibpMapId) ibpUidsMap := memory.QueryUidStructure[*memory.IBPUidStructure](ibpMapId)
buttonStates, err := collectIBPButtonState(world, stationUid, ibpUidsMap, ibpStorage.IbpButtons) buttonStates, err := collectIBPButtonState(world, stationUid, ibpUidsMap, ibpStorage.IbpButtons)
if err != nil { if err != nil {
@ -54,9 +54,9 @@ func collectStationIbpState(mapId int32, world ecs.World, station *graphicData.S
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &state.PushedDevicesStatus{ return &state_proto.PushedDevicesStatus{
All: true, All: true,
AllStatus: &state.AllDevicesStatus{ AllStatus: &state_proto.AllDevicesStatus{
ButtonState: buttonStates, ButtonState: buttonStates,
AlarmState: alarmStates, AlarmState: alarmStates,
LightState: lightStates, LightState: lightStates,
@ -66,8 +66,8 @@ func collectStationIbpState(mapId int32, world ecs.World, station *graphicData.S
} }
// 收集IBP按钮状态 // 收集IBP按钮状态
func collectIBPButtonState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpButtons []*graphicData.IBPButton) ([]*state.ButtonState, error) { func collectIBPButtonState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpButtons []*data_proto.IBPButton) ([]*state_proto.ButtonState, error) {
var states []*state.ButtonState var states []*state_proto.ButtonState
for _, data := range ibpButtons { // 按钮 for _, data := range ibpButtons { // 按钮
did := memory.GetMapElementId(data.Common) did := memory.GetMapElementId(data.Common)
uid := stationUid + "_" + uidsMap.IbpButtonIds[did].Uid uid := stationUid + "_" + uidsMap.IbpButtonIds[did].Uid
@ -83,8 +83,8 @@ func collectIBPButtonState(world ecs.World, stationUid string, uidsMap *memory.I
} }
// 获取IBP盘按钮状态 // 获取IBP盘按钮状态
func getIBPButtonState(id uint32, entry *ecs.Entry) *state.ButtonState { func getIBPButtonState(id uint32, entry *ecs.Entry) *state_proto.ButtonState {
status := &state.ButtonState{Id: id} status := &state_proto.ButtonState{Id: id}
bit := component.BitStateType.Get(entry) bit := component.BitStateType.Get(entry)
status.Down = bit.Val status.Down = bit.Val
// 如果按钮包含灯 // 如果按钮包含灯
@ -96,8 +96,8 @@ func getIBPButtonState(id uint32, entry *ecs.Entry) *state.ButtonState {
} }
// 收集报警器状态 // 收集报警器状态
func collectIBPAlarmState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpAlarms []*graphicData.IbpAlarm) ([]*state.AlarmState, error) { func collectIBPAlarmState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpAlarms []*data_proto.IbpAlarm) ([]*state_proto.AlarmState, error) {
var states []*state.AlarmState var states []*state_proto.AlarmState
for _, data := range ibpAlarms { // 报警器 for _, data := range ibpAlarms { // 报警器
did := memory.GetMapElementId(data.Common) did := memory.GetMapElementId(data.Common)
uid := stationUid + "_" + uidsMap.IbpAlarmIds[did].Uid uid := stationUid + "_" + uidsMap.IbpAlarmIds[did].Uid
@ -106,15 +106,15 @@ func collectIBPAlarmState(world ecs.World, stationUid string, uidsMap *memory.IB
continue continue
} }
if entry.HasComponent(component.AlarmTag) { if entry.HasComponent(component.AlarmTag) {
states = append(states, &state.AlarmState{Id: did, Active: component.BitStateType.Get(entry).Val}) states = append(states, &state_proto.AlarmState{Id: did, Active: component.BitStateType.Get(entry).Val})
} }
} }
return states, nil return states, nil
} }
// 收集灯状态信息 // 收集灯状态信息
func collectIBPLightState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpLights []*graphicData.IbpLight) ([]*state.LightState, error) { func collectIBPLightState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpLights []*data_proto.IbpLight) ([]*state_proto.LightState, error) {
var states []*state.LightState var states []*state_proto.LightState
for _, data := range ibpLights { // 指示灯 for _, data := range ibpLights { // 指示灯
did := memory.GetMapElementId(data.Common) did := memory.GetMapElementId(data.Common)
uid := stationUid + "_" + uidsMap.IbpLightIds[did].Uid uid := stationUid + "_" + uidsMap.IbpLightIds[did].Uid
@ -123,15 +123,15 @@ func collectIBPLightState(world ecs.World, stationUid string, uidsMap *memory.IB
continue continue
} }
if entry.HasComponent(component.LightTag) { if entry.HasComponent(component.LightTag) {
states = append(states, &state.LightState{Id: did, Active: component.BitStateType.Get(entry).Val}) states = append(states, &state_proto.LightState{Id: did, Active: component.BitStateType.Get(entry).Val})
} }
} }
return states, nil return states, nil
} }
// 收集钥匙状态 // 收集钥匙状态
func collectIBPKeyState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpKeys []*graphicData.IbpKey) ([]*state.KeyState, error) { func collectIBPKeyState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpKeys []*data_proto.IbpKey) ([]*state_proto.KeyState, error) {
var states []*state.KeyState var states []*state_proto.KeyState
for _, data := range ibpKeys { // 钥匙 for _, data := range ibpKeys { // 钥匙
did := memory.GetMapElementId(data.Common) did := memory.GetMapElementId(data.Common)
uid := stationUid + "_" + uidsMap.IbpKeyIds[did].Uid uid := stationUid + "_" + uidsMap.IbpKeyIds[did].Uid
@ -140,7 +140,7 @@ func collectIBPKeyState(world ecs.World, stationUid string, uidsMap *memory.IBPU
continue continue
} }
if entry.HasComponent(component.KeyTag) { if entry.HasComponent(component.KeyTag) {
states = append(states, &state.KeyState{Id: did, Gear: component.GearStateType.Get(entry).Val}) states = append(states, &state_proto.KeyState{Id: did, Gear: component.GearStateType.Get(entry).Val})
} }
} }
return states, nil return states, nil

View File

@ -2,12 +2,12 @@ package message_server
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/state_proto"
"time" "time"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt" "joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory" "joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
@ -15,21 +15,21 @@ import (
) )
func NewPSLMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask { func NewPSLMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
mapData := memory.QueryGiData[*graphicData.RtssGraphicStorage](mapId) mapData := memory.QueryGiData[*data_proto.RtssGraphicStorage](mapId)
return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]综合门控箱按钮状态", mapId), func() error { return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]综合门控箱按钮状态", mapId), func() error {
for _, box := range mapData.GateBoxs { for _, box := range mapData.GateBoxs {
did := memory.GetMapElementId(box.Common) did := memory.GetMapElementId(box.Common)
state, err := collectGateBoxPSLState(vs.World, mapId, box) data_proto, err := collectGateBoxPSLState(vs.World, mapId, box)
if err != nil { if err != nil {
return err return err
} }
mqtt.GetMsgClient().PubPSLState(vs.SimulationId, mapId, did, state) mqtt.GetMsgClient().PubPSLState(vs.SimulationId, mapId, did, data_proto)
} }
return nil return nil
}, 200*time.Millisecond) }, 200*time.Millisecond)
} }
func collectGateBoxPSLState(world ecs.World, mapId int32, box *graphicData.GatedBox) (*state.PushedDevicesStatus, error) { func collectGateBoxPSLState(world ecs.World, mapId int32, box *data_proto.GatedBox) (*state_proto.PushedDevicesStatus, error) {
did := memory.GetMapElementId(box.Common) did := memory.GetMapElementId(box.Common)
uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId) uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId)
boxUid := uidStructure.GateBoxIds[did].Uid boxUid := uidStructure.GateBoxIds[did].Uid
@ -38,9 +38,9 @@ func collectGateBoxPSLState(world ecs.World, mapId int32, box *graphicData.Gated
return nil, fmt.Errorf("[id:%s]的门控箱实体找不到", boxUid) return nil, fmt.Errorf("[id:%s]的门控箱实体找不到", boxUid)
} }
mkx := component.MkxType.Get(mkxEntry) mkx := component.MkxType.Get(mkxEntry)
var buttonStateArr []*state.ButtonState var buttonStateArr []*state_proto.ButtonState
if ok { if ok {
_, pslStorage := memory.QueryGiDataByName[*graphicData.PslGraphicStorage](box.RefGatedBoxMapCode) _, pslStorage := memory.QueryGiDataByName[*data_proto.PslGraphicStorage](box.RefGatedBoxMapCode)
btnUidMap := make(map[string]uint32, len(pslStorage.PslButtons)) btnUidMap := make(map[string]uint32, len(pslStorage.PslButtons))
for _, button := range pslStorage.PslButtons { for _, button := range pslStorage.PslButtons {
btnUidMap[boxUid+"_"+button.Code] = memory.GetMapElementId(button.Common) btnUidMap[boxUid+"_"+button.Code] = memory.GetMapElementId(button.Common)
@ -50,16 +50,16 @@ func collectGateBoxPSLState(world ecs.World, mapId int32, box *graphicData.Gated
if btn == nil { if btn == nil {
continue continue
} }
buttonStateArr = append(buttonStateArr, &state.ButtonState{ buttonStateArr = append(buttonStateArr, &state_proto.ButtonState{
Id: btnUidMap[component.UidType.Get(btn).Id], Id: btnUidMap[component.UidType.Get(btn).Id],
Down: component.BitStateType.Get(btn).Val, Down: component.BitStateType.Get(btn).Val,
Active: component.BitStateType.Get(btn).Val, Active: component.BitStateType.Get(btn).Val,
}) })
} }
} }
return &state.PushedDevicesStatus{ return &state_proto.PushedDevicesStatus{
All: true, All: true,
AllStatus: &state.AllDevicesStatus{ AllStatus: &state_proto.AllDevicesStatus{
ButtonState: buttonStateArr, ButtonState: buttonStateArr,
}, },
}, nil }, nil

View File

@ -2,12 +2,12 @@ package message_server
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/state_proto"
"time" "time"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt" "joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory" "joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
@ -20,9 +20,9 @@ func NewRccMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
if err != nil { if err != nil {
return err return err
} }
ststes := &state.PushedDevicesStatus{ ststes := &state_proto.PushedDevicesStatus{
All: true, All: true,
AllStatus: &state.AllDevicesStatus{ AllStatus: &state_proto.AllDevicesStatus{
ReplyState: relayStates, ReplyState: relayStates,
}, },
} }
@ -32,10 +32,10 @@ func NewRccMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
} }
// 获取仿真地图的继电器状态,前端推送 // 获取仿真地图的继电器状态,前端推送
func collectRelayState(world ecs.World, mapId int32) ([]*state.ReplyState, error) { func collectRelayState(world ecs.World, mapId int32) ([]*state_proto.ReplyState, error) {
// 获取本地图下的继电器信息 // 获取本地图下的继电器信息
uidMap := memory.QueryMapUidMapByType(mapId, &graphicData.Relay{}) uidMap := memory.QueryMapUidMapByType(mapId, &data_proto.Relay{})
var replyStateArr []*state.ReplyState var replyStateArr []*state_proto.ReplyState
for _, u := range uidMap { for _, u := range uidMap {
entry, ok := entity.GetEntityByUid(world, u.Uid) entry, ok := entity.GetEntityByUid(world, u.Uid)
if !ok { if !ok {
@ -45,7 +45,7 @@ func collectRelayState(world ecs.World, mapId int32) ([]*state.ReplyState, error
} }
if entry.HasComponent(component.RelayTag) { if entry.HasComponent(component.RelayTag) {
bit := component.BitStateType.Get(entry) bit := component.BitStateType.Get(entry)
replyStateArr = append(replyStateArr, &state.ReplyState{Id: u.CommonId, Xh: bit.Val}) replyStateArr = append(replyStateArr, &state_proto.ReplyState{Id: u.CommonId, Xh: bit.Val})
} }
} }
return replyStateArr, nil return replyStateArr, nil

View File

@ -2,14 +2,14 @@ package message_server
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/rtsssimulation/repository/model/proto" "joylink.club/rtsssimulation/repository/model/proto"
"strings" "strings"
"time" "time"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt" "joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory" "joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
@ -52,9 +52,9 @@ func NewSfpMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
if err != nil { if err != nil {
return err return err
} }
ststes := &state.PushedDevicesStatus{ ststes := &state_proto.PushedDevicesStatus{
All: true, All: true,
AllStatus: &state.AllDevicesStatus{ AllStatus: &state_proto.AllDevicesStatus{
TrainState: trainState, TrainState: trainState,
SwitchState: turnoutStates, SwitchState: turnoutStates,
SignalState: signalStates, SignalState: signalStates,
@ -71,26 +71,26 @@ func NewSfpMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
} }
// 收集应答器状态 // 收集应答器状态
func collectBaliseStates(world ecs.World, mapId int32) ([]*state.BaliseState, error) { func collectBaliseStates(world ecs.World, mapId int32) ([]*state_proto.BaliseState, error) {
uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId) uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId)
var transponderStates []*state.BaliseState var transponderStates []*state_proto.BaliseState
for id, structure := range uidStructure.TransponderIds { for id, structure := range uidStructure.TransponderIds {
entry, ok := entity.GetEntityByUid(world, structure.Uid) entry, ok := entity.GetEntityByUid(world, structure.Uid)
if ok { if ok {
baliseState := &state.BaliseState{ baliseState := &state_proto.BaliseState{
Id: id, Id: id,
Telegram: component.BaliseStateType.Get(entry).ValidTelegram, Telegram: component.BaliseStateType.Get(entry).ValidTelegram,
} }
transponderStates = append(transponderStates, baliseState) transponderStates = append(transponderStates, baliseState)
km := component.KmType.Get(entry) km := component.KmType.Get(entry)
baliseState.Km = &graphicData.KilometerSystem{ baliseState.Km = &data_proto.KilometerSystem{
Kilometer: km.Value, Kilometer: km.Value,
CoordinateSystem: km.CoordinateSystem, CoordinateSystem: km.CoordinateSystem,
} }
if km.Direction == proto.Direction_LEFT { if km.Direction == proto.Direction_LEFT {
baliseState.Km.Direction = graphicData.KilometerSystem_LEFT baliseState.Km.Direction = data_proto.KilometerSystem_LEFT
} else if km.Direction == proto.Direction_RIGHT { } else if km.Direction == proto.Direction_RIGHT {
baliseState.Km.Direction = graphicData.KilometerSystem_RIGHT baliseState.Km.Direction = data_proto.KilometerSystem_RIGHT
} }
} }
} }
@ -98,27 +98,27 @@ func collectBaliseStates(world ecs.World, mapId int32) ([]*state.BaliseState, er
} }
// 收集屏蔽门状态 // 收集屏蔽门状态
func collectPsdStates(world ecs.World, mapId int32) ([]*state.PsdState, error) { func collectPsdStates(world ecs.World, mapId int32) ([]*state_proto.PsdState, error) {
uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId) uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId)
data := memory.QueryGiData[*graphicData.RtssGraphicStorage](mapId) data := memory.QueryGiData[*data_proto.RtssGraphicStorage](mapId)
var psdStateArr []*state.PsdState var psdStateArr []*state_proto.PsdState
for _, door := range data.ScreenDoors { for _, door := range data.ScreenDoors {
did := memory.GetMapElementId(door.Common) did := memory.GetMapElementId(door.Common)
uid := uidStructure.PsdIds[did].Uid uid := uidStructure.PsdIds[did].Uid
psdEntry, ok := entity.GetEntityByUid(world, uid) psdEntry, ok := entity.GetEntityByUid(world, uid)
if ok { if ok {
list := component.AsdListType.Get(psdEntry).List list := component.AsdListType.Get(psdEntry).List
asdStates := make([]*state.AsdState, len(list)) asdStates := make([]*state_proto.AsdState, len(list))
for i, asdEntry := range list { for i, asdEntry := range list {
asdState := component.AsdStateType.Get(asdEntry) asdState := component.AsdStateType.Get(asdEntry)
asdStates[i] = &state.AsdState{ asdStates[i] = &state_proto.AsdState{
Code: int32(i + 1), Code: int32(i + 1),
Kmdw: asdState.Kmdw, Kmdw: asdState.Kmdw,
Gmdw: asdState.Gmdw, Gmdw: asdState.Gmdw,
Mgj: asdState.Mgj, Mgj: asdState.Mgj,
} }
} }
psdStateArr = append(psdStateArr, &state.PsdState{ psdStateArr = append(psdStateArr, &state_proto.PsdState{
Id: did, Id: did,
AsdStates: asdStates, AsdStates: asdStates,
Mgj: component.PsdStateType.Get(psdEntry).Close, Mgj: component.PsdStateType.Get(psdEntry).Close,
@ -129,9 +129,9 @@ func collectPsdStates(world ecs.World, mapId int32) ([]*state.PsdState, error) {
} }
// 收集区段状态 // 收集区段状态
func collectSectionStates(world ecs.World, mapId int32) ([]*state.SectionState, error) { func collectSectionStates(world ecs.World, mapId int32) ([]*state_proto.SectionState, error) {
uidMap := memory.QueryMapUidMapByType(mapId, &graphicData.Section{}) uidMap := memory.QueryMapUidMapByType(mapId, &data_proto.Section{})
var sectionArr []*state.SectionState var sectionArr []*state_proto.SectionState
for _, u := range uidMap { for _, u := range uidMap {
s := handlerSectionState(world, u.Uid) s := handlerSectionState(world, u.Uid)
if s == nil { if s == nil {
@ -143,14 +143,14 @@ func collectSectionStates(world ecs.World, mapId int32) ([]*state.SectionState,
return sectionArr, nil return sectionArr, nil
} }
func handlerSectionState(w ecs.World, uid string) *state.SectionState { func handlerSectionState(w ecs.World, uid string) *state_proto.SectionState {
entry, ok := entity.GetEntityByUid(w, uid) entry, ok := entity.GetEntityByUid(w, uid)
if !ok { if !ok {
//fmt.Printf("id=%s的信号机不存在", uid) //fmt.Printf("id=%s的信号机不存在", uid)
return nil return nil
} }
if entry.HasComponent(component.PhysicalSectionStateType) { //计轴区段 if entry.HasComponent(component.PhysicalSectionStateType) { //计轴区段
sectionState := &state.SectionState{} sectionState := &state_proto.SectionState{}
axleState := component.PhysicalSectionStateType.Get(entry) axleState := component.PhysicalSectionStateType.Get(entry)
sectionState.Occupied = axleState.Occ sectionState.Occupied = axleState.Occ
sectionState.AxleFault = entry.HasComponent(component.AxleSectionFaultTag) sectionState.AxleFault = entry.HasComponent(component.AxleSectionFaultTag)
@ -160,10 +160,10 @@ func handlerSectionState(w ecs.World, uid string) *state.SectionState {
} }
// 收集车站按钮状态 // 收集车站按钮状态
func collectStationButtonStates(world ecs.World, mapId int32) ([]*state.ButtonState, error) { func collectStationButtonStates(world ecs.World, mapId int32) ([]*state_proto.ButtonState, error) {
// 获取地图上的按钮状态 // 获取地图上的按钮状态
uidMap := memory.QueryMapUidMapByType(mapId, &graphicData.EsbButton{}) uidMap := memory.QueryMapUidMapByType(mapId, &data_proto.EsbButton{})
var btnStateArr []*state.ButtonState var btnStateArr []*state_proto.ButtonState
for _, u := range uidMap { for _, u := range uidMap {
entry, ok := entity.GetEntityByUid(world, u.Uid) entry, ok := entity.GetEntityByUid(world, u.Uid)
if !ok { if !ok {
@ -171,16 +171,16 @@ func collectStationButtonStates(world ecs.World, mapId int32) ([]*state.ButtonSt
} }
if entry.HasComponent(component.ButtonTag) { // 按钮 if entry.HasComponent(component.ButtonTag) { // 按钮
bit := component.BitStateType.Get(entry) bit := component.BitStateType.Get(entry)
btnStateArr = append(btnStateArr, &state.ButtonState{Id: u.CommonId, Down: bit.Val}) btnStateArr = append(btnStateArr, &state_proto.ButtonState{Id: u.CommonId, Down: bit.Val})
} }
} }
return btnStateArr, nil return btnStateArr, nil
} }
// 收集信号机状态 // 收集信号机状态
func collectSignalStates(world ecs.World, mapId int32) ([]*state.SignalState, error) { func collectSignalStates(world ecs.World, mapId int32) ([]*state_proto.SignalState, error) {
uidMap := memory.QueryMapUidMapByType(mapId, &graphicData.Signal{}) uidMap := memory.QueryMapUidMapByType(mapId, &data_proto.Signal{})
var signalArr []*state.SignalState var signalArr []*state_proto.SignalState
for _, u := range uidMap { for _, u := range uidMap {
s, err := handlerSignalState(world, u.Uid) s, err := handlerSignalState(world, u.Uid)
if err != nil { if err != nil {
@ -192,7 +192,7 @@ func collectSignalStates(world ecs.World, mapId int32) ([]*state.SignalState, er
return signalArr, nil return signalArr, nil
} }
func handlerSignalState(w ecs.World, uid string) (*state.SignalState, error) { func handlerSignalState(w ecs.World, uid string) (*state_proto.SignalState, error) {
entry, ok := entity.GetEntityByUid(w, uid) entry, ok := entity.GetEntityByUid(w, uid)
if !ok { if !ok {
return nil, fmt.Errorf("信号机不存在: World id=%d, 信号机id=%s", w.Id(), uid) return nil, fmt.Errorf("信号机不存在: World id=%d, 信号机id=%s", w.Id(), uid)
@ -200,7 +200,7 @@ func handlerSignalState(w ecs.World, uid string) (*state.SignalState, error) {
if !entry.HasComponent(component.SignalLightsType) { //信号机灯列表 if !entry.HasComponent(component.SignalLightsType) { //信号机灯列表
return nil, fmt.Errorf("信号机没有SignalLights组件: World id=%d, 信号机id=%s", w.Id(), uid) return nil, fmt.Errorf("信号机没有SignalLights组件: World id=%d, 信号机id=%s", w.Id(), uid)
} }
signalState := &state.SignalState{} signalState := &state_proto.SignalState{}
lights := component.SignalLightsType.Get(entry) lights := component.SignalLightsType.Get(entry)
isL := false isL := false
isH := false isH := false
@ -222,37 +222,37 @@ func handlerSignalState(w ecs.World, uid string) (*state.SignalState, error) {
} }
} }
if isH && isU { if isH && isU {
signalState.Aspect = state.Signal_HU signalState.Aspect = state_proto.Signal_HU
} else { } else {
switch { switch {
case isL: case isL:
signalState.Aspect = state.Signal_L signalState.Aspect = state_proto.Signal_L
case isH: case isH:
signalState.Aspect = state.Signal_H signalState.Aspect = state_proto.Signal_H
case isU: case isU:
signalState.Aspect = state.Signal_U signalState.Aspect = state_proto.Signal_U
case isB: case isB:
signalState.Aspect = state.Signal_B signalState.Aspect = state_proto.Signal_B
case isA: case isA:
signalState.Aspect = state.Signal_A signalState.Aspect = state_proto.Signal_A
} }
} }
return signalState, nil return signalState, nil
} }
// 收集列车状态 // 收集列车状态
func collectTrainStates(vs *memory.VerifySimulation) ([]*state.TrainMapState, error) { func collectTrainStates(vs *memory.VerifySimulation) ([]*state_proto.TrainMapState, error) {
allTrainMap := &vs.Memory.Status.TrainStateMap allTrainMap := &vs.Memory.Status.TrainStateMap
var trainArr []*state.TrainMapState var trainArr []*state_proto.TrainMapState
allTrainMap.Range(func(_, v any) bool { allTrainMap.Range(func(_, v any) bool {
trainArr = append(trainArr, convertTrainState(v.(*state.TrainState))) trainArr = append(trainArr, convertTrainState(v.(*state_proto.TrainState)))
return true return true
}) })
return trainArr, nil return trainArr, nil
} }
func convertTrainState(v *state.TrainState) *state.TrainMapState { func convertTrainState(v *state_proto.TrainState) *state_proto.TrainMapState {
t := &state.TrainMapState{ t := &state_proto.TrainMapState{
Id: v.Id, Id: v.Id,
Up: v.Up, Up: v.Up,
InitialSpeed: v.Speed, InitialSpeed: v.Speed,
@ -321,10 +321,10 @@ func convertTrainState(v *state.TrainState) *state.TrainMapState {
} }
// 收集道岔状态 // 收集道岔状态
func collectTurnoutStates(sim *memory.VerifySimulation, mapId int32) ([]*state.SwitchState, error) { func collectTurnoutStates(sim *memory.VerifySimulation, mapId int32) ([]*state_proto.SwitchState, error) {
uidMap := memory.QueryMapUidMapByType(mapId, &graphicData.Turnout{}) uidMap := memory.QueryMapUidMapByType(mapId, &data_proto.Turnout{})
wd := entity.GetWorldData(sim.World) wd := entity.GetWorldData(sim.World)
var switchArr []*state.SwitchState var switchArr []*state_proto.SwitchState
for _, u := range uidMap { for _, u := range uidMap {
entry, ok := entity.GetEntityByUid(sim.World, u.Uid) entry, ok := entity.GetEntityByUid(sim.World, u.Uid)
if !ok { if !ok {
@ -334,7 +334,7 @@ func collectTurnoutStates(sim *memory.VerifySimulation, mapId int32) ([]*state.S
return nil, fmt.Errorf("道岔没有TurnoutPosition组件: World id=%d,道岔id=%s", sim.World.Id(), u.Uid) return nil, fmt.Errorf("道岔没有TurnoutPosition组件: World id=%d,道岔id=%s", sim.World.Id(), u.Uid)
} }
pos := component.TurnoutPositionType.Get(entry) pos := component.TurnoutPositionType.Get(entry)
s := &state.SwitchState{ s := &state_proto.SwitchState{
Id: u.CommonId, Id: u.CommonId,
Normal: pos.Db, Normal: pos.Db,
Reverse: pos.Fb, Reverse: pos.Fb,
@ -396,9 +396,9 @@ func collectTurnoutStates(sim *memory.VerifySimulation, mapId int32) ([]*state.S
} }
// 收集站台状态 // 收集站台状态
func collectPlatformStates(world ecs.World, mapId int32) ([]*state.PlatformState, error) { func collectPlatformStates(world ecs.World, mapId int32) ([]*state_proto.PlatformState, error) {
var states []*state.PlatformState var states []*state_proto.PlatformState
mapData := memory.QueryGiData[*graphicData.RtssGraphicStorage](mapId) mapData := memory.QueryGiData[*data_proto.RtssGraphicStorage](mapId)
uidsMap := memory.QueryUidStructure[*memory.StationUidStructure](mapId) uidsMap := memory.QueryUidStructure[*memory.StationUidStructure](mapId)
platformScreenDoorMap := wrapScreenDoorToPlatform(mapData) platformScreenDoorMap := wrapScreenDoorToPlatform(mapData)
for _, platform := range mapData.Platforms { for _, platform := range mapData.Platforms {
@ -415,7 +415,7 @@ func collectPlatformStates(world ecs.World, mapId int32) ([]*state.PlatformState
if !ok { if !ok {
return nil, fmt.Errorf("车站实体不存在: World id=%d, uid=%s", world.Id(), uidInfo.Uid) return nil, fmt.Errorf("车站实体不存在: World id=%d, uid=%s", world.Id(), uidInfo.Uid)
} }
sta := &state.PlatformState{Id: pid} sta := &state_proto.PlatformState{Id: pid}
isX := strings.Contains(platform.Code, "下行站台") //下行站台 isX := strings.Contains(platform.Code, "下行站台") //下行站台
if entry.HasComponent(component.EmpElectronicType) { // 紧急停车继电器 if entry.HasComponent(component.EmpElectronicType) { // 紧急停车继电器
empElectronic := component.EmpElectronicType.Get(entry) empElectronic := component.EmpElectronicType.Get(entry)
@ -427,13 +427,13 @@ func collectPlatformStates(world ecs.World, mapId int32) ([]*state.PlatformState
if entry.HasComponent(component.SpkElectronicType) { // SPKS继电器 if entry.HasComponent(component.SpkElectronicType) { // SPKS继电器
spkElectronic := component.SpkElectronicType.Get(entry) spkElectronic := component.SpkElectronicType.Get(entry)
if isX { if isX {
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKSX旁路", Xh: getRelayXqVal(spkElectronic.SPKSXPLAJ)}) sta.SpksState = append(sta.SpksState, &state_proto.ReplyState{Code: "SPKSX旁路", Xh: getRelayXqVal(spkElectronic.SPKSXPLAJ)})
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKS1", Xh: getRelayXqVal(spkElectronic.SPKSX1J)}) sta.SpksState = append(sta.SpksState, &state_proto.ReplyState{Code: "SPKS1", Xh: getRelayXqVal(spkElectronic.SPKSX1J)})
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKS3", Xh: getRelayXqVal(spkElectronic.SPKSX3J)}) sta.SpksState = append(sta.SpksState, &state_proto.ReplyState{Code: "SPKS3", Xh: getRelayXqVal(spkElectronic.SPKSX3J)})
} else { } else {
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKSS旁路", Xh: getRelayXqVal(spkElectronic.SPKSSPLAJ)}) sta.SpksState = append(sta.SpksState, &state_proto.ReplyState{Code: "SPKSS旁路", Xh: getRelayXqVal(spkElectronic.SPKSSPLAJ)})
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKS2", Xh: getRelayXqVal(spkElectronic.SPKSS2J)}) sta.SpksState = append(sta.SpksState, &state_proto.ReplyState{Code: "SPKS2", Xh: getRelayXqVal(spkElectronic.SPKSS2J)})
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKS4", Xh: getRelayXqVal(spkElectronic.SPKSS4J)}) sta.SpksState = append(sta.SpksState, &state_proto.ReplyState{Code: "SPKS4", Xh: getRelayXqVal(spkElectronic.SPKSS4J)})
} }
} }
psdId := platformScreenDoorMap[pid] psdId := platformScreenDoorMap[pid]
@ -448,15 +448,15 @@ func collectPlatformStates(world ecs.World, mapId int32) ([]*state.PlatformState
} }
if psdEntry.HasComponent(component.PlatformMkxCircuitType) { if psdEntry.HasComponent(component.PlatformMkxCircuitType) {
mkxCircuit := component.PlatformMkxCircuitType.Get(psdEntry) mkxCircuit := component.PlatformMkxCircuitType.Get(psdEntry)
mkxj := &state.MkxJState{Code: psdUid.Code} mkxj := &state_proto.MkxJState{Code: psdUid.Code}
if mkxCircuit.PABJ != nil { if mkxCircuit.PABJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "站台确认继电器", Xh: getRelayXqVal(mkxCircuit.PABJ)}) mkxj.ReplyState = append(mkxj.ReplyState, &state_proto.ReplyState{Code: "站台确认继电器", Xh: getRelayXqVal(mkxCircuit.PABJ)})
} }
if mkxCircuit.PCBJ != nil { if mkxCircuit.PCBJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "站台关门继电器", Xh: getRelayXqVal(mkxCircuit.PCBJ)}) mkxj.ReplyState = append(mkxj.ReplyState, &state_proto.ReplyState{Code: "站台关门继电器", Xh: getRelayXqVal(mkxCircuit.PCBJ)})
} }
if mkxCircuit.POBJ != nil { if mkxCircuit.POBJ != nil {
mkxj.ReplyState = append(mkxj.ReplyState, &state.ReplyState{Code: "站台开门继电器", Xh: getRelayXqVal(mkxCircuit.POBJ)}) mkxj.ReplyState = append(mkxj.ReplyState, &state_proto.ReplyState{Code: "站台开门继电器", Xh: getRelayXqVal(mkxCircuit.POBJ)})
} }
sta.MkxJState = mkxj sta.MkxJState = mkxj
} }
@ -468,7 +468,7 @@ func collectPlatformStates(world ecs.World, mapId int32) ([]*state.PlatformState
} }
// 将屏蔽门关联到站台 // 将屏蔽门关联到站台
func wrapScreenDoorToPlatform(mapData *graphicData.RtssGraphicStorage) map[uint32]uint32 { func wrapScreenDoorToPlatform(mapData *data_proto.RtssGraphicStorage) map[uint32]uint32 {
platformMap := make(map[uint32]uint32, len(mapData.Platforms)) platformMap := make(map[uint32]uint32, len(mapData.Platforms))
for _, s := range mapData.ScreenDoors { for _, s := range mapData.ScreenDoors {
platformMap[s.RefPlatformId] = memory.GetMapElementId(s.Common) platformMap[s.RefPlatformId] = memory.GetMapElementId(s.Common)

View File

@ -1,8 +1,8 @@
package message_server package message_server
import ( import (
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/mqtt" "joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory" "joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
) )
@ -11,10 +11,10 @@ func Start(vs *memory.VerifySimulation) {
for _, mapId := range vs.MapIds { for _, mapId := range vs.MapIds {
t := memory.QueryGiType(mapId) t := memory.QueryGiType(mapId)
switch t { switch t {
case graphicData.PictureType_StationLayout: // 平面布置图 case data_proto.PictureType_StationLayout: // 平面布置图
// 添加车站关联的平面布置图、IBP、PSL信息 // 添加车站关联的平面布置图、IBP、PSL信息
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewSfpMs(vs, mapId), NewIBPMs(vs, mapId), NewPSLMs(vs, mapId)) mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewSfpMs(vs, mapId), NewIBPMs(vs, mapId), NewPSLMs(vs, mapId))
case graphicData.PictureType_RelayCabinetLayout: // 继电器柜 case data_proto.PictureType_RelayCabinetLayout: // 继电器柜
mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewRccMs(vs, mapId)) mqtt.GetMsgClient().PublishTask(vs.SimulationId, NewRccMs(vs, mapId))
} }
} }

View File

@ -2,10 +2,10 @@ package message_server
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt" "joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory" "joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
"joylink.club/ecs" "joylink.club/ecs"
) )
@ -13,14 +13,14 @@ import (
func NewStateMs(vs *memory.VerifySimulation) ms_api.MsgTask { func NewStateMs(vs *memory.VerifySimulation) ms_api.MsgTask {
return ms_api.NewMonitorTask(fmt.Sprintf("仿真[%s]状态", vs.SimulationId), func() { return ms_api.NewMonitorTask(fmt.Sprintf("仿真[%s]状态", vs.SimulationId), func() {
ecs.WorldStateChangeEvent.Subscribe(vs.World, func(_ ecs.World, e ecs.WorldStateChange) { ecs.WorldStateChangeEvent.Subscribe(vs.World, func(_ ecs.World, e ecs.WorldStateChange) {
s := &state.SimulationStatus{SimulationId: vs.SimulationId} s := &state_proto.SimulationStatus{SimulationId: vs.SimulationId}
switch e.NewState { switch e.NewState {
case ecs.WorldClosed: case ecs.WorldClosed:
s.State = state.SimulationStatus_DESTROY s.State = state_proto.SimulationStatus_DESTROY
case ecs.WorldError: case ecs.WorldError:
s.State = state.SimulationStatus_ERROR s.State = state_proto.SimulationStatus_ERROR
case ecs.WorldPause: case ecs.WorldPause:
s.State = state.SimulationStatus_PAUSE s.State = state_proto.SimulationStatus_PAUSE
default: default:
return return
} }

View File

@ -9,8 +9,8 @@ import (
"github.com/sagikazarmark/slog-shim" "github.com/sagikazarmark/slog-shim"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoreflect"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/ts/protos/state"
) )
var mqttClient *MqttClient var mqttClient *MqttClient
@ -107,26 +107,26 @@ func (client *MqttClient) CloseTask(simulationId string) {
} }
// 发送仿真状态数据 // 发送仿真状态数据
func (client *MqttClient) PubSimulationState(simulationId string, msg *state.SimulationStatus) error { func (client *MqttClient) PubSimulationState(simulationId string, msg *state_proto.SimulationStatus) error {
return client.pub(GetStateTopic(simulationId), msg) return client.pub(GetStateTopic(simulationId), msg)
} }
// 发送IBP状态数据 // 发送IBP状态数据
func (client *MqttClient) PubIBPState(simulationId string, mapId int32, stationId uint32, msg *state.PushedDevicesStatus) error { func (client *MqttClient) PubIBPState(simulationId string, mapId int32, stationId uint32, msg *state_proto.PushedDevicesStatus) error {
return client.pub(GetIbpTopic(simulationId, mapId, stationId), msg) return client.pub(GetIbpTopic(simulationId, mapId, stationId), msg)
} }
// 发送PSL状态数据 // 发送PSL状态数据
func (client *MqttClient) PubPSLState(simulationId string, mapId int32, boxId uint32, msg *state.PushedDevicesStatus) error { func (client *MqttClient) PubPSLState(simulationId string, mapId int32, boxId uint32, msg *state_proto.PushedDevicesStatus) error {
return client.pub(GetPslTopic(simulationId, mapId, boxId), msg) return client.pub(GetPslTopic(simulationId, mapId, boxId), msg)
} }
// 发送继电器状态数据 // 发送继电器状态数据
func (client *MqttClient) PubRCCState(simulationId string, mapId int32, msg *state.PushedDevicesStatus) error { func (client *MqttClient) PubRCCState(simulationId string, mapId int32, msg *state_proto.PushedDevicesStatus) error {
return client.pub(GetRccTopic(simulationId, mapId), msg) return client.pub(GetRccTopic(simulationId, mapId), msg)
} }
// 发送站场图状态数据 // 发送站场图状态数据
func (client *MqttClient) PubSfpState(simulationId string, mapId int32, msg *state.PushedDevicesStatus) error { func (client *MqttClient) PubSfpState(simulationId string, mapId int32, msg *state_proto.PushedDevicesStatus) error {
return client.pub(GetSfpTopic(simulationId, mapId), msg) return client.pub(GetSfpTopic(simulationId, mapId), msg)
} }

View File

@ -1,18 +1,21 @@
package main package main
import ( import (
"bufio"
"fmt" "fmt"
"io/fs" "io/fs"
"log" "log"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strings"
) )
var ( var (
basePath, _ = os.Getwd() basePath, _ = os.Getwd()
protoFolder = filepath.Join(basePath, "bj-rtss-message", "protos") protoFolder = filepath.Join(basePath, "bj-rtss-message", "protos")
protocPath = filepath.Join(basePath, "bj-rtss-message", "protoc-23.1", "bin", "win64", "protoc") protocPath = filepath.Join(basePath, "bj-rtss-message", "protoc-23.1", "bin", "win64", "protoc")
modulePrefix = "joylink.club/bj-rtsts-server"
) )
func main() { func main() {
@ -44,7 +47,34 @@ func getProtoFiles() []string {
// 编译proto文件为Go文件 // 编译proto文件为Go文件
func compileProto(protoFiles []string) error { func compileProto(protoFiles []string) error {
for _, fileName := range protoFiles { for _, fileName := range protoFiles {
cmd := exec.Command(protocPath, "-I="+protoFolder, "--go_out=./", fileName) file, err := os.Open(fileName)
if err != nil {
return err
}
scanner := bufio.NewScanner(file)
var outPath string
for scanner.Scan() {
text := scanner.Text()
if !strings.HasPrefix(text, "option go_package") {
continue
}
start := strings.Index(text, modulePrefix)
if start < 0 {
break
}
start += len(modulePrefix)
dir := "." + text[start:len(text)-2]
err := os.MkdirAll(dir, fs.ModeDir)
if err != nil {
panic(fmt.Sprintf("创建目录 %s 失败:%v", dir, err))
}
outPath = "paths=source_relative:" + dir
break
}
if outPath == "" {
outPath = "./"
}
cmd := exec.Command(protocPath, "-I="+protoFolder, "--go_out="+outPath, fileName)
fmt.Println(cmd.String()) fmt.Println(cmd.String())
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr

@ -1 +1 @@
Subproject commit ef48c7ba0b65a11c599f1e6032f383d6a596e6f4 Subproject commit 0316b398d526147d4578fe7a76609ea0371037c7

View File

@ -8,11 +8,11 @@ import (
"joylink.club/bj-rtsts-server/db/dbquery" "joylink.club/bj-rtsts-server/db/dbquery"
"joylink.club/bj-rtsts-server/db/model" "joylink.club/bj-rtsts-server/db/model"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
) )
var trainDataType = int32(graphicData.PictureType_TrainData) var trainDataType = int32(data_proto.PictureType_TrainData)
// 查询列车信息列表 // 查询列车信息列表
func PageTrainInfoByPublished(query *dto.PageTrainInfoReqDto) *dto.PageDto { func PageTrainInfoByPublished(query *dto.PageTrainInfoReqDto) *dto.PageDto {
@ -66,8 +66,8 @@ func CreateTrain(td *dto.TrainInfoDto, user *model.User) bool {
// 转成列车proto // 转成列车proto
func convertTrainProto(t *dto.TrainInfoDto) []byte { func convertTrainProto(t *dto.TrainInfoDto) []byte {
message := &graphicData.Train{ message := &data_proto.Train{
TrainModel: graphicData.Train_TrainModel(t.TrainModel), TrainModel: data_proto.Train_TrainModel(t.TrainModel),
CarriageLength: t.CarriageLength, CarriageLength: t.CarriageLength,
TotalLength: t.TotalLength, TotalLength: t.TotalLength,
MinDiameter: t.MinDiameter, MinDiameter: t.MinDiameter,

View File

@ -2,20 +2,19 @@ package message
import ( import (
"encoding/binary" "encoding/binary"
"joylink.club/bj-rtsts-server/dto/state_proto"
"math" "math"
"time" "time"
"joylink.club/bj-rtsts-server/ts/protos/state"
) )
// 接收到的列车控制信息 // 接收到的列车控制信息
type TrainControlMsg struct { type TrainControlMsg struct {
ControlInfo *state.TrainVobcState ControlInfo *state_proto.TrainVobcState
} }
// 解析VOBC列车信息 // 解析VOBC列车信息
func (r *TrainControlMsg) Decode(buf []byte) error { func (r *TrainControlMsg) Decode(buf []byte) error {
t := &state.TrainVobcState{} t := &state_proto.TrainVobcState{}
t.LifeSignal = int32(binary.BigEndian.Uint16(buf[0:2])) t.LifeSignal = int32(binary.BigEndian.Uint16(buf[0:2]))
b2 := buf[2] b2 := buf[2]
t.Tc1Active = (b2 & 1) != 0 t.Tc1Active = (b2 & 1) != 0

View File

@ -3,7 +3,7 @@ package memory
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/ts/protos/graphicData" "joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
) )
@ -16,7 +16,7 @@ func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId u
if uidMap.IbpButtonIds[btnId] == nil { if uidMap.IbpButtonIds[btnId] == nil {
return fmt.Errorf("车站【%d】按钮【%d】UID不存在", stationId, btnId) return fmt.Errorf("车站【%d】按钮【%d】UID不存在", stationId, btnId)
} }
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{}) stationUid := QueryUidByMidAndComId(mapId, stationId, &data_proto.Station{})
if pressDown { if pressDown {
return fi.PressDownButton(sim.World, stationUid+"_"+uidMap.IbpButtonIds[btnId].Uid) return fi.PressDownButton(sim.World, stationUid+"_"+uidMap.IbpButtonIds[btnId].Uid)
} else { } else {
@ -33,14 +33,14 @@ func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, stationId, keyId uint
if uidMap.IbpKeyIds[keyId] == nil { if uidMap.IbpKeyIds[keyId] == nil {
return fmt.Errorf("车站【%d】钥匙【%d】UID不存在", stationId, keyId) return fmt.Errorf("车站【%d】钥匙【%d】UID不存在", stationId, keyId)
} }
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{}) stationUid := QueryUidByMidAndComId(mapId, stationId, &data_proto.Station{})
return fi.SwitchKeyGear(sim.World, stationUid+"_"+uidMap.IbpKeyIds[keyId].Uid, gear) return fi.SwitchKeyGear(sim.World, stationUid+"_"+uidMap.IbpKeyIds[keyId].Uid, gear)
} }
// 根据平面布置图ID、列车ID获取IbpUid信息 // 根据平面布置图ID、列车ID获取IbpUid信息
func getIbpUidByMapIdAndStationId(mapId int32, stationId uint32) (*IBPUidStructure, error) { func getIbpUidByMapIdAndStationId(mapId int32, stationId uint32) (*IBPUidStructure, error) {
giData := QueryGiData[*graphicData.RtssGraphicStorage](mapId) giData := QueryGiData[*data_proto.RtssGraphicStorage](mapId)
var station *graphicData.Station var station *data_proto.Station
for _, s := range giData.Stations { for _, s := range giData.Stations {
if GetMapElementId(s.Common) == stationId { if GetMapElementId(s.Common) == stationId {
station = s station = s
@ -54,6 +54,6 @@ func getIbpUidByMapIdAndStationId(mapId int32, stationId uint32) (*IBPUidStructu
if station.RefIbpMapCode == "" { if station.RefIbpMapCode == "" {
return nil, fmt.Errorf("车站【%s】未关联IBP地图", station.StationName) return nil, fmt.Errorf("车站【%s】未关联IBP地图", station.StationName)
} }
ibpMapId, _ := QueryGiDataByName[*graphicData.IBPGraphicStorage](station.RefIbpMapCode) ibpMapId, _ := QueryGiDataByName[*data_proto.IBPGraphicStorage](station.RefIbpMapCode)
return QueryUidStructure[*IBPUidStructure](ibpMapId), nil return QueryUidStructure[*IBPUidStructure](ibpMapId), nil
} }

View File

@ -13,16 +13,16 @@ import (
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/service" "joylink.club/bj-rtsts-server/service"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
) )
var giPublishData sync.Map var giPublishData sync.Map
type giStoreData struct { type giStoreData struct {
name string name string
giType graphicData.PictureType giType data_proto.PictureType
message proto.Message message proto.Message
version int32 version int32
} }
@ -30,15 +30,15 @@ type giStoreData struct {
// 将发布的地图数据放入内存中 // 将发布的地图数据放入内存中
func PublishMapVerifyStructure(graphic *dto.PublishedDto) { func PublishMapVerifyStructure(graphic *dto.PublishedDto) {
var message proto.Message var message proto.Message
switch graphicData.PictureType(graphic.Type) { switch data_proto.PictureType(graphic.Type) {
case graphicData.PictureType_StationLayout: case data_proto.PictureType_StationLayout:
message = &graphicData.RtssGraphicStorage{} message = &data_proto.RtssGraphicStorage{}
case graphicData.PictureType_RelayCabinetLayout: case data_proto.PictureType_RelayCabinetLayout:
message = &graphicData.RelayCabinetGraphicStorage{} message = &data_proto.RelayCabinetGraphicStorage{}
case graphicData.PictureType_Psl: case data_proto.PictureType_Psl:
message = &graphicData.PslGraphicStorage{} message = &data_proto.PslGraphicStorage{}
case graphicData.PictureType_IBP: case data_proto.PictureType_IBP:
message = &graphicData.IBPGraphicStorage{} message = &data_proto.IBPGraphicStorage{}
} }
err := proto.Unmarshal(graphic.Proto, message) err := proto.Unmarshal(graphic.Proto, message)
if err != nil { if err != nil {
@ -47,21 +47,21 @@ func PublishMapVerifyStructure(graphic *dto.PublishedDto) {
// 缓存数据 // 缓存数据
giPublishData.Store(graphic.ID, &giStoreData{ giPublishData.Store(graphic.ID, &giStoreData{
name: graphic.Name, name: graphic.Name,
giType: graphicData.PictureType(graphic.Type), giType: data_proto.PictureType(graphic.Type),
message: message, message: message,
version: graphic.Version, version: graphic.Version,
}) })
// 初始化地图结构 // 初始化地图结构
switch graphicData.PictureType(graphic.Type) { switch data_proto.PictureType(graphic.Type) {
case graphicData.PictureType_StationLayout: case data_proto.PictureType_StationLayout:
graphicStorage := message.(*graphicData.RtssGraphicStorage) graphicStorage := message.(*data_proto.RtssGraphicStorage)
filterOtherLineDevice(graphicStorage) // 处理掉其他线路的设备 filterOtherLineDevice(graphicStorage) // 处理掉其他线路的设备
giUidMap.Store(graphic.ID, initStationUid(graphicStorage)) giUidMap.Store(graphic.ID, initStationUid(graphicStorage))
case graphicData.PictureType_RelayCabinetLayout: case data_proto.PictureType_RelayCabinetLayout:
graphicStorage := message.(*graphicData.RelayCabinetGraphicStorage) graphicStorage := message.(*data_proto.RelayCabinetGraphicStorage)
giUidMap.Store(graphic.ID, initRelayCabinetUid(graphicStorage)) giUidMap.Store(graphic.ID, initRelayCabinetUid(graphicStorage))
case graphicData.PictureType_IBP: case data_proto.PictureType_IBP:
graphicStorage := message.(*graphicData.IBPGraphicStorage) graphicStorage := message.(*data_proto.IBPGraphicStorage)
giUidMap.Store(graphic.ID, initIBPUid(graphicStorage)) giUidMap.Store(graphic.ID, initIBPUid(graphicStorage))
} }
} }
@ -82,12 +82,12 @@ func DeleteMapVerifyStructure(mapId int32) {
} }
// 获取地图类型 // 获取地图类型
func QueryGiType(mapId int32) graphicData.PictureType { func QueryGiType(mapId int32) data_proto.PictureType {
value, ok := giPublishData.Load(mapId) value, ok := giPublishData.Load(mapId)
if !ok { if !ok {
graphic := service.GetPublishedById(mapId) graphic := service.GetPublishedById(mapId)
PublishMapVerifyStructure(graphic) PublishMapVerifyStructure(graphic)
return graphicData.PictureType(graphic.Type) return data_proto.PictureType(graphic.Type)
} }
d, ok := value.(*giStoreData) d, ok := value.(*giStoreData)
if !ok { if !ok {

View File

@ -8,8 +8,8 @@ import (
"sync" "sync"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/repository" "joylink.club/rtsssimulation/repository"
) )
@ -58,7 +58,7 @@ type deviceRelateUidPriex struct {
} }
// 获取地图元素ID // 获取地图元素ID
func GetMapElementId(common *graphicData.CommonInfo) uint32 { func GetMapElementId(common *data_proto.CommonInfo) uint32 {
if common.Id != 0 { if common.Id != 0 {
return common.Id return common.Id
} }
@ -79,7 +79,7 @@ func getMapELementCode(id uint32, code ...string) string {
} }
// 获取关联的车站名 // 获取关联的车站名
func handleRefStationName(stationMap map[uint32]*graphicData.Station, sid []uint32) []string { func handleRefStationName(stationMap map[uint32]*data_proto.Station, sid []uint32) []string {
var stationNames []string var stationNames []string
for _, id := range sid { for _, id := range sid {
if id == 0 { if id == 0 {
@ -96,12 +96,12 @@ func handleRefStationName(stationMap map[uint32]*graphicData.Station, sid []uint
// 获取UID的前缀信息 // 获取UID的前缀信息
func getUIdPrefix(prefix interface{}) (string, string, string) { func getUIdPrefix(prefix interface{}) (string, string, string) {
switch p := prefix.(type) { switch p := prefix.(type) {
case *graphicData.UniqueIdOfStationLayout: case *data_proto.UniqueIdOfStationLayout:
if p == nil { if p == nil {
return "", "", "" return "", "", ""
} }
return p.City, p.LineId, "" return p.City, p.LineId, ""
case *graphicData.UniqueIdType: case *data_proto.UniqueIdType:
if p == nil { if p == nil {
return "", "", "" return "", "", ""
} }
@ -112,7 +112,7 @@ func getUIdPrefix(prefix interface{}) (string, string, string) {
} }
// 过滤掉其他线路的设备 // 过滤掉其他线路的设备
func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) { func filterOtherLineDevice(data *data_proto.RtssGraphicStorage) {
otherDeviceIdMap := make(map[uint32]bool) otherDeviceIdMap := make(map[uint32]bool)
for _, ods := range data.OtherLineList { for _, ods := range data.OtherLineList {
for _, id := range ods.Ids { for _, id := range ods.Ids {
@ -127,7 +127,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
otherDeviceIdMap[did] = (strings.TrimSpace(d.Code) == "" || d.Code == "G000") otherDeviceIdMap[did] = (strings.TrimSpace(d.Code) == "" || d.Code == "G000")
} }
// 处理物理区段 // 处理物理区段
var sections []*graphicData.Section var sections []*data_proto.Section
for _, d := range data.Section { for _, d := range data.Section {
did := GetMapElementId(d.Common) did := GetMapElementId(d.Common)
if otherDeviceIdMap[did] { if otherDeviceIdMap[did] {
@ -157,14 +157,14 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
} }
data.Section = sections data.Section = sections
// 处理计轴 // 处理计轴
var axleCounts []*graphicData.AxleCounting var axleCounts []*data_proto.AxleCounting
for _, d := range data.AxleCountings { for _, d := range data.AxleCountings {
did := GetMapElementId(d.Common) did := GetMapElementId(d.Common)
if otherDeviceIdMap[did] { if otherDeviceIdMap[did] {
slog.Warn("计轴[id:%v][code:%s]设备其他线路设备已过滤", did, d.Code) slog.Warn("计轴[id:%v][code:%s]设备其他线路设备已过滤", did, d.Code)
continue continue
} }
var refs []*graphicData.RelatedRef var refs []*data_proto.RelatedRef
for _, r := range d.AxleCountingRef { for _, r := range d.AxleCountingRef {
if otherDeviceIdMap[r.Id] { if otherDeviceIdMap[r.Id] {
continue continue
@ -176,7 +176,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
} }
data.AxleCountings = axleCounts data.AxleCountings = axleCounts
// 处理道岔 // 处理道岔
var turnouts []*graphicData.Turnout var turnouts []*data_proto.Turnout
for _, d := range data.Turnouts { for _, d := range data.Turnouts {
did := GetMapElementId(d.Common) did := GetMapElementId(d.Common)
if otherDeviceIdMap[did] { if otherDeviceIdMap[did] {
@ -208,7 +208,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
} }
data.Turnouts = turnouts data.Turnouts = turnouts
// 处理信号机 // 处理信号机
var signals []*graphicData.Signal var signals []*data_proto.Signal
for _, d := range data.Signals { for _, d := range data.Signals {
did := GetMapElementId(d.Common) did := GetMapElementId(d.Common)
if otherDeviceIdMap[did] { if otherDeviceIdMap[did] {
@ -219,7 +219,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
} }
data.Signals = signals data.Signals = signals
// 处理应答器 // 处理应答器
var transponders []*graphicData.Transponder var transponders []*data_proto.Transponder
for _, d := range data.Transponders { for _, d := range data.Transponders {
did := GetMapElementId(d.Common) did := GetMapElementId(d.Common)
if otherDeviceIdMap[did] { if otherDeviceIdMap[did] {
@ -232,7 +232,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
} }
// 初始化平面布置图 UID // 初始化平面布置图 UID
func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure { func initStationUid(data *data_proto.RtssGraphicStorage) *StationUidStructure {
gus := &StationUidStructure{ gus := &StationUidStructure{
AxlePointIds: make(map[uint32]*elementIdStructure, len(data.AxleCountings)), AxlePointIds: make(map[uint32]*elementIdStructure, len(data.AxleCountings)),
TurnoutIds: make(map[uint32]*elementIdStructure, len(data.Turnouts)), TurnoutIds: make(map[uint32]*elementIdStructure, len(data.Turnouts)),
@ -250,7 +250,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
} }
city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix) city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix)
// 处理车站信息 // 处理车站信息
stationMap := make(map[uint32]*graphicData.Station) stationMap := make(map[uint32]*data_proto.Station)
for _, s := range data.Stations { for _, s := range data.Stations {
eid := GetMapElementId(s.Common) eid := GetMapElementId(s.Common)
stationName := getMapELementCode(eid, s.StationName, s.Code) stationName := getMapELementCode(eid, s.StationName, s.Code)
@ -357,7 +357,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
} }
} }
// 站台 // 站台
platformMap := make(map[uint32]*graphicData.Platform) platformMap := make(map[uint32]*data_proto.Platform)
for _, platform := range data.Platforms { for _, platform := range data.Platforms {
eid := GetMapElementId(platform.Common) eid := GetMapElementId(platform.Common)
platformMap[eid] = platform platformMap[eid] = platform
@ -416,15 +416,15 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
} }
// 初始化继电器柜 UID // 初始化继电器柜 UID
func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUidStructure { func initRelayCabinetUid(data *data_proto.RelayCabinetGraphicStorage) *RelayUidStructure {
rus := &RelayUidStructure{ rus := &RelayUidStructure{
RelayIds: make(map[uint32]*elementIdStructure, len(data.Relays)), RelayIds: make(map[uint32]*elementIdStructure, len(data.Relays)),
} }
// 继电器所属设备 // 继电器所属设备
refMap := make(map[uint32]*deviceRelateUidPriex, len(data.Relays)) refMap := make(map[uint32]*deviceRelateUidPriex, len(data.Relays))
for _, r := range data.DeviceRelateRelayList { for _, r := range data.DeviceRelateRelayList {
isStation := r.DeviceType == graphicData.RelatedRef_station isStation := r.DeviceType == data_proto.RelatedRef_station
isPsd := r.DeviceType == graphicData.RelatedRef_ScreenDoor isPsd := r.DeviceType == data_proto.RelatedRef_ScreenDoor
for _, c := range r.Combinationtypes { for _, c := range r.Combinationtypes {
p := &deviceRelateUidPriex{deviceCode: r.Code, typeCode: c.Code, isStation: isStation, isPSD: isPsd} p := &deviceRelateUidPriex{deviceCode: r.Code, typeCode: c.Code, isStation: isStation, isPSD: isPsd}
for _, i := range c.RefRelays { for _, i := range c.RefRelays {
@ -473,7 +473,7 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
} }
// 初始化IBP地图UID // 初始化IBP地图UID
func initIBPUid(data *graphicData.IBPGraphicStorage) *IBPUidStructure { func initIBPUid(data *data_proto.IBPGraphicStorage) *IBPUidStructure {
rus := &IBPUidStructure{ rus := &IBPUidStructure{
IbpButtonIds: make(map[uint32]*elementIdStructure), IbpButtonIds: make(map[uint32]*elementIdStructure),
IbpAlarmIds: make(map[uint32]*elementIdStructure), IbpAlarmIds: make(map[uint32]*elementIdStructure),
@ -580,29 +580,29 @@ func QueryUidStructure[T *StationUidStructure | *RelayUidStructure | *IBPUidStru
// 获取设备类型获取对应字段 // 获取设备类型获取对应字段
func getUidMapByType(uidData any, m interface{}) map[uint32]*elementIdStructure { func getUidMapByType(uidData any, m interface{}) map[uint32]*elementIdStructure {
switch m.(type) { switch m.(type) {
case *graphicData.AxleCounting: case *data_proto.AxleCounting:
return (uidData.(*StationUidStructure)).AxlePointIds return (uidData.(*StationUidStructure)).AxlePointIds
case *graphicData.Turnout: case *data_proto.Turnout:
return (uidData.(*StationUidStructure)).TurnoutIds return (uidData.(*StationUidStructure)).TurnoutIds
case *graphicData.Section: case *data_proto.Section:
return (uidData.(*StationUidStructure)).PhysicalSectionIds return (uidData.(*StationUidStructure)).PhysicalSectionIds
case *graphicData.Signal: case *data_proto.Signal:
return (uidData.(*StationUidStructure)).SignalIds return (uidData.(*StationUidStructure)).SignalIds
case *graphicData.Transponder: case *data_proto.Transponder:
return (uidData.(*StationUidStructure)).TransponderIds return (uidData.(*StationUidStructure)).TransponderIds
case *graphicData.Slope: case *data_proto.Slope:
return (uidData.(*StationUidStructure)).SlopeIds return (uidData.(*StationUidStructure)).SlopeIds
case *graphicData.Curvature: case *data_proto.Curvature:
return (uidData.(*StationUidStructure)).CurvatureIds return (uidData.(*StationUidStructure)).CurvatureIds
case *graphicData.Relay: case *data_proto.Relay:
return (uidData.(*RelayUidStructure)).RelayIds return (uidData.(*RelayUidStructure)).RelayIds
case *graphicData.EsbButton: case *data_proto.EsbButton:
return (uidData.(*StationUidStructure)).ButtonIds return (uidData.(*StationUidStructure)).ButtonIds
case *graphicData.Station: case *data_proto.Station:
return (uidData.(*StationUidStructure)).StationIds return (uidData.(*StationUidStructure)).StationIds
case *graphicData.SpksSwitch: case *data_proto.SpksSwitch:
return (uidData.(*StationUidStructure)).SpksSwitchIds return (uidData.(*StationUidStructure)).SpksSwitchIds
case *graphicData.ScreenDoor: case *data_proto.ScreenDoor:
return (uidData.(*StationUidStructure)).PsdIds return (uidData.(*StationUidStructure)).PsdIds
default: default:
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"}) panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})

View File

@ -2,15 +2,15 @@ package memory
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/component/component_proto" "joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
) )
// 处理道岔操作 // 处理道岔操作
func HandlePsdOperation(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error { func HandlePsdOperation(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error {
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.ScreenDoor{}) uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.ScreenDoor{})
switch req.Operation { switch req.Operation {
case request_proto.Psd_Km: case request_proto.Psd_Km:
return fi.SetInterlockKm(simulation.World, uid, req.Group) return fi.SetInterlockKm(simulation.World, uid, req.Group)

View File

@ -3,14 +3,14 @@ package memory
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
) )
// 继电器操作方法 // 继电器操作方法
func ChangeRelayState(sim *VerifySimulation, mapId int32, id uint32, td bool) error { func ChangeRelayState(sim *VerifySimulation, mapId int32, id uint32, td bool) error {
uid := QueryUidByMidAndComId(mapId, id, &graphicData.Relay{}) uid := QueryUidByMidAndComId(mapId, id, &data_proto.Relay{})
if td { if td {
return fi.DriveRelayUp(sim.World, uid) return fi.DriveRelayUp(sim.World, uid)
} else { } else {
@ -20,7 +20,7 @@ func ChangeRelayState(sim *VerifySimulation, mapId int32, id uint32, td bool) er
// 处理继电器操作 // 处理继电器操作
func HandleRelayOperation(simulation *VerifySimulation, req *request_proto.RelayOperationReq) error { func HandleRelayOperation(simulation *VerifySimulation, req *request_proto.RelayOperationReq) error {
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Relay{}) uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.Relay{})
var err error var err error
switch req.Operation { switch req.Operation {
case request_proto.Relay_ForceQw: case request_proto.Relay_ForceQw:

View File

@ -4,13 +4,13 @@ import (
"log/slog" "log/slog"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
) )
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error { func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error {
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{}) sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.Section{})
slog.Debug("操作计轴区段", "axleSectionUid", sectionUid) slog.Debug("操作计轴区段", "axleSectionUid", sectionUid)
if req.TrainIn { if req.TrainIn {
return fi.AxleSectionTrainDrive(simulation.World, sectionUid, true) return fi.AxleSectionTrainDrive(simulation.World, sectionUid, true)

View File

@ -2,12 +2,12 @@ package memory
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/dto/state_proto"
"log/slog" "log/slog"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_proto" "joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/consts" "joylink.club/rtsssimulation/consts"
@ -17,7 +17,7 @@ import (
) )
func ChangeSignalState(simulation *VerifySimulation, req *dto.SignalOperationReqDto) { func ChangeSignalState(simulation *VerifySimulation, req *dto.SignalOperationReqDto) {
signalUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Signal{}) signalUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.Signal{})
signalModel, err := simulation.Repo.FindModel(signalUid, proto.DeviceType_DeviceType_Signal) signalModel, err := simulation.Repo.FindModel(signalUid, proto.DeviceType_DeviceType_Signal)
if err != nil { if err != nil {
panic(fmt.Sprintf("信号机[%s]模型不存在", signalUid)) panic(fmt.Sprintf("信号机[%s]模型不存在", signalUid))
@ -119,107 +119,107 @@ func ChangeSignalState(simulation *VerifySimulation, req *dto.SignalOperationReq
} }
} }
func changeSignalJCKXHState(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { func changeSignalJCKXHState(w ecs.World, signalUid string, toAspect state_proto.Signal_Aspect) {
switch toAspect { switch toAspect {
case state.Signal_U: case state_proto.Signal_U:
fi.DriveSignalJCKXHLx(w, signalUid) fi.DriveSignalJCKXHLx(w, signalUid)
case state.Signal_B: case state_proto.Signal_B:
fi.DriveSignalJCKXHDx(w, signalUid) fi.DriveSignalJCKXHDx(w, signalUid)
case state.Signal_H: case state_proto.Signal_H:
fi.DriveSignalJCKXHNon(w, signalUid) fi.DriveSignalJCKXHNon(w, signalUid)
default: default:
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]}) panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
} }
} }
func changeSignalDCXHState(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { func changeSignalDCXHState(w ecs.World, signalUid string, toAspect state_proto.Signal_Aspect) {
switch toAspect { switch toAspect {
case state.Signal_B: case state_proto.Signal_B:
fi.DriveSignalDCXHDx(w, signalUid) fi.DriveSignalDCXHDx(w, signalUid)
case state.Signal_A: case state_proto.Signal_A:
fi.DriveSignalDCXHNon(w, signalUid) fi.DriveSignalDCXHNon(w, signalUid)
default: default:
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]}) panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
} }
} }
func changeSignal3XH4State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { func changeSignal3XH4State(w ecs.World, signalUid string, toAspect state_proto.Signal_Aspect) {
switch toAspect { switch toAspect {
case state.Signal_OFF: case state_proto.Signal_OFF:
fi.DriveSignal3XH4Dd(w, signalUid, false) fi.DriveSignal3XH4Dd(w, signalUid, false)
case state.Signal_L: case state_proto.Signal_L:
fi.DriveSignal3XH4Dd(w, signalUid, true) fi.DriveSignal3XH4Dd(w, signalUid, true)
fi.DriveSignal3XH4Lx(w, signalUid, true) fi.DriveSignal3XH4Lx(w, signalUid, true)
case state.Signal_U: case state_proto.Signal_U:
fi.DriveSignal3XH4Dd(w, signalUid, true) fi.DriveSignal3XH4Dd(w, signalUid, true)
fi.DriveSignal3XH4Lx(w, signalUid, false) fi.DriveSignal3XH4Lx(w, signalUid, false)
case state.Signal_H: case state_proto.Signal_H:
fi.DriveSignal3XH4Dd(w, signalUid, true) fi.DriveSignal3XH4Dd(w, signalUid, true)
fi.DriveSignal3XH4Non(w, signalUid) fi.DriveSignal3XH4Non(w, signalUid)
default: default:
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]}) panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
} }
} }
func changeSignal3XH3State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { func changeSignal3XH3State(w ecs.World, signalUid string, toAspect state_proto.Signal_Aspect) {
switch toAspect { switch toAspect {
case state.Signal_OFF: case state_proto.Signal_OFF:
fi.DriveSignal3XH3Dd(w, signalUid, false) fi.DriveSignal3XH3Dd(w, signalUid, false)
case state.Signal_U: case state_proto.Signal_U:
fi.DriveSignal3XH3Dd(w, signalUid, true) fi.DriveSignal3XH3Dd(w, signalUid, true)
fi.DriveSignal3XH3Lx(w, signalUid) fi.DriveSignal3XH3Lx(w, signalUid)
case state.Signal_HU: case state_proto.Signal_HU:
fi.DriveSignal3XH3Dd(w, signalUid, true) fi.DriveSignal3XH3Dd(w, signalUid, true)
fi.DriveSignal3XH3Yx(w, signalUid) fi.DriveSignal3XH3Yx(w, signalUid)
case state.Signal_H: case state_proto.Signal_H:
fi.DriveSignal3XH3Dd(w, signalUid, true) fi.DriveSignal3XH3Dd(w, signalUid, true)
fi.DriveSignal3XH3Non(w, signalUid) fi.DriveSignal3XH3Non(w, signalUid)
default: default:
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]}) panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
} }
} }
func changeSignal3XH2State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { func changeSignal3XH2State(w ecs.World, signalUid string, toAspect state_proto.Signal_Aspect) {
switch toAspect { switch toAspect {
case state.Signal_OFF: case state_proto.Signal_OFF:
fi.DriveSignal3XH2Dd(w, signalUid, false) fi.DriveSignal3XH2Dd(w, signalUid, false)
case state.Signal_L: case state_proto.Signal_L:
fi.DriveSignal3XH2Dd(w, signalUid, true) fi.DriveSignal3XH2Dd(w, signalUid, true)
fi.DriveSignal3XH2Lx(w, signalUid) fi.DriveSignal3XH2Lx(w, signalUid)
case state.Signal_HU: case state_proto.Signal_HU:
fi.DriveSignal3XH2Dd(w, signalUid, true) fi.DriveSignal3XH2Dd(w, signalUid, true)
fi.DriveSignal3XH2Yx(w, signalUid) fi.DriveSignal3XH2Yx(w, signalUid)
case state.Signal_H: case state_proto.Signal_H:
fi.DriveSignal3XH2Dd(w, signalUid, true) fi.DriveSignal3XH2Dd(w, signalUid, true)
fi.DriveSignal3XH2Non(w, signalUid) fi.DriveSignal3XH2Non(w, signalUid)
default: default:
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]}) panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
} }
} }
func changeSignal3XH1State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { func changeSignal3XH1State(w ecs.World, signalUid string, toAspect state_proto.Signal_Aspect) {
switch toAspect { switch toAspect {
case state.Signal_OFF: case state_proto.Signal_OFF:
fi.DriveSignal3XH1Dd(w, signalUid, false) fi.DriveSignal3XH1Dd(w, signalUid, false)
case state.Signal_L: case state_proto.Signal_L:
fi.DriveSignal3XH1Dd(w, signalUid, true) fi.DriveSignal3XH1Dd(w, signalUid, true)
fi.DriveSignal3XH1Lx(w, signalUid, true) fi.DriveSignal3XH1Lx(w, signalUid, true)
case state.Signal_U: case state_proto.Signal_U:
fi.DriveSignal3XH1Dd(w, signalUid, true) fi.DriveSignal3XH1Dd(w, signalUid, true)
fi.DriveSignal3XH1Lx(w, signalUid, false) fi.DriveSignal3XH1Lx(w, signalUid, false)
case state.Signal_HU: case state_proto.Signal_HU:
fi.DriveSignal3XH1Dd(w, signalUid, true) fi.DriveSignal3XH1Dd(w, signalUid, true)
fi.DriveSignal3XH1Yx(w, signalUid) fi.DriveSignal3XH1Yx(w, signalUid)
case state.Signal_H: case state_proto.Signal_H:
fi.DriveSignal3XH1Dd(w, signalUid, true) fi.DriveSignal3XH1Dd(w, signalUid, true)
fi.DriveSignal3XH1Non(w, signalUid) fi.DriveSignal3XH1Non(w, signalUid)
default: default:
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]}) panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
} }
} }
func changeSignal2XH1State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { func changeSignal2XH1State(w ecs.World, signalUid string, toAspect state_proto.Signal_Aspect) {
switch toAspect { switch toAspect {
case state.Signal_OFF: case state_proto.Signal_OFF:
fi.DriveSignal2XH1Dd(w, signalUid, false) fi.DriveSignal2XH1Dd(w, signalUid, false)
case state.Signal_L: case state_proto.Signal_L:
fi.DriveSignal2XH1Dd(w, signalUid, true) fi.DriveSignal2XH1Dd(w, signalUid, true)
fi.DriveSignal2XH1Lx(w, signalUid) fi.DriveSignal2XH1Lx(w, signalUid)
case state.Signal_H: case state_proto.Signal_H:
fi.DriveSignal2XH1Dd(w, signalUid, true) fi.DriveSignal2XH1Dd(w, signalUid, true)
fi.DriveSignal2XH1Non(w, signalUid) fi.DriveSignal2XH1Non(w, signalUid)
default: default:

View File

@ -1,13 +1,13 @@
package memory package memory
import ( import (
"joylink.club/bj-rtsts-server/ts/protos/graphicData" "joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
) )
// 操作esb按钮 // 操作esb按钮
func ChangeEsbButtonState(sim *VerifySimulation, mapId int32, btnId uint32, pressDown bool) error { func ChangeEsbButtonState(sim *VerifySimulation, mapId int32, btnId uint32, pressDown bool) error {
uid := QueryUidByMidAndComId(mapId, btnId, &graphicData.EsbButton{}) uid := QueryUidByMidAndComId(mapId, btnId, &data_proto.EsbButton{})
if pressDown { if pressDown {
return fi.PressDownButton(sim.World, uid) return fi.PressDownButton(sim.World, uid)
} else { } else {

View File

@ -14,12 +14,12 @@ import (
"joylink.club/bj-rtsts-server/third_party/message" "joylink.club/bj-rtsts-server/third_party/message"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
"joylink.club/bj-rtsts-server/ts/protos/graphicData" "joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/ts/protos/state" "joylink.club/bj-rtsts-server/dto/state_proto"
) )
// 增加列车状态 // 增加列车状态
func AddTrainState(vs *VerifySimulation, status *state.TrainState, mapId int32) *state.TrainState { func AddTrainState(vs *VerifySimulation, status *state_proto.TrainState, mapId int32) *state_proto.TrainState {
allTrainMap := &vs.Memory.Status.TrainStateMap allTrainMap := &vs.Memory.Status.TrainStateMap
_, ok := allTrainMap.Load(status.Id) _, ok := allTrainMap.Load(status.Id)
if ok { if ok {
@ -33,9 +33,9 @@ func AddTrainState(vs *VerifySimulation, status *state.TrainState, mapId int32)
// 映射link、偏移量、运行方向 // 映射link、偏移量、运行方向
var uid string var uid string
if status.DevicePort == "" { if status.DevicePort == "" {
uid = QueryUidByMidAndComId(mapId, status.HeadDeviceId, &graphicData.Section{}) uid = QueryUidByMidAndComId(mapId, status.HeadDeviceId, &data_proto.Section{})
} else { } else {
uid = QueryUidByMidAndComId(mapId, status.HeadDeviceId, &graphicData.Turnout{}) uid = QueryUidByMidAndComId(mapId, status.HeadDeviceId, &data_proto.Turnout{})
} }
// 车头所在link、link上的偏移 // 车头所在link、link上的偏移
linkId, loffset := QueryLinkAndOffsetByDevice(vs.Repo, uid, status.DevicePort, status.HeadOffset) linkId, loffset := QueryLinkAndOffsetByDevice(vs.Repo, uid, status.DevicePort, status.HeadOffset)
@ -53,14 +53,14 @@ func AddTrainState(vs *VerifySimulation, status *state.TrainState, mapId int32)
status.Up = up status.Up = up
status.PointTo = pointTo status.PointTo = pointTo
status.TrainKilometer = kilometer.Value status.TrainKilometer = kilometer.Value
status.DynamicState = &state.TrainDynamicState{ status.DynamicState = &state_proto.TrainDynamicState{
HeadLinkId: linkId, HeadLinkId: linkId,
HeadLinkOffset: loffset, HeadLinkOffset: loffset,
TailLinkId: tailLink, TailLinkId: tailLink,
TailLinkOffset: tailLOffset, TailLinkOffset: tailLOffset,
RunningUp: up, RunningUp: up,
} }
status.VobcState = &state.TrainVobcState{} status.VobcState = &state_proto.TrainVobcState{}
slog.Debug("列车初始化", "trainIndex", trainIndex, "linkId", linkId, "loffset", loffset) slog.Debug("列车初始化", "trainIndex", trainIndex, "linkId", linkId, "loffset", loffset)
linkIdInt, _ := strconv.Atoi(linkId) linkIdInt, _ := strconv.Atoi(linkId)
err := dynamics.Default().RequestAddTrain(&message.InitTrainInfo{ err := dynamics.Default().RequestAddTrain(&message.InitTrainInfo{
@ -91,25 +91,25 @@ func AddTrainState(vs *VerifySimulation, status *state.TrainState, mapId int32)
} }
// 修改列车信息 // 修改列车信息
func UpdateTrainInfo(vs *VerifySimulation, status *state.TrainState) *state.TrainState { func UpdateTrainInfo(vs *VerifySimulation, status *state_proto.TrainState) *state_proto.TrainState {
allTrainMap := &vs.Memory.Status.TrainStateMap allTrainMap := &vs.Memory.Status.TrainStateMap
data, ok := allTrainMap.Load(status.Id) data, ok := allTrainMap.Load(status.Id)
if !ok { if !ok {
panic(sys_error.New(fmt.Sprintf("列车【%s】不存在", status.Id))) panic(sys_error.New(fmt.Sprintf("列车【%s】不存在", status.Id)))
} }
sta := data.(*state.TrainState) sta := data.(*state_proto.TrainState)
sta.TrainLength = status.TrainLength sta.TrainLength = status.TrainLength
sta.WheelDiameter = status.WheelDiameter sta.WheelDiameter = status.WheelDiameter
return sta return sta
} }
// 根据动力学发来的信息修改列车状态 // 根据动力学发来的信息修改列车状态
func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *message.DynamicsTrainInfo) *state.TrainState { func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *message.DynamicsTrainInfo) *state_proto.TrainState {
data, ok := vs.Memory.Status.TrainStateMap.Load(trainId) data, ok := vs.Memory.Status.TrainStateMap.Load(trainId)
if !ok { if !ok {
panic(sys_error.New(fmt.Sprintf("动力学传输数据:列车【%s】不存在", trainId))) panic(sys_error.New(fmt.Sprintf("动力学传输数据:列车【%s】不存在", trainId)))
} }
sta := data.(*state.TrainState) sta := data.(*state_proto.TrainState)
delayTime := time.Now().UnixMilli() - sta.VobcState.UpdateTime delayTime := time.Now().UnixMilli() - sta.VobcState.UpdateTime
sta.ControlDelayTime = (int64(sta.VobcState.LifeSignal)-int64(info.VobcLifeSignal))*20 + delayTime sta.ControlDelayTime = (int64(sta.VobcState.LifeSignal)-int64(info.VobcLifeSignal))*20 + delayTime
//slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset) //slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
@ -193,7 +193,7 @@ func RemoveTrainState(vs *VerifySimulation, id string) {
allTrainMap := &vs.Memory.Status.TrainStateMap allTrainMap := &vs.Memory.Status.TrainStateMap
d, ok := allTrainMap.Load(id) d, ok := allTrainMap.Load(id)
if ok { if ok {
t := d.(*state.TrainState) t := d.(*state_proto.TrainState)
trainIndex, _ := strconv.ParseUint(id, 10, 16) trainIndex, _ := strconv.ParseUint(id, 10, 16)
err := dynamics.Default().RequestRemoveTrain(&message.RemoveTrainReq{ err := dynamics.Default().RequestRemoveTrain(&message.RemoveTrainReq{
TrainIndex: uint16(trainIndex), TrainIndex: uint16(trainIndex),

View File

@ -2,10 +2,11 @@ package memory
import ( import (
"fmt" "fmt"
"strings"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/component/component_data" "joylink.club/rtsssimulation/component/component_data"
"joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/entity"
@ -17,7 +18,7 @@ import (
// BalisePositionModify 应答器移位 // BalisePositionModify 应答器移位
func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDto) error { func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDto) error {
uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
transponder := simulation.Repo.FindTransponder(uid) transponder := simulation.Repo.FindTransponder(uid)
if transponder == nil { if transponder == nil {
return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId)) return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
@ -27,9 +28,9 @@ func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDt
Value: req.Km.Kilometer, Value: req.Km.Kilometer,
CoordinateSystem: req.Km.CoordinateSystem, CoordinateSystem: req.Km.CoordinateSystem,
} }
if req.Km.Direction == graphicData.KilometerSystem_LEFT { if req.Km.Direction == data_proto.KilometerSystem_LEFT {
km.Direction = proto.Direction_LEFT km.Direction = proto.Direction_LEFT
} else if req.Km.Direction == graphicData.KilometerSystem_RIGHT { } else if req.Km.Direction == data_proto.KilometerSystem_RIGHT {
km.Direction = proto.Direction_RIGHT km.Direction = proto.Direction_RIGHT
} else { } else {
panic(fmt.Sprintf("未知的公里标方向[%d]", req.Km.Direction)) panic(fmt.Sprintf("未知的公里标方向[%d]", req.Km.Direction))
@ -103,23 +104,27 @@ func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDt
// BalisePositionReset 应答器复位 // BalisePositionReset 应答器复位
func BalisePositionReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error { func BalisePositionReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error {
uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
transponder := simulation.Repo.FindTransponder(uid) balise := simulation.Repo.FindTransponder(uid)
if transponder == nil { if balise == nil {
return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId)) return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
} }
entry, _ := entity.GetEntityByUid(simulation.World, uid) return balisePositionReset(simulation, balise)
component.KmType.Set(entry, transponder.Km()) }
func balisePositionReset(simulation *VerifySimulation, balise *repository.Transponder) error {
entry, _ := entity.GetEntityByUid(simulation.World, balise.Id())
component.KmType.Set(entry, balise.Km())
component.LinkPositionType.SetValue(entry, component_data.LinkPosition{ component.LinkPositionType.SetValue(entry, component_data.LinkPosition{
LinkId: transponder.LinkPosition().Link().Id(), LinkId: balise.LinkPosition().Link().Id(),
Offset: transponder.LinkPosition().Offset(), Offset: balise.LinkPosition().Offset(),
}) })
return nil return nil
} }
// BaliseTelegramModify 修改应答器报文 // BaliseTelegramModify 修改应答器报文
func BaliseTelegramModify(simulation *VerifySimulation, req *dto.BaliseModifyTelegramReqDto) error { func BaliseTelegramModify(simulation *VerifySimulation, req *dto.BaliseModifyTelegramReqDto) error {
uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
entry, ok := entity.GetEntityByUid(simulation.World, uid) entry, ok := entity.GetEntityByUid(simulation.World, uid)
if !ok { if !ok {
return sys_error.New(fmt.Sprintf("没有[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId)) return sys_error.New(fmt.Sprintf("没有[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
@ -130,25 +135,45 @@ func BaliseTelegramModify(simulation *VerifySimulation, req *dto.BaliseModifyTel
// BaliseTelegramReset 重置应答器报文 // BaliseTelegramReset 重置应答器报文
func BaliseTelegramReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error { func BaliseTelegramReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error {
uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid
entry, ok := entity.GetEntityByUid(simulation.World, uid)
if !ok {
return sys_error.New(fmt.Sprintf("没有[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
}
worldData := entity.GetWorldData(simulation.World) worldData := entity.GetWorldData(simulation.World)
transponder := worldData.Repo.FindTransponder(uid) balise := worldData.Repo.FindTransponder(uid)
if balise == nil {
return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
}
return baliseTelegramReset(simulation, balise)
}
func baliseTelegramReset(simulation *VerifySimulation, balise *repository.Transponder) error {
entry, _ := entity.GetEntityByUid(simulation.World, balise.Id())
component.BaliseStateType.SetValue(entry, component.BaliseState{ component.BaliseStateType.SetValue(entry, component.BaliseState{
ValidTelegram: transponder.FixedTelegram(), ValidTelegram: balise.FixedTelegram(),
}) })
return nil return nil
} }
// BaliseReset 重置应答器所有状态 // BaliseReset 重置应答器所有状态
func BaliseReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error { func BaliseReset(simulation *VerifySimulation) error {
err := BaliseTelegramReset(simulation, req) var errs []error
if err != nil { for _, balise := range simulation.Repo.ResponderList() {
return err err := baliseTelegramReset(simulation, balise)
if err != nil {
errs = append(errs, err)
}
err = balisePositionReset(simulation, balise)
if err != nil {
errs = append(errs, err)
}
} }
err = BalisePositionReset(simulation, req) if len(errs) > 0 {
return err var userMsg []string
for _, err := range errs {
be, ok := err.(*sys_error.BusinessError)
if ok {
userMsg = append(userMsg, be.UserMsg)
}
}
return sys_error.New(strings.Join(userMsg, "\n"))
}
return nil
} }

View File

@ -6,13 +6,13 @@ import (
"joylink.club/rtsssimulation/component/component_proto" "joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
) )
// 处理道岔操作 // 处理道岔操作
func HandleTurnoutOperation(simulation *VerifySimulation, req *request_proto.TurnoutOperationReq) error { func HandleTurnoutOperation(simulation *VerifySimulation, req *request_proto.TurnoutOperationReq) error {
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Turnout{}) uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &data_proto.Turnout{})
var err error var err error
switch req.Operation { switch req.Operation {
case request_proto.Turnout_DC: case request_proto.Turnout_DC:

View File

@ -12,13 +12,13 @@ import (
"joylink.club/bj-rtsts-server/config" "joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/third_party/dynamics" "joylink.club/bj-rtsts-server/third_party/dynamics"
"joylink.club/bj-rtsts-server/third_party/electrical_machinery" "joylink.club/bj-rtsts-server/third_party/electrical_machinery"
"joylink.club/bj-rtsts-server/third_party/message" "joylink.club/bj-rtsts-server/third_party/message"
"joylink.club/bj-rtsts-server/third_party/semi_physical_train" "joylink.club/bj-rtsts-server/third_party/semi_physical_train"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/entity"
@ -46,7 +46,7 @@ type VerifySimulation struct {
// 运行环境配置 // 运行环境配置
runConfig *config.ThridPartyConfig runConfig *config.ThridPartyConfig
// 运行状态 // 运行状态
runState state.SimulationStatus_SimulationState runState state_proto.SimulationStatus_SimulationState
} }
// 轨旁仿真内存模型 // 轨旁仿真内存模型
@ -61,19 +61,19 @@ type WaysideMemory struct {
// 轨旁仿真模型状态 // 轨旁仿真模型状态
type VerifyStatus struct { type VerifyStatus struct {
//道岔状态key为道岔id即索引 state.SwitchState //道岔状态key为道岔id即索引 state_proto.SwitchState
SwitchStateMap sync.Map SwitchStateMap sync.Map
//轨道状态key为轨道id即索引 state.LinkState //轨道状态key为轨道id即索引 state_proto.LinkState
LinkStateMap sync.Map LinkStateMap sync.Map
//列车状态key为列车id即索引 state.TrainState //列车状态key为列车id即索引 state_proto.TrainState
TrainStateMap sync.Map TrainStateMap sync.Map
//计轴区段状态key为计轴区段的id即索引 state.SectionState //计轴区段状态key为计轴区段的id即索引 state_proto.SectionState
AxleSectionStateMap sync.Map AxleSectionStateMap sync.Map
//物理区段状态key为物理区段id即索引 state.SectionState //物理区段状态key为物理区段id即索引 state_proto.SectionState
PhysicalSectionStateMap sync.Map PhysicalSectionStateMap sync.Map
//逻辑区段状态key为逻辑区段id即索引 state.SectionState //逻辑区段状态key为逻辑区段id即索引 state_proto.SectionState
LogicSectionStateMap sync.Map LogicSectionStateMap sync.Map
//信号机状态key为信号机id,即索引 state.SignalState //信号机状态key为信号机id,即索引 state_proto.SignalState
SignalStateMap sync.Map SignalStateMap sync.Map
} }
@ -101,7 +101,7 @@ func CreateSimulation(projectId int32, mapIds []int32, runConfig *dto.ProjectRun
verifySimulation := &VerifySimulation{ verifySimulation := &VerifySimulation{
ProjectId: projectId, ProjectId: projectId,
MapIds: mapIds, MapIds: mapIds,
runState: state.SimulationStatus_PAUSE, runState: state_proto.SimulationStatus_PAUSE,
} }
// 设置运行环境 // 设置运行环境
err := verifySimulation.initRunConfig(runConfig) err := verifySimulation.initRunConfig(runConfig)
@ -118,21 +118,21 @@ func CreateSimulation(projectId int32, mapIds []int32, runConfig *dto.ProjectRun
// 启动 // 启动
func (s *VerifySimulation) Start() { func (s *VerifySimulation) Start() {
s.runState = state.SimulationStatus_START s.runState = state_proto.SimulationStatus_START
} }
// 销毁 // 销毁
func (s *VerifySimulation) Destroy() { func (s *VerifySimulation) Destroy() {
s.runState = state.SimulationStatus_DESTROY s.runState = state_proto.SimulationStatus_DESTROY
} }
// 暂停 // 暂停
func (s *VerifySimulation) Pause() { func (s *VerifySimulation) Pause() {
s.runState = state.SimulationStatus_PAUSE s.runState = state_proto.SimulationStatus_PAUSE
} }
// 获取状态 // 获取状态
func (s *VerifySimulation) GetRunState() state.SimulationStatus_SimulationState { func (s *VerifySimulation) GetRunState() state_proto.SimulationStatus_SimulationState {
return s.runState return s.runState
} }
@ -202,13 +202,13 @@ func (s *VerifySimulation) CollectSectionStatus(city string, lineId string, cent
for _, codePoint := range codePoints { for _, codePoint := range codePoints {
sectionState, find := stateMap[codePoint.SectionId] sectionState, find := stateMap[codePoint.SectionId]
if find { if find {
state := &message.SectionStatusMsg{} state_proto := &message.SectionStatusMsg{}
state.Rac = sectionState.Rac state_proto.Rac = sectionState.Rac
state.Rjt = sectionState.Rjt state_proto.Rjt = sectionState.Rjt
state.Rjo = sectionState.Rjo state_proto.Rjo = sectionState.Rjo
state.Occ = sectionState.Occ state_proto.Occ = sectionState.Occ
state.Clr = sectionState.Clr state_proto.Clr = sectionState.Clr
msg = append(msg, state) msg = append(msg, state_proto)
} else { } else {
return nil, fmt.Errorf("仿真中没有对应区段[%s]的状态", codePoint.SectionId) return nil, fmt.Errorf("仿真中没有对应区段[%s]的状态", codePoint.SectionId)
} }
@ -383,7 +383,7 @@ func speedParse(speed float32) int32 {
// 处理半实物仿真列车控制消息 // 处理半实物仿真列车控制消息
func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg(b []byte) { func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg(b []byte) {
s.Memory.Status.TrainStateMap.Range(func(_, value any) bool { s.Memory.Status.TrainStateMap.Range(func(_, value any) bool {
train := value.(*state.TrainState) train := value.(*state_proto.TrainState)
if !train.Show { // 下线列车 if !train.Show { // 下线列车
return false return false
} }
@ -548,8 +548,8 @@ func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
//创建设备 //创建设备
for _, mapId := range mapIds { for _, mapId := range mapIds {
giType := QueryGiType(mapId) giType := QueryGiType(mapId)
if giType == graphicData.PictureType_StationLayout { if giType == data_proto.PictureType_StationLayout {
stationGi := QueryGiData[*graphicData.RtssGraphicStorage](mapId) stationGi := QueryGiData[*data_proto.RtssGraphicStorage](mapId)
fillProtoRepository(repo, stationGi, mapId) fillProtoRepository(repo, stationGi, mapId)
} else { } else {
exceptStationGiMapIds = append(exceptStationGiMapIds, mapId) exceptStationGiMapIds = append(exceptStationGiMapIds, mapId)
@ -558,23 +558,23 @@ func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
//构建并关联电子元件 //构建并关联电子元件
for _, mapId := range exceptStationGiMapIds { for _, mapId := range exceptStationGiMapIds {
giType := QueryGiType(mapId) giType := QueryGiType(mapId)
if giType == graphicData.PictureType_RelayCabinetLayout { if giType == data_proto.PictureType_RelayCabinetLayout {
relayGi := QueryGiData[*graphicData.RelayCabinetGraphicStorage](mapId) relayGi := QueryGiData[*data_proto.RelayCabinetGraphicStorage](mapId)
buildAndRelateElectronicComponent(repo, relayGi, mapId) buildAndRelateElectronicComponent(repo, relayGi, mapId)
} }
} }
//构建信号平面图中物理区段码表与集中站的关系 //构建信号平面图中物理区段码表与集中站的关系
for _, mapId := range mapIds { for _, mapId := range mapIds {
giType := QueryGiType(mapId) giType := QueryGiType(mapId)
if giType == graphicData.PictureType_StationLayout { if giType == data_proto.PictureType_StationLayout {
stationGi := QueryGiData[*graphicData.RtssGraphicStorage](mapId) stationGi := QueryGiData[*data_proto.RtssGraphicStorage](mapId)
buildSectionCodePoint(repo, stationGi, mapId) buildSectionCodePoint(repo, stationGi, mapId)
} }
} }
return repo, nil return repo, nil
} }
func buildSectionCodePoint(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) { func buildSectionCodePoint(repo *proto.Repository, storage *data_proto.RtssGraphicStorage, mapId int32) {
// city := storage.UniqueIdPrefix.City // city := storage.UniqueIdPrefix.City
// lineId := storage.UniqueIdPrefix.LineId // lineId := storage.UniqueIdPrefix.LineId
uidsMap := QueryUidStructure[*StationUidStructure](mapId) uidsMap := QueryUidStructure[*StationUidStructure](mapId)
@ -587,13 +587,13 @@ func buildSectionCodePoint(repo *proto.Repository, storage *graphicData.RtssGrap
for sectionPoint, sectionGId := range sectionGIds { for sectionPoint, sectionGId := range sectionGIds {
cc := &proto.CiSectionCodePoint{} cc := &proto.CiSectionCodePoint{}
cc.Row = int32(sectionPoint) cc.Row = int32(sectionPoint)
cc.SectionId = QueryUidByMidAndComId(mapId, sectionGId, &graphicData.Section{}) cc.SectionId = QueryUidByMidAndComId(mapId, sectionGId, &data_proto.Section{})
ccs = append(ccs, cc) ccs = append(ccs, cc)
} }
ref.SectionCodePoints = ccs ref.SectionCodePoints = ccs
} }
} }
func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphicStorage, mapId int32) { func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *data_proto.RelayCabinetGraphicStorage, mapId int32) {
relayUidStructure := QueryUidStructure[*RelayUidStructure](mapId) relayUidStructure := QueryUidStructure[*RelayUidStructure](mapId)
city := relayGi.UniqueIdPrefix.City city := relayGi.UniqueIdPrefix.City
lineId := relayGi.UniqueIdPrefix.LineId lineId := relayGi.UniqueIdPrefix.LineId
@ -644,7 +644,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
} }
for _, relationship := range relayGi.DeviceRelateRelayList { for _, relationship := range relayGi.DeviceRelateRelayList {
switch relationship.DeviceType { switch relationship.DeviceType {
case graphicData.RelatedRef_Turnout: case data_proto.RelatedRef_Turnout:
turnout := turnoutMap[GenerateElementUid(city, lineId, []string{station}, relationship.Code)] turnout := turnoutMap[GenerateElementUid(city, lineId, []string{station}, relationship.Code)]
if turnout == nil { if turnout == nil {
continue continue
@ -663,7 +663,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
ComponentIds: componentIds, ComponentIds: componentIds,
}) })
} }
case graphicData.RelatedRef_signal: case data_proto.RelatedRef_signal:
signal := signalMap[GenerateElementUid(city, lineId, []string{station}, relationship.Code)] signal := signalMap[GenerateElementUid(city, lineId, []string{station}, relationship.Code)]
if signal == nil { if signal == nil {
continue continue
@ -686,7 +686,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
Code: group.Code, Code: group.Code,
ComponentIds: componentIds, ComponentIds: componentIds,
}) })
case graphicData.RelatedRef_station: case data_proto.RelatedRef_station:
station := stationMap[GenerateElementUid(city, lineId, nil, relationship.Code)] station := stationMap[GenerateElementUid(city, lineId, nil, relationship.Code)]
if station == nil { if station == nil {
continue continue
@ -704,7 +704,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
} }
station.ElectronicGroup = append(station.ElectronicGroup, d) station.ElectronicGroup = append(station.ElectronicGroup, d)
} }
case graphicData.RelatedRef_ScreenDoor: case data_proto.RelatedRef_ScreenDoor:
psd, ok := psdMap[GenerateElementUid(city, lineId, nil, relationship.Code)] psd, ok := psdMap[GenerateElementUid(city, lineId, nil, relationship.Code)]
if !ok { if !ok {
continue continue
@ -723,7 +723,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
ComponentIds: componentIds, ComponentIds: componentIds,
}) })
} }
case graphicData.RelatedRef_SignalFaultAlarm: // 信号机故障报警仪设备组合 case data_proto.RelatedRef_SignalFaultAlarm: // 信号机故障报警仪设备组合
{ {
egs := buildEgs(relationship.Combinationtypes, relayUidStructure) egs := buildEgs(relationship.Combinationtypes, relayUidStructure)
ciecs.Deccs = append(ciecs.Deccs, &proto.DeviceEcc{ ciecs.Deccs = append(ciecs.Deccs, &proto.DeviceEcc{
@ -731,7 +731,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
Egs: egs, Egs: egs,
}) })
} }
case graphicData.RelatedRef_Breakers: // 断路器 case data_proto.RelatedRef_Breakers: // 断路器
{ {
egs := buildEgs(relationship.Combinationtypes, relayUidStructure) egs := buildEgs(relationship.Combinationtypes, relayUidStructure)
ciecs.Deccs = append(ciecs.Deccs, &proto.DeviceEcc{ ciecs.Deccs = append(ciecs.Deccs, &proto.DeviceEcc{
@ -739,7 +739,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
Egs: egs, Egs: egs,
}) })
} }
case graphicData.RelatedRef_PowerScreen: // 电源屏 case data_proto.RelatedRef_PowerScreen: // 电源屏
{ {
egs := buildEgs(relationship.Combinationtypes, relayUidStructure) egs := buildEgs(relationship.Combinationtypes, relayUidStructure)
ciecs.Deccs = append(ciecs.Deccs, &proto.DeviceEcc{ ciecs.Deccs = append(ciecs.Deccs, &proto.DeviceEcc{
@ -805,7 +805,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
sortQcTable(ref.QdList) sortQcTable(ref.QdList)
} }
func buildEgs(cts []*graphicData.Combinationtype, relayUidStructure *RelayUidStructure) []*proto.ElectronicComponentGroup { func buildEgs(cts []*data_proto.Combinationtype, relayUidStructure *RelayUidStructure) []*proto.ElectronicComponentGroup {
var egs []*proto.ElectronicComponentGroup var egs []*proto.ElectronicComponentGroup
for _, ct := range cts { for _, ct := range cts {
d := &proto.ElectronicComponentGroup{Code: ct.Code} d := &proto.ElectronicComponentGroup{Code: ct.Code}
@ -860,7 +860,7 @@ func queryCentralizedStationRef(stationId string, repo *proto.Repository) *proto
} }
// 处理继电器采集信息 // 处理继电器采集信息
func handlerRelayGiCj(uidsMap *RelayUidStructure, stationId string, ciCj *graphicData.CiCj) []*proto.CjData { func handlerRelayGiCj(uidsMap *RelayUidStructure, stationId string, ciCj *data_proto.CiCj) []*proto.CjData {
if ciCj == nil { if ciCj == nil {
return nil return nil
} }
@ -881,7 +881,7 @@ func handlerRelayGiCj(uidsMap *RelayUidStructure, stationId string, ciCj *graphi
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%d】UID映射关系", stationId, j.RelayId))) panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%d】UID映射关系", stationId, j.RelayId)))
} }
d := &proto.CjDataItem{RelayId: u.Uid} d := &proto.CjDataItem{RelayId: u.Uid}
if j.Position == graphicData.CjDataItem_H { if j.Position == data_proto.CjDataItem_H {
d.Q = false d.Q = false
} else { } else {
d.Q = true d.Q = true
@ -897,7 +897,7 @@ func handlerRelayGiCj(uidsMap *RelayUidStructure, stationId string, ciCj *graphi
} }
// 处理继电器驱动信息 // 处理继电器驱动信息
func handlerRelayGiQd(uidsMap *RelayUidStructure, stationId string, ciQd *graphicData.CiQd) []*proto.QdData { func handlerRelayGiQd(uidsMap *RelayUidStructure, stationId string, ciQd *data_proto.CiQd) []*proto.QdData {
if ciQd == nil { if ciQd == nil {
return nil return nil
} }
@ -927,40 +927,40 @@ func handlerRelayGiQd(uidsMap *RelayUidStructure, stationId string, ciQd *graphi
return qdList return qdList
} }
func convertRelayModel(modelType graphicData.Relay_ModelType) proto.Relay_Model { func convertRelayModel(modelType data_proto.Relay_ModelType) proto.Relay_Model {
switch modelType { switch modelType {
case graphicData.Relay_Unknown: case data_proto.Relay_Unknown:
return proto.Relay_Unknown return proto.Relay_Unknown
case graphicData.Relay_JPXC_1000: case data_proto.Relay_JPXC_1000:
return proto.Relay_JPXC_1000 return proto.Relay_JPXC_1000
case graphicData.Relay_JPXC_1700: case data_proto.Relay_JPXC_1700:
return proto.Relay_JPXC_1700 return proto.Relay_JPXC_1700
case graphicData.Relay_JWJXC_480: case data_proto.Relay_JWJXC_480:
return proto.Relay_JWJXC_480 return proto.Relay_JWJXC_480
case graphicData.Relay_JWJXC_H125_80: case data_proto.Relay_JWJXC_H125_80:
return proto.Relay_JWJXC_H125_80 return proto.Relay_JWJXC_H125_80
case graphicData.Relay_JWXC_1700: case data_proto.Relay_JWXC_1700:
return proto.Relay_JWXC_1700 return proto.Relay_JWXC_1700
case graphicData.Relay_JWXC_H340: case data_proto.Relay_JWXC_H340:
return proto.Relay_JWXC_H340 return proto.Relay_JWXC_H340
case graphicData.Relay_JYJXC_160_260: case data_proto.Relay_JYJXC_160_260:
return proto.Relay_JYJXC_160_260 return proto.Relay_JYJXC_160_260
case graphicData.Relay_JZXC_H18: case data_proto.Relay_JZXC_H18:
return proto.Relay_JZXC_H18 return proto.Relay_JZXC_H18
default: default:
panic(fmt.Sprintf("意料之外的继电器型号:%s", modelType)) panic(fmt.Sprintf("意料之外的继电器型号:%s", modelType))
} }
} }
func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) { func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphicStorage, mapId int32) {
repo.MainCoordinateSystem = storage.UniqueIdPrefix.MainCoordinateSystem repo.MainCoordinateSystem = storage.UniqueIdPrefix.MainCoordinateSystem
axleCountingMap := make(map[uint32]*graphicData.AxleCounting) axleCountingMap := make(map[uint32]*data_proto.AxleCounting)
uidsMap := QueryUidStructure[*StationUidStructure](mapId) uidsMap := QueryUidStructure[*StationUidStructure](mapId)
for _, data := range storage.AxleCountings { for _, data := range storage.AxleCountings {
id := GetMapElementId(data.Common) id := GetMapElementId(data.Common)
axleCountingMap[id] = data axleCountingMap[id] = data
cpType := proto.CheckPointType_AxleCounter cpType := proto.CheckPointType_AxleCounter
if data.Type == graphicData.AxleCounting_SectionBoundary { if data.Type == data_proto.AxleCounting_SectionBoundary {
cpType = proto.CheckPointType_Boundary cpType = proto.CheckPointType_Boundary
} }
cp := &proto.CheckPoint{ cp := &proto.CheckPoint{
@ -975,7 +975,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
} }
for _, data := range storage.Section { for _, data := range storage.Section {
var turnoutUids []string var turnoutUids []string
if data.SectionType == graphicData.Section_TurnoutPhysical { if data.SectionType == data_proto.Section_TurnoutPhysical {
turnoutIds := findTurnoutIds(axleCountingMap, data.AxleCountings) turnoutIds := findTurnoutIds(axleCountingMap, data.AxleCountings)
for _, tid := range turnoutIds { for _, tid := range turnoutIds {
turnoutUids = append(turnoutUids, uidsMap.TurnoutIds[tid].Uid) turnoutUids = append(turnoutUids, uidsMap.TurnoutIds[tid].Uid)
@ -1013,9 +1013,9 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
CDevicePort: convertDevicePort(data.PcRef, uidsMap), CDevicePort: convertDevicePort(data.PcRef, uidsMap),
} }
switch data.SwitchMachineType { switch data.SwitchMachineType {
case graphicData.Turnout_ZDJ9_Single: case data_proto.Turnout_ZDJ9_Single:
turnout.SwitchMachineType = proto.Turnout_ZDJ9_Single turnout.SwitchMachineType = proto.Turnout_ZDJ9_Single
case graphicData.Turnout_ZDJ9_Double: case data_proto.Turnout_ZDJ9_Double:
turnout.SwitchMachineType = proto.Turnout_ZDJ9_Double turnout.SwitchMachineType = proto.Turnout_ZDJ9_Double
} }
repo.Turnouts = append(repo.Turnouts, turnout) repo.Turnouts = append(repo.Turnouts, turnout)
@ -1027,9 +1027,9 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
Model: convertToProtoSignalModel(data.Mt), Model: convertToProtoSignalModel(data.Mt),
} }
switch data.RefDev.DeviceType { switch data.RefDev.DeviceType {
case graphicData.RelatedRef_Section: case data_proto.RelatedRef_Section:
signal.SectionId = uidsMap.PhysicalSectionIds[data.RefDev.Id].Uid signal.SectionId = uidsMap.PhysicalSectionIds[data.RefDev.Id].Uid
case graphicData.RelatedRef_Turnout: case data_proto.RelatedRef_Turnout:
signal.TurnoutPort = convertDevicePort(data.RefDev, uidsMap) signal.TurnoutPort = convertDevicePort(data.RefDev, uidsMap)
} }
repo.Signals = append(repo.Signals, signal) repo.Signals = append(repo.Signals, signal)
@ -1043,9 +1043,9 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
Type: convertToProtoBaliseType(data.Type), Type: convertToProtoBaliseType(data.Type),
} }
switch data.TransponderRef.DeviceType { switch data.TransponderRef.DeviceType {
case graphicData.RelatedRef_Section: case data_proto.RelatedRef_Section:
responder.SectionId = uidsMap.PhysicalSectionIds[data.TransponderRef.Id].Uid responder.SectionId = uidsMap.PhysicalSectionIds[data.TransponderRef.Id].Uid
case graphicData.RelatedRef_Turnout: case data_proto.RelatedRef_Turnout:
responder.TurnoutPort = convertDevicePort(data.TransponderRef, uidsMap) responder.TurnoutPort = convertDevicePort(data.TransponderRef, uidsMap)
} }
for _, stationId := range data.CentralizedStations { for _, stationId := range data.CentralizedStations {
@ -1057,7 +1057,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
} }
repo.Transponders = append(repo.Transponders, responder) repo.Transponders = append(repo.Transponders, responder)
} }
slopeKsMap := make(map[uint32]*graphicData.SlopeKiloMarker) slopeKsMap := make(map[uint32]*data_proto.SlopeKiloMarker)
for _, data := range storage.SlopeKiloMarker { for _, data := range storage.SlopeKiloMarker {
slopeKsMap[GetMapElementId(data.Common)] = data slopeKsMap[GetMapElementId(data.Common)] = data
} }
@ -1073,7 +1073,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
} }
repo.Slopes = append(repo.Slopes, slope) repo.Slopes = append(repo.Slopes, slope)
} }
curveKsMap := make(map[uint32]*graphicData.CurvatureKiloMarker) curveKsMap := make(map[uint32]*data_proto.CurvatureKiloMarker)
for _, data := range storage.CurvatureKiloMarker { for _, data := range storage.CurvatureKiloMarker {
curveKsMap[GetMapElementId(data.Common)] = data curveKsMap[GetMapElementId(data.Common)] = data
} }
@ -1105,7 +1105,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
}) })
} }
// 车站关联关系 // 车站关联关系
relateMap := make(map[string]*graphicData.StationRelateDevice) relateMap := make(map[string]*data_proto.StationRelateDevice)
for _, data := range storage.StationRelateDeviceList { for _, data := range storage.StationRelateDeviceList {
relateMap[data.Code] = data relateMap[data.Code] = data
} }
@ -1152,7 +1152,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
PsdId: uidsMap.PsdIds[data.RefScreenDoor].Uid, PsdId: uidsMap.PsdIds[data.RefScreenDoor].Uid,
} }
repo.Mkxs = append(repo.Mkxs, mkx) repo.Mkxs = append(repo.Mkxs, mkx)
_, pslStorage := QueryGiDataByName[*graphicData.PslGraphicStorage](data.RefGatedBoxMapCode) _, pslStorage := QueryGiDataByName[*data_proto.PslGraphicStorage](data.RefGatedBoxMapCode)
for _, button := range pslStorage.PslButtons { for _, button := range pslStorage.PslButtons {
repoButton := &proto.Button{ repoButton := &proto.Button{
Id: boxUidInfo.Uid + "_" + button.Code, Id: boxUidInfo.Uid + "_" + button.Code,
@ -1172,7 +1172,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
} }
} }
//站台 //站台
platformMap := make(map[uint32]*graphicData.Platform) platformMap := make(map[uint32]*data_proto.Platform)
for _, data := range storage.Platforms { for _, data := range storage.Platforms {
platformId := GetMapElementId(data.Common) platformId := GetMapElementId(data.Common)
platformMap[platformId] = data platformMap[platformId] = data
@ -1206,7 +1206,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
// 将IBP的设备关联到车站中 // 将IBP的设备关联到车站中
func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, ibpMapCode string) { func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, ibpMapCode string) {
mapId, storage := QueryGiDataByName[*graphicData.IBPGraphicStorage](ibpMapCode) mapId, storage := QueryGiDataByName[*data_proto.IBPGraphicStorage](ibpMapCode)
if storage == nil { if storage == nil {
return return
} }
@ -1282,12 +1282,12 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
} }
} }
func convertKm(ks *graphicData.KilometerSystem) *proto.Kilometer { func convertKm(ks *data_proto.KilometerSystem) *proto.Kilometer {
var dir proto.Direction var dir proto.Direction
switch ks.Direction { switch ks.Direction {
case graphicData.KilometerSystem_LEFT: case data_proto.KilometerSystem_LEFT:
dir = proto.Direction_LEFT dir = proto.Direction_LEFT
case graphicData.KilometerSystem_RIGHT: case data_proto.KilometerSystem_RIGHT:
dir = proto.Direction_RIGHT dir = proto.Direction_RIGHT
} }
return &proto.Kilometer{ return &proto.Kilometer{
@ -1297,26 +1297,26 @@ func convertKm(ks *graphicData.KilometerSystem) *proto.Kilometer {
} }
} }
func convertDevicePort(ref *graphicData.RelatedRef, uidsMap *StationUidStructure) *proto.DevicePort { func convertDevicePort(ref *data_proto.RelatedRef, uidsMap *StationUidStructure) *proto.DevicePort {
if ref == nil { if ref == nil {
return nil return nil
} }
var port proto.Port var port proto.Port
switch ref.DevicePort { switch ref.DevicePort {
case graphicData.RelatedRef_A: case data_proto.RelatedRef_A:
port = proto.Port_A port = proto.Port_A
case graphicData.RelatedRef_B: case data_proto.RelatedRef_B:
port = proto.Port_B port = proto.Port_B
case graphicData.RelatedRef_C: case data_proto.RelatedRef_C:
port = proto.Port_C port = proto.Port_C
} }
var elementId string var elementId string
var deviceType proto.DeviceType var deviceType proto.DeviceType
switch ref.DeviceType { switch ref.DeviceType {
case graphicData.RelatedRef_Section: case data_proto.RelatedRef_Section:
deviceType = proto.DeviceType_DeviceType_PhysicalSection deviceType = proto.DeviceType_DeviceType_PhysicalSection
elementId = uidsMap.PhysicalSectionIds[ref.Id].Uid elementId = uidsMap.PhysicalSectionIds[ref.Id].Uid
case graphicData.RelatedRef_Turnout: case data_proto.RelatedRef_Turnout:
deviceType = proto.DeviceType_DeviceType_Turnout deviceType = proto.DeviceType_DeviceType_Turnout
elementId = uidsMap.TurnoutIds[ref.Id].Uid elementId = uidsMap.TurnoutIds[ref.Id].Uid
default: default:
@ -1329,7 +1329,7 @@ func convertDevicePort(ref *graphicData.RelatedRef, uidsMap *StationUidStructure
} }
} }
func findTurnoutIds(axleCountingMap map[uint32]*graphicData.AxleCounting, axleIds []uint32) []uint32 { func findTurnoutIds(axleCountingMap map[uint32]*data_proto.AxleCounting, axleIds []uint32) []uint32 {
if len(axleIds) <= 2 { if len(axleIds) <= 2 {
return nil return nil
} }
@ -1337,7 +1337,7 @@ func findTurnoutIds(axleCountingMap map[uint32]*graphicData.AxleCounting, axleId
for _, axleId := range axleIds { for _, axleId := range axleIds {
axle := axleCountingMap[axleId] axle := axleCountingMap[axleId]
for _, ref := range axle.AxleCountingRef { for _, ref := range axle.AxleCountingRef {
if ref.DeviceType == graphicData.RelatedRef_Turnout { if ref.DeviceType == data_proto.RelatedRef_Turnout {
turnoutMap[ref.Id] = turnoutMap[ref.Id] + 1 turnoutMap[ref.Id] = turnoutMap[ref.Id] + 1
} }
} }
@ -1363,42 +1363,42 @@ func findTurnoutIds(axleCountingMap map[uint32]*graphicData.AxleCounting, axleId
HBU_DU = 7; //JCKXH 红白黄,不封灯,有单黄,无引导 HBU_DU = 7; //JCKXH 红白黄,不封灯,有单黄,无引导
} }
*/ */
func convertToProtoSignalModel(gSmt graphicData.Signal_Model) proto.Signal_Model { func convertToProtoSignalModel(gSmt data_proto.Signal_Model) proto.Signal_Model {
switch gSmt { switch gSmt {
case graphicData.Signal_HL: case data_proto.Signal_HL:
return proto.Signal_HL return proto.Signal_HL
case graphicData.Signal_HLU_FU: case data_proto.Signal_HLU_FU:
return proto.Signal_HLU_FU return proto.Signal_HLU_FU
case graphicData.Signal_HLU_DU_YY: case data_proto.Signal_HLU_DU_YY:
return proto.Signal_HLU_DU_YY return proto.Signal_HLU_DU_YY
case graphicData.Signal_HLU_YY: case data_proto.Signal_HLU_YY:
return proto.Signal_HLU_YY return proto.Signal_HLU_YY
case graphicData.Signal_HLU_FL_DU_YY: case data_proto.Signal_HLU_FL_DU_YY:
return proto.Signal_HLU_FL_DU_YY return proto.Signal_HLU_FL_DU_YY
case graphicData.Signal_HLU_DU: case data_proto.Signal_HLU_DU:
return proto.Signal_HLU_DU return proto.Signal_HLU_DU
case graphicData.Signal_AB: case data_proto.Signal_AB:
return proto.Signal_AB return proto.Signal_AB
case graphicData.Signal_HBU_DU: case data_proto.Signal_HBU_DU:
return proto.Signal_HBU_DU return proto.Signal_HBU_DU
default: default:
panic(fmt.Sprintf("graphicData.Signal_Model[%d]无法映射到proto.Signal_Model", gSmt)) panic(fmt.Sprintf("data_proto.Signal_Model[%d]无法映射到proto.Signal_Model", gSmt))
} }
} }
func convertToProtoBaliseType(bt graphicData.Transponder_TransponderTypeEnum) proto.Transponder_Type { func convertToProtoBaliseType(bt data_proto.Transponder_TransponderTypeEnum) proto.Transponder_Type {
switch bt { switch bt {
case graphicData.Transponder_FB: case data_proto.Transponder_FB:
return proto.Transponder_FB return proto.Transponder_FB
case graphicData.Transponder_WB: case data_proto.Transponder_WB:
return proto.Transponder_WB return proto.Transponder_WB
case graphicData.Transponder_DB: case data_proto.Transponder_DB:
return proto.Transponder_DB return proto.Transponder_DB
case graphicData.Transponder_VB: case data_proto.Transponder_VB:
return proto.Transponder_VB return proto.Transponder_VB
case graphicData.Transponder_IB: case data_proto.Transponder_IB:
return proto.Transponder_IB return proto.Transponder_IB
default: default:
panic(fmt.Sprintf("graphicData.Transponder_TransponderTypeEnum[%d]无法映射到proto.Transponder_Type", bt)) panic(fmt.Sprintf("data_proto.Transponder_TransponderTypeEnum[%d]无法映射到proto.Transponder_Type", bt))
} }
} }