51 lines
1.4 KiB
Go
51 lines
1.4 KiB
Go
|
package memory
|
||
|
|
||
|
import (
|
||
|
"joylink.club/bj-rtsts-server/config"
|
||
|
"joylink.club/bj-rtsts-server/dto/state_proto"
|
||
|
"joylink.club/bj-rtsts-server/third_party/message"
|
||
|
)
|
||
|
|
||
|
// 获取半实物运行配置信息
|
||
|
func (s *VerifySimulation) GetSemiPhysicalRunConfig() *config.VobcConfig {
|
||
|
return &s.runConfig.Vobc
|
||
|
}
|
||
|
|
||
|
// 处理半实物仿真列车控制消息
|
||
|
func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg(b []byte) {
|
||
|
s.Memory.Status.TrainStateMap.Range(func(_, value any) bool {
|
||
|
train := value.(*state_proto.TrainState)
|
||
|
if !train.Show { // 下线列车
|
||
|
return true
|
||
|
}
|
||
|
connState := train.ConnState
|
||
|
if connState.Conn == true && connState.ConnType == state_proto.TrainConnState_VOBC {
|
||
|
/*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)
|
||
|
controlMessage.TrainId = train.Id
|
||
|
controlMessage.FromVobc = true
|
||
|
train.VobcState = controlMessage.ControlInfo
|
||
|
|
||
|
return false
|
||
|
}
|
||
|
return true
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// 处理半实物仿真列车控制消息
|
||
|
func (s *VerifySimulation) HandleSemiPhysicalTrainControlMsg2(b []byte) {
|
||
|
//train := s.GetConnVobcTrain()
|
||
|
|
||
|
}
|
||
|
func aaByte1() {
|
||
|
|
||
|
}
|