From 844532b93021ecc9f0f5dabbc00f8965f088c54b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 28 Oct 2020 11:24:39 +0100 Subject: common ea3156f: EDI input: Do not print sequence error on first packet --- lib/edi/common.cpp | 12 +++++++++--- lib/edi/common.hpp | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/edi/common.cpp b/lib/edi/common.cpp index 3005802..306261a 100644 --- a/lib/edi/common.cpp +++ b/lib/edi/common.cpp @@ -264,9 +264,15 @@ decode_state_t TagDispatcher::decode_afpacket( } // SEQ wraps at 0xFFFF, unsigned integer overflow is intentional - const uint16_t expected_seq = m_last_seq + 1; - if (expected_seq != seq) { - etiLog.level(warn) << "EDI AF Packet sequence error, " << seq; + if (m_last_seq_valid) { + const uint16_t expected_seq = m_last_seq + 1; + if (expected_seq != seq) { + etiLog.level(warn) << "EDI AF Packet sequence error, " << seq; + } + } + else { + etiLog.level(info) << "EDI AF Packet initial sequence number: " << seq; + m_last_seq_valid = true; } m_last_seq = seq; diff --git a/lib/edi/common.hpp b/lib/edi/common.hpp index ff5bab1..c8c4bb3 100644 --- a/lib/edi/common.hpp +++ b/lib/edi/common.hpp @@ -107,6 +107,7 @@ class TagDispatcher { bool decode_tagpacket(const std::vector &payload); PFT::PFT m_pft; + bool m_last_seq_valid = false; uint16_t m_last_seq = 0; std::vector m_input_data; std::map m_handlers; -- cgit v1.2.3