From f4e6037864f353a0deb3b40a4533cffa70bc201f Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 19 May 2021 14:48:55 +0200 Subject: Common 44ae39c: Make SEQ and PSEQ available on EDI receive and improve error handling --- lib/edioutput/AFPacket.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/edioutput/AFPacket.cpp') diff --git a/lib/edioutput/AFPacket.cpp b/lib/edioutput/AFPacket.cpp index b38c38b..323a3b1 100644 --- a/lib/edioutput/AFPacket.cpp +++ b/lib/edioutput/AFPacket.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 + Copyright (C) 2021 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -25,7 +25,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "config.h" #include "crc.h" #include "AFPacket.h" #include "TagItems.h" @@ -50,7 +49,7 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet) std::vector payload = tag_packet.Assemble(); if (m_verbose) - std::cerr << "Assemble AFPacket " << seq << std::endl; + std::cerr << "Assemble AFPacket " << m_seq << std::endl; std::string pack_data("AF"); // SYNC std::vector packet(pack_data.begin(), pack_data.end()); @@ -67,10 +66,10 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet) packet.push_back(taglength & 0xFF); // fill rest of header - packet.push_back(seq >> 8); - packet.push_back(seq & 0xFF); - seq++; - packet.push_back((have_crc ? 0x80 : 0) | AFHEADER_VERSION); // ar_cf: CRC=1 + packet.push_back(m_seq >> 8); + packet.push_back(m_seq & 0xFF); + m_seq++; + packet.push_back((m_have_crc ? 0x80 : 0) | AFHEADER_VERSION); // ar_cf: CRC=1 packet.push_back(AFHEADER_PT_TAG); // insert payload, must have a length multiple of 8 bytes @@ -93,4 +92,9 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet) return packet; } +void AFPacketiser::OverrideSeq(uint16_t seq) +{ + m_seq = seq; +} + } -- cgit v1.2.3