From a1fc0311bfc0997fd10f19b1c26ef69096bb553e Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Thu, 23 Nov 2023 18:13:52 +0800 Subject: [PATCH] btm --- component/train.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/component/train.go b/component/train.go index 42c72b1..cb91b0c 100644 --- a/component/train.go +++ b/component/train.go @@ -73,6 +73,18 @@ func (t *TrainBtm) baliseMessageCounterAdd1() { } } +// SetBaliseTelegramHadSentAndGet 获取未发送的应答器报文并标记已发送 +// 通过Canet发送应答器报文时调用该方法来获取要发送的报文 +func (t *TrainBtm) SetBaliseTelegramHadSentAndGet() *TrainBaliseTelegram { + for _, tbt := range t.ScannedBalises { + if !tbt.sent { + tbt.sent = true + return tbt + } + } + return nil +} + const scannedBalisesMax = 3 // Scanning BTM通过车载应答器天线接收到应答器报文