From fc1f1640278e7eb228ec1a6290d30b95f1b6a476 Mon Sep 17 00:00:00 2001 From: KuntzeM Date: Sun, 15 Mar 2020 13:46:08 +0100 Subject: add linkage set activator flag to remote controllable --- src/MuxElements.h | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/MuxElements.h') diff --git a/src/MuxElements.h b/src/MuxElements.h index 98de70e..55bddaf 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -542,15 +542,32 @@ struct ServiceLink { * TS 103 176 Clause 5.2.3 "Linkage sets". This information will * be encoded in FIG 0/6. */ -class LinkageSet { +class LinkageSet : public RemoteControllable { public: LinkageSet(const std::string& name, uint16_t lsn, bool active, bool hard, - bool international); + bool international) : + RemoteControllable(name), + lsn(lsn), + active(active), + hard(hard), + international(international) + { + RC_ADD_PARAMETER(active, "Signal this linkage set active [0 or 1]"); + } + + LinkageSet(const LinkageSet& other) : + LinkageSet(other.m_rc_name, + other.lsn, + other.active, + other.hard, + other.international) + { + } - std::string get_name(void) const { return m_name; } + std::string get_name(void) const { return m_rc_name; } std::list id_list; @@ -566,13 +583,22 @@ class LinkageSet { std::string keyservice; // TODO replace by pointer to service + //LinkageSet& operator=(const LinkageSet& other) = default; + /* Return a LinkageSet with id_list filtered to include * only those links of a given type */ LinkageSet filter_type(const ServiceLinkType type); + /* Remote control */ + virtual void set_parameter(const std::string& parameter, + const std::string& value); + + /* Getting a parameter always returns a string. */ + virtual const std::string get_parameter(const std::string& parameter) const; + private: - std::string m_name; + mutable std::mutex m_active_mutex; }; // FIG 0/21 -- cgit v1.2.3 From f97de5d4b6b6d77dfbe7e50432a8b3057e9361f8 Mon Sep 17 00:00:00 2001 From: KuntzeM Date: Tue, 17 Mar 2020 16:37:42 +0100 Subject: change FIG 0/0 alarm flag if an alarm cluster available in mux --- src/ConfigParser.cpp | 5 +++++ src/MuxElements.h | 4 ++++ src/fig/FIG0_0.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/MuxElements.h') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index dd0041e..538cb76 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -509,6 +509,11 @@ static void parse_general(ptree& pt, throw runtime_error("Announcement cluster id " + to_string(cl->cluster_id) + " is not allowed"); } + if (cl->cluster_id == 255) { + etiLog.level(debug) << + "Alarm flag for FIG 0/0 is set 1, because announcement group with cluster id oxFF is found."; + ensemble->alarm_flag = 1; + } cl->flags = get_announcement_flag_from_ptree( pt_announcement.get_child("flags")); cl->subchanneluid = pt_announcement.get("subchannel"); diff --git a/src/MuxElements.h b/src/MuxElements.h index 55bddaf..3640e6c 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -337,6 +337,10 @@ class dabEnsemble : public RemoteControllable { static constexpr int RECONFIG_COUNTER_HASH = -2; int reconfig_counter = RECONFIG_COUNTER_DISABLED; + // alarm flag is use for AL flag in FIG 0/0. + // set to true if one announcement group with cluster ID 0xFF is available in multiplex file + bool alarm_flag = 0; + vec_sp_service services; vec_sp_component components; vec_sp_subchannel subchannels; diff --git a/src/fig/FIG0_0.cpp b/src/fig/FIG0_0.cpp index 9a99984..a793b98 100644 --- a/src/fig/FIG0_0.cpp +++ b/src/fig/FIG0_0.cpp @@ -67,7 +67,7 @@ FillStatus FIG0_0::fill(uint8_t *buf, size_t max_size) fig0_0->EId = htons(m_rti->ensemble->id); fig0_0->Change = 0; - fig0_0->Al = 0; + fig0_0->Al = m_rti->ensemble->alarm_flag; fig0_0->CIFcnt_hight = (m_rti->currentFrame / 250) % 20; fig0_0->CIFcnt_low = (m_rti->currentFrame % 250); -- cgit v1.2.3 From ac074ac552a6e9b0698cadfdb5174787800ecd4c Mon Sep 17 00:00:00 2001 From: KuntzeM Date: Sat, 28 Mar 2020 17:51:19 +0100 Subject: Revert "add linkage set activator flag to remote controllable" This reverts commit fc1f1640278e7eb228ec1a6290d30b95f1b6a476. --- src/ConfigParser.cpp | 1 - src/MuxElements.cpp | 49 ++++++++++++------------------------------------- src/MuxElements.h | 34 ++++------------------------------ 3 files changed, 16 insertions(+), 68 deletions(-) (limited to 'src/MuxElements.h') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 538cb76..30140bf 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -193,7 +193,6 @@ static void parse_linkage(ptree& pt, linkageset->id_list.push_back(link); } } - rcs.enrol(linkageset.get()); ensemble->linkagesets.push_back(linkageset); } } diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 70930cb..cb2d545 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -805,11 +805,22 @@ size_t DabSubchannel::readFrame(uint8_t *buffer, size_t size, std::time_t second throw logic_error("Unhandled case"); } +LinkageSet::LinkageSet(const std::string& name, + uint16_t lsn, + bool active, + bool hard, + bool international) : + lsn(lsn), + active(active), + hard(hard), + international(international), + m_name(name) +{} LinkageSet LinkageSet::filter_type(const ServiceLinkType type) { - LinkageSet lsd(m_rc_name, lsn, active, hard, international); + LinkageSet lsd(m_name, lsn, active, hard, international); lsd.active = active; lsd.keyservice = keyservice; @@ -822,39 +833,3 @@ LinkageSet LinkageSet::filter_type(const ServiceLinkType type) return lsd; } - - -void LinkageSet::set_parameter(const string& parameter, - const string& value) -{ - if (parameter == "active") { - stringstream ss; - ss << value; - - lock_guard lock(m_active_mutex); - ss >> active; - } - else { - stringstream ss; - ss << "Parameter '" << parameter << - "' is not exported by controllable " << get_rc_name(); - throw ParameterError(ss.str()); - } -} - -const string LinkageSet::get_parameter(const string& parameter) const -{ - using namespace std::chrono; - - stringstream ss; - if (parameter == "active") { - lock_guard lock(m_active_mutex); - ss << active; - } - else { - ss << "Parameter '" << parameter << - "' is not exported by controllable " << get_rc_name(); - throw ParameterError(ss.str()); - } - return ss.str(); -} diff --git a/src/MuxElements.h b/src/MuxElements.h index 3640e6c..77d417b 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -546,32 +546,15 @@ struct ServiceLink { * TS 103 176 Clause 5.2.3 "Linkage sets". This information will * be encoded in FIG 0/6. */ -class LinkageSet : public RemoteControllable { +class LinkageSet { public: LinkageSet(const std::string& name, uint16_t lsn, bool active, bool hard, - bool international) : - RemoteControllable(name), - lsn(lsn), - active(active), - hard(hard), - international(international) - { - RC_ADD_PARAMETER(active, "Signal this linkage set active [0 or 1]"); - } - - LinkageSet(const LinkageSet& other) : - LinkageSet(other.m_rc_name, - other.lsn, - other.active, - other.hard, - other.international) - { - } + bool international); - std::string get_name(void) const { return m_rc_name; } + std::string get_name(void) const { return m_name; } std::list id_list; @@ -587,22 +570,13 @@ class LinkageSet : public RemoteControllable { std::string keyservice; // TODO replace by pointer to service - //LinkageSet& operator=(const LinkageSet& other) = default; - /* Return a LinkageSet with id_list filtered to include * only those links of a given type */ LinkageSet filter_type(const ServiceLinkType type); - /* Remote control */ - virtual void set_parameter(const std::string& parameter, - const std::string& value); - - /* Getting a parameter always returns a string. */ - virtual const std::string get_parameter(const std::string& parameter) const; - private: - mutable std::mutex m_active_mutex; + std::string m_name; }; // FIG 0/21 -- cgit v1.2.3