diff options
author | Mathias Kuntze <mathias.kuntze@magna.com> | 2020-03-10 10:14:14 +0100 |
---|---|---|
committer | Mathias Kuntze <mathias.kuntze@magna.com> | 2020-03-10 10:14:14 +0100 |
commit | eb8c283cff3269f0cac45472d31a3fc6f78cefab (patch) | |
tree | 9ae55038d6d9e37bf03180ef75af81c36c12cc13 /src | |
parent | 34db5f02dd472857de2fd810a3ff8a8f83f407fb (diff) | |
download | dabmux-eb8c283cff3269f0cac45472d31a3fc6f78cefab.tar.gz dabmux-eb8c283cff3269f0cac45472d31a3fc6f78cefab.tar.bz2 dabmux-eb8c283cff3269f0cac45472d31a3fc6f78cefab.zip |
add special FIG 0/7 handling to send directly after FIG 0/0
Diffstat (limited to 'src')
-rw-r--r-- | src/fig/FIGCarousel.cpp | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/fig/FIGCarousel.cpp b/src/fig/FIGCarousel.cpp index bb5e79b..162f0dd 100644 --- a/src/fig/FIGCarousel.cpp +++ b/src/fig/FIGCarousel.cpp @@ -272,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()) { @@ -316,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()) { |