summaryrefslogtreecommitdiff
path: root/gr-zeromq/examples
diff options
context:
space:
mode:
Diffstat (limited to 'gr-zeromq/examples')
-rw-r--r--gr-zeromq/examples/CMakeLists.txt9
-rw-r--r--gr-zeromq/examples/python/README71
-rwxr-xr-xgr-zeromq/examples/python/client.py (renamed from gr-zeromq/examples/client.py)0
-rwxr-xr-xgr-zeromq/examples/python/fixui4py.sh (renamed from gr-zeromq/examples/fixui4py.sh)0
-rwxr-xr-xgr-zeromq/examples/python/gui.py (renamed from gr-zeromq/examples/gui.py)0
-rw-r--r--gr-zeromq/examples/python/main_window.ui (renamed from gr-zeromq/examples/main_window.ui)0
-rwxr-xr-xgr-zeromq/examples/python/run_app.sh (renamed from gr-zeromq/examples/run_app.sh)0
-rwxr-xr-xgr-zeromq/examples/python/server.py (renamed from gr-zeromq/examples/server.py)0
8 files changed, 76 insertions, 4 deletions
diff --git a/gr-zeromq/examples/CMakeLists.txt b/gr-zeromq/examples/CMakeLists.txt
index c837d77f67..926ed90f09 100644
--- a/gr-zeromq/examples/CMakeLists.txt
+++ b/gr-zeromq/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -19,7 +19,8 @@
include(GrPython)
-GR_PYTHON_INSTALL(
- PROGRAMS
- DESTINATION bin
+# Base stuff
+GR_PYTHON_INSTALL(PROGRAMS
+ DESTINATION ${GR_PKG_ZEROMQ_EXAMPLES_DIR}
+ COMPONENT "zeromq_python"
)
diff --git a/gr-zeromq/examples/python/README b/gr-zeromq/examples/python/README
new file mode 100644
index 0000000000..2bc2dc8a52
--- /dev/null
+++ b/gr-zeromq/examples/python/README
@@ -0,0 +1,71 @@
+THIS IS EXPERIMENTAL SOFTWARE AND API IS SUBJECT TO CHANGE
+
+How to run the example
+----------------------
+
+Assuming that the module has been compiled but not installed, in the
+gr-zeromq folder do
+
+ cd examples
+ ./run_app.sh server
+
+on another terminal or machine
+
+ ./run_app.sh client -s hostname
+
+You can also run a (remote) GUI on any of the two or a third machine for monitoring and control.
+
+ ./run_app.sh gui.py -s servername -c hostname
+
+in doing so the order of starting the scripts is arbitrary. When installing the
+module, the run\_app.sh script is of course not needed.
+
+
+How to use the API
+------------------
+
+### PROBE API
+Connect a zmq pubsub sink to the block you want to monitor
+
+ self.zmq_probe = zeromq.sink_pubsub(gr.sizeof_float, "tcp://*:5556")
+
+add a probe manager to your Python GUI
+
+ # ZeroMQ
+ probe_manager = zeromq.probe_manager()
+ probe_manager.add_socket("tcp://localhost:5556",
+ 'float32', self.plot_data)
+
+ def plot_data(self,samples):
+ [...]
+
+basically creates a watcher thread that calls the call back functions and
+unpacks sample data. Now you can use a timer to update the plot, e.g. in PyQt
+
+ update_timer = Qt.QTimer()
+ self.connect(update_timer,
+ QtCore.SIGNAL("timeout()"),
+ probe_manager.watcher)
+ update_timer.start(30)
+
+### RPC API
+Add an rpc manager to your Python app to receive RPCs
+
+ rpc_manager = zeromq.rpc_manager()
+ rpc_manager.set_reply_socket("tcp://*:6666")
+ rpc_manager.add_interface("start_fg",self.start)
+ rpc_manager.start_watcher()
+
+to be able to send requests also add one on the other side
+
+ rpc_manager = zeromq.rpc_manager()
+ rpc_manager.set_request_socket("tcp://localhost:6666")
+
+send a request
+
+ rpc_mganager.request("start_fg")
+ rpc_mgr_server.request("set_k",gain)
+
+RPCs use GNU Radio pmt's to serialize arguments, the watcher thread will
+regularly poll for incoming RPC requests, deserializes arguments and call the
+interface callback function accordingly.
diff --git a/gr-zeromq/examples/client.py b/gr-zeromq/examples/python/client.py
index 3d55cc9a98..3d55cc9a98 100755
--- a/gr-zeromq/examples/client.py
+++ b/gr-zeromq/examples/python/client.py
diff --git a/gr-zeromq/examples/fixui4py.sh b/gr-zeromq/examples/python/fixui4py.sh
index d2978000bf..d2978000bf 100755
--- a/gr-zeromq/examples/fixui4py.sh
+++ b/gr-zeromq/examples/python/fixui4py.sh
diff --git a/gr-zeromq/examples/gui.py b/gr-zeromq/examples/python/gui.py
index 91223dd734..91223dd734 100755
--- a/gr-zeromq/examples/gui.py
+++ b/gr-zeromq/examples/python/gui.py
diff --git a/gr-zeromq/examples/main_window.ui b/gr-zeromq/examples/python/main_window.ui
index 14f810e67d..14f810e67d 100644
--- a/gr-zeromq/examples/main_window.ui
+++ b/gr-zeromq/examples/python/main_window.ui
diff --git a/gr-zeromq/examples/run_app.sh b/gr-zeromq/examples/python/run_app.sh
index 4af936ca82..4af936ca82 100755
--- a/gr-zeromq/examples/run_app.sh
+++ b/gr-zeromq/examples/python/run_app.sh
diff --git a/gr-zeromq/examples/server.py b/gr-zeromq/examples/python/server.py
index 28b732ed3e..28b732ed3e 100755
--- a/gr-zeromq/examples/server.py
+++ b/gr-zeromq/examples/python/server.py