summaryrefslogtreecommitdiffstats
path: root/src/MuxElements.cpp
diff options
context:
space:
mode:
authorKuntzeM <github@kuntze.email>2020-03-15 13:46:08 +0100
committerKuntzeM <github@kuntze.email>2020-03-15 13:46:08 +0100
commitfc1f1640278e7eb228ec1a6290d30b95f1b6a476 (patch)
tree85359cd0d8cb7e27d20df260a645c8bc38e758db /src/MuxElements.cpp
parent5340215304193f18af3bc76c7ae7a6a79f008339 (diff)
downloaddabmux-fc1f1640278e7eb228ec1a6290d30b95f1b6a476.tar.gz
dabmux-fc1f1640278e7eb228ec1a6290d30b95f1b6a476.tar.bz2
dabmux-fc1f1640278e7eb228ec1a6290d30b95f1b6a476.zip
add linkage set activator flag to remote controllable
Diffstat (limited to 'src/MuxElements.cpp')
-rw-r--r--src/MuxElements.cpp49
1 files changed, 37 insertions, 12 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index cb2d545..70930cb 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -805,22 +805,11 @@ 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_name, lsn, active, hard, international);
+ LinkageSet lsd(m_rc_name, lsn, active, hard, international);
lsd.active = active;
lsd.keyservice = keyservice;
@@ -833,3 +822,39 @@ 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<mutex> 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<mutex> 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();
+}