diff options
Diffstat (limited to 'src/MuxElements.cpp')
-rw-r--r-- | src/MuxElements.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index db59078..2215bda 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -662,4 +662,60 @@ unsigned short DabSubchannel::getSizeDWord() const return (bitrate * 3) >> 3; } +LinkageSet::LinkageSet(string name, uint16_t lsn, bool hard, bool international) : + RemoteControllable(name) +{ + data.lsn = lsn; + data.active = false; + data.hard = hard; + data.international = international; + RC_ADD_PARAMETER(active, "Activate this linkage set [0 or 1]"); +} + +void LinkageSet::set_parameter(const string& parameter, const string& value) +{ + if (parameter == "active") { + stringstream ss; + ss << value; + ss >> data.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 +{ + stringstream ss; + if (parameter == "active") { + ss << data.active; + } + else { + ss << "Parameter '" << parameter << + "' is not exported by controllable " << get_rc_name(); + throw ParameterError(ss.str()); + } + return ss.str(); +} + +LinkageSetData LinkageSetData::filter_type(ServiceLinkType type) +{ + LinkageSetData lsd; + + lsd.lsn = lsn; + lsd.active = active; + lsd.hard = hard; + lsd.international = international; + lsd.keyservice = keyservice; + for (const auto& link : id_list) { + if (link.type == type) { + lsd.id_list.push_back(link); + } + } + + return lsd; +} |