summaryrefslogtreecommitdiffstats
path: root/src/dabOutput/edi/AFPacket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-24 16:59:09 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-05-20 21:39:36 +0200
commit67300d5c4fa279eb5144d60874753b10de678f55 (patch)
treee127c74147a115e9c1f7c4502296f2d05dbe6656 /src/dabOutput/edi/AFPacket.cpp
parent7dc5341629fb63059b8936d0442b11c285cbf19a (diff)
downloaddabmux-67300d5c4fa279eb5144d60874753b10de678f55.tar.gz
dabmux-67300d5c4fa279eb5144d60874753b10de678f55.tar.bz2
dabmux-67300d5c4fa279eb5144d60874753b10de678f55.zip
add TagPacket, add to DabMux.cpp. Must fix the goto EXIT now
Diffstat (limited to 'src/dabOutput/edi/AFPacket.cpp')
-rw-r--r--src/dabOutput/edi/AFPacket.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dabOutput/edi/AFPacket.cpp b/src/dabOutput/edi/AFPacket.cpp
index cd845d7..1516561 100644
--- a/src/dabOutput/edi/AFPacket.cpp
+++ b/src/dabOutput/edi/AFPacket.cpp
@@ -26,6 +26,8 @@
#include "config.h"
#include "crc.h"
#include "AFPacket.h"
+#include "TagItems.h"
+#include "TagPacket.h"
#include <vector>
#include <string>
#include <stdint.h>
@@ -37,8 +39,10 @@
// AF Packet Major (3 bits) and Minor (4 bits) version
#define AFHEADER_VERSION 0x8 // MAJ=1, MIN=0
-std::vector<uint8_t> AFPacket::Assemble(char protocol_type, std::vector<uint8_t> payload)
+std::vector<uint8_t> AFPacket::Assemble(TagPacket tag_packet)
{
+ std::vector<uint8_t> payload = tag_packet.Assemble();
+
header.ar_maj = 1;
header.ar_min = 0;
header.pt = protocol_type;
@@ -60,7 +64,7 @@ std::vector<uint8_t> AFPacket::Assemble(char protocol_type, std::vector<uint8_t>
packet.push_back((have_crc ? 0x80 : 0) | AFHEADER_VERSION); // ar_cf: CRC=1
packet.push_back(AFHEADER_PT_TAG);
- // insert payload
+ // insert payload, must have a length multiple of 8 bytes
packet.insert(packet.end(), payload.begin(), payload.end());
// calculate CRC over AF Header and payload