summaryrefslogtreecommitdiffstats
path: root/src/MuxElements.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-11 09:51:16 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-11 09:51:16 +0200
commit3e53747724c6e01bd0be17aaa9461c884fb821e7 (patch)
tree9c67b63bfa5ed992aaac6f086aeab7dc95b510c2 /src/MuxElements.cpp
parent7832faf05ccf5253ef27e560a8ac823446b95efc (diff)
downloaddabmux-3e53747724c6e01bd0be17aaa9461c884fb821e7.tar.gz
dabmux-3e53747724c6e01bd0be17aaa9461c884fb821e7.tar.bz2
dabmux-3e53747724c6e01bd0be17aaa9461c884fb821e7.zip
Add local-time-offset to remote control
Diffstat (limited to 'src/MuxElements.cpp')
-rw-r--r--src/MuxElements.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index 11eb4bf..03e9bbf 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -383,6 +383,47 @@ const string DabService::get_parameter(const string& parameter) const
}
+void dabEnsemble::set_parameter(const string& parameter, const string& value)
+{
+ stringstream ss(value);
+ ss.exceptions ( stringstream::failbit | stringstream::badbit );
+
+ if (parameter == "localtimeoffset") {
+ int new_lto = atol(value.c_str());
+
+ if (new_lto < -24) {
+ throw ParameterError("Desired local time offset too small."
+ " Minimum -24" );
+ }
+ else if (new_lto > 24) {
+ throw ParameterError("Desired local time offset too large."
+ " Maximum 24" );
+ }
+
+ this->lto = new_lto;
+ }
+ else {
+ stringstream ss;
+ ss << "Parameter '" << parameter <<
+ "' is not exported by controllable " << get_rc_name();
+ throw ParameterError(ss.str());
+ }
+}
+
+const string dabEnsemble::get_parameter(const string& parameter) const
+{
+ stringstream ss;
+ if (parameter == "localtimeoffset") {
+ ss << this->lto;
+ }
+ else {
+ ss << "Parameter '" << parameter <<
+ "' is not exported by controllable " << get_rc_name();
+ throw ParameterError(ss.str());
+ }
+ return ss.str();
+}
+
unsigned short getSizeCu(dabSubchannel* subchannel)
{
if (subchannel->protection.form == 0) {