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

This commit is contained in:
tiger_zhou 2024-03-19 14:49:44 +08:00
parent 6958259e03
commit 774355ca4d
4 changed files with 17 additions and 18 deletions

View File

@ -902,7 +902,7 @@ type TrainConnState struct {
Conn bool `protobuf:"varint,1,opt,name=conn,proto3" json:"conn,omitempty"` Conn bool `protobuf:"varint,1,opt,name=conn,proto3" json:"conn,omitempty"`
ConnType TrainConnState_TrainConnType `protobuf:"varint,2,opt,name=connType,proto3,enum=state.TrainConnState_TrainConnType" json:"connType,omitempty"` ConnType TrainConnState_TrainConnType `protobuf:"varint,2,opt,name=connType,proto3,enum=state.TrainConnState_TrainConnType" json:"connType,omitempty"`
TrainControlMapId uint32 `protobuf:"varint,3,opt,name=TrainControlMapId,proto3" json:"TrainControlMapId,omitempty"` TrainControlMapId uint32 `protobuf:"varint,3,opt,name=TrainControlMapId,proto3" json:"TrainControlMapId,omitempty"` //关联的列车控制mapId
} }
func (x *TrainConnState) Reset() { func (x *TrainConnState) Reset() {

View File

@ -47,7 +47,7 @@ func Start(vs *memory.VerifySimulation) {
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: case data_proto.PictureType_TrainControlCab:
_default.AddTasks(vs.SimulationId, NewTrainControlMs(vs)) _default.AddTasks(vs.SimulationId, NewTrainControlMs(vs, mapId))
} }
} }
} }

View File

@ -2,7 +2,6 @@ package message_server
import ( import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/state_proto" "joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/message_server/ms_api"
"joylink.club/bj-rtsts-server/mqtt" "joylink.club/bj-rtsts-server/mqtt"
@ -12,21 +11,21 @@ import (
) )
// 综合后备盘IBP消息服务 // 综合后备盘IBP消息服务
func NewTrainControlMs(vs *memory.VerifySimulation) ms_api.MsgTask { func NewTrainControlMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
var findMapId int32 = 0 /* var findMapId int32 = 0
for _, d := range vs.MapIds { for _, d := range vs.MapIds {
mapData := memory.QueryGiType(d) mapData := memory.QueryGiType(d)
if mapData == data_proto.PictureType_TrainControlCab { if mapData == data_proto.PictureType_TrainControlCab {
findMapId = d findMapId = d
break break
}
} }
}
if findMapId == 0 { if findMapId == 0 {
slog.Error("未找到对应的列城控制图形") slog.Error("未找到对应的列城控制图形")
return nil return nil
} }*/
return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]列车控制", findMapId), func() error { return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]列车控制", mapId), func() error {
allTrainMap := &vs.Memory.Status.TrainStateMap allTrainMap := &vs.Memory.Status.TrainStateMap
allTrainMap.Range(func(key, value any) bool { allTrainMap.Range(func(key, value any) bool {
trainId := fmt.Sprintf("%v", key) trainId := fmt.Sprintf("%v", key)

View File

@ -39,8 +39,8 @@ 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: case data_proto.PictureType_TrainControlCab:
message = &data_proto.TccGraphicStorage{}*/ message = &data_proto.TccGraphicStorage{}
} }
err := proto.Unmarshal(graphic.Proto, message) err := proto.Unmarshal(graphic.Proto, message)