summaryrefslogtreecommitdiffstats
path: root/src/DabMod.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-10 11:58:37 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-10 11:58:37 +0200
commit5c3d2648abaedc18e36f2ba99bd70aec0df3b1be (patch)
treea9da05140e527f8ef7d1647e6b9a0e7d215057d4 /src/DabMod.cpp
parentc126ec3bfc44ab62017e7a75a1a1f49855f46f9a (diff)
downloaddabmod-5c3d2648abaedc18e36f2ba99bd70aec0df3b1be.tar.gz
dabmod-5c3d2648abaedc18e36f2ba99bd70aec0df3b1be.tar.bz2
dabmod-5c3d2648abaedc18e36f2ba99bd70aec0df3b1be.zip
ZMQ output: Add REP socket type
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r--src/DabMod.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 75e76e0..304d252 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -47,6 +47,7 @@
#include "RemoteControl.h"
#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <complex>
@@ -119,6 +120,7 @@ int main(int argc, char* argv[])
std::string outputName;
int useZeroMQOutput = 0;
+ std::string zmqOutputSocketType = "";
int useFileOutput = 0;
std::string fileOutputFormat = "complexf";
int useUHDOutput = 0;
@@ -563,6 +565,7 @@ int main(int argc, char* argv[])
#if defined(HAVE_ZEROMQ)
else if (output_selected == "zmq") {
outputName = pt.get<std::string>("zmqoutput.listen");
+ zmqOutputSocketType = pt.get<std::string>("zmqoutput.socket_type");
useZeroMQOutput = 1;
}
#endif
@@ -676,8 +679,10 @@ int main(int argc, char* argv[])
#endif
else if (useZeroMQOutput) {
fprintf(stderr, " ZeroMQ\n"
- " Listening on: %s\n",
- outputName.c_str());
+ " Listening on: %s\n"
+ " Socket type : %s\n",
+ outputName.c_str(),
+ zmqOutputSocketType.c_str());
}
fprintf(stderr, " Sampling rate: ");
@@ -744,7 +749,17 @@ int main(int argc, char* argv[])
else if (useZeroMQOutput) {
/* We normalise the same way as for the UHD output */
normalise = 1.0f / normalise_factor;
- output = shared_ptr<OutputZeroMQ>(new OutputZeroMQ(outputName));
+ if (zmqOutputSocketType == "pub") {
+ output = make_shared<OutputZeroMQ>(outputName, ZMQ_PUB);
+ }
+ else if (zmqOutputSocketType == "rep") {
+ output = make_shared<OutputZeroMQ>(outputName, ZMQ_REP);
+ }
+ else {
+ std::stringstream ss;
+ ss << "ZeroMQ output socket type " << zmqOutputSocketType << " invalid";
+ throw std::invalid_argument(ss.str());
+ }
}
#endif