diff options
-rw-r--r-- | src/fig/FIG0.cpp | 69 | ||||
-rw-r--r-- | src/fig/FIG0.h | 28 | ||||
-rw-r--r-- | src/fig/FIG0structs.h | 19 |
3 files changed, 116 insertions, 0 deletions
diff --git a/src/fig/FIG0.cpp b/src/fig/FIG0.cpp index bb08fac..b560e4c 100644 --- a/src/fig/FIG0.cpp +++ b/src/fig/FIG0.cpp @@ -662,6 +662,75 @@ FillStatus FIG0_5::fill(uint8_t *buf, size_t max_size) return fs; } +//=========== FIG 0/6 =========== + +FIG0_6::FIG0_6(FIGRuntimeInformation *rti) : + m_rti(rti), + m_initialised(false) +{ +} + +FillStatus FIG0_6::fill(uint8_t *buf, size_t max_size) +{ + FillStatus fs; + ssize_t remaining = max_size; + auto ensemble = m_rti->ensemble; + + if (not m_initialised) { + linkageSetFIG0_6 = m_rti->ensemble->linkagesets.end(); + m_initialised = true; + } + + FIGtype0* fig0 = NULL; + + for (; linkageSetFIG0_6 != ensemble->linkagesets.end(); + ++linkageSetFIG0_6) { + + const int required_size = 2; + + if (fig0 == NULL) { + if (remaining < 2 + required_size) { + break; + } + fig0 = (FIGtype0*)buf; + fig0->FIGtypeNumber = 0; + fig0->Length = 1; + fig0->CN = 0; + fig0->OE = 0; + fig0->PD = 0; + fig0->Extension = 5; + + buf += 2; + remaining -= 2; + } + else if (remaining < required_size) { + break; + } + + FIGtype0_6 *fig0_6 = (FIGtype0_6*)buf; + + fig0_6->IdListFlag = 1; + fig0_6->LA = (*linkageSetFIG0_6)->active; + fig0_6->SH = (*linkageSetFIG0_6)->hard; + fig0_6->ILS = (*linkageSetFIG0_6)->international; + fig0_6->LSN = (*linkageSetFIG0_6)->lsn; + +#error "handle FIG insertion and CEI properly" + + fig0->Length += 2; + buf += 2; + remaining -= 2; + } + + if (linkageSetFIG0_6 == ensemble->linkagesets.end()) { + linkageSetFIG0_6 = ensemble->linkagesets.begin(); + fs.complete_fig_transmitted = true; + } + + fs.num_bytes_written = max_size - remaining; + return fs; +} + //=========== FIG 0/8 =========== FIG0_8::FIG0_8(FIGRuntimeInformation *rti) : diff --git a/src/fig/FIG0.h b/src/fig/FIG0.h index 25aea15..5a8a69f 100644 --- a/src/fig/FIG0.h +++ b/src/fig/FIG0.h @@ -28,6 +28,7 @@ #include <cstdint> #include <map> #include <set> +#include <vector> #include "fig/FIG.h" @@ -135,6 +136,33 @@ class FIG0_5 : public IFIG std::vector<DabComponent*>::iterator componentFIG0_5; }; +// FIG type 0/6 +// Service Linking +// +// This feature shall use the SIV signalling (see clause 5.2.2.1). The database +// shall be divided by use of a database key. Changes to the database shall be +// signalled using the CEI. The first service in the list of services in each +// part of the database, as divided by the database key, shall be a service +// carried in the ensemble. This service is called the key service. +// +// The database key comprises the OE and P/D flags and the S/H, ILS, and LSN +// fields. +class FIG0_6 : public IFIG +{ + public: + FIG0_6(FIGRuntimeInformation* rti); + virtual FillStatus fill(uint8_t *buf, size_t max_size); + virtual FIG_rate repetition_rate(void) { return FIG_rate::E; } + + virtual const int figtype(void) const { return 0; } + virtual const int figextension(void) const { return 6; } + + private: + FIGRuntimeInformation *m_rti; + bool m_initialised; + std::list<std::shared_ptr<LinkageSet> >::iterator linkageSetFIG0_6; +}; + // FIG type 0/8 // The Extension 8 of FIG type 0 (FIG 0/8) provides information to link // together the service component description that is valid within the ensemble diff --git a/src/fig/FIG0structs.h b/src/fig/FIG0structs.h index a1e79d3..4b9b7e0 100644 --- a/src/fig/FIG0structs.h +++ b/src/fig/FIG0structs.h @@ -152,6 +152,25 @@ struct FIGtype0_5_short { uint8_t language; } PACKED; +struct FIGtype0_6 { + uint16_t IdListFlag:1; + uint16_t LA:1; // Linkage actuator + uint16_t SH:1; // 0=Soft link / 1=Hard link + uint16_t ILS:1; // 0=national / 1=international + uint16_t LSN:12; // Linkage Set Number +} PACKED; + +#define FIG0_6_IDLQ_DAB 0x0 +#define FIG0_6_IDLQ_RDS 0x1 +#define FIG0_6_IDLQ_DRM_AMSS 0x3 + +struct FIGtype0_6_header { + uint8_t rfu:1; // must be 0 + uint8_t IdLQ:2; // Identifier List Qualifier, see above defines + uint8_t rfa:1; // must be 0 + uint8_t num_ids:4; // number of Ids to follow in the list +} PACKED; + struct FIGtype0_8_short { uint8_t SCIdS:4; uint8_t rfa_1:3; |