diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-03-11 09:48:43 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-03-11 09:48:43 +0100 |
commit | 2aef86e1ee7a49afb29e810b2aefcae4adc7c763 (patch) | |
tree | 9d79ba1345298e99a2999f7755dd7f2d84b96d94 /src/fig/FIGCarousel.cpp | |
parent | da8d545d997a7003c0393b2eba861f9a3a9f8daf (diff) | |
parent | eb8c283cff3269f0cac45472d31a3fc6f78cefab (diff) | |
download | dabmux-2aef86e1ee7a49afb29e810b2aefcae4adc7c763.tar.gz dabmux-2aef86e1ee7a49afb29e810b2aefcae4adc7c763.tar.bz2 dabmux-2aef86e1ee7a49afb29e810b2aefcae4adc7c763.zip |
Merge KuntzeM's FIG0/7
Diffstat (limited to 'src/fig/FIGCarousel.cpp')
-rw-r--r-- | src/fig/FIGCarousel.cpp | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/src/fig/FIGCarousel.cpp b/src/fig/FIGCarousel.cpp index 8ea183c..162f0dd 100644 --- a/src/fig/FIGCarousel.cpp +++ b/src/fig/FIGCarousel.cpp @@ -3,7 +3,7 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2020 Matthias P. Braendli, matthias.braendli@mpb.li Implementation of the FIG carousel to schedule the FIGs into the @@ -82,6 +82,7 @@ FIGCarousel::FIGCarousel(std::shared_ptr<dabEnsemble> ensemble) : m_fig0_3(&m_rti), m_fig0_5(&m_rti), m_fig0_6(&m_rti), + m_fig0_7(&m_rti), m_fig0_17(&m_rti), m_fig0_8(&m_rti), m_fig1_0(&m_rti), @@ -114,6 +115,7 @@ FIGCarousel::FIGCarousel(std::shared_ptr<dabEnsemble> ensemble) : * FIG 0/7 have a defined location in the FIC. */ load_and_allocate(m_fig0_0, FIBAllocation::FIB0); + load_and_allocate(m_fig0_7, FIBAllocation::FIB0); load_and_allocate(m_fig0_1, FIBAllocation::FIB_ANY); load_and_allocate(m_fig0_2, FIBAllocation::FIB_ANY); load_and_allocate(m_fig0_3, FIBAllocation::FIB_ANY); @@ -270,7 +272,7 @@ size_t FIGCarousel::carousel( /* Take special care for FIG0/0 */ auto fig0_0 = find_if(sorted_figs.begin(), sorted_figs.end(), [](const FIGCarouselElement* f) { - return f->fig->repetition_rate() == FIG_rate::FIG0_0; + return (f->fig->figtype() == 0 && f->fig->figextension() == 0); }); if (fig0_0 != sorted_figs.end()) { @@ -314,6 +316,53 @@ size_t FIGCarousel::carousel( sorted_figs.erase(fig0_0); } + /* Take special care for FIG0/7 */ + auto fig0_7 = find_if(sorted_figs.begin(), sorted_figs.end(), + [](const FIGCarouselElement* f) { + return (f->fig->figtype() == 0 && f->fig->figextension() == 7); + }); + + if (fig0_7 != sorted_figs.end()) { + if (framephase == 0) { // TODO check for all TM + FillStatus status = (*fig0_7)->fig->fill(pbuf, available_size); + size_t written = status.num_bytes_written; + + if (written > 0) { + available_size -= written; + pbuf += written; + +#if CAROUSELDEBUG + if (written) { + std::cerr << " ****** FIG0/7(special) wrote\t" << written << " bytes" + << std::endl; + } + + if ( (*fig0_7)->fig->figtype() != 0 or + (*fig0_7)->fig->figextension() != 7 or + written != 4) { + + std::stringstream ss; + ss << "Assertion error: FIG 0/7 is actually " << + (*fig0_7)->fig->figtype() + << "/" << (*fig0_7)->fig->figextension() << + " and wrote " << written << " bytes"; + + throw std::runtime_error(ss.str()); + } +#endif + } + else { + throw std::runtime_error("Failed to write FIG0/7"); + } + + if (status.complete_fig_transmitted) { + (*fig0_7)->increase_deadline(); + } + } + + sorted_figs.erase(fig0_7); + } + /* Fill the FIB with the FIGs, taking the earliest deadline first */ while (available_size > 0 and not sorted_figs.empty()) { |