列车前端操作接口,列车连接三方映射接口及ws返回列车连接状态

This commit is contained in:
tiger_zhou 2024-03-19 08:28:50 +08:00
parent de6f358171
commit 12145b8539
18 changed files with 2625 additions and 998 deletions

View File

@ -231,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"))
} }
@ -348,7 +345,8 @@ func trainConnTypeList(c *gin.Context) {
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/train/control [post] // @Router /api/v1/simulation/train/control [post]
func controlTrain(c *gin.Context) { func controlTrain(c *gin.Context) {
req := &dto.ControlTrainReqDtos{} req := &request_proto.TrainControl{}
if err := c.ShouldBind(req); err != nil { if err := c.ShouldBind(req); err != nil {
panic(sys_error.New("修改列车控制参数失败,请求参数异常", err)) panic(sys_error.New("修改列车控制参数失败,请求参数异常", err))
} }

View File

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

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

@ -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

@ -151,19 +151,6 @@ type TrainConnThirdDto struct {
ConnType state_proto.TrainConnState_TrainConnType `json:"connType" form:"connType"` //连接类型 0=未连接;1=半实物;2= 车载仿真 ConnType state_proto.TrainConnState_TrainConnType `json:"connType" form:"connType"` //连接类型 0=未连接;1=半实物;2= 车载仿真
} }
// 列车控制
type ControlTrainReqDtos struct {
// 仿真id
SimulationId string `json:"simulationId" form:"simulationId"`
// 列车Id
Id string `json:"id" form:"id"`
PressingBrake bool `json:"pressingBrake" form:"pressingBrake"` // 紧急制动
Tc1On bool `json:"tc1On" form:"tc1On"` // 驾驶室激活1
Tc2On bool `json:"tc2On" form:"tc2On"` // 驾驶室激活2
TuningDir uint8 `json:"tuningDir" form:"tuningDir"` // 运行方向 1=前进;2=后退;0=原地等待
TractionOrBrake uint8 `json:"tractionOrBrake" form:"tractionOrBrake"` // 牵引或制动 大于0是牵引小于0是制动 整体按照整型传输(*100)使用时除以100
}
// 为仿真添加测试车请求 // 为仿真添加测试车请求
type AddTrainRspDto struct { type AddTrainRspDto struct {
//仿真id //仿真id

File diff suppressed because it is too large Load Diff

View File

@ -409,7 +409,6 @@ 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))
} }
} }
} }

View File

@ -0,0 +1,42 @@
package message_server
import (
"fmt"
"joylink.club/bj-rtsts-server/dto/data_proto"
"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) 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]列车控制", findMapId), 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)
}

