From 5d1b6420535c72d7a8df85a5db08ff1c0230690a Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 28 Jul 2017 16:11:32 +0200 Subject: Add work in progress odr-zmq2edi --- src/dabOutput/edi/TagItems.cpp | 6 +++--- src/dabOutput/edi/TagItems.h | 2 +- src/dabOutput/metadata.cpp | 16 ++++++++++++++++ src/dabOutput/metadata.h | 24 ++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) (limited to 'src/dabOutput') diff --git a/src/dabOutput/edi/TagItems.cpp b/src/dabOutput/edi/TagItems.cpp index 75a4ecf..ed8517d 100644 --- a/src/dabOutput/edi/TagItems.cpp +++ b/src/dabOutput/edi/TagItems.cpp @@ -72,8 +72,8 @@ std::vector TagDETI::Assemble() packet.push_back(0); packet.push_back(0); - uint8_t fct = dflc % 250; - uint8_t fcth = dflc / 250; + uint8_t fct = dlfc % 250; + uint8_t fcth = dlfc / 250; uint16_t detiHeader = fct | (fcth << 8) | (rfudf << 13) | (ficf << 14) | (atstf << 15); @@ -122,7 +122,7 @@ std::vector TagDETI::Assemble() packet[6] = (taglength >> 8) & 0xFF; packet[7] = taglength & 0xFF; - dflc = (dflc+1) % 5000; + dlfc = (dlfc+1) % 5000; /* std::cerr << "TagItem deti, packet.size " << packet.size() << std::endl; diff --git a/src/dabOutput/edi/TagItems.h b/src/dabOutput/edi/TagItems.h index 856d25b..19284d2 100644 --- a/src/dabOutput/edi/TagItems.h +++ b/src/dabOutput/edi/TagItems.h @@ -64,7 +64,7 @@ class TagDETI : public TagItem uint8_t rfa = 0; uint8_t rfu = 0; // MNSC is valid uint16_t mnsc = 0; - uint16_t dflc = 0; // modulo 5000 frame counter + uint16_t dlfc = 0; // modulo 5000 frame counter // ATST (optional) bool atstf = false; // presence of atst data diff --git a/src/dabOutput/metadata.cpp b/src/dabOutput/metadata.cpp index 6dfd65c..cb355cc 100644 --- a/src/dabOutput/metadata.cpp +++ b/src/dabOutput/metadata.cpp @@ -59,6 +59,16 @@ size_t write_meta(output_metadata_id_e md, uint8_t *buf, T value) return 3 + len_value; } +size_t OutputMetadataSeparation::write(uint8_t *buf) +{ + buf[0] = static_cast(getId()); + + // Length 0 + buf[1] = 0; + buf[2] = 0; + return 3; +} + size_t OutputMetadataUTCO::write(uint8_t *buf) { return write_meta(getId(), buf, utco); @@ -68,3 +78,9 @@ size_t OutputMetadataEDITime::write(uint8_t *buf) { return write_meta(getId(), buf, seconds); } + +size_t OutputMetadataDLFC::write(uint8_t *buf) +{ + return write_meta(getId(), buf, dlfc); +} + diff --git a/src/dabOutput/metadata.h b/src/dabOutput/metadata.h index e250938..ed16de5 100644 --- a/src/dabOutput/metadata.h +++ b/src/dabOutput/metadata.h @@ -39,12 +39,18 @@ */ enum class output_metadata_id_e { + // Contains no value, can be used to group fields + separation_marker = 0, + // TAI-UTC offset, value is int16_t. utc_offset = 1, /* EDI Time is the number of SI seconds since 2000-01-01 T 00:00:00 UTC. * value is an uint32_t */ edi_time = 2, + + /* The DLFC field from the EDI TAG deti. value is uint16_t */ + dlfc = 3, }; struct OutputMetadata { @@ -58,6 +64,14 @@ struct OutputMetadata { virtual size_t write(uint8_t *buf) = 0; }; +struct OutputMetadataSeparation : public OutputMetadata { + explicit OutputMetadataSeparation() {} + output_metadata_id_e getId(void) const { return output_metadata_id_e::separation_marker; } + virtual size_t getLength(void) const { return 3; } + virtual size_t write(uint8_t *buf); +}; + + struct OutputMetadataUTCO : public OutputMetadata { explicit OutputMetadataUTCO(int16_t utco) : utco(utco) {} output_metadata_id_e getId(void) const { return output_metadata_id_e::utc_offset; } @@ -77,3 +91,13 @@ struct OutputMetadataEDITime : public OutputMetadata { }; +struct OutputMetadataDLFC : public OutputMetadata { + explicit OutputMetadataDLFC(uint16_t dlfc) : dlfc(dlfc) {} + output_metadata_id_e getId(void) const { return output_metadata_id_e::dlfc; } + virtual size_t getLength(void) const { return 5; } + virtual size_t write(uint8_t *buf); + + uint16_t dlfc; + +}; + -- cgit v1.2.3