diff options
-rw-r--r-- | src/ConfigParser.cpp | 9 | ||||
-rw-r--r-- | src/MuxElements.cpp | 10 | ||||
-rw-r--r-- | src/fig/FIG0.cpp | 20 | ||||
-rw-r--r-- | src/utils.cpp | 2 |
4 files changed, 19 insertions, 22 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 38a4efb..7803ad5 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -134,8 +134,6 @@ uint16_t get_announcement_flag_from_ptree( std::string announcement_name(annoucement_flags_names[flag]); bool flag_set = pt.get<bool>(announcement_name, false); - cerr << " CHECK FOR " << announcement_name << " " << flag_set << endl; - if (flag_set) { flags |= (1 << flag); } @@ -244,7 +242,7 @@ void parse_ptree(boost::property_tree::ptree& pt, ptree pt_announcement = announcement.second; auto cl = make_shared<AnnouncementCluster>(name); - cl->cluster_id = pt_announcement.get<uint8_t>("cluster"); + cl->cluster_id = hexparse(pt_announcement.get<string>("cluster")); cl->flags = get_announcement_flag_from_ptree( pt_announcement.get_child("flags")); cl->subchanneluid = pt_announcement.get<string>("subchannel"); @@ -255,6 +253,7 @@ void parse_ptree(boost::property_tree::ptree& pt, } catch (ptree_error& e) { etiLog.level(info) << "No announcements defined in ensemble"; + etiLog.level(debug) << "because " << e.what(); } /******************** READ SERVICES PARAMETERS *************/ @@ -304,7 +303,7 @@ void parse_ptree(boost::property_tree::ptree& pt, continue; } try { - service->clusters.push_back(std::stoi(cluster_s)); + service->clusters.push_back(hexparse(cluster_s)); } catch (std::logic_error& e) { etiLog.level(warn) << "Cannot parse '" << clusterlist << @@ -905,7 +904,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan, /* Get id */ try { - subchan->id = hexparse(pt.get<std::string>("subchid")); + subchan->id = hexparse(pt.get<std::string>("id")); } catch (ptree_error &e) { for (int i = 0; i < 64; ++i) { // Find first free subchannel diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 452e179..60056e4 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -48,13 +48,15 @@ using namespace std; std::string AnnouncementCluster::tostring() const { stringstream ss; - ss << " cluster id : " << (int)cluster_id; - ss << " flags : 0x" << boost::format("%04x") % flags; - ss << " subchannel : " << subchanneluid; + ss << "cluster id(" << (int)cluster_id; + ss << "flags 0x" << boost::format("%04x") % flags; + ss << ", subchannel " << subchanneluid; if (m_active) { - ss << " *"; + ss << " *"; } + ss << " )"; + return ss.str(); } diff --git a/src/fig/FIG0.cpp b/src/fig/FIG0.cpp index 3d058a8..9d728dd 100644 --- a/src/fig/FIG0.cpp +++ b/src/fig/FIG0.cpp @@ -1026,16 +1026,17 @@ FillStatus FIG0_19::fill(uint8_t *buf, size_t max_size) allclusters.insert(cluster.first.get()); } + const int length_0_19 = 4; fs.complete_fig_transmitted = true; for (const auto& cluster : allclusters) { - if (remaining < 6) { + if (remaining < length_0_19) { fs.complete_fig_transmitted = false; break; } if (fig0 == NULL) { - if (remaining < 2 + 6) { + if (remaining < 2 + length_0_19) { fs.complete_fig_transmitted = false; break; } @@ -1054,7 +1055,7 @@ FillStatus FIG0_19::fill(uint8_t *buf, size_t max_size) auto fig0_19 = (FIGtype0_19*)buf; fig0_19->ClusterId = cluster->cluster_id; if (cluster->is_active()) { - fig0_19->ASw = cluster->flags; + fig0_19->ASw = htons(cluster->flags); } else { fig0_19->ASw = 0; @@ -1078,16 +1079,11 @@ FillStatus FIG0_19::fill(uint8_t *buf, size_t max_size) continue; } - buf += 6; - remaining -= 6; + fig0->Length += length_0_19; + buf += length_0_19; + remaining -= length_0_19; } - if (not fs.complete_fig_transmitted) { - etiLog.level(warn) << "FIG0/19 incomplete!"; - } - else { - etiLog.level(warn) << "FIG0/19 complete " << remaining; - } fs.num_bytes_written = max_size - remaining; return fs; } @@ -1099,7 +1095,7 @@ void FIG0_19::update_state() // We are called every 24ms, and must timeout after 2s const int timeout = 2000/24; -#define DEBUG_FIG0_19 +//#define DEBUG_FIG0_19 #ifdef DEBUG_FIG0_19 etiLog.level(info) << " FIG0/19 new"; for (const auto& cluster : m_new_announcements) { diff --git a/src/utils.cpp b/src/utils.cpp index b45f930..743d74a 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -484,7 +484,7 @@ void printSubchannels(vector<dabSubchannel*>& subchannels) for (subchannel = subchannels.begin(); subchannel != subchannels.end(); ++subchannel) { dabProtection* protection = &(*subchannel)->protection; - etiLog.log(info, "Subchannel %i", index); + etiLog.level(info) << "Subchannel " << (*subchannel)->uid; etiLog.log(info, " input"); etiLog.level(info) << " URI: " << (*subchannel)->inputUri; switch ((*subchannel)->type) { |