summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJörgen Scott <jorgen.scott@gmail.com>2014-12-22 08:32:15 +0100
committerJörgen Scott <jorgen.scott@gmail.com>2014-12-22 08:32:15 +0100
commit593c130b1e6848a08b30a84732ebd6862ef2e3b7 (patch)
tree2d9353a6603eef708c0ef239c00ec6e9b1f5fa08 /src
parent7e3e3f290e9fbbd314919474ed7bc61c3ce43041 (diff)
downloaddabmod-593c130b1e6848a08b30a84732ebd6862ef2e3b7.tar.gz
dabmod-593c130b1e6848a08b30a84732ebd6862ef2e3b7.tar.bz2
dabmod-593c130b1e6848a08b30a84732ebd6862ef2e3b7.zip
changed zmq api
Diffstat (limited to 'src')
-rw-r--r--src/OutputUHD.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index 6a4ccf4..e3d2d77 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -727,12 +727,12 @@ void OutputUHD::ZmqCtrl()
try
{
// connect the socket
- int hwm = 5;
+ int hwm = 100;
int linger = 0;
repSocket.setsockopt(ZMQ_RCVHWM, &hwm, sizeof(hwm));
repSocket.setsockopt(ZMQ_SNDHWM, &hwm, sizeof(hwm));
repSocket.setsockopt(ZMQ_LINGER, &linger, sizeof(linger));
- repSocket.connect(m_zmqCtrlEndpoint.c_str());
+ repSocket.bind(m_zmqCtrlEndpoint.c_str());
// create pollitem that polls the ZMQ sockets
zmq::pollitem_t pollItems[] = { {repSocket, 0, ZMQ_POLLIN, 0} };
@@ -746,24 +746,34 @@ void OutputUHD::ZmqCtrl()
std::string module((char*)msg[0].data(), msg[0].size());
if (module == "uhd")
{
- if (msg.size() != 3)
+ if (msg.size() < 2)
{
SendFailReply(&repSocket, "Wrong request format");
continue;
}
-
+
std::string param((char*) msg[1].data(), msg[1].size());
- std::string value((char*) msg[2].data(), msg[2].size());
- try
+ if (msg.size() == 2 && param == "ping")
{
- set_parameter(param, value);
+ SendOkReply(&repSocket);
}
- catch (ParameterError &err)
+ else if (msg.size() != 3)
{
- SendFailReply(&repSocket, err.what());
- continue;
+ SendFailReply(&repSocket, "Wrong request format");
+ }
+ else
+ {
+ std::string value((char*) msg[2].data(), msg[2].size());
+ try
+ {
+ set_parameter(param, value);
+ SendOkReply(&repSocket);
+ }
+ catch (ParameterError &err)
+ {
+ SendFailReply(&repSocket, err.what());
+ }
}
- SendOkReply(&repSocket);
}
}