列车btm调整重构
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m41s

This commit is contained in:
tiger_zhou 2024-08-13 17:33:57 +08:00
parent 30c932f178
commit 270f5a9772

View File

@ -4,7 +4,6 @@ import (
"encoding/binary" "encoding/binary"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
uuid2 "github.com/google/uuid"
"joylink.club/bj-rtsts-server/config" "joylink.club/bj-rtsts-server/config"
"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"
@ -697,18 +696,13 @@ func (s *VerifySimulation) TrainPcSimMockInfo(train *state_proto.TrainState, dat
// 4.4.4. 车载输出BTM查询同步帧报文内容0x04 // 4.4.4. 车载输出BTM查询同步帧报文内容0x04
func (s *VerifySimulation) TrainBtmQuery(train *state_proto.TrainState, data []byte) { func (s *VerifySimulation) TrainBtmQuery(train *state_proto.TrainState, data []byte) {
uuid := uuid2.NewString()
ts := time.Now().UnixMilli() ts := time.Now().UnixMilli()
//slog.Info(fmt.Sprintf("收到车载输出BTM查询同步帧uuid:%v,时间:%v, 报文内容:%v", uuid, ts, hex.EncodeToString(data)))
if len(data) < 12 { if len(data) < 12 {
slog.Error("列车btm查询报文长度错误:", len(data)) slog.Error("列车btm查询报文长度错误:", len(data))
return return
} }
balise, dsn, bc, mc := can_btm.Default().FindNotSendState(train) balise, dsn, bc, mc := can_btm.Default().FindNotSendState(train)
/*if balise == nil {
//slog.Warn(fmt.Sprintf("列车暂时未获取到应答器信息,无法进行btm查询列车id:%v", train.Id))
return
}*/
trainAtm := message.NewBtmHeadFrame(data) trainAtm := message.NewBtmHeadFrame(data)
atpReq := &message.AtpRequestFrame{} atpReq := &message.AtpRequestFrame{}
@ -753,7 +747,7 @@ func (s *VerifySimulation) TrainBtmQuery(train *state_proto.TrainState, data []b
train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_NOT_DATA, queryData) train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_NOT_DATA, queryData)
} else if !balise.IsSend { } else if !balise.IsSend {
balise.IsSend = true balise.IsSend = true
slog.Info(fmt.Sprintf("准备发送应答id:%v,uuid :%v,接受时间:%v,发送时间:%v , 数据:%v 经过:%v,解报文:%v", balise.BaliseId, uuid, ts, time.Now().UnixMilli(), balise.Telegram, bc, mc)) slog.Info(fmt.Sprintf("准备发送应答id:%v,接受时间:%v,发送时间:%v , 数据:%v 经过:%v,解报文:%v", balise.BaliseId, ts, time.Now().UnixMilli(), balise.Telegram, bc, mc))
aliseData, _ := hex.DecodeString(balise.Telegram) aliseData, _ := hex.DecodeString(balise.Telegram)
stateRepFrame := btmRepFrame.EncodeBtmAtp() stateRepFrame := btmRepFrame.EncodeBtmAtp()
statusDataCf, statusDataCfOk := message.CreateBtmAtpDataRspFramesData(stateRepFrame, aliseData, false, cl.BtmTk, cl.BtmTk, cl.BtmTk) statusDataCf, statusDataCfOk := message.CreateBtmAtpDataRspFramesData(stateRepFrame, aliseData, false, cl.BtmTk, cl.BtmTk, cl.BtmTk)