diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-01-17 09:48:56 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-01-17 09:50:50 +0100 |
commit | 0b7d58968b37dc9d36a90d3fb439891a57b81a18 (patch) | |
tree | 22c3c5106b49d5364f7f926a440fee894889e545 /src/MuxElements.cpp | |
parent | c2e1b31a7c5a948b6155bc9fcaee4defbf4504bd (diff) | |
download | dabmux-0b7d58968b37dc9d36a90d3fb439891a57b81a18.tar.gz dabmux-0b7d58968b37dc9d36a90d3fb439891a57b81a18.tar.bz2 dabmux-0b7d58968b37dc9d36a90d3fb439891a57b81a18.zip |
Update ClockTAI and RemoteControl
Diffstat (limited to 'src/MuxElements.cpp')
-rw-r--r-- | src/MuxElements.cpp | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 215a56d..d17b283 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -3,7 +3,7 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2020 + Copyright (C) 2024 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -180,6 +180,34 @@ const string AnnouncementCluster::get_parameter(const string& parameter) const return ss.str(); } +const json::map_t AnnouncementCluster::get_all_values() const +{ + json::map_t map; + + lock_guard<mutex> lock(m_active_mutex); + map["active"].v = m_active; + + using namespace std::chrono; + + if (m_deferred_start_time) { + const auto diff = *m_deferred_start_time - steady_clock::now(); + map["start_in"].v = duration_cast<milliseconds>(diff).count(); + } + else { + map["start_in"].v = nullopt; + } + + if (m_deferred_stop_time) { + const auto diff = *m_deferred_stop_time - steady_clock::now(); + map["stop_in"].v = duration_cast<milliseconds>(diff).count(); + } + else { + map["stop_in"].v = nullopt; + } + + return map; +} + int DabLabel::setLabel(const std::string& label) { @@ -512,6 +540,16 @@ const string DabComponent::get_parameter(const string& parameter) const } +const json::map_t DabComponent::get_all_values() const +{ + json::map_t map; + // It's cleaner to have it separate in JSON, but we + // need the comma separated variant for setting + map["label"].v = label.long_label(); + map["shortlabel"].v = label.short_label(); + return map; +} + subchannel_type_t DabService::getType( const std::shared_ptr<dabEnsemble> ensemble) const { @@ -638,6 +676,16 @@ const string DabService::get_parameter(const string& parameter) const return ss.str(); } +const json::map_t DabService::get_all_values() const +{ + json::map_t map; + map["label"].v = label.long_label(); + map["shortlabel"].v = label.short_label(); + map["pty"].v = (int)pty_settings.pty; + map["ptysd"].v = (pty_settings.dynamic_no_static ? "dynamic" : "static"); + return map; +} + void dabEnsemble::set_parameter(const string& parameter, const string& value) { if (parameter == "localtimeoffset") { @@ -687,6 +735,14 @@ const string dabEnsemble::get_parameter(const string& parameter) const return ss.str(); } +const json::map_t dabEnsemble::get_all_values() const +{ + json::map_t map; + map["localtimeoffset_auto"].v = lto_auto; + map["localtimeoffset"].v = lto; + return map; +} + bool dabEnsemble::validate_linkage_sets() { for (const auto& ls : linkagesets) { |