@ -1 +1 @@
Subproject commit c0f73e7b5d404e4c932711b44770b4e75ebbfe74 Subproject commit da149138353f1904cff3328327cae45980a59f8b

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,7 +74,7 @@ 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.ConnState = &state_proto.TrainConnState{Conn: false, ConnType: state_proto.TrainConnState_NONE} status.Tcc = &state_proto.TrainControlState{ConnState: &state_proto.TrainConnState{Conn: false, ConnType: state_proto.TrainConnState_NONE}}
status.DynamicState = &state_proto.TrainDynamicState{ status.DynamicState = &state_proto.TrainDynamicState{
HeadLinkId: linkId, HeadLinkId: linkId,
HeadLinkOffset: loffset, HeadLinkOffset: loffset,
@ -113,6 +116,7 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
allTrainMap.Store(status.Id, status) allTrainMap.Store(status.Id, status)
return nil return nil
} }
func TrainConnTypeUpdate(vs *VerifySimulation, ct *dto.TrainConnThirdDto) { func TrainConnTypeUpdate(vs *VerifySimulation, ct *dto.TrainConnThirdDto) {
allTrainMap := &vs.Memory.Status.TrainStateMap allTrainMap := &vs.Memory.Status.TrainStateMap
data, ok := allTrainMap.Load(ct.Id) data, ok := allTrainMap.Load(ct.Id)
@ -126,7 +130,7 @@ func TrainConnTypeUpdate(vs *VerifySimulation, ct *dto.TrainConnThirdDto) {
if conn { if conn {
allTrainMap.Range(func(k, v any) bool { allTrainMap.Range(func(k, v any) bool {
tmpTrain := v.(*state_proto.TrainState) tmpTrain := v.(*state_proto.TrainState)
if tmpTrain.ConnState.Conn { if tmpTrain.Tcc.ConnState.Conn {
panic(sys_error.New(fmt.Sprintf("列车【%s】已经连接,此列车无法联系", k))) panic(sys_error.New(fmt.Sprintf("列车【%s】已经连接,此列车无法联系", k)))
return false return false
} }
@ -134,126 +138,10 @@ func TrainConnTypeUpdate(vs *VerifySimulation, ct *dto.TrainConnThirdDto) {
}) })
} }
train := data.(*state_proto.TrainState) train := data.(*state_proto.TrainState)
train.ConnState.Conn = conn train.Tcc.ConnState.Conn = conn
train.Tcc.ConnState.ConnType = ct.ConnType
train.ConnState.ConnType = ct.ConnType
} }
// 列车控制修改参数
func ControlTrainUpdate(vs *VerifySimulation, ct *dto.ControlTrainReqDtos) {
allTrainMap := &vs.Memory.Status.TrainStateMap
data, ok := allTrainMap.Load(ct.Id)
if !ok {
panic(sys_error.New(fmt.Sprintf("列车【%s】不存在", ct.Id)))
}
sta := data.(*state_proto.TrainState)
sta.VobcState.Tc1Active = ct.Tc1On
sta.VobcState.Tc2Active = ct.Tc2On
sta.VobcState.EmergencyBrakingStatus = ct.PressingBrake
switch ct.TuningDir {
case 1:
sta.VobcState.DirectionForward = true
sta.VobcState.DirectionBackward = false
break
case 2:
sta.VobcState.DirectionForward = false
sta.VobcState.DirectionBackward = true
break
default:
sta.VobcState.DirectionForward = false
sta.VobcState.DirectionBackward = false
}
if ct.TractionOrBrake > 0 {
sta.VobcState.BrakingStatus = false
sta.VobcState.BrakeForce = 0
sta.VobcState.TractionStatus = true
sta.VobcState.TractionForce = int64(ct.TractionOrBrake)
} else if ct.TractionOrBrake < 0 {
sta.VobcState.TractionStatus = false
sta.VobcState.TractionForce = 0
sta.VobcState.BrakingStatus = true
sta.VobcState.BrakeForce = int64(ct.TractionOrBrake)
} else if ct.TractionOrBrake == 0 {
sta.VobcState.TractionStatus = false
sta.VobcState.TractionForce = 0
sta.VobcState.BrakingStatus = false
sta.VobcState.BrakeForce = 0
}
}
// 增加列车状态
/*func AddTrainState(vs *VerifySimulation, status *state_proto.TrainState, mapId int32) *state_proto.TrainState {
allTrainMap := &vs.Memory.Status.TrainStateMap
_, ok := allTrainMap.Load(status.Id)
if ok {
panic(fmt.Sprintf("列车【%s】已存在", status.Id))
}
// 显示状态
status.Show = true
//向动力学发送初始化请求
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上的偏移
linkId, loffset := QueryLinkAndOffsetByDevice(vs.Repo, uid, status.DevicePort, status.HeadOffset)
// link上的运行方向、设备上的运行方向
up, pointTo := QueryUpAndABByDevice(vs.Repo, uid, status.DevicePort, status.RunDirection)
// 车头所在公里标
kilometer := CalcTrainKilometer(vs.Repo, uid, status.DevicePort, status.RunDirection, status.HeadOffset)
// 车尾相对车头link的偏移量
calctailOffset := calcTrailTailOffset(loffset, status.TrainLength, up)
// 车尾位置
tailLink, _, _, tailLOffset, _, _, e1 := CalcInitializeLink(vs, linkId, calctailOffset, up)
if e1 != nil {
panic(sys_error.New("添加列车失败,列车车尾占用位置计算出错", e1))
}
status.Up = up
status.PointTo = pointTo
status.TrainKilometer = kilometer.Value
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) {
trainState.TrainDynamicConfig = service.TrainConfigToProtoConvert(&configTrainData) trainState.TrainDynamicConfig = service.TrainConfigToProtoConvert(&configTrainData)
@ -439,6 +327,9 @@ func removeTrain(vs *VerifySimulation, trainId string, train *state_proto.TrainS
return err return err
} }
train.Show = false train.Show = false
if train.Tcc.ConnState.Conn {
train.Tcc.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

@ -286,7 +286,7 @@ func (s *VerifySimulation) HandleDynamicsTrainInfo(info *message.DynamicsTrainIn
return return
} }
train := trainData.(*state_proto.TrainState) train := trainData.(*state_proto.TrainState)
connType := train.ConnState connType := train.Tcc.ConnState
//列车连接并且是半实物连接 date 2024-3-15 //列车连接并且是半实物连接 date 2024-3-15
if connType.Conn && connType.ConnType == state_proto.TrainConnState_VOBC { if connType.Conn && connType.ConnType == state_proto.TrainConnState_VOBC {
// 给半实物仿真发送速度 // 给半实物仿真发送速度
@ -390,7 +390,7 @@ func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg(b []byte) {
if !train.Show { // 下线列车 if !train.Show { // 下线列车
return true return true
} }
connState := train.ConnState connState := train.Tcc.ConnState
if connState.Conn == true && connState.ConnType == state_proto.TrainConnState_VOBC { if connState.Conn == true && connState.ConnType == state_proto.TrainConnState_VOBC {
trainId, err := strconv.Atoi(train.Id) trainId, err := strconv.Atoi(train.Id)
if err != nil { if err != nil {