Merge branch 'master' into develop

This commit is contained in:
soul-walker 2024-03-19 21:24:46 +08:00
commit 5856236b12
25 changed files with 3966 additions and 1777 deletions

View File

@ -32,6 +32,10 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
authed.POST("/train/remove", removeTrain) authed.POST("/train/remove", removeTrain)
authed.POST("/train/remove/all", removeAllTrain) authed.POST("/train/remove/all", removeAllTrain)
authed.POST("/train/update", updateTrain) authed.POST("/train/update", updateTrain)
authed.POST("/train/control", controlTrain)
authed.POST("/train/conn", trainConnThird)
authed.GET("/train/conn/type/:id", trainConnTypeList)
authed.POST("/switch/operation", turnoutOperation) authed.POST("/switch/operation", turnoutOperation)
authed.POST("/relay/operation", relayOperation) authed.POST("/relay/operation", relayOperation)
authed.POST("/signal/operation", signalOperation) authed.POST("/signal/operation", signalOperation)
@ -227,10 +231,7 @@ func addTrain(c *gin.Context) {
panic(sys_error.New("添加列车失败,请求参数异常", err)) panic(sys_error.New("添加列车失败,请求参数异常", err))
} }
simulation := checkDeviceDataAndReturn(req.SimulationId) simulation := checkDeviceDataAndReturn(req.SimulationId)
//id := getAddTrainPrimaryKey(simulation)
//if id == -1 {
// panic(sys_error.New("添加列车失败,已有列车在运行"))
//}
if req.TrainId < 0 || req.TrainId >= 255 { if req.TrainId < 0 || req.TrainId >= 255 {
panic(sys_error.New("列车编号不能小于0大于255")) panic(sys_error.New("列车编号不能小于0大于255"))
} }
@ -243,6 +244,7 @@ func addTrain(c *gin.Context) {
TrainLength: req.TrainLength, TrainLength: req.TrainLength,
WheelDiameter: req.WheelDiameter, WheelDiameter: req.WheelDiameter,
Speed: req.TrainSpeed, Speed: req.TrainSpeed,
ConnState: &state_proto.TrainConnState{TrainControlMapId: req.TrainControlMapId, Conn: false, ConnType: state_proto.TrainConnState_NONE},
} }
var err *sys_error.BusinessError = memory.AddTrainStateNew(simulation, var err *sys_error.BusinessError = memory.AddTrainStateNew(simulation,
rsp, req.ConfigTrain, req.TrainEndsA, req.TrainEndsB, req.MapId) rsp, req.ConfigTrain, req.TrainEndsA, req.TrainEndsB, req.MapId)
@ -282,6 +284,78 @@ func updateTrain(c *gin.Context) {
c.JSON(http.StatusOK, &rsp) c.JSON(http.StatusOK, &rsp)
} }
// ATS测试仿真-列车连接三方
//
// @Summary ATS测试仿真-列车连接三方
//
// @Security JwtAuth
//
// @Description ATS测试仿真-列车连接三方
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param TrainConnThirdDto body dto.TrainConnThirdDto true "ATS测试仿真-修改列车基础信息"
// @Success 200 {object} dto.AddTrainRspDto
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/train/conn [post]
func trainConnThird(c *gin.Context) {
req := &dto.TrainConnThirdDto{}
if err := c.ShouldBind(req); err != nil {
panic(sys_error.New("修改列车控制参数失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
memory.TrainConnTypeUpdate(simulation, req)
c.JSON(http.StatusOK, "ok")
}
// ATS测试仿真-列车连接三方类型列表
//
// @Summary ATS测试仿真-列车连接三方类型列表
//
// @Security JwtAuth
//
// @Description ATS测试仿真-列车连接三方类型列表
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param id path string true "仿真id"
// @Success 200 {object} dto.AddTrainRspDto
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/train/conn/type/{id} [get]
func trainConnTypeList(c *gin.Context) {
simId := c.Param("id")
simulation := checkDeviceDataAndReturn(simId)
c.JSON(http.StatusOK, simulation.FindTrainConnTypes())
}
// ATS测试仿真-修改列车控制
//
// @Summary ATS测试仿真-修改列车控制
//
// @Security JwtAuth
//
// @Description ATS测试仿真-修改列车控制
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param ControlTrainReqDtos body dto.ControlTrainReqDtos true "ATS测试仿真-修改列车基础信息"
// @Success 200 {object} dto.AddTrainRspDto
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/train/control [post]
func controlTrain(c *gin.Context) {
req := &request_proto.TrainControl{}
if err := c.ShouldBind(req); err != nil {
panic(sys_error.New("修改列车控制参数失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
memory.ControlTrainUpdate(simulation, req)
c.JSON(http.StatusOK, "ok")
}
// ATS测试仿真-移除所有列车 // ATS测试仿真-移除所有列车
// //
// @Summary ATS测试仿真-移除列车 // @Summary ATS测试仿真-移除列车

View File

@ -71,6 +71,7 @@ type ThridPartyConfig struct {
CidcModbus []CidcModbusConfig `json:"cidcModbus" description:"联锁驱采Modbus接口配置"` CidcModbus []CidcModbusConfig `json:"cidcModbus" description:"联锁驱采Modbus接口配置"`
Radar RadarConfig `json:"radar" description:"车载雷达相关配置"` Radar RadarConfig `json:"radar" description:"车载雷达相关配置"`
Acc AccConfig `json:"acc" description:"车载加速计"` Acc AccConfig `json:"acc" description:"车载加速计"`
PcSimConfig VehiclePCSimConfig `json:"pcSimConfig" description:"车载pc仿真平台通信"`
} }
type RadarConfig struct { type RadarConfig struct {
Open bool `json:"open" description:"是否开启"` Open bool `json:"open" description:"是否开启"`
@ -168,6 +169,13 @@ type RsspConfig struct {
LocalUdpPort int `json:"localUdpPort" description:"本地服务器端口"` //本地服务器端口 LocalUdpPort int `json:"localUdpPort" description:"本地服务器端口"` //本地服务器端口
} }
type VehiclePCSimConfig struct {
Open bool `json:"open" description:"是否开启"`
PcSimIp string `json:"pcSimIp" description:"pc仿真平台通信ip"`
PcSimPort uint32 `json:"pcSimPort" description:"pc仿真平台通信端口"`
LocalTestingPort uint32 `json:"localTestingPort" description:"本地测试端口"`
}
// CheckAddress 检测目标源地址目的地址是否在配置中 // CheckAddress 检测目标源地址目的地址是否在配置中
func (c *RsspConfig) CheckAddress(srcAddr uint16, dstAddr uint16) bool { func (c *RsspConfig) CheckAddress(srcAddr uint16, dstAddr uint16) bool {
return true return true

View File

@ -6,6 +6,7 @@ server:
# 数据源 # 数据源
datasource: datasource:
# 数据库访问url # 数据库访问url
# dsn: root:root@tcp(127.0.0.1:3306)/bj-rtss?charset=utf8mb4&parseTime=true&loc=UTC
dsn: root:joylink0503@tcp(192.168.33.233:3306)/bj-rtss?charset=utf8mb4&parseTime=true&loc=UTC dsn: root:joylink0503@tcp(192.168.33.233:3306)/bj-rtss?charset=utf8mb4&parseTime=true&loc=UTC
# 日志配置 # 日志配置
@ -32,6 +33,7 @@ logging:
# 消息配置 # 消息配置
messaging: messaging:
mqtt: mqtt:
# address: tcp://127.0.0.1:1883
address: tcp://192.168.33.233:1883 address: tcp://192.168.33.233:1883
username: rtsts_service username: rtsts_service
password: joylink@0503 password: joylink@0503

View File

@ -33,6 +33,8 @@ const (
PictureType_IBP PictureType = 3 PictureType_IBP PictureType = 3
// * 列车数据 // * 列车数据
PictureType_TrainData PictureType = 4 PictureType_TrainData PictureType = 4
// * 列车驾驶台
PictureType_TrainControlCab PictureType = 5
) )
// Enum value maps for PictureType. // Enum value maps for PictureType.
@ -43,6 +45,7 @@ var (
2: "RelayCabinetLayout", 2: "RelayCabinetLayout",
3: "IBP", 3: "IBP",
4: "TrainData", 4: "TrainData",
5: "TrainControlCab",
} }
PictureType_value = map[string]int32{ PictureType_value = map[string]int32{
"StationLayout": 0, "StationLayout": 0,
@ -50,6 +53,7 @@ var (
"RelayCabinetLayout": 2, "RelayCabinetLayout": 2,
"IBP": 3, "IBP": 3,
"TrainData": 4, "TrainData": 4,
"TrainControlCab": 5,
} }
) )
@ -84,16 +88,17 @@ var File_picture_proto protoreflect.FileDescriptor
var file_picture_proto_rawDesc = []byte{ var file_picture_proto_rawDesc = []byte{
0x0a, 0x0d, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a, 0x0a, 0x0d, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a,
0x59, 0x0a, 0x0b, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x11, 0x6e, 0x0a, 0x0b, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x11,
0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x10, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x10,
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, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f, 0x72, 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x72,
0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x43, 0x61, 0x62, 0x10, 0x05, 0x42,
0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f,
0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f,
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 (

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,607 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.32.0
// protoc v4.23.1
// source: tccGraphics.proto
package data_proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type TccKeyType int32
const (
TccKeyType_driverControllerActivationClint TccKeyType = 0 //司控器激活端
TccKeyType_frontAndRearDirectionalControl TccKeyType = 1 //前后方向控制
)
// Enum value maps for TccKeyType.
var (
TccKeyType_name = map[int32]string{
0: "driverControllerActivationClint",
1: "frontAndRearDirectionalControl",
}
TccKeyType_value = map[string]int32{
"driverControllerActivationClint": 0,
"frontAndRearDirectionalControl": 1,
}
)
func (x TccKeyType) Enum() *TccKeyType {
p := new(TccKeyType)
*p = x
return p
}
func (x TccKeyType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TccKeyType) Descriptor() protoreflect.EnumDescriptor {
return file_tccGraphics_proto_enumTypes[0].Descriptor()
}
func (TccKeyType) Type() protoreflect.EnumType {
return &file_tccGraphics_proto_enumTypes[0]
}
func (x TccKeyType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use TccKeyType.Descriptor instead.
func (TccKeyType) EnumDescriptor() ([]byte, []int) {
return file_tccGraphics_proto_rawDescGZIP(), []int{0}
}
type TccGraphicStorage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Canvas *Canvas `protobuf:"bytes,1,opt,name=canvas,proto3" json:"canvas,omitempty"`
TccButtons []*TccButton `protobuf:"bytes,2,rep,name=tccButtons,proto3" json:"tccButtons,omitempty"`
TccTexts []*TccText `protobuf:"bytes,3,rep,name=tccTexts,proto3" json:"tccTexts,omitempty"`
TccKeys []*TccKey `protobuf:"bytes,4,rep,name=tccKeys,proto3" json:"tccKeys,omitempty"`
TccHandles []*TccHandle `protobuf:"bytes,5,rep,name=tccHandles,proto3" json:"tccHandles,omitempty"`
}
func (x *TccGraphicStorage) Reset() {
*x = TccGraphicStorage{}
if protoimpl.UnsafeEnabled {
mi := &file_tccGraphics_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TccGraphicStorage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TccGraphicStorage) ProtoMessage() {}
func (x *TccGraphicStorage) ProtoReflect() protoreflect.Message {
mi := &file_tccGraphics_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TccGraphicStorage.ProtoReflect.Descriptor instead.
func (*TccGraphicStorage) Descriptor() ([]byte, []int) {
return file_tccGraphics_proto_rawDescGZIP(), []int{0}
}
func (x *TccGraphicStorage) GetCanvas() *Canvas {
if x != nil {
return x.Canvas
}
return nil
}
func (x *TccGraphicStorage) GetTccButtons() []*TccButton {
if x != nil {
return x.TccButtons
}
return nil
}
func (x *TccGraphicStorage) GetTccTexts() []*TccText {
if x != nil {
return x.TccTexts
}
return nil
}
func (x *TccGraphicStorage) GetTccKeys() []*TccKey {
if x != nil {
return x.TccKeys
}
return nil
}
func (x *TccGraphicStorage) GetTccHandles() []*TccHandle {
if x != nil {
return x.TccHandles
}
return nil
}
// * TCC按钮
type TccButton struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
IsSelfReset bool `protobuf:"varint,3,opt,name=isSelfReset,proto3" json:"isSelfReset,omitempty"`
}
func (x *TccButton) Reset() {
*x = TccButton{}
if protoimpl.UnsafeEnabled {
mi := &file_tccGraphics_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TccButton) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TccButton) ProtoMessage() {}
func (x *TccButton) ProtoReflect() protoreflect.Message {
mi := &file_tccGraphics_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TccButton.ProtoReflect.Descriptor instead.
func (*TccButton) Descriptor() ([]byte, []int) {
return file_tccGraphics_proto_rawDescGZIP(), []int{1}
}
func (x *TccButton) GetCommon() *CommonInfo {
if x != nil {
return x.Common
}
return nil
}
func (x *TccButton) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *TccButton) GetIsSelfReset() bool {
if x != nil {
return x.IsSelfReset
}
return false
}
// * TCC文字
type TccText struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
Color string `protobuf:"bytes,4,opt,name=color,proto3" json:"color,omitempty"`
FontSize int32 `protobuf:"varint,5,opt,name=fontSize,proto3" json:"fontSize,omitempty"`
}
func (x *TccText) Reset() {
*x = TccText{}
if protoimpl.UnsafeEnabled {
mi := &file_tccGraphics_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TccText) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TccText) ProtoMessage() {}
func (x *TccText) ProtoReflect() protoreflect.Message {
mi := &file_tccGraphics_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TccText.ProtoReflect.Descriptor instead.
func (*TccText) Descriptor() ([]byte, []int) {
return file_tccGraphics_proto_rawDescGZIP(), []int{2}
}
func (x *TccText) GetCommon() *CommonInfo {
if x != nil {
return x.Common
}
return nil
}
func (x *TccText) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *TccText) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *TccText) GetColor() string {
if x != nil {
return x.Color
}
return ""
}
func (x *TccText) GetFontSize() int32 {
if x != nil {
return x.FontSize
}
return 0
}
// * TCC钥匙
type TccKey struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
Type TccKeyType `protobuf:"varint,3,opt,name=type,proto3,enum=tccGraphicData.TccKeyType" json:"type,omitempty"`
}
func (x *TccKey) Reset() {
*x = TccKey{}
if protoimpl.UnsafeEnabled {
mi := &file_tccGraphics_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TccKey) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TccKey) ProtoMessage() {}
func (x *TccKey) ProtoReflect() protoreflect.Message {
mi := &file_tccGraphics_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TccKey.ProtoReflect.Descriptor instead.
func (*TccKey) Descriptor() ([]byte, []int) {
return file_tccGraphics_proto_rawDescGZIP(), []int{3}
}
func (x *TccKey) GetCommon() *CommonInfo {
if x != nil {
return x.Common
}
return nil
}
func (x *TccKey) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *TccKey) GetType() TccKeyType {
if x != nil {
return x.Type
}
return TccKeyType_driverControllerActivationClint
}
// * TCC手柄
type TccHandle struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *CommonInfo `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
}
func (x *TccHandle) Reset() {
*x = TccHandle{}
if protoimpl.UnsafeEnabled {
mi := &file_tccGraphics_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TccHandle) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TccHandle) ProtoMessage() {}
func (x *TccHandle) ProtoReflect() protoreflect.Message {
mi := &file_tccGraphics_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TccHandle.ProtoReflect.Descriptor instead.
func (*TccHandle) Descriptor() ([]byte, []int) {
return file_tccGraphics_proto_rawDescGZIP(), []int{4}
}
func (x *TccHandle) GetCommon() *CommonInfo {
if x != nil {
return x.Common
}
return nil
}
func (x *TccHandle) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
var File_tccGraphics_proto protoreflect.FileDescriptor
var file_tccGraphics_proto_rawDesc = []byte{
0x0a, 0x11, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44,
0x61, 0x74, 0x61, 0x1a, 0x1b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x61, 0x79, 0x6f,
0x75, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x9d, 0x02, 0x0a, 0x11, 0x54, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x53,
0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x76, 0x61, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63,
0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x61, 0x6e, 0x76, 0x61, 0x73, 0x52, 0x06, 0x63, 0x61, 0x6e,
0x76, 0x61, 0x73, 0x12, 0x39, 0x0a, 0x0a, 0x74, 0x63, 0x63, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e,
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61,
0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x63, 0x63, 0x42, 0x75, 0x74, 0x74,
0x6f, 0x6e, 0x52, 0x0a, 0x74, 0x63, 0x63, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x73, 0x12, 0x33,
0x0a, 0x08, 0x74, 0x63, 0x63, 0x54, 0x65, 0x78, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74,
0x61, 0x2e, 0x54, 0x63, 0x63, 0x54, 0x65, 0x78, 0x74, 0x52, 0x08, 0x74, 0x63, 0x63, 0x54, 0x65,
0x78, 0x74, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x74, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x04,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69,
0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x07, 0x74, 0x63,
0x63, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x39, 0x0a, 0x0a, 0x74, 0x63, 0x63, 0x48, 0x61, 0x6e, 0x64,
0x6c, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x63, 0x63, 0x47,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x63, 0x63, 0x48, 0x61,
0x6e, 0x64, 0x6c, 0x65, 0x52, 0x0a, 0x74, 0x63, 0x63, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73,
0x22, 0x72, 0x0a, 0x09, 0x54, 0x63, 0x63, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x2f, 0x0a,
0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f,
0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x73, 0x53, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x73, 0x65,
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x53, 0x65, 0x6c, 0x66, 0x52,
0x65, 0x73, 0x65, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x07, 0x54, 0x63, 0x63, 0x54, 0x65, 0x78, 0x74,
0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12,
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x6f, 0x6e, 0x74, 0x53, 0x69, 0x7a,
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x66, 0x6f, 0x6e, 0x74, 0x53, 0x69, 0x7a,
0x65, 0x22, 0x7d, 0x0a, 0x06, 0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x2f, 0x0a, 0x06, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72,
0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a,
0x2e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e,
0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
0x22, 0x50, 0x0a, 0x09, 0x54, 0x63, 0x63, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x2f, 0x0a,
0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f,
0x64, 0x65, 0x2a, 0x55, 0x0a, 0x0a, 0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65,
0x12, 0x23, 0x0a, 0x1f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
0x6c, 0x6c, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c,
0x69, 0x6e, 0x74, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x41, 0x6e,
0x64, 0x52, 0x65, 0x61, 0x72, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x10, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f, 0x79,
0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73,
0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x61,
0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_tccGraphics_proto_rawDescOnce sync.Once
file_tccGraphics_proto_rawDescData = file_tccGraphics_proto_rawDesc
)
func file_tccGraphics_proto_rawDescGZIP() []byte {
file_tccGraphics_proto_rawDescOnce.Do(func() {
file_tccGraphics_proto_rawDescData = protoimpl.X.CompressGZIP(file_tccGraphics_proto_rawDescData)
})
return file_tccGraphics_proto_rawDescData
}
var file_tccGraphics_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_tccGraphics_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_tccGraphics_proto_goTypes = []interface{}{
(TccKeyType)(0), // 0: tccGraphicData.TccKeyType
(*TccGraphicStorage)(nil), // 1: tccGraphicData.TccGraphicStorage
(*TccButton)(nil), // 2: tccGraphicData.TccButton
(*TccText)(nil), // 3: tccGraphicData.TccText
(*TccKey)(nil), // 4: tccGraphicData.TccKey
(*TccHandle)(nil), // 5: tccGraphicData.TccHandle
(*Canvas)(nil), // 6: graphicData.Canvas
(*CommonInfo)(nil), // 7: graphicData.CommonInfo
}
var file_tccGraphics_proto_depIdxs = []int32{
6, // 0: tccGraphicData.TccGraphicStorage.canvas:type_name -> graphicData.Canvas
2, // 1: tccGraphicData.TccGraphicStorage.tccButtons:type_name -> tccGraphicData.TccButton
3, // 2: tccGraphicData.TccGraphicStorage.tccTexts:type_name -> tccGraphicData.TccText
4, // 3: tccGraphicData.TccGraphicStorage.tccKeys:type_name -> tccGraphicData.TccKey
5, // 4: tccGraphicData.TccGraphicStorage.tccHandles:type_name -> tccGraphicData.TccHandle
7, // 5: tccGraphicData.TccButton.common:type_name -> graphicData.CommonInfo
7, // 6: tccGraphicData.TccText.common:type_name -> graphicData.CommonInfo
7, // 7: tccGraphicData.TccKey.common:type_name -> graphicData.CommonInfo
0, // 8: tccGraphicData.TccKey.type:type_name -> tccGraphicData.TccKeyType
7, // 9: tccGraphicData.TccHandle.common:type_name -> graphicData.CommonInfo
10, // [10:10] is the sub-list for method output_type
10, // [10:10] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_tccGraphics_proto_init() }
func file_tccGraphics_proto_init() {
if File_tccGraphics_proto != nil {
return
}
file_stationLayoutGraphics_proto_init()
if !protoimpl.UnsafeEnabled {
file_tccGraphics_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TccGraphicStorage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_tccGraphics_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TccButton); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_tccGraphics_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TccText); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_tccGraphics_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TccKey); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_tccGraphics_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TccHandle); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_tccGraphics_proto_rawDesc,
NumEnums: 1,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_tccGraphics_proto_goTypes,
DependencyIndexes: file_tccGraphics_proto_depIdxs,
EnumInfos: file_tccGraphics_proto_enumTypes,
MessageInfos: file_tccGraphics_proto_msgTypes,
}.Build()
File_tccGraphics_proto = out.File
file_tccGraphics_proto_rawDesc = nil
file_tccGraphics_proto_goTypes = nil
file_tccGraphics_proto_depIdxs = nil
}

View File

@ -1,6 +1,9 @@
package dto package dto
import "joylink.club/bj-rtsts-server/db/model" import (
"joylink.club/bj-rtsts-server/db/model"
"joylink.club/bj-rtsts-server/dto/state_proto"
)
type PageProjectRunConfigReqDto struct { type PageProjectRunConfigReqDto struct {
PageQueryDto PageQueryDto
@ -36,6 +39,10 @@ type RunConfigSelectOption struct {
Value int32 `json:"value" form:"value"` Value int32 `json:"value" form:"value"`
} }
type TrainConnTypeConfigDto struct {
ConnType state_proto.TrainConnState_TrainConnType `json:"connType" form:"connType"` // NONE = 0 未知连接 ;VOBC = 1; //半实物PC_SIM = 2; //PC仿真
}
func ConvertToRunConfigDto(gi *model.ProjectRunConfig) *ProjectRunConfigDto { func ConvertToRunConfigDto(gi *model.ProjectRunConfig) *ProjectRunConfigDto {
return &ProjectRunConfigDto{ return &ProjectRunConfigDto{
Id: gi.ID, Id: gi.ID,

View File

@ -20,6 +20,52 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type DriverType int32
const (
DriverType_ONE_END DriverType = 0
DriverType_TWO_END DriverType = 1
)
// Enum value maps for DriverType.
var (
DriverType_name = map[int32]string{
0: "ONE_END",
1: "TWO_END",
}
DriverType_value = map[string]int32{
"ONE_END": 0,
"TWO_END": 1,
}
)
func (x DriverType) Enum() *DriverType {
p := new(DriverType)
*p = x
return p
}
func (x DriverType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (DriverType) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[0].Descriptor()
}
func (DriverType) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[0]
}
func (x DriverType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use DriverType.Descriptor instead.
func (DriverType) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0}
}
// 继电器操作 // 继电器操作
type Relay_Operation int32 type Relay_Operation int32
@ -57,11 +103,11 @@ func (x Relay_Operation) String() string {
} }
func (Relay_Operation) Descriptor() protoreflect.EnumDescriptor { func (Relay_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[0].Descriptor() return file_request_proto_enumTypes[1].Descriptor()
} }
func (Relay_Operation) Type() protoreflect.EnumType { func (Relay_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[0] return &file_request_proto_enumTypes[1]
} }
func (x Relay_Operation) Number() protoreflect.EnumNumber { func (x Relay_Operation) Number() protoreflect.EnumNumber {
@ -104,11 +150,11 @@ func (x Points_Operation) String() string {
} }
func (Points_Operation) Descriptor() protoreflect.EnumDescriptor { func (Points_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[1].Descriptor() return file_request_proto_enumTypes[2].Descriptor()
} }
func (Points_Operation) Type() protoreflect.EnumType { func (Points_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[1] return &file_request_proto_enumTypes[2]
} }
func (x Points_Operation) Number() protoreflect.EnumNumber { func (x Points_Operation) Number() protoreflect.EnumNumber {
@ -157,11 +203,11 @@ func (x Points_Force) String() string {
} }
func (Points_Force) Descriptor() protoreflect.EnumDescriptor { func (Points_Force) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[2].Descriptor() return file_request_proto_enumTypes[3].Descriptor()
} }
func (Points_Force) Type() protoreflect.EnumType { func (Points_Force) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[2] return &file_request_proto_enumTypes[3]
} }
func (x Points_Force) Number() protoreflect.EnumNumber { func (x Points_Force) Number() protoreflect.EnumNumber {
@ -204,11 +250,11 @@ func (x Signal_Operation) String() string {
} }
func (Signal_Operation) Descriptor() protoreflect.EnumDescriptor { func (Signal_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[3].Descriptor() return file_request_proto_enumTypes[4].Descriptor()
} }
func (Signal_Operation) Type() protoreflect.EnumType { func (Signal_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[3] return &file_request_proto_enumTypes[4]
} }
func (x Signal_Operation) Number() protoreflect.EnumNumber { func (x Signal_Operation) Number() protoreflect.EnumNumber {
@ -259,11 +305,11 @@ func (x Signal_DS) String() string {
} }
func (Signal_DS) Descriptor() protoreflect.EnumDescriptor { func (Signal_DS) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[4].Descriptor() return file_request_proto_enumTypes[5].Descriptor()
} }
func (Signal_DS) Type() protoreflect.EnumType { func (Signal_DS) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[4] return &file_request_proto_enumTypes[5]
} }
func (x Signal_DS) Number() protoreflect.EnumNumber { func (x Signal_DS) Number() protoreflect.EnumNumber {
@ -324,11 +370,11 @@ func (x Signal_Force) String() string {
} }
func (Signal_Force) Descriptor() protoreflect.EnumDescriptor { func (Signal_Force) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[5].Descriptor() return file_request_proto_enumTypes[6].Descriptor()
} }
func (Signal_Force) Type() protoreflect.EnumType { func (Signal_Force) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[5] return &file_request_proto_enumTypes[6]
} }
func (x Signal_Force) Number() protoreflect.EnumNumber { func (x Signal_Force) Number() protoreflect.EnumNumber {
@ -378,11 +424,11 @@ func (x Section_Operation) String() string {
} }
func (Section_Operation) Descriptor() protoreflect.EnumDescriptor { func (Section_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[6].Descriptor() return file_request_proto_enumTypes[7].Descriptor()
} }
func (Section_Operation) Type() protoreflect.EnumType { func (Section_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[6] return &file_request_proto_enumTypes[7]
} }
func (x Section_Operation) Number() protoreflect.EnumNumber { func (x Section_Operation) Number() protoreflect.EnumNumber {
@ -424,11 +470,11 @@ func (x Psd_Operation) String() string {
} }
func (Psd_Operation) Descriptor() protoreflect.EnumDescriptor { func (Psd_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[7].Descriptor() return file_request_proto_enumTypes[8].Descriptor()
} }
func (Psd_Operation) Type() protoreflect.EnumType { func (Psd_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[7] return &file_request_proto_enumTypes[8]
} }
func (x Psd_Operation) Number() protoreflect.EnumNumber { func (x Psd_Operation) Number() protoreflect.EnumNumber {
@ -473,11 +519,11 @@ func (x Psd_Force) String() string {
} }
func (Psd_Force) Descriptor() protoreflect.EnumDescriptor { func (Psd_Force) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[8].Descriptor() return file_request_proto_enumTypes[9].Descriptor()
} }
func (Psd_Force) Type() protoreflect.EnumType { func (Psd_Force) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[8] return &file_request_proto_enumTypes[9]
} }
func (x Psd_Force) Number() protoreflect.EnumNumber { func (x Psd_Force) Number() protoreflect.EnumNumber {
@ -519,11 +565,11 @@ func (x Psd_Fault) String() string {
} }
func (Psd_Fault) Descriptor() protoreflect.EnumDescriptor { func (Psd_Fault) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[9].Descriptor() return file_request_proto_enumTypes[10].Descriptor()
} }
func (Psd_Fault) Type() protoreflect.EnumType { func (Psd_Fault) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[9] return &file_request_proto_enumTypes[10]
} }
func (x Psd_Fault) Number() protoreflect.EnumNumber { func (x Psd_Fault) Number() protoreflect.EnumNumber {
@ -535,6 +581,58 @@ func (Psd_Fault) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{11, 2} return file_request_proto_rawDescGZIP(), []int{11, 2}
} }
type TrainControl_TrainControlType int32
const (
TrainControl_EMERGENT_BUTTON TrainControl_TrainControlType = 0 // 摁钮
TrainControl_DRIVER_KEY_SWITCH TrainControl_TrainControlType = 1 //驾驶端钥匙
TrainControl_DIRECTION_KEY_SWITCH TrainControl_TrainControlType = 2 //方向钥匙
TrainControl_HANDLER TrainControl_TrainControlType = 3 //手柄
)
// Enum value maps for TrainControl_TrainControlType.
var (
TrainControl_TrainControlType_name = map[int32]string{
0: "EMERGENT_BUTTON",
1: "DRIVER_KEY_SWITCH",
2: "DIRECTION_KEY_SWITCH",
3: "HANDLER",
}
TrainControl_TrainControlType_value = map[string]int32{
"EMERGENT_BUTTON": 0,
"DRIVER_KEY_SWITCH": 1,
"DIRECTION_KEY_SWITCH": 2,
"HANDLER": 3,
}
)
func (x TrainControl_TrainControlType) Enum() *TrainControl_TrainControlType {
p := new(TrainControl_TrainControlType)
*p = x
return p
}
func (x TrainControl_TrainControlType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TrainControl_TrainControlType) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[11].Descriptor()
}
func (TrainControl_TrainControlType) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[11]
}
func (x TrainControl_TrainControlType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use TrainControl_TrainControlType.Descriptor instead.
func (TrainControl_TrainControlType) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 0}
}
// 继电器 // 继电器
type Relay struct { type Relay struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -1342,6 +1440,309 @@ func (x *PsdParam) GetFault() Psd_Fault {
return Psd_FA_NONE return Psd_FA_NONE
} }
// 列车控制
type TrainControl struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
TrainId uint32 `protobuf:"varint,2,opt,name=trainId,proto3" json:"trainId,omitempty"`
DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` //设备id
ControlType TrainControl_TrainControlType `protobuf:"varint,4,opt,name=controlType,proto3,enum=request.TrainControl_TrainControlType" json:"controlType,omitempty"`
Button *TrainControl_EmergentButton `protobuf:"bytes,5,opt,name=button,proto3" json:"button,omitempty"` // 紧急制动
DriverKey *TrainControl_DriverKeySwitch `protobuf:"bytes,6,opt,name=driverKey,proto3" json:"driverKey,omitempty"`
DirKey *TrainControl_DirectionKeySwitch `protobuf:"bytes,7,opt,name=dirKey,proto3" json:"dirKey,omitempty"` //方向
Handler *TrainControl_PushHandler `protobuf:"bytes,8,opt,name=handler,proto3" json:"handler,omitempty"` //手柄
}
func (x *TrainControl) Reset() {
*x = TrainControl{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TrainControl) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrainControl) ProtoMessage() {}
func (x *TrainControl) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrainControl.ProtoReflect.Descriptor instead.
func (*TrainControl) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14}
}
func (x *TrainControl) GetSimulationId() string {
if x != nil {
return x.SimulationId
}
return ""
}
func (x *TrainControl) GetTrainId() uint32 {
if x != nil {
return x.TrainId
}
return 0
}
func (x *TrainControl) GetDeviceId() uint32 {
if x != nil {
return x.DeviceId
}
return 0
}
func (x *TrainControl) GetControlType() TrainControl_TrainControlType {
if x != nil {
return x.ControlType
}
return TrainControl_EMERGENT_BUTTON
}
func (x *TrainControl) GetButton() *TrainControl_EmergentButton {
if x != nil {
return x.Button
}
return nil
}
func (x *TrainControl) GetDriverKey() *TrainControl_DriverKeySwitch {
if x != nil {
return x.DriverKey
}
return nil
}
func (x *TrainControl) GetDirKey() *TrainControl_DirectionKeySwitch {
if x != nil {
return x.DirKey
}
return nil
}
func (x *TrainControl) GetHandler() *TrainControl_PushHandler {
if x != nil {
return x.Handler
}
return nil
}
// 紧急制动
type TrainControl_EmergentButton struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"`
}
func (x *TrainControl_EmergentButton) Reset() {
*x = TrainControl_EmergentButton{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TrainControl_EmergentButton) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrainControl_EmergentButton) ProtoMessage() {}
func (x *TrainControl_EmergentButton) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrainControl_EmergentButton.ProtoReflect.Descriptor instead.
func (*TrainControl_EmergentButton) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 0}
}
func (x *TrainControl_EmergentButton) GetActive() bool {
if x != nil {
return x.Active
}
return false
}
// 驾驶
type TrainControl_DriverKeySwitch struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Val bool `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` //0=关1=开
Dt DriverType `protobuf:"varint,2,opt,name=dt,proto3,enum=request.DriverType" json:"dt,omitempty"`
}
func (x *TrainControl_DriverKeySwitch) Reset() {
*x = TrainControl_DriverKeySwitch{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TrainControl_DriverKeySwitch) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrainControl_DriverKeySwitch) ProtoMessage() {}
func (x *TrainControl_DriverKeySwitch) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrainControl_DriverKeySwitch.ProtoReflect.Descriptor instead.
func (*TrainControl_DriverKeySwitch) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 1}
}
func (x *TrainControl_DriverKeySwitch) GetVal() bool {
if x != nil {
return x.Val
}
return false
}
func (x *TrainControl_DriverKeySwitch) GetDt() DriverType {
if x != nil {
return x.Dt
}
return DriverType_ONE_END
}
type TrainControl_DirectionKeySwitch struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Val uint32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` //0=后1=前,2=中位
}
func (x *TrainControl_DirectionKeySwitch) Reset() {
*x = TrainControl_DirectionKeySwitch{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TrainControl_DirectionKeySwitch) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrainControl_DirectionKeySwitch) ProtoMessage() {}
func (x *TrainControl_DirectionKeySwitch) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrainControl_DirectionKeySwitch.ProtoReflect.Descriptor instead.
func (*TrainControl_DirectionKeySwitch) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 2}
}
func (x *TrainControl_DirectionKeySwitch) GetVal() uint32 {
if x != nil {
return x.Val
}
return 0
}
// 牵引或制动手柄
type TrainControl_PushHandler struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Val int32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` // 牵引或制动 大于0是牵引小于0是制动 整体按照整型传输(*100)使用时除以100
}
func (x *TrainControl_PushHandler) Reset() {
*x = TrainControl_PushHandler{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TrainControl_PushHandler) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrainControl_PushHandler) ProtoMessage() {}
func (x *TrainControl_PushHandler) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrainControl_PushHandler.ProtoReflect.Descriptor instead.
func (*TrainControl_PushHandler) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 3}
}
func (x *TrainControl_PushHandler) GetVal() int32 {
if x != nil {
return x.Val
}
return 0
}
var File_request_proto protoreflect.FileDescriptor var File_request_proto protoreflect.FileDescriptor
var file_request_proto_rawDesc = []byte{ var file_request_proto_rawDesc = []byte{
@ -1470,10 +1871,58 @@ var file_request_proto_rawDesc = []byte{
0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x2e, 0x50, 0x73, 0x64, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c,
0x74, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x74, 0x22, 0xd8, 0x05, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72,
0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x49,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64,
0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x48, 0x0a, 0x0b,
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x26, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x69,
0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x72,
0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x3c, 0x0a, 0x06, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e,
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x45, 0x6d,
0x65, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x52, 0x06, 0x62, 0x75,
0x74, 0x74, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4b, 0x65,
0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x44,
0x72, 0x69, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x52, 0x09,
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x06, 0x64, 0x69, 0x72,
0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69,
0x74, 0x63, 0x68, 0x52, 0x06, 0x64, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x3b, 0x0a, 0x07, 0x68,
0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74,
0x72, 0x6f, 0x6c, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52,
0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x1a, 0x28, 0x0a, 0x0e, 0x45, 0x6d, 0x65, 0x72,
0x67, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63,
0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69,
0x76, 0x65, 0x1a, 0x48, 0x0a, 0x0f, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53,
0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01,
0x28, 0x08, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x23, 0x0a, 0x02, 0x64, 0x74, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x72,
0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x02, 0x64, 0x74, 0x1a, 0x26, 0x0a, 0x12,
0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69, 0x74,
0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x03, 0x76, 0x61, 0x6c, 0x1a, 0x1f, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x48, 0x61, 0x6e, 0x64,
0x6c, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x65, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x4d, 0x45,
0x52, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x42, 0x55, 0x54, 0x54, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x15,
0x0a, 0x11, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x57, 0x49,
0x54, 0x43, 0x48, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49,
0x4f, 0x4e, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x57, 0x49, 0x54, 0x43, 0x48, 0x10, 0x02, 0x12,
0x0b, 0x0a, 0x07, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x52, 0x10, 0x03, 0x2a, 0x26, 0x0a, 0x0a,
0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x4e,
0x45, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x57, 0x4f, 0x5f, 0x45,
0x4e, 0x44, 0x10, 0x01, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e,
0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1488,54 +1937,67 @@ func file_request_proto_rawDescGZIP() []byte {
return file_request_proto_rawDescData return file_request_proto_rawDescData
} }
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 10) var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 12)
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
var file_request_proto_goTypes = []interface{}{ var file_request_proto_goTypes = []interface{}{
(Relay_Operation)(0), // 0: request.Relay.Operation (DriverType)(0), // 0: request.DriverType
(Points_Operation)(0), // 1: request.Points.Operation (Relay_Operation)(0), // 1: request.Relay.Operation
(Points_Force)(0), // 2: request.Points.Force (Points_Operation)(0), // 2: request.Points.Operation
(Signal_Operation)(0), // 3: request.Signal.Operation (Points_Force)(0), // 3: request.Points.Force
(Signal_DS)(0), // 4: request.Signal.DS (Signal_Operation)(0), // 4: request.Signal.Operation
(Signal_Force)(0), // 5: request.Signal.Force (Signal_DS)(0), // 5: request.Signal.DS
(Section_Operation)(0), // 6: request.Section.Operation (Signal_Force)(0), // 6: request.Signal.Force
(Psd_Operation)(0), // 7: request.Psd.Operation (Section_Operation)(0), // 7: request.Section.Operation
(Psd_Force)(0), // 8: request.Psd.Force (Psd_Operation)(0), // 8: request.Psd.Operation
(Psd_Fault)(0), // 9: request.Psd.Fault (Psd_Force)(0), // 9: request.Psd.Force
(*Relay)(nil), // 10: request.Relay (Psd_Fault)(0), // 10: request.Psd.Fault
(*RelayOperationReq)(nil), // 11: request.RelayOperationReq (TrainControl_TrainControlType)(0), // 11: request.TrainControl.TrainControlType
(*Points)(nil), // 12: request.Points (*Relay)(nil), // 12: request.Relay
(*PointsOperationReq)(nil), // 13: request.PointsOperationReq (*RelayOperationReq)(nil), // 13: request.RelayOperationReq
(*PointsParam)(nil), // 14: request.PointsParam (*Points)(nil), // 14: request.Points
(*Signal)(nil), // 15: request.Signal (*PointsOperationReq)(nil), // 15: request.PointsOperationReq
(*SignalOperationReq)(nil), // 16: request.SignalOperationReq (*PointsParam)(nil), // 16: request.PointsParam
(*SignalParam)(nil), // 17: request.SignalParam (*Signal)(nil), // 17: request.Signal
(*Section)(nil), // 18: request.Section (*SignalOperationReq)(nil), // 18: request.SignalOperationReq
(*SectionOperationReq)(nil), // 19: request.SectionOperationReq (*SignalParam)(nil), // 19: request.SignalParam
(*SectionParam)(nil), // 20: request.SectionParam (*Section)(nil), // 20: request.Section
(*Psd)(nil), // 21: request.Psd (*SectionOperationReq)(nil), // 21: request.SectionOperationReq
(*PsdOperationReq)(nil), // 22: request.PsdOperationReq (*SectionParam)(nil), // 22: request.SectionParam
(*PsdParam)(nil), // 23: request.PsdParam (*Psd)(nil), // 23: request.Psd
(*PsdOperationReq)(nil), // 24: request.PsdOperationReq
(*PsdParam)(nil), // 25: request.PsdParam
(*TrainControl)(nil), // 26: request.TrainControl
(*TrainControl_EmergentButton)(nil), // 27: request.TrainControl.EmergentButton
(*TrainControl_DriverKeySwitch)(nil), // 28: request.TrainControl.DriverKeySwitch
(*TrainControl_DirectionKeySwitch)(nil), // 29: request.TrainControl.DirectionKeySwitch
(*TrainControl_PushHandler)(nil), // 30: request.TrainControl.PushHandler
} }
var file_request_proto_depIdxs = []int32{ var file_request_proto_depIdxs = []int32{
0, // 0: request.RelayOperationReq.operation:type_name -> request.Relay.Operation 1, // 0: request.RelayOperationReq.operation:type_name -> request.Relay.Operation
1, // 1: request.PointsOperationReq.operation:type_name -> request.Points.Operation 2, // 1: request.PointsOperationReq.operation:type_name -> request.Points.Operation
14, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam 16, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam
2, // 3: request.PointsParam.forcePosition:type_name -> request.Points.Force 3, // 3: request.PointsParam.forcePosition:type_name -> request.Points.Force
3, // 4: request.SignalOperationReq.operation:type_name -> request.Signal.Operation 4, // 4: request.SignalOperationReq.operation:type_name -> request.Signal.Operation
17, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam 19, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam
5, // 6: request.SignalParam.force:type_name -> request.Signal.Force 6, // 6: request.SignalParam.force:type_name -> request.Signal.Force
4, // 7: request.SignalParam.dsList:type_name -> request.Signal.DS 5, // 7: request.SignalParam.dsList:type_name -> request.Signal.DS
6, // 8: request.SectionOperationReq.operation:type_name -> request.Section.Operation 7, // 8: request.SectionOperationReq.operation:type_name -> request.Section.Operation
20, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam 22, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam
7, // 10: request.PsdOperationReq.operation:type_name -> request.Psd.Operation 8, // 10: request.PsdOperationReq.operation:type_name -> request.Psd.Operation
23, // 11: request.PsdOperationReq.param:type_name -> request.PsdParam 25, // 11: request.PsdOperationReq.param:type_name -> request.PsdParam
8, // 12: request.PsdParam.force:type_name -> request.Psd.Force 9, // 12: request.PsdParam.force:type_name -> request.Psd.Force
9, // 13: request.PsdParam.fault:type_name -> request.Psd.Fault 10, // 13: request.PsdParam.fault:type_name -> request.Psd.Fault
14, // [14:14] is the sub-list for method output_type 11, // 14: request.TrainControl.controlType:type_name -> request.TrainControl.TrainControlType
14, // [14:14] is the sub-list for method input_type 27, // 15: request.TrainControl.button:type_name -> request.TrainControl.EmergentButton
14, // [14:14] is the sub-list for extension type_name 28, // 16: request.TrainControl.driverKey:type_name -> request.TrainControl.DriverKeySwitch
14, // [14:14] is the sub-list for extension extendee 29, // 17: request.TrainControl.dirKey:type_name -> request.TrainControl.DirectionKeySwitch
0, // [0:14] is the sub-list for field type_name 30, // 18: request.TrainControl.handler:type_name -> request.TrainControl.PushHandler
0, // 19: request.TrainControl.DriverKeySwitch.dt:type_name -> request.DriverType
20, // [20:20] is the sub-list for method output_type
20, // [20:20] is the sub-list for method input_type
20, // [20:20] is the sub-list for extension type_name
20, // [20:20] is the sub-list for extension extendee
0, // [0:20] is the sub-list for field type_name
} }
func init() { file_request_proto_init() } func init() { file_request_proto_init() }
@ -1712,14 +2174,74 @@ func file_request_proto_init() {
return nil return nil
} }
} }
file_request_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrainControl); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_request_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrainControl_EmergentButton); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_request_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrainControl_DriverKeySwitch); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_request_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrainControl_DirectionKeySwitch); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_request_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrainControl_PushHandler); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_request_proto_rawDesc, RawDescriptor: file_request_proto_rawDesc,
NumEnums: 10, NumEnums: 12,
NumMessages: 14, NumMessages: 19,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -3,6 +3,7 @@ package dto
import ( import (
"joylink.club/bj-rtsts-server/dto/data_proto" "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"
) )
// 创建仿真请求 // 创建仿真请求
@ -75,11 +76,12 @@ type AddTrainReqDtoNew struct {
MapId int32 `json:"mapId" from:"mapId"` MapId int32 `json:"mapId" from:"mapId"`
WheelDiameter int32 `json:"wheelDiameter" from:"wheelDiameter"` WheelDiameter int32 `json:"wheelDiameter" from:"wheelDiameter"`
// 列车数据配置 // 列车数据配置
ConfigTrain ConfigTrainData `json:"configTrain" from:"mapId"` ConfigTrain ConfigTrainData `json:"configTrain" from:"mapId"`
TrainEndsA ConfigTrainEnds `json:"trainEndsA"` // 车辆A端 TrainEndsA ConfigTrainEnds `json:"trainEndsA"` // 车辆A端
TrainEndsB ConfigTrainEnds `json:"trainEndsB"` // 车辆B端 TrainEndsB ConfigTrainEnds `json:"trainEndsB"` // 车辆B端
TrainId int `json:"trainId" from:"trainId"` // 列车id TrainId int `json:"trainId" from:"trainId"` // 列车id
TrainSpeed float32 `json:"TrainSpeed" from:"TrainSpeed"` // 列车时速 TrainSpeed float32 `json:"trainSpeed" from:"trainSpeed"` // 列车时速
TrainControlMapId uint32 `json:"trainControlMapId" from:"trainControlMapId"` // 列车mapId
} }
// 为反正列车修改对应的测试配置 // 为反正列车修改对应的测试配置
@ -126,6 +128,7 @@ type ConfigTrainData struct {
IdlingA float32 `json:"idlingA"` // 空转加速度(m/s) 默认0 IdlingA float32 `json:"idlingA"` // 空转加速度(m/s) 默认0
IdlingR float32 `json:"idlingR"` // 空转冲击率(m/s) 默认0 IdlingR float32 `json:"idlingR"` // 空转冲击率(m/s) 默认0
IdlingD int32 `json:"idlingD"` // 空转持续时间s 默认0 IdlingD int32 `json:"idlingD"` // 空转持续时间s 默认0
//TrainEndsA ConfigTrainEnds `json:"TrainEndsA"` // 车辆A端 //TrainEndsA ConfigTrainEnds `json:"TrainEndsA"` // 车辆A端
//TrainEndsB ConfigTrainEnds `json:"TrainEndsB"` // 车辆B端 //TrainEndsB ConfigTrainEnds `json:"TrainEndsB"` // 车辆B端
} }
@ -142,6 +145,14 @@ type UpdateTrainReqDto struct {
WheelDiameter int32 `json:"wheelDiameter" from:"wheelDiameter"` WheelDiameter int32 `json:"wheelDiameter" from:"wheelDiameter"`
} }
// 列车连接三方类型
type TrainConnThirdDto struct {
// 仿真id
SimulationId string `json:"simulationId" form:"simulationId"`
Id string `json:"id" form:"id"` // 列车Id
ConnType state_proto.TrainConnState_TrainConnType `json:"connType" form:"connType"` //连接类型 0=未连接;1=半实物;2= 车载仿真
}
// 为仿真添加测试车请求 // 为仿真添加测试车请求
type AddTrainRspDto struct { type AddTrainRspDto struct {
//仿真id //仿真id

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,8 @@ type TrainInfoDto struct {
TrainSets string `json:"train_sets" form:"train_sets"` TrainSets string `json:"train_sets" form:"train_sets"`
Description string `json:"description" form:"description"` Description string `json:"description" form:"description"`
TrainConfigData *ConfigTrainData `json:"trainConfigData" form:"trainConfigData"` TrainConfigData *ConfigTrainData `json:"trainConfigData" form:"trainConfigData"`
//TrainControlMapCode string `json:"trainControlMapCode"` // 关联列车控制图形code
TrainControlMapId int32 `json:"trainControlMapId"` // 关联列车控制图形code
} }
func ConvertToTrainDto(trailInfos []*PublishedDto) []*TrainInfoDto { func ConvertToTrainDto(trailInfos []*PublishedDto) []*TrainInfoDto {
@ -51,12 +53,14 @@ func ConvertDtoFromTrain(t *PublishedDto) *TrainInfoDto {
message := &data_proto.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,
Name: t.Name, Name: t.Name,
Description: t.Note, Description: t.Note,
TrainModel: int32(message.TrainModel), TrainModel: int32(message.TrainModel),
CarriageLength: message.CarriageLength, CarriageLength: message.CarriageLength,
TotalLength: message.TotalLength, TotalLength: message.TotalLength,
TrainControlMapId: message.TrainControlMapId,
//TrainControlMapCode: message.TrainControlMapCode,
//MinDiameter: message.MinDiameter, //MinDiameter: message.MinDiameter,
//MaxDiameter: message.MaxDiameter, //MaxDiameter: message.MaxDiameter,
TrainSets: message.TrainSets, TrainSets: message.TrainSets,

View File

@ -409,6 +409,7 @@ func convertTrainState(v *state_proto.TrainState) *state_proto.TrainMapState {
TailOffset: v.TailOffset, TailOffset: v.TailOffset,
TailDevicePort: v.TailDevicePort, TailDevicePort: v.TailDevicePort,
BtmState: v.BtmState, BtmState: v.BtmState,
ConnState: v.ConnState,
} }
convertDynamicConfig(v.TrainDynamicConfig, t.TrainDynamicConfig) convertDynamicConfig(v.TrainDynamicConfig, t.TrainDynamicConfig)
convertDynamicConfig(v.TrainEndsA, t.TrainEndsA) convertDynamicConfig(v.TrainEndsA, t.TrainEndsA)

View File

@ -46,6 +46,8 @@ func Start(vs *memory.VerifySimulation) {
_default.AddTasks(vs.SimulationId, NewSfpMs(vs, mapId), NewIBPMs(vs, mapId), NewPSLMs(vs, mapId)) _default.AddTasks(vs.SimulationId, NewSfpMs(vs, mapId), NewIBPMs(vs, mapId), NewPSLMs(vs, mapId))
case data_proto.PictureType_RelayCabinetLayout: // 继电器柜 case data_proto.PictureType_RelayCabinetLayout: // 继电器柜
_default.AddTasks(vs.SimulationId, NewRccMs(vs, mapId)) _default.AddTasks(vs.SimulationId, NewRccMs(vs, mapId))
case data_proto.PictureType_TrainControlCab:
_default.AddTasks(vs.SimulationId, NewTrainControlMs(vs, mapId))
} }
} }
} }

