diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-08-22 20:42:34 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-08-22 20:42:34 +0200 |
commit | 289f61e5023758f1ca805d19be5f2c19757090e3 (patch) | |
tree | 49577f82f450d56f2962ecbfbd0237034774a2c2 /src/fig | |
parent | 1f4a861853f37fccbd0aa25a9f1b6457117ee85c (diff) | |
download | dabmux-289f61e5023758f1ca805d19be5f2c19757090e3.tar.gz dabmux-289f61e5023758f1ca805d19be5f2c19757090e3.tar.bz2 dabmux-289f61e5023758f1ca805d19be5f2c19757090e3.zip |
Switch FIG0/10 to long form
The latest draft specification deprecates the short form, and most
muxes today used the long form.
Diffstat (limited to 'src/fig')
-rw-r--r-- | src/fig/FIG.h | 1 | ||||
-rw-r--r-- | src/fig/FIG0.cpp | 20 | ||||
-rw-r--r-- | src/fig/FIG0.h | 17 | ||||
-rw-r--r-- | src/fig/FIGCarousel.cpp | 5 | ||||
-rw-r--r-- | src/fig/FIGCarousel.h | 2 |
5 files changed, 32 insertions, 13 deletions
diff --git a/src/fig/FIG.h b/src/fig/FIG.h index 0316d77..2325252 100644 --- a/src/fig/FIG.h +++ b/src/fig/FIG.h @@ -41,7 +41,6 @@ class FIGRuntimeInformation { ensemble(e), factumAnalyzer(false) {} - time_t date; unsigned long currentFrame; std::shared_ptr<dabEnsemble> ensemble; bool factumAnalyzer; diff --git a/src/fig/FIG0.cpp b/src/fig/FIG0.cpp index 41cf9f2..3bd1307 100644 --- a/src/fig/FIG0.cpp +++ b/src/fig/FIG0.cpp @@ -27,6 +27,7 @@ #include "fig/FIG0.h" #include "dabUtils.h" +#include "utils.h" namespace FIC { @@ -817,16 +818,16 @@ FillStatus FIG0_10::fill(uint8_t *buf, size_t max_size) auto ensemble = m_rti->ensemble; size_t remaining = max_size; - if (remaining < 6) { + if (remaining < 8) { fs.num_bytes_written = 0; return fs; } //Time and country identifier - auto fig0_10 = (FIGtype0_10 *)buf; + auto fig0_10 = (FIGtype0_10_LongForm*)buf; fig0_10->FIGtypeNumber = 0; - fig0_10->Length = 5; + fig0_10->Length = 7; fig0_10->CN = 0; fig0_10->OE = 0; fig0_10->PD = 0; @@ -835,7 +836,10 @@ FillStatus FIG0_10::fill(uint8_t *buf, size_t max_size) remaining -= 2; tm* timeData; - timeData = gmtime(&m_rti->date); + time_t dab_time_seconds = 0; + uint32_t dab_time_millis = 0; + get_dab_time(&dab_time_seconds, &dab_time_millis); + timeData = gmtime(&dab_time_seconds); fig0_10->RFU = 0; fig0_10->setMJD(gregorian2mjd(timeData->tm_year + 1900, @@ -843,11 +847,13 @@ FillStatus FIG0_10::fill(uint8_t *buf, size_t max_size) timeData->tm_mday)); fig0_10->LSI = 0; fig0_10->ConfInd = 1; - fig0_10->UTC = 0; + fig0_10->UTC = 1; fig0_10->setHours(timeData->tm_hour); fig0_10->Minutes = timeData->tm_min; - buf += 4; - remaining -= 4; + fig0_10->Seconds = timeData->tm_sec; + fig0_10->setMilliseconds(dab_time_millis); + buf += 6; + remaining -= 6; fs.num_bytes_written = max_size - remaining; fs.complete_fig_transmitted = true; diff --git a/src/fig/FIG0.h b/src/fig/FIG0.h index a096d57..59ed1af 100644 --- a/src/fig/FIG0.h +++ b/src/fig/FIG0.h @@ -428,9 +428,10 @@ struct FIGtype0_9 { } PACKED; -struct FIGtype0_10 { +struct FIGtype0_10_LongForm { uint8_t Length:5; uint8_t FIGtypeNumber:3; + uint8_t Extension:5; uint8_t PD:1; uint8_t OE:1; @@ -438,14 +439,23 @@ struct FIGtype0_10 { uint8_t MJD_high:7; uint8_t RFU:1; + uint8_t MJD_med; + uint8_t Hours_high:3; uint8_t UTC:1; uint8_t ConfInd:1; uint8_t LSI:1; uint8_t MJD_low:2; + uint8_t Minutes:6; uint8_t Hours_low:2; + + uint8_t Milliseconds_high:2; + uint8_t Seconds:6; + + uint8_t Milliseconds_low; + void setMJD(uint32_t date) { MJD_high = (date >> 10) & 0x7f; MJD_med = (date >> 2) & 0xff; @@ -455,6 +465,11 @@ struct FIGtype0_10 { Hours_high = (hours >> 2) & 0x07; Hours_low = hours & 0x03; } + + void setMilliseconds(uint16_t ms) { + Milliseconds_high = (ms >> 8) & 0x03; + Milliseconds_low = ms & 0xFF; + } } PACKED; diff --git a/src/fig/FIGCarousel.cpp b/src/fig/FIGCarousel.cpp index 8c7558a..20b3412 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) 2015 + Copyright (C) 2016 Matthias P. Braendli, matthias.braendli@mpb.li Implementation of the FIG carousel to schedule the FIGs into the @@ -116,10 +116,9 @@ void FIGCarousel::load_and_allocate(IFIG& fig, FIBAllocation fib) allocate_fig_to_fib(type, extension, fib); } -void FIGCarousel::update(unsigned long currentFrame, time_t dabTime) +void FIGCarousel::update(unsigned long currentFrame) { m_rti.currentFrame = currentFrame; - m_rti.date = dabTime; } void FIGCarousel::allocate_fig_to_fib(int figtype, int extension, FIBAllocation fib) diff --git a/src/fig/FIGCarousel.h b/src/fig/FIGCarousel.h index 738a302..583ac39 100644 --- a/src/fig/FIGCarousel.h +++ b/src/fig/FIGCarousel.h @@ -60,7 +60,7 @@ class FIGCarousel { public: FIGCarousel(std::shared_ptr<dabEnsemble> ensemble); - void update(unsigned long currentFrame, time_t dabTime); + void update(unsigned long currentFrame); void allocate_fig_to_fib(int figtype, int extension, FIBAllocation fib); |