diff --git a/third_party/can_btm/balise_btm.go b/third_party/can_btm/balise_btm.go index ed287b9..59efdf1 100644 --- a/third_party/can_btm/balise_btm.go +++ b/third_party/can_btm/balise_btm.go @@ -37,6 +37,9 @@ type btmCanetClient struct { remoteIp string //最近一次车载ATP系统查询帧序号 atpReqSn byte + //btm最近一次接收到atp查询请求的时间 + //当BTM超过150ms即3个周期没有收到atq下发的查询帧,则清空报文缓冲区 + atpReqTime *time.Time //最近一次车载ATP系统查询帧CRC16校验结果,true-校验通过 atpReqCrc16Check bool //btm系统时间,每次接收到ATP查询请求帧时同步一次时间 @@ -160,6 +163,7 @@ func (s *btmCanetClient) handleCanetFrames(cfs []byte) { // 处理接收的ATP查询请求帧 func (s *btmCanetClient) dealWithAptReq(f *message.CanetFrame) { + now := time.Now() atpReq := &message.AtpRequestFrame{} if !atpReq.Decode(f) { slog.Warn("CanetFrame解码成AtpRequestFrame失败", "CanetFrame", f.String()) @@ -179,6 +183,8 @@ func (s *btmCanetClient) dealWithAptReq(f *message.CanetFrame) { //ATP 是否要求BTM 重发上一应答器报文 isResendRequest := atpReq.ResendRequest == 2 //0b10 s.rspToAtp(isResendRequest) + //记录atp查询时间 + s.atpReqTime = &now } // BTM发送响应给ATP