View File

@ -0,0 +1,41 @@
package message_server
import (
"fmt"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt"
"joylink.club/bj-rtsts-server/ts/simulation/wayside/memory"
"log/slog"
"time"
)
// 综合后备盘IBP消息服务
func NewTrainControlMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
/* var findMapId int32 = 0
for _, d := range vs.MapIds {
mapData := memory.QueryGiType(d)
if mapData == data_proto.PictureType_TrainControlCab {
findMapId = d
break
}
}
if findMapId == 0 {
slog.Error("未找到对应的列城控制图形")
return nil
}*/
return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]列车控制", mapId), func() error {
allTrainMap := &vs.Memory.Status.TrainStateMap
allTrainMap.Range(func(key, value any) bool {
trainId := fmt.Sprintf("%v", key)
ts := value.(*state_proto.TrainState)
err := mqtt.GetMsgClient().PubTrainControlState(vs.SimulationId, trainId, ts.Tcc)
if err != nil {
slog.Error("发送列车控制mqtt失败", err)
}
return true
})
return nil
}, 200*time.Millisecond)
}

View File

@ -118,3 +118,8 @@ func (client *MqttClient) PubRCCState(simulationId string, mapId int32, msg *sta
func (client *MqttClient) PubSfpState(simulationId string, mapId int32, msg *state_proto.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)
} }
// 发送列车控制状态
func (client *MqttClient) PubTrainControlState(simulationId string, trainId string, msg *state_proto.TrainControlState) error {
return client.pub(GetTrainControlTopic(simulationId, trainId), msg)
}

View File

@ -15,6 +15,7 @@ const (
rccTopic = topicPrefix + "rcc/%d" // 继电器柜继电器状态topic 地图ID rccTopic = topicPrefix + "rcc/%d" // 继电器柜继电器状态topic 地图ID
pslTopic = topicPrefix + "psl/%d/%d" // psl状态topic 地图ID/PSL盘ID pslTopic = topicPrefix + "psl/%d/%d" // psl状态topic 地图ID/PSL盘ID
ibpTopic = topicPrefix + "ibp/%d/%d" // ibp盘状态topic 地图ID/IBP盘ID ibpTopic = topicPrefix + "ibp/%d/%d" // ibp盘状态topic 地图ID/IBP盘ID
trainControlTopic = topicPrefix + "train/control/%s" // 列车控制台状态topic 列车id
) )
var topicMap = map[string]string{ var topicMap = map[string]string{
@ -24,6 +25,7 @@ var topicMap = map[string]string{
"rcc": rccTopic, "rcc": rccTopic,
"psl": pslTopic, "psl": pslTopic,
"ibp": ibpTopic, "ibp": ibpTopic,
"train": trainControlTopic,
} }
// 检测topic是否合法 // 检测topic是否合法
@ -79,3 +81,8 @@ func GetPslTopic(simulationId string, mapId int32, boxId uint32) string {
func GetIbpTopic(simulationId string, mapId int32, ibpId uint32) string { func GetIbpTopic(simulationId string, mapId int32, ibpId uint32) string {
return fmt.Sprintf(ibpTopic, simulationId, mapId, ibpId) return fmt.Sprintf(ibpTopic, simulationId, mapId, ibpId)
} }
// 列车控制消息topic
func GetTrainControlTopic(simulationId string, trainId string) string {
return fmt.Sprintf(trainControlTopic, simulationId, trainId)
}

View File

@ -13,9 +13,9 @@ import (
var ( var (
basePath, _ = os.Getwd() basePath, _ = os.Getwd()
protoFolder = filepath.Join(basePath, "bj-rtss-message", "protos") protoFolder = filepath.Join(basePath, "rts-sim-testing-message", "protos")
protocPath = filepath.Join(basePath, "bj-rtss-message", "protoc-23.1", "bin", "win64", "protoc") protocPath = filepath.Join(basePath, "rts-sim-testing-message", "protoc-23.1", "bin", "win64", "protoc")
modulePrefix = "joylink.club/bj-rtsts-server" modulePrefix = "joylink.club/rts-sim-testing-service"
) )
func main() { func main() {

@ -1 +1 @@
Subproject commit a8b2c32c950d35520e459b2e5f4ae76ece252abf Subproject commit cd5946438c5100f5685877ea5ce632fd5b5962a7

View File

@ -79,9 +79,11 @@ func TrainConfigToProtoConvert(t *dto.ConfigTrainData) *common_proto.TrainDynami
// 转成列车proto // 转成列车proto
func convertTrainDtoToProto(t *dto.TrainInfoDto) []byte { func convertTrainDtoToProto(t *dto.TrainInfoDto) []byte {
message := &data_proto.Train{ message := &data_proto.Train{
TrainModel: data_proto.Train_TrainModel(t.TrainModel), TrainModel: data_proto.Train_TrainModel(t.TrainModel),
CarriageLength: t.CarriageLength, CarriageLength: t.CarriageLength,
TotalLength: t.TotalLength, TotalLength: t.TotalLength,
TrainControlMapId: t.TrainControlMapId,
//TrainControlMapCode: t.TrainControlMapCode,
//MinDiameter: t.MinDiameter, //MinDiameter: t.MinDiameter,
//MaxDiameter: t.MaxDiameter, //MaxDiameter: t.MaxDiameter,
TrainSets: t.TrainSets, TrainSets: t.TrainSets,

View File

@ -39,7 +39,10 @@ func PublishMapVerifyStructure(graphic *dto.PublishedDto) {
message = &data_proto.PslGraphicStorage{} message = &data_proto.PslGraphicStorage{}
case data_proto.PictureType_IBP: case data_proto.PictureType_IBP:
message = &data_proto.IBPGraphicStorage{} message = &data_proto.IBPGraphicStorage{}
case data_proto.PictureType_TrainControlCab:
message = &data_proto.TccGraphicStorage{}
} }
err := proto.Unmarshal(graphic.Proto, message) err := proto.Unmarshal(graphic.Proto, message)
if err != nil { if err != nil {
panic(&dto.ErrorDto{Code: dto.LogicError, Message: fmt.Sprintf("[id:%d]proto数据反序列化失败:%s", graphic.ID, err)}) panic(&dto.ErrorDto{Code: dto.LogicError, Message: fmt.Sprintf("[id:%d]proto数据反序列化失败:%s", graphic.ID, err)})
@ -63,7 +66,11 @@ func PublishMapVerifyStructure(graphic *dto.PublishedDto) {
case data_proto.PictureType_IBP: case data_proto.PictureType_IBP:
graphicStorage := message.(*data_proto.IBPGraphicStorage) graphicStorage := message.(*data_proto.IBPGraphicStorage)
giUidMap.Store(graphic.ID, initIBPUid(graphicStorage)) giUidMap.Store(graphic.ID, initIBPUid(graphicStorage))
/* case data_proto.PictureType_TrainControlCab:
graphicStorage := message.(*data_proto.TccGraphicStorage)
giUidMap.Store(graphic.ID, initTccUid(graphicStorage))*/
} }
} }
func GenerateElementUid(city, lineId string, stationIndexList []string, code string) string { func GenerateElementUid(city, lineId string, stationIndexList []string, code string) string {

View File

@ -21,6 +21,13 @@ type elementIdStructure struct {
Uid string Uid string
} }
// 列车控制
/*type TccUidStructure struct {
ButtonIds map[uint32]*elementIdStructure
Keys map[uint32]*elementIdStructure
Handler map[uint32]*elementIdStructure
}*/
// 数组为Index为 common.ButtonCode, index, uid // 数组为Index为 common.ButtonCode, index, uid
type StationUidStructure struct { type StationUidStructure struct {
AxlePointIds map[uint32]*elementIdStructure AxlePointIds map[uint32]*elementIdStructure
@ -425,6 +432,30 @@ func initStationUid(data *data_proto.RtssGraphicStorage) *StationUidStructure {
return gus return gus
} }
// 初始化列车控制
/*func initTccUid(tcc *data_proto.TccGraphicStorage) *TccUidStructure {
tc := &TccUidStructure{ButtonIds: make(map[uint32]*elementIdStructure), Keys: make(map[uint32]*elementIdStructure), Handler: make(map[uint32]*elementIdStructure)}
for _, d := range tcc.TccButtons {
id := GetMapElementId(d.Common)
tc.ButtonIds[id] = &elementIdStructure{CommonId: id,
Code: d.Code}
}
for _, d := range tcc.TccKeys {
id := GetMapElementId(d.Common)
tc.Keys[id] = &elementIdStructure{CommonId: id,
Code: d.Code}
}
for _, d := range tcc.TccHandles {
id := GetMapElementId(d.Common)
tc.Handler[id] = &elementIdStructure{CommonId: id,
Code: d.Code}
}
return tc
}*/
// 初始化继电器柜 UID // 初始化继电器柜 UID
func initRelayCabinetUid(data *data_proto.RelayCabinetGraphicStorage) *RelayUidStructure { func initRelayCabinetUid(data *data_proto.RelayCabinetGraphicStorage) *RelayUidStructure {
rus := &RelayUidStructure{ rus := &RelayUidStructure{

View File

@ -43,6 +43,9 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
return sys_error.New(fmt.Sprintf("列车【%s】已存在", status.Id)) return sys_error.New(fmt.Sprintf("列车【%s】已存在", status.Id))
} }
} }
//tcc := createTrainControl(vs)
//status.Tcc = tcc
// 显示状态 // 显示状态
status.Show = true status.Show = true
//向动力学发送初始化请求 //向动力学发送初始化请求
@ -71,6 +74,8 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
status.Up = up status.Up = up
status.PointTo = pointTo status.PointTo = pointTo
status.TrainKilometer = kilometer.Value status.TrainKilometer = kilometer.Value
status.Tcc = &state_proto.TrainControlState{}
status.DynamicState = &state_proto.TrainDynamicState{ status.DynamicState = &state_proto.TrainDynamicState{
HeadLinkId: linkId, HeadLinkId: linkId,
HeadLinkOffset: loffset, HeadLinkOffset: loffset,
@ -113,77 +118,30 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
return nil return nil
} }
// 增加列车状态 func TrainConnTypeUpdate(vs *VerifySimulation, ct *dto.TrainConnThirdDto) {
/*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) data, ok := allTrainMap.Load(ct.Id)
if ok { if !ok {
panic(fmt.Sprintf("列车【%s】已存在", status.Id)) panic(sys_error.New(fmt.Sprintf("列车【%s】不存在", ct.Id)))
} }
// 显示状态 var conn = true
status.Show = true if ct.ConnType == state_proto.TrainConnState_NONE {
//向动力学发送初始化请求 conn = false
trainIndex, _ := strconv.ParseUint(status.Id, 10, 16)
slog.Debug("添加列车", "trainIndex", trainIndex, "HeadDeviceId", status.HeadDeviceId, "HeadOffset", status.HeadOffset)
// 映射link、偏移量、运行方向
var uid string
if status.DevicePort == "" {
uid = QueryUidByMidAndComId(mapId, status.HeadDeviceId, &data_proto.Section{})
} else {
uid = QueryUidByMidAndComId(mapId, status.HeadDeviceId, &data_proto.Turnout{})
} }
// 车头所在link、link上的偏移 if conn {
linkId, loffset := QueryLinkAndOffsetByDevice(vs.Repo, uid, status.DevicePort, status.HeadOffset) allTrainMap.Range(func(k, v any) bool {
// link上的运行方向、设备上的运行方向 tmpTrain := v.(*state_proto.TrainState)
up, pointTo := QueryUpAndABByDevice(vs.Repo, uid, status.DevicePort, status.RunDirection) if tmpTrain.ConnState.Conn {
// 车头所在公里标 panic(sys_error.New(fmt.Sprintf("列车【%s】已经连接,此列车无法联系", k)))
kilometer := CalcTrainKilometer(vs.Repo, uid, status.DevicePort, status.RunDirection, status.HeadOffset) return false
// 车尾相对车头link的偏移量 }
calctailOffset := calcTrailTailOffset(loffset, status.TrainLength, up) return true
// 车尾位置 })
tailLink, _, _, tailLOffset, _, _, e1 := CalcInitializeLink(vs, linkId, calctailOffset, up)
if e1 != nil {
panic(sys_error.New("添加列车失败,列车车尾占用位置计算出错", e1))
} }
status.Up = up train := data.(*state_proto.TrainState)
status.PointTo = pointTo train.ConnState.Conn = conn
status.TrainKilometer = kilometer.Value train.ConnState.ConnType = ct.ConnType
status.DynamicState = &state_proto.TrainDynamicState{ }
HeadLinkId: linkId,
HeadLinkOffset: loffset,
TailLinkId: tailLink,
TailLinkOffset: tailLOffset,
RunningUp: up,
}
status.VobcState = &state_proto.TrainVobcState{}
slog.Debug("列车初始化", "trainIndex", trainIndex, "linkId", linkId, "loffset", loffset)
linkIdInt, _ := strconv.Atoi(linkId)
err := dynamics.Default().RequestAddTrain(&message.InitTrainInfo{
TrainIndex: uint16(trainIndex),
LinkIndex: uint16(linkIdInt),
LinkOffset: uint32(loffset),
Speed: uint16(math.Round(float64(status.Speed * 10))),
Up: status.Up,
TrainLength: uint32(status.TrainLength),
})
if err != nil {
panic(dto.ErrorDto{Code: dto.DynamicsError, Message: err.Error()})
}
// world中加车
fi.AddTrainToWorld(vs.World, status.Id)
fi.UpdateTrainPositionFromDynamics(vs.World, fi.TrainPositionInfo{
TrainId: status.Id,
Up: status.Up,
Len: uint32(status.TrainLength),
HeadLink: linkId,
HeadLinkOffset: uint32(loffset),
TailLink: tailLink,
TailLinkOffset: uint32(tailLOffset),
})
// 将信息合并到当前设备状态中
allTrainMap.Store(status.Id, status)
return status
}*/
func createOrUpdateStateDynamicConfig(trainState *state_proto.TrainState, configTrainData dto.ConfigTrainData, trainEndsA dto.ConfigTrainEnds, func createOrUpdateStateDynamicConfig(trainState *state_proto.TrainState, configTrainData dto.ConfigTrainData, trainEndsA dto.ConfigTrainEnds,
trainEndsB dto.ConfigTrainEnds) { trainEndsB dto.ConfigTrainEnds) {
@ -370,6 +328,9 @@ func removeTrain(vs *VerifySimulation, trainId string, train *state_proto.TrainS
return err return err
} }
train.Show = false train.Show = false
if train.ConnState.Conn {
train.ConnState.ConnType = state_proto.TrainConnState_NONE
}
return fi.RemoveTrainFromWorld(vs.World, trainId) return fi.RemoveTrainFromWorld(vs.World, trainId)
} }

View File

@ -0,0 +1,118 @@
package memory
import (
"fmt"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/sys_error"
)
/*func createTrainControl(vs *VerifySimulation) *state_proto.TrainControlState {
var tccMapId int32
for _, mapId := range vs.MapIds {
picProType := QueryGiType(mapId)
if picProType == data_proto.PictureType_TrainControlCab {
tccMapId = mapId
break
}
}
if tccMapId == 0 {
panic(sys_error.New("未找到列车控制相关图形数据"))
}
tcs := &state_proto.TrainControlState{
ConnState: &state_proto.TrainConnState{Conn: false, ConnType: state_proto.TrainConnState_NONE},
}
tcc := QueryUidStructure[*TccUidStructure](tccMapId)
for _, d := range tcc.ButtonIds {
tcs.Buttons = append(tcs.Buttons, &state_proto.TrainControlState_TccButton{Id: d.CommonId, Code: d.Code})
}
for _, d := range tcc.Keys {
tcs.Keys = append(tcs.Keys, &state_proto.TrainControlState_TccKey{Id: d.CommonId, Code: d.Code})
}
for _, d := range tcc.Handler {
tcs.Handlers = append(tcs.Handlers, &state_proto.TrainControlState_TccHander{Id: d.CommonId, Code: d.Code})
}
return tcs
}*/
// 列车控制修改参数
func ControlTrainUpdate(vs *VerifySimulation, ct *request_proto.TrainControl) {
allTrainMap := &vs.Memory.Status.TrainStateMap
data, ok := allTrainMap.Load(ct.TrainId)
if !ok {
panic(sys_error.New(fmt.Sprintf("列车【%s】不存在", ct.TrainId)))
}
sta := data.(*state_proto.TrainState)
if ct.ControlType == request_proto.TrainControl_EMERGENT_BUTTON {
trainControlEB(sta, ct.Button, ct.DeviceId)
} else if ct.ControlType == request_proto.TrainControl_DRIVER_KEY_SWITCH {
trainControlDriverKey(sta, ct.DriverKey, ct.DeviceId)
} else if ct.ControlType == request_proto.TrainControl_DIRECTION_KEY_SWITCH {
trainControlDirKey(sta, ct.DirKey, ct.DeviceId)
} else if ct.ControlType == request_proto.TrainControl_HANDLER {
trainControlHandle(sta, ct.Handler, ct.DeviceId)
}
}
func trainControlEB(trainState *state_proto.TrainState, request *request_proto.TrainControl_EmergentButton, deviceId uint32) {
trainState.VobcState.EmergencyBrakingStatus = request.Active
if trainState.Tcc.Ebutton == nil {
trainState.Tcc.Ebutton = &state_proto.TrainControlState_EmergentButton{Id: deviceId, Passed: request.Active}
} else {
trainState.Tcc.Ebutton.Passed = request.Active
}
}
func trainControlDirKey(trainState *state_proto.TrainState, request *request_proto.TrainControl_DirectionKeySwitch, deviceId uint32) {
trainState.VobcState.DirectionForward = false
trainState.VobcState.DirectionBackward = false
if request.Val == 1 {
trainState.VobcState.DirectionForward = true
} else if request.Val == 0 {
trainState.VobcState.DirectionBackward = false
}
if trainState.Tcc.DirKey == nil {
trainState.Tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: deviceId, Val: request.Val}
} else {
trainState.Tcc.DirKey.Val = request.Val
}
}
func trainControlDriverKey(trainState *state_proto.TrainState, request *request_proto.TrainControl_DriverKeySwitch, deviceId uint32) {
if request.Dt == request_proto.DriverType_ONE_END {
trainState.VobcState.Tc1Active = request.Val
} else if request.Dt == request_proto.DriverType_TWO_END {
trainState.VobcState.Tc2Active = request.Val
}
var addNew = true
for _, k := range trainState.Tcc.DriverKey {
if k.Id == deviceId {
k.Dt = request.Dt
k.Id = deviceId
k.Val = request.Val
addNew = false
break
}
}
if addNew {
trainState.Tcc.DriverKey = append(trainState.Tcc.DriverKey, &state_proto.TrainControlState_DriverKeySwitch{Id: deviceId, Val: request.Val, Dt: request.Dt})
}
}
func trainControlHandle(trainState *state_proto.TrainState, request *request_proto.TrainControl_PushHandler, deviceId uint32) {
trainState.VobcState.TractionStatus = false
trainState.VobcState.TractionForce = 0
trainState.VobcState.BrakingStatus = false
trainState.VobcState.BrakeForce = 0
if request.Val > 0 {
trainState.VobcState.TractionStatus = true
trainState.VobcState.TractionForce = int64(request.Val)
} else if request.Val < 0 {
trainState.VobcState.BrakingStatus = true
trainState.VobcState.BrakeForce = int64(request.Val)
}
if trainState.Tcc.DirKey == nil {
trainState.Tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: deviceId, Val: request.Val}
} else {
trainState.Tcc.PushHandler.Val = request.Val
}
}

View File

@ -134,6 +134,10 @@ func CreateSimulation(projectId int32, mapIds []int32, runConfig *dto.ProjectRun
// return s.runState // return s.runState
// } // }
func (s *VerifySimulation) GetTrainPcSimConfig() config.VehiclePCSimConfig {
return s.runConfig.PcSimConfig
}
// 获取仿真世界信息 // 获取仿真世界信息
func (s *VerifySimulation) GetComIdByUid(uid string) uint32 { func (s *VerifySimulation) GetComIdByUid(uid string) uint32 {
es := s.UidMap es := s.UidMap
@ -277,12 +281,18 @@ func (s *VerifySimulation) HandleSectionCmdMsg(city string, lineId string, centr
// 处理动力学列车速度消息 // 处理动力学列车速度消息
func (s *VerifySimulation) HandleDynamicsTrainInfo(info *message.DynamicsTrainInfo) { func (s *VerifySimulation) HandleDynamicsTrainInfo(info *message.DynamicsTrainInfo) {
trainId := strconv.Itoa(int(info.Number)) trainId := strconv.Itoa(int(info.Number))
_, ok := s.Memory.Status.TrainStateMap.Load(trainId) trainData, ok := s.Memory.Status.TrainStateMap.Load(trainId)
if !ok { if !ok {
return return
} }
// 给半实物仿真发送速度 train := trainData.(*state_proto.TrainState)
semi_physical_train.Default().SendTrainControlMessage(info) connType := train.ConnState
//列车连接并且是半实物连接 date 2024-3-15
if connType.Conn && connType.ConnType == state_proto.TrainConnState_VOBC {
// 给半实物仿真发送速度
semi_physical_train.Default().SendTrainControlMessage(info)
}
// 更新列车状态 // 更新列车状态
trainState := UpdateTrainStateByDynamics(s, trainId, info) trainState := UpdateTrainStateByDynamics(s, trainId, info)
// 更新电机转速 // 更新电机转速
@ -380,17 +390,21 @@ func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg(b []byte) {
if !train.Show { // 下线列车 if !train.Show { // 下线列车
return true return true
} }
trainId, err := strconv.Atoi(train.Id) connState := train.ConnState
if err != nil { if connState.Conn == true && connState.ConnType == state_proto.TrainConnState_VOBC {
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()}) trainId, err := strconv.Atoi(train.Id)
if err != nil {
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
}
d := append(b, uint8(trainId))
// 发送给动力学
dynamics.Default().SendTrainControlMessage(d)
// 存放至列车中
controlMessage := &message.TrainControlMsg{}
controlMessage.Decode(b)
train.VobcState = controlMessage.ControlInfo
return false
} }
d := append(b, uint8(trainId))
// 发送给动力学
dynamics.Default().SendTrainControlMessage(d)
// 存放至列车中
controlMessage := &message.TrainControlMsg{}
controlMessage.Decode(b)
train.VobcState = controlMessage.ControlInfo
return true return true
}) })
} }
@ -472,6 +486,16 @@ func (s *VerifySimulation) CollectInterlockRelayInfo(code string) *message.Inter
} }
return nil return nil
} }
func (s *VerifySimulation) FindTrainConnTypes() []dto.TrainConnTypeConfigDto {
typeConfig := make([]dto.TrainConnTypeConfigDto, 0)
if s.runConfig.Vobc.Open /*&& s.runConfig.Vobc.Ip != ""*/ {
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{ConnType: state_proto.TrainConnState_VOBC})
}
if s.runConfig.PcSimConfig.Open /*&& s.runConfig.PcSimConfig.PcSimIp != ""*/ {
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{ConnType: state_proto.TrainConnState_PC_SIM})
}
return typeConfig
}
// 获取电机转速参数 // 获取电机转速参数
func (s *VerifySimulation) GetElectricMachineryRunConfig() *config.ElectricMachineryConfig { func (s *VerifySimulation) GetElectricMachineryRunConfig() *config.ElectricMachineryConfig {

View File

@ -136,6 +136,7 @@ func runThirdParty(s *memory.VerifySimulation) error {
radar.Default().Start(s) radar.Default().Start(s)
//列车加速计发送vobc //列车加速计发送vobc
acc.Default().Start(s) acc.Default().Start(s)
//train_pc_sim.Default().Start(s)
return nil return nil
} }