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通过车载应答器天线接收到应答器报文