btm
This commit is contained in:
parent
be1e0d59d2
commit
1784f3a66b
26
third_party/can_btm/balise_btm.go
vendored
26
third_party/can_btm/balise_btm.go
vendored
@ -125,6 +125,32 @@ func (s *btmCanetClient) dealWithAptReq(f *message.CanetFrame) {
|
||||
}
|
||||
}
|
||||
|
||||
// BTM发送响应给ATP
|
||||
// 当收到应答器报文时响应:时间同步帧、状态应答帧、数据帧
|
||||
// 当未收到应答器报文时响应:时间同步帧、状态应答帧
|
||||
func (s *btmCanetClient) rspToAtp() {
|
||||
timeSyncF := message.NewBtmTimeSyncCheckFrame(s.atpReqSn)
|
||||
timeSyncCf := timeSyncF.Encode().Encode()
|
||||
statusF := message.NewBtmStatusRspFrame(s.atpReqSn)
|
||||
//true-收到应答器报文
|
||||
//todo
|
||||
isRcvTelegram := false
|
||||
|
||||
if isRcvTelegram { //当收到应答器报文时响应:时间同步帧、状态应答帧、数据帧
|
||||
s.sendCanetFrame(timeSyncCf)
|
||||
|
||||
} else { //当未收到应答器报文时响应:时间同步帧、状态应答帧
|
||||
statusCf := statusF.Encode().Encode()
|
||||
s.sendCanetFrame(timeSyncCf)
|
||||
s.sendCanetFrame(statusCf)
|
||||
}
|
||||
}
|
||||
|
||||
// 发送Canet帧,一帧13字节
|
||||
func (s *btmCanetClient) sendCanetFrame(cf []byte) {
|
||||
s.udpClient.Send(cf)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 处理接收的状态应答帧
|
||||
|
2
third_party/message/can_btm_rsp.go
vendored
2
third_party/message/can_btm_rsp.go
vendored
@ -2,6 +2,8 @@ package message
|
||||
|
||||
import "log/slog"
|
||||
|
||||
//BTM与ATP之间为双向通信,ATP(主)定时发送请求帧,BTM(从)在未接收到应答器报文时回复状态应答器帧和时间同步帧,在接收到应答器报文时回复所有帧
|
||||
|
||||
// CreateBtmRspFramesData 数据帧与状态应答帧同时发送给ATP
|
||||
// 共17帧,17X12个字节,每个帧12字节
|
||||
// msg - 应答器报文
|
||||
|
Loading…
Reference in New Issue
Block a user