summaryrefslogtreecommitdiffstats
path: root/lib/edi/STIDecoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/edi/STIDecoder.cpp')
-rw-r--r--lib/edi/STIDecoder.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/edi/STIDecoder.cpp b/lib/edi/STIDecoder.cpp
index d55cc12..b6b9878 100644
--- a/lib/edi/STIDecoder.cpp
+++ b/lib/edi/STIDecoder.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2019
+ Copyright (C) 2020
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -30,9 +30,9 @@ namespace EdiDecoder {
using namespace std;
-STIDecoder::STIDecoder(STIDataCollector& data_collector, bool verbose) :
+STIDecoder::STIDecoder(STIDataCollector& data_collector) :
m_data_collector(data_collector),
- m_dispatcher(std::bind(&STIDecoder::packet_completed, this), verbose)
+ m_dispatcher(std::bind(&STIDecoder::packet_completed, this))
{
using std::placeholders::_1;
using std::placeholders::_2;
@@ -50,6 +50,11 @@ STIDecoder::STIDecoder(STIDataCollector& data_collector, bool verbose) :
std::bind(&STIDecoder::decode_odrversion, this, _1, _2));
}
+void STIDecoder::set_verbose(bool verbose)
+{
+ m_dispatcher.set_verbose(verbose);
+}
+
void STIDecoder::push_bytes(const vector<uint8_t> &buf)
{
m_dispatcher.push_bytes(buf);
@@ -67,7 +72,7 @@ void STIDecoder::setMaxDelay(int num_af_packets)
#define AFPACKET_HEADER_LEN 10 // includes SYNC
-bool STIDecoder::decode_starptr(const vector<uint8_t> &value, uint16_t)
+bool STIDecoder::decode_starptr(const std::vector<uint8_t>& value, const tag_name_t& n)
{
if (value.size() != 0x40 / 8) {
etiLog.log(warn, "Incorrect length %02lx for *PTR", value.size());
@@ -87,7 +92,7 @@ bool STIDecoder::decode_starptr(const vector<uint8_t> &value, uint16_t)
return true;
}
-bool STIDecoder::decode_dsti(const vector<uint8_t> &value, uint16_t)
+bool STIDecoder::decode_dsti(const std::vector<uint8_t>& value, const tag_name_t& n)
{
size_t offset = 0;
@@ -156,10 +161,14 @@ bool STIDecoder::decode_dsti(const vector<uint8_t> &value, uint16_t)
return true;
}
-bool STIDecoder::decode_ssn(const vector<uint8_t> &value, uint16_t n)
+bool STIDecoder::decode_ssn(const std::vector<uint8_t>& value, const tag_name_t& name)
{
sti_payload_data sti;
+ uint16_t n = 0;
+ n = (uint16_t)(name[2]) << 8;
+ n |= (uint16_t)(name[3]);
+
sti.stream_index = n - 1; // n is 1-indexed
sti.rfa = value[0] >> 3;
sti.tid = value[0] & 0x07;
@@ -182,12 +191,12 @@ bool STIDecoder::decode_ssn(const vector<uint8_t> &value, uint16_t n)
return true;
}
-bool STIDecoder::decode_stardmy(const vector<uint8_t>& /*value*/, uint16_t)
+bool STIDecoder::decode_stardmy(const std::vector<uint8_t>&, const tag_name_t&)
{
return true;
}
-bool STIDecoder::decode_odraudiolevel(const vector<uint8_t>& value, uint16_t)
+bool STIDecoder::decode_odraudiolevel(const std::vector<uint8_t>& value, const tag_name_t& n)
{
constexpr size_t expected_length = 2 * sizeof(int16_t);
@@ -210,7 +219,7 @@ bool STIDecoder::decode_odraudiolevel(const vector<uint8_t>& value, uint16_t)
return true;
}
-bool STIDecoder::decode_odrversion(const vector<uint8_t>& value, uint16_t)
+bool STIDecoder::decode_odrversion(const std::vector<uint8_t>& value, const tag_name_t& n)
{
const auto vd = parse_odr_version_data(value);
m_data_collector.update_odr_version(vd);