summaryrefslogtreecommitdiffstats
path: root/src/dabOutput/edi
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-08-22 11:38:14 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-08-22 11:38:14 +0200
commit7a056ef2cb94fb2fa45d8ecaed9dd97e99749fde (patch)
treedb39d470c3209f5385f53ae453321a9f5f2f2b16 /src/dabOutput/edi
parent4e141ca1ebc12b8d647ed62c2930bf41166a4583 (diff)
downloaddabmux-7a056ef2cb94fb2fa45d8ecaed9dd97e99749fde.tar.gz
dabmux-7a056ef2cb94fb2fa45d8ecaed9dd97e99749fde.tar.bz2
dabmux-7a056ef2cb94fb2fa45d8ecaed9dd97e99749fde.zip
Add experimental EDI to configuration file
Diffstat (limited to 'src/dabOutput/edi')
-rw-r--r--src/dabOutput/edi/AFPacket.cpp13
-rw-r--r--src/dabOutput/edi/AFPacket.h7
-rw-r--r--src/dabOutput/edi/PFT.cpp10
-rw-r--r--src/dabOutput/edi/PFT.h9
-rw-r--r--src/dabOutput/edi/TagItems.cpp6
-rw-r--r--src/dabOutput/edi/TagPacket.cpp4
6 files changed, 32 insertions, 17 deletions
diff --git a/src/dabOutput/edi/AFPacket.cpp b/src/dabOutput/edi/AFPacket.cpp
index ae2bdd6..3b69f1c 100644
--- a/src/dabOutput/edi/AFPacket.cpp
+++ b/src/dabOutput/edi/AFPacket.cpp
@@ -45,13 +45,16 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet)
{
std::vector<uint8_t> payload = tag_packet.Assemble();
- std::cerr << "Assemble AFPacket " << seq << std::endl;
+ if (m_verbose)
+ std::cerr << "Assemble AFPacket " << seq << std::endl;
std::string pack_data("AF"); // SYNC
std::vector<uint8_t> packet(pack_data.begin(), pack_data.end());
uint32_t taglength = payload.size();
- std::cerr << " AFPacket payload size " << payload.size() << std::endl;
+
+ if (m_verbose)
+ std::cerr << " AFPacket payload size " << payload.size() << std::endl;
// write length into packet
packet.push_back((taglength >> 24) & 0xFF);
@@ -73,12 +76,14 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet)
crc = crc16(crc, &(packet.front()), packet.size());
crc ^= 0xffff;
- fprintf(stderr, " AFPacket crc %x\n", crc);
+ if (m_verbose)
+ fprintf(stderr, " AFPacket crc %x\n", crc);
packet.push_back((crc >> 8) & 0xFF);
packet.push_back(crc & 0xFF);
- std::cerr << " AFPacket length " << packet.size() << std::endl;
+ if (m_verbose)
+ std::cerr << " AFPacket length " << packet.size() << std::endl;
return packet;
}
diff --git a/src/dabOutput/edi/AFPacket.h b/src/dabOutput/edi/AFPacket.h
index ac3cc28..5f62456 100644
--- a/src/dabOutput/edi/AFPacket.h
+++ b/src/dabOutput/edi/AFPacket.h
@@ -33,15 +33,14 @@
#include "TagItems.h"
#include "TagPacket.h"
-#define EDI_AFPACKET_PROTOCOLTYPE_TAGITEMS ('T')
-
typedef std::vector<uint8_t> AFPacket;
// ETSI TS 102 821, 6.1 AF packet structure
class AFPacketiser
{
public:
- AFPacketiser(char protocolType) : protocol_type(protocolType) {};
+ AFPacketiser(bool verbose) :
+ m_verbose(verbose) {};
AFPacket Assemble(TagPacket tag_packet);
@@ -50,7 +49,7 @@ class AFPacketiser
uint16_t seq; //counter that overflows at 0xFFFF
- char protocol_type;
+ bool m_verbose;
};
#endif
diff --git a/src/dabOutput/edi/PFT.cpp b/src/dabOutput/edi/PFT.cpp
index ac53f5d..5eaac09 100644
--- a/src/dabOutput/edi/PFT.cpp
+++ b/src/dabOutput/edi/PFT.cpp
@@ -88,8 +88,9 @@ vector< vector<uint8_t> > PFT::ProtectAndFragment(AFPacket af_packet)
const size_t fragment_size = m_num_chunks * (m_k + ParityBytes) / max_payload_size;
const size_t num_fragments = m_num_chunks * (m_k + ParityBytes) / fragment_size;
- fprintf(stderr, " PnF fragment_size %zu, num frag %zu\n",
- fragment_size, num_fragments);
+ if (m_verbose)
+ fprintf(stderr, " PnF fragment_size %zu, num frag %zu\n",
+ fragment_size, num_fragments);
vector< vector<uint8_t> > fragments(num_fragments);
@@ -154,8 +155,9 @@ std::vector< PFTFragment > PFT::Assemble(AFPacket af_packet)
pft_fragments.push_back(packet);
- fprintf(stderr, "* PFT pseq %d, findex %d, fcount %d, plen %d\n",
- m_pseq, findex, fcount, plen & ~0x8000);
+ if (m_verbose)
+ fprintf(stderr, "* PFT pseq %d, findex %d, fcount %d, plen %d\n",
+ m_pseq, findex, fcount, plen & ~0x8000);
}
m_pseq++;
diff --git a/src/dabOutput/edi/PFT.h b/src/dabOutput/edi/PFT.h
index 54c229f..02380ec 100644
--- a/src/dabOutput/edi/PFT.h
+++ b/src/dabOutput/edi/PFT.h
@@ -48,11 +48,14 @@ class PFT
public:
static const int ParityBytes = 48;
- PFT(unsigned int RSDataWordLength, unsigned int NumRecoverableFragments) :
+ PFT(unsigned int RSDataWordLength,
+ unsigned int NumRecoverableFragments,
+ bool verbose) :
m_k(RSDataWordLength),
m_m(NumRecoverableFragments),
m_pseq(0),
- m_encoder(m_k + ParityBytes, m_k)
+ m_encoder(m_k + ParityBytes, m_k),
+ m_verbose(verbose)
{
if (m_k > 207) {
etiLog.level(warn) <<
@@ -88,6 +91,8 @@ class PFT
ReedSolomon m_encoder;
+ bool m_verbose;
+
};
#endif
diff --git a/src/dabOutput/edi/TagItems.cpp b/src/dabOutput/edi/TagItems.cpp
index d4f73d2..488f8c3 100644
--- a/src/dabOutput/edi/TagItems.cpp
+++ b/src/dabOutput/edi/TagItems.cpp
@@ -36,7 +36,7 @@
std::vector<uint8_t> TagStarPTR::Assemble()
{
- std::cerr << "TagItem *ptr" << std::endl;
+ //std::cerr << "TagItem *ptr" << std::endl;
std::string pack_data("*ptr");
std::vector<uint8_t> packet(pack_data.begin(), pack_data.end());
@@ -118,9 +118,11 @@ std::vector<uint8_t> TagDETI::Assemble()
dflc = (dflc+1) % 5000;
+ /*
std::cerr << "TagItem deti, packet.size " << packet.size() << std::endl;
std::cerr << " fic length " << fic_length << std::endl;
std::cerr << " length " << taglength / 8 << std::endl;
+ */
return packet;
}
@@ -159,8 +161,10 @@ std::vector<uint8_t> TagESTn::Assemble()
packet[6] = (taglength >> 8) & 0xFF;
packet[7] = taglength & 0xFF;
+ /*
std::cerr << "TagItem ESTn, length " << packet.size() << std::endl;
std::cerr << " mst_length " << mst_length << std::endl;
+ */
return packet;
}
#endif
diff --git a/src/dabOutput/edi/TagPacket.cpp b/src/dabOutput/edi/TagPacket.cpp
index 0fc9a17..fbb0f8b 100644
--- a/src/dabOutput/edi/TagPacket.cpp
+++ b/src/dabOutput/edi/TagPacket.cpp
@@ -39,7 +39,7 @@ std::vector<uint8_t> TagPacket::Assemble()
std::vector<uint8_t> packet;
- std::cerr << "Assemble TAGPacket" << std::endl;
+ //std::cerr << "Assemble TAGPacket" << std::endl;
size_t packet_length = 0;
for (tag = tag_items.begin(); tag != tag_items.end(); ++tag) {
@@ -48,7 +48,7 @@ std::vector<uint8_t> TagPacket::Assemble()
packet_length += tag_data.size();
- std::cerr << " Add TAGItem of length " << tag_data.size() << std::endl;
+ //std::cerr << " Add TAGItem of length " << tag_data.size() << std::endl;
}
// Add padding