aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-22 10:08:07 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-22 10:08:07 +0100
commitbedf7e60522bb34b19f4a28b8866aea7062c9054 (patch)
tree1ea63e33b03b314bd00148a5bf992f9a16139431 /src
parent9c72ead2dadad8982f345e4f5c1d8206668ebc61 (diff)
downloaddabmod-bedf7e60522bb34b19f4a28b8866aea7062c9054.tar.gz
dabmod-bedf7e60522bb34b19f4a28b8866aea7062c9054.tar.bz2
dabmod-bedf7e60522bb34b19f4a28b8866aea7062c9054.zip
Add modulator rate (r/o) to RC
Diffstat (limited to 'src')
-rw-r--r--src/DabMod.cpp4
-rw-r--r--src/DabModulator.cpp34
-rw-r--r--src/DabModulator.h21
3 files changed, 49 insertions, 10 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index c53b7c9..57acd40 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2018
+ Copyright (C) 2019
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -315,6 +315,7 @@ int launch_modulator(int argc, char* argv[])
Flowgraph flowgraph;
auto modulator = make_shared<DabModulator>(ediReader, mod_settings);
+ rcs.enrol(modulator.get());
if (format_converter) {
flowgraph.connect(modulator, format_converter);
@@ -420,6 +421,7 @@ int launch_modulator(int argc, char* argv[])
auto input = make_shared<InputMemory>(&m.data);
auto modulator = make_shared<DabModulator>(etiReader, mod_settings);
+ rcs.enrol(modulator.get());
if (format_converter) {
flowgraph.connect(modulator, format_converter);
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp
index ca958e3..666745d 100644
--- a/src/DabModulator.cpp
+++ b/src/DabModulator.cpp
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2018
+ Copyright (C) 2019
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -58,15 +58,20 @@
#include "RemoteControl.h"
#include "Log.h"
+using namespace std;
+
DabModulator::DabModulator(EtiSource& etiSource,
mod_settings_t& settings) :
ModInput(),
+ RemoteControllable("modulator"),
m_settings(settings),
myEtiSource(etiSource),
myFlowgraph()
{
PDEBUG("DabModulator::DabModulator() @ %p\n", this);
+ RC_ADD_PARAMETER(rate, "(Read-only) IQ output samplerate");
+
if (m_settings.dabMode == 0) {
setMode(2);
}
@@ -385,3 +390,30 @@ meta_vec_t DabModulator::process_metadata(const meta_vec_t& metadataIn)
return {};
}
+
+void DabModulator::set_parameter(const string& parameter, const string& value)
+{
+ if (parameter == "rate") {
+ throw ParameterError("Parameter 'rate' is read-only");
+ }
+ else {
+ stringstream ss;
+ ss << "Parameter '" << parameter <<
+ "' is not exported by controllable " << get_rc_name();
+ throw ParameterError(ss.str());
+ }
+}
+
+const string DabModulator::get_parameter(const string& parameter) const
+{
+ stringstream ss;
+ if (parameter == "rate") {
+ ss << m_settings.outputRate;
+ }
+ else {
+ ss << "Parameter '" << parameter <<
+ "' is not exported by controllable " << get_rc_name();
+ throw ParameterError(ss.str());
+ }
+ return ss.str();
+}
diff --git a/src/DabModulator.h b/src/DabModulator.h
index 355eeb3..00d71f5 100644
--- a/src/DabModulator.h
+++ b/src/DabModulator.h
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2018
+ Copyright (C) 2019
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -46,21 +46,26 @@
#include "TII.h"
-class DabModulator : public ModInput, public ModMetadata
+class DabModulator : public ModInput, public ModMetadata, public RemoteControllable
{
public:
- DabModulator(EtiSource& etiSource,
- mod_settings_t& settings);
+ DabModulator(EtiSource& etiSource, mod_settings_t& settings);
- int process(Buffer* dataOut);
- const char* name() { return "DabModulator"; }
+ int process(Buffer* dataOut) override;
+ const char* name() override { return "DabModulator"; }
- virtual meta_vec_t process_metadata(
- const meta_vec_t& metadataIn);
+ virtual meta_vec_t process_metadata(const meta_vec_t& metadataIn) override;
/* Required to get the timestamp */
EtiSource* getEtiSource() { return &myEtiSource; }
+ /******* REMOTE CONTROL ********/
+ virtual void set_parameter(const std::string& parameter,
+ const std::string& value) override;
+
+ virtual const std::string get_parameter(
+ const std::string& parameter) const override;
+
protected:
void setMode(unsigned mode);