aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edi/PFT.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-13 10:14:45 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-13 10:14:45 +0100
commit0f9f51279b77fecc1d8c9ea8fe0fc62d8e945645 (patch)
treed23947320efe789e351a2ebd288c96a23095d3ec /lib/edi/PFT.cpp
parentc74279c0af306e2fb4a1f03b0a698fb239f4c33b (diff)
downloaddabmod-0f9f51279b77fecc1d8c9ea8fe0fc62d8e945645.tar.gz
dabmod-0f9f51279b77fecc1d8c9ea8fe0fc62d8e945645.tar.bz2
dabmod-0f9f51279b77fecc1d8c9ea8fe0fc62d8e945645.zip
Update edi code from edilib
Diffstat (limited to 'lib/edi/PFT.cpp')
-rw-r--r--lib/edi/PFT.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/lib/edi/PFT.cpp b/lib/edi/PFT.cpp
index 4bd1030..4348f14 100644
--- a/lib/edi/PFT.cpp
+++ b/lib/edi/PFT.cpp
@@ -445,6 +445,22 @@ std::vector<uint8_t> AFBuilder::extractAF() const
return _af_packet;
}
+std::string AFBuilder::visualise() const
+{
+ stringstream ss;
+ ss << "|";
+ for (size_t i = 0; i < _Fcount; i++) {
+ if (_fragments.count(i)) {
+ ss << ".";
+ }
+ else {
+ ss << " ";
+ }
+ }
+ ss << "| " << AFBuilder::dar_to_string(canAttemptToDecode()) << " " << lifeTime;
+ return ss.str();
+}
+
void PFT::pushPFTFrag(const Fragment &fragment)
{
// Start decoding the first pseq we receive. In normal
@@ -473,11 +489,12 @@ void PFT::pushPFTFrag(const Fragment &fragment)
p.pushPFTFrag(fragment);
#if 0
- etiLog.log(debug, "After new frag with pseq %u, afbuilders: ", fragment.Pseq());
+ etiLog.log(debug, "Got frag %u:%u, afbuilders: ",
+ fragment.Pseq(), fragment.Findex());
for (const auto &k : m_afbuilders) {
- etiLog.log(debug, "%u ", k.first);
+ const bool isNextPseq = (m_next_pseq == k.first);
+ etiLog.level(debug) << (isNextPseq ? "->" : " ") << k.first << " " << k.second.visualise();
}
- etiLog.log(debug, "\n");
#endif
}
@@ -494,21 +511,16 @@ std::vector<uint8_t> PFT::getNextAFPacket()
}
auto &builder = m_afbuilders.at(m_next_pseq);
- //const auto nf = builder.numberOfFragments();
using dar_t = AFBuilder::decode_attempt_result_t;
if (builder.canAttemptToDecode() == dar_t::yes) {
- //etiLog.log(debug, "pseq %d (%d %d/%d) yes\n",
- // m_next_pseq, lt, nf.first, nf.second);
auto afpacket = builder.extractAF();
assert(not afpacket.empty());
incrementNextPseq();
return afpacket;
}
else if (builder.canAttemptToDecode() == dar_t::maybe) {
- //etiLog.log(debug, "pseq %d (%d %d/%d) maybe\n",
- // m_next_pseq, lt, nf.first, nf.second);
if (builder.lifeTime > 0) {
builder.lifeTime--;
}
@@ -518,15 +530,13 @@ std::vector<uint8_t> PFT::getNextAFPacket()
auto afpacket = builder.extractAF();
if (afpacket.empty()) {
- etiLog.log(debug,"pseq %d timed out after RS\n", m_next_pseq);
+ etiLog.log(debug,"pseq %d timed out after RS", m_next_pseq);
}
incrementNextPseq();
return afpacket;
}
}
else {
- //etiLog.log(debug, "pseq %d (%d %d/%d) no\n",
- // m_next_pseq, lt, nf.first, nf.second);
if (builder.lifeTime > 0) {
builder.lifeTime--;
}