summaryrefslogtreecommitdiffstats
path: root/lib/edioutput/AFPacket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-05-19 14:48:13 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-05-19 14:48:13 +0200
commit26b20a9aa0167b64e75b813aaf9b41557b4de3df (patch)
tree8ea23fc867cde052a70795159e8c122dccd763a7 /lib/edioutput/AFPacket.cpp
parent9067a63a4dd433c6109ba0157db516c9cac398e4 (diff)
downloaddabmux-26b20a9aa0167b64e75b813aaf9b41557b4de3df.tar.gz
dabmux-26b20a9aa0167b64e75b813aaf9b41557b4de3df.tar.bz2
dabmux-26b20a9aa0167b64e75b813aaf9b41557b4de3df.zip
Common 44ae39c: Make SEQ and PSEQ available on EDI receive and improve error handling
Diffstat (limited to 'lib/edioutput/AFPacket.cpp')
-rw-r--r--lib/edioutput/AFPacket.cpp18
1 files changed, 11 insertions, 7 deletions
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 <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
#include "crc.h"
#include "AFPacket.h"
#include "TagItems.h"
@@ -50,7 +49,7 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet)
std::vector<uint8_t> 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<uint8_t> 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;
+}
+
}