summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/grc_gr_qtgui.m412
-rw-r--r--config/grc_gr_uhd.m41
-rw-r--r--config/grc_volk.m418
-rw-r--r--gr-audio/include/gr_audio_api.h6
-rw-r--r--gr-qtgui/apps/Makefile.am1
-rwxr-xr-xgr-qtgui/apps/pyqt_example_c.py3
-rwxr-xr-xgr-qtgui/apps/pyqt_example_f.py12
-rwxr-xr-xgr-qtgui/apps/pyqt_time_c.py163
-rwxr-xr-xgr-qtgui/apps/pyqt_time_f.py163
-rwxr-xr-xgr-qtgui/apps/qt_digital.py1
-rw-r--r--gr-qtgui/grc/Makefile.am1
-rw-r--r--gr-qtgui/grc/qtgui_time_sink_x.xml78
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.cc22
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.h23
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.cc22
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.h22
-rw-r--r--gr-qtgui/lib/Makefile.am11
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.cc22
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.h22
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.cc141
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.h46
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc22
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.h22
-rw-r--r--gr-qtgui/lib/gr_qtgui_api.h33
-rw-r--r--gr-qtgui/lib/qtgui_sink_c.h7
-rw-r--r--gr-qtgui/lib/qtgui_sink_f.h7
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_c.cc199
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_c.h93
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_f.cc197
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_f.h93
-rw-r--r--gr-qtgui/lib/qtgui_util.h6
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.cc43
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.h24
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.cc42
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.h22
-rw-r--r--gr-qtgui/lib/timedisplayform.cc177
-rw-r--r--gr-qtgui/lib/timedisplayform.h85
-rw-r--r--gr-qtgui/swig/Makefile.am5
-rw-r--r--gr-qtgui/swig/qtgui_sink_c.i (renamed from gr-qtgui/swig/qtgui.i)47
-rw-r--r--gr-qtgui/swig/qtgui_sink_f.i66
-rw-r--r--gr-qtgui/swig/qtgui_swig.i9
-rw-r--r--gr-qtgui/swig/qtgui_time_sink_c.i56
-rw-r--r--gr-qtgui/swig/qtgui_time_sink_f.i56
-rw-r--r--gr-uhd/Makefile.am2
-rw-r--r--gr-uhd/gnuradio-uhd.pc.in11
-rw-r--r--gr-uhd/include/gr_uhd_usrp_sink.h32
-rw-r--r--gr-uhd/include/gr_uhd_usrp_source.h32
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_sink.cc16
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_source.cc16
-rw-r--r--gr-uhd/swig/uhd_swig.i3
-rw-r--r--grc/python/FlowGraph.py31
-rw-r--r--grc/python/convert_hier.py14
-rw-r--r--grc/python/flow_graph.tmpl16
53 files changed, 2086 insertions, 188 deletions
diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4
index a4592fa41..ddb7c7ca9 100644
--- a/config/grc_gr_qtgui.m4
+++ b/config/grc_gr_qtgui.m4
@@ -47,12 +47,12 @@ AC_DEFUN([GRC_GR_QTGUI],[
if test $passed = yes; then
dnl Check for package qt or qt-mt, set QT_CFLAGS and QT_LIBS
- PKG_CHECK_MODULES(QTCORE, QtCore >= 4.2, [],
- [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtCore >= 4.2.])])
- PKG_CHECK_MODULES(QTGUI, QtGui >= 4.2, [],
- [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtGui >= 4.2.])])
- PKG_CHECK_MODULES(QTOPENGL, QtOpenGL >= 4.2, [],
- [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtOpenGL >- 4.2.])])
+ PKG_CHECK_MODULES(QTCORE, QtCore >= 4.4, [],
+ [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtCore >= 4.4.])])
+ PKG_CHECK_MODULES(QTGUI, QtGui >= 4.4, [],
+ [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtGui >= 4..])])
+ PKG_CHECK_MODULES(QTOPENGL, QtOpenGL >= 4.4, [],
+ [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtOpenGL >- 4.4.])])
dnl Fetch QWT variables
GR_QWT([], [passed=no])
diff --git a/config/grc_gr_uhd.m4 b/config/grc_gr_uhd.m4
index 3cc9691e5..2d571d970 100644
--- a/config/grc_gr_uhd.m4
+++ b/config/grc_gr_uhd.m4
@@ -40,6 +40,7 @@ AC_DEFUN([GRC_GR_UHD],[
AM_CONDITIONAL([GR_DEFINE_HAVE_UHD],[test $passed = yes])
AC_CONFIG_FILES([ \
+ gr-uhd/gnuradio-uhd.pc \
gr-uhd/Makefile \
gr-uhd/grc/Makefile \
gr-uhd/include/Makefile \
diff --git a/config/grc_volk.m4 b/config/grc_volk.m4
index 1b3c54dd7..f349d5e99 100644
--- a/config/grc_volk.m4
+++ b/config/grc_volk.m4
@@ -21,19 +21,23 @@ AC_DEFUN([GRC_VOLK],[
GRC_ENABLE(volk)
GRC_WITH(volk)
- dnl volk uses a subsidiary configure.ac
- AC_CONFIG_SUBDIRS([volk])
-
- dnl If execution gets to here, $passed will be:
- dnl with : if the --with code didn't error out
+ dnl If execution gets to here, test if $passed is:
+ dnl with : if the --with code didn't error out, use these values
+ dnl Test if $enable_volk is:
dnl yes : if the --enable code passed muster and all dependencies are met
- dnl no : otherwise
- if test $passed != with; then
+ dnl no : otherwise, then do not set variables
+ if test $passed != with && test x$enable_volk == xyes; then
dnl how and where to find INCLUDES and LA
volk_INCLUDES="-I\${abs_top_srcdir}/volk/include"
volk_LA="\${abs_top_builddir}/volk/lib/libvolk.la \
\${abs_top_builddir}/volk/lib/libvolk_runtime.la"
fi
+ dnl volk uses a subsidiary configure.ac
+ dnl only run if building Volk
+ if test $passed == yes && test x$enable_volk != xno; then
+ AC_CONFIG_SUBDIRS([volk])
+ fi
+
GRC_BUILD_CONDITIONAL(volk, [])
])
diff --git a/gr-audio/include/gr_audio_api.h b/gr-audio/include/gr_audio_api.h
index b21819bab..65782d308 100644
--- a/gr-audio/include/gr_audio_api.h
+++ b/gr-audio/include/gr_audio_api.h
@@ -22,10 +22,12 @@
#ifndef INCLUDED_GR_AUDIO_API_H
#define INCLUDED_GR_AUDIO_API_H
+#include <gruel/attributes.h>
+
#ifdef gnuradio_audio_EXPORTS
-# define GR_AUDIO_API //FIXME needs attributes defines
+# define GR_AUDIO_API __GR_ATTR_EXPORT
#else
-# define GR_AUDIO_API //FIXME needs attributes defines
+# define GR_AUDIO_API __GR_ATTR_IMPORT
#endif
#endif /* INCLUDED_GR_AUDIO_API_H */
diff --git a/gr-qtgui/apps/Makefile.am b/gr-qtgui/apps/Makefile.am
index c8d967334..7b35d949e 100644
--- a/gr-qtgui/apps/Makefile.am
+++ b/gr-qtgui/apps/Makefile.am
@@ -30,6 +30,7 @@ nodist_bin_SCRIPTS = \
noinst_PYTHON = \
pyqt_example_f.py \
pyqt_example_c.py \
+ pyqt_time_c.py \
qt_digital.py \
qt_digital_window.py \
usrp2_display.py \
diff --git a/gr-qtgui/apps/pyqt_example_c.py b/gr-qtgui/apps/pyqt_example_c.py
index e1b58442f..607ab12ee 100755
--- a/gr-qtgui/apps/pyqt_example_c.py
+++ b/gr-qtgui/apps/pyqt_example_c.py
@@ -145,5 +145,6 @@ class my_top_block(gr.top_block):
if __name__ == "__main__":
tb = my_top_block();
tb.start()
- sys.exit(tb.qapp.exec_())
+ tb.qapp.exec_()
+ tb.stop()
diff --git a/gr-qtgui/apps/pyqt_example_f.py b/gr-qtgui/apps/pyqt_example_f.py
index 6b2131019..2d957c85a 100755
--- a/gr-qtgui/apps/pyqt_example_f.py
+++ b/gr-qtgui/apps/pyqt_example_f.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from gnuradio import gr, blks2
+from gnuradio import gr
from gnuradio import qtgui
from PyQt4 import QtGui, QtCore
import sys, sip
@@ -117,6 +117,8 @@ class my_top_block(gr.top_block):
src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
src = gr.add_ff()
thr = gr.throttle(gr.sizeof_float, 100*fftsize)
+ noise = gr.noise_source_f(gr.GR_GAUSSIAN, 0.001)
+ add = gr.add_ff()
self.snk1 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Float Signal Example",
@@ -124,7 +126,9 @@ class my_top_block(gr.top_block):
self.connect(src1, (src,0))
self.connect(src2, (src,1))
- self.connect(src, thr, self.snk1)
+ self.connect(src, thr, (add,0))
+ self.connect(noise, (add,1))
+ self.connect(add, self.snk1)
self.ctrl_win = control_box()
self.ctrl_win.attach_signal1(src1)
@@ -144,5 +148,5 @@ class my_top_block(gr.top_block):
if __name__ == "__main__":
tb = my_top_block();
tb.start()
- sys.exit(tb.qapp.exec_())
-
+ tb.qapp.exec_()
+ tb.stop()
diff --git a/gr-qtgui/apps/pyqt_time_c.py b/gr-qtgui/apps/pyqt_time_c.py
new file mode 100755
index 000000000..fa7d60e81
--- /dev/null
+++ b/gr-qtgui/apps/pyqt_time_c.py
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import qtgui
+from PyQt4 import QtGui, QtCore
+import sys, sip
+
+class dialog_box(QtGui.QWidget):
+ def __init__(self, display, control):
+ QtGui.QWidget.__init__(self, None)
+ self.setWindowTitle('PyQt Test GUI')
+
+ self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self)
+ self.boxlayout.addWidget(display, 1)
+ self.boxlayout.addWidget(control)
+
+ self.resize(800, 500)
+
+class control_box(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.setWindowTitle('Control Panel')
+
+ self.setToolTip('Control the signals')
+ QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
+
+ self.layout = QtGui.QFormLayout(self)
+
+ # Control the first signal
+ self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
+ self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq1EditText)
+
+ self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
+ self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp1EditText)
+
+
+ # Control the second signal
+ self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
+ self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq2EditText)
+
+
+ self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
+ self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp2EditText)
+
+ self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
+ self.layout.addWidget(self.quit)
+
+ self.connect(self.quit, QtCore.SIGNAL('clicked()'),
+ QtGui.qApp, QtCore.SLOT('quit()'))
+
+ def attach_signal1(self, signal):
+ self.signal1 = signal
+ self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency()))
+ self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude()))
+
+ def attach_signal2(self, signal):
+ self.signal2 = signal
+ self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency()))
+ self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude()))
+
+ def freq1EditText(self):
+ try:
+ newfreq = float(self.freq1Edit.text())
+ self.signal1.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp1EditText(self):
+ try:
+ newamp = float(self.amp1Edit.text())
+ self.signal1.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+ def freq2EditText(self):
+ try:
+ newfreq = float(self.freq2Edit.text())
+ self.signal2.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp2EditText(self):
+ try:
+ newamp = float(self.amp2Edit.text())
+ self.signal2.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+class my_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ Rs = 8000
+ f1 = 100
+ f2 = 200
+
+ npts = 2048
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0)
+ src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
+ src = gr.add_cc()
+ channel = gr.channel_model(0.01)
+ thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ self.snk1 = qtgui.time_sink_c(npts, Rs,
+ "Complex Time Example", 3)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, channel, thr, (self.snk1, 0))
+ self.connect(src1, (self.snk1, 1))
+ self.connect(src2, (self.snk1, 2))
+
+ self.ctrl_win = control_box()
+ self.ctrl_win.attach_signal1(src1)
+ self.ctrl_win.attach_signal2(src2)
+
+ # Get the reference pointer to the SpectrumDisplayForm QWidget
+ pyQt = self.snk1.pyqwidget()
+
+ # Wrap the pointer as a PyQt SIP object
+ # This can now be manipulated as a PyQt4.QtGui.QWidget
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+
+ # Example of using signal/slot to set the title of a curve
+ pyWin.connect(pyWin, QtCore.SIGNAL("setTitle(int, QString)"),
+ pyWin, QtCore.SLOT("setTitle(int, QString)"))
+ pyWin.emit(QtCore.SIGNAL("setTitle(int, QString)"), 0, "Re{sum}")
+ self.snk1.set_title(1, "Im{Sum}")
+ self.snk1.set_title(2, "Re{src1}")
+ self.snk1.set_title(3, "Im{src1}")
+ self.snk1.set_title(4, "Re{src2}")
+ self.snk1.set_title(5, "Im{src2}")
+
+ # Can also set the color of a curve
+ #self.snk1.set_color(5, "blue")
+
+ #pyWin.show()
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
+ self.main_box.show()
+
+if __name__ == "__main__":
+ tb = my_top_block();
+ tb.start()
+ tb.qapp.exec_()
+ tb.stop()
+
diff --git a/gr-qtgui/apps/pyqt_time_f.py b/gr-qtgui/apps/pyqt_time_f.py
new file mode 100755
index 000000000..1b9efa10d
--- /dev/null
+++ b/gr-qtgui/apps/pyqt_time_f.py
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import qtgui
+from PyQt4 import QtGui, QtCore
+import sys, sip
+
+class dialog_box(QtGui.QWidget):
+ def __init__(self, display, control):
+ QtGui.QWidget.__init__(self, None)
+ self.setWindowTitle('PyQt Test GUI')
+
+ self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self)
+ self.boxlayout.addWidget(display, 1)
+ self.boxlayout.addWidget(control)
+
+ self.resize(800, 500)
+
+class control_box(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.setWindowTitle('Control Panel')
+
+ self.setToolTip('Control the signals')
+ QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
+
+ self.layout = QtGui.QFormLayout(self)
+
+ # Control the first signal
+ self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
+ self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq1EditText)
+
+ self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
+ self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp1EditText)
+
+
+ # Control the second signal
+ self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
+ self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq2EditText)
+
+
+ self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
+ self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp2EditText)
+
+ self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
+ self.layout.addWidget(self.quit)
+
+ self.connect(self.quit, QtCore.SIGNAL('clicked()'),
+ QtGui.qApp, QtCore.SLOT('quit()'))
+
+ def attach_signal1(self, signal):
+ self.signal1 = signal
+ self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency()))
+ self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude()))
+
+ def attach_signal2(self, signal):
+ self.signal2 = signal
+ self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency()))
+ self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude()))
+
+ def freq1EditText(self):
+ try:
+ newfreq = float(self.freq1Edit.text())
+ self.signal1.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp1EditText(self):
+ try:
+ newamp = float(self.amp1Edit.text())
+ self.signal1.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+ def freq2EditText(self):
+ try:
+ newfreq = float(self.freq2Edit.text())
+ self.signal2.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp2EditText(self):
+ try:
+ newamp = float(self.amp2Edit.text())
+ self.signal2.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+class my_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ Rs = 8000
+ f1 = 100
+ f2 = 200
+
+ npts = 2048
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0)
+ src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
+ src = gr.add_ff()
+ thr = gr.throttle(gr.sizeof_float, 100*npts)
+ noise = gr.noise_source_f(gr.GR_GAUSSIAN, 0.001)
+ add = gr.add_ff()
+ self.snk1 = qtgui.time_sink_f(npts, Rs,
+ "Complex Time Example", 3)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, thr, (add,0))
+ self.connect(noise, (add,1))
+ self.connect(add, self.snk1)
+ self.connect(src1, (self.snk1, 1))
+ self.connect(src2, (self.snk1, 2))
+
+ self.ctrl_win = control_box()
+ self.ctrl_win.attach_signal1(src1)
+ self.ctrl_win.attach_signal2(src2)
+
+ # Get the reference pointer to the SpectrumDisplayForm QWidget
+ pyQt = self.snk1.pyqwidget()
+
+ # Wrap the pointer as a PyQt SIP object
+ # This can now be manipulated as a PyQt4.QtGui.QWidget
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+
+ # Example of using signal/slot to set the title of a curve
+ pyWin.connect(pyWin, QtCore.SIGNAL("setTitle(int, QString)"),
+ pyWin, QtCore.SLOT("setTitle(int, QString)"))
+ pyWin.emit(QtCore.SIGNAL("setTitle(int, QString)"), 0, "sum")
+ self.snk1.set_title(1, "src1")
+ self.snk1.set_title(2, "src2")
+
+ # Can also set the color of a curve
+ #self.snk1.set_color(5, "blue")
+
+ #pyWin.show()
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
+ self.main_box.show()
+
+if __name__ == "__main__":
+ tb = my_top_block();
+ tb.start()
+ tb.qapp.exec_()
+ tb.stop()
+
diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py
index c6920a05d..99c799f2a 100755
--- a/gr-qtgui/apps/qt_digital.py
+++ b/gr-qtgui/apps/qt_digital.py
@@ -274,3 +274,4 @@ if __name__ == "__main__":
tb = my_top_block();
tb.start()
tb.qapp.exec_()
+ tb.stop()
diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am
index b3114268c..ccd459a13 100644
--- a/gr-qtgui/grc/Makefile.am
+++ b/gr-qtgui/grc/Makefile.am
@@ -29,5 +29,6 @@ dist_grcblocks_DATA = \
qtgui_label.xml \
qtgui_range.xml \
qtgui_sink_x.xml \
+ qtgui_time_sink_x.xml \
qtgui_tab_widget.xml \
qtgui_chooser.xml
diff --git a/gr-qtgui/grc/qtgui_time_sink_x.xml b/gr-qtgui/grc/qtgui_time_sink_x.xml
new file mode 100644
index 000000000..9c8da6fbc
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_time_sink_x.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##QT GUI Sink
+###################################################
+ -->
+<block>
+ <name>QT GUI Time Sink</name>
+ <key>qtgui_time_sink_x</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio.qtgui import qtgui</import>
+ <import>from gnuradio.gr import firdes</import>
+ <import>import sip</import>
+ <make>#set $win = 'self._%s_win'%$id
+qtgui.$(type.fcn)(
+ $size, \#size
+ $bw, \#bw
+ $name, \#name
+ $nconnections \#number of inputs
+)
+self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
+$(gui_hint()($win))</make>
+ <callback>set_time_domain_axis($min, $max)</callback>
+ <callback>set_update_time($t)</callback>
+ <callback>set_title($which, $title)</callback>
+ <callback>set_color($which, $color)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option><name>Complex</name><key>complex</key><opt>fcn:time_sink_c</opt></option>
+ <option><name>Float</name><key>float</key><opt>fcn:time_sink_f</opt></option>
+ </param>
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Number of Points</name>
+ <key>size</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Bandwidth (Hz)</name>
+ <key>bw</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Number of Inputs</name>
+ <key>nconnections</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$nconnections</nports>
+ </sink>
+ <doc>
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc
index 75dbe9c37..7ec2db820 100644
--- a/gr-qtgui/lib/ConstellationDisplayPlot.cc
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef CONSTELLATION_DISPLAY_PLOT_C
#define CONSTELLATION_DISPLAY_PLOT_C
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h
index bf4531e0a..3a85f3bc3 100644
--- a/gr-qtgui/lib/ConstellationDisplayPlot.h
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.h
@@ -1,6 +1,29 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef CONSTELLATION_DISPLAY_PLOT_HPP
#define CONSTELLATION_DISPLAY_PLOT_HPP
+#include <stdint.h>
#include <cstdio>
#include <qwt_plot.h>
#include <qwt_painter.h>
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index 30b318184..4d60cd9be 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef FREQUENCY_DISPLAY_PLOT_C
#define FREQUENCY_DISPLAY_PLOT_C
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h
index 7a207ab8d..6689703bc 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.h
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.h
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef FREQUENCY_DISPLAY_PLOT_HPP
#define FREQUENCY_DISPLAY_PLOT_HPP
diff --git a/gr-qtgui/lib/Makefile.am b/gr-qtgui/lib/Makefile.am
index 7dee39eb4..95b636d89 100644
--- a/gr-qtgui/lib/Makefile.am
+++ b/gr-qtgui/lib/Makefile.am
@@ -24,12 +24,14 @@ include $(top_srcdir)/Makefile.common
EXTRA_DIST += spectrumdisplayform.ui
AM_CPPFLAGS = -I. $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \
- $(QT_INCLUDES) $(BOOST_CPPFLAGS) $(WITH_INCLUDES)
+ $(QT_INCLUDES) $(BOOST_CPPFLAGS) $(WITH_INCLUDES) \
+ -Dlibgnuradio_qtgui_EXPORTS
# Only include these files in the build if qtgui passes configure checks
# This is mostly to help make distcheck pass
QMAKE_SOURCES = \
spectrumdisplayform.moc.cc \
+ timedisplayform.moc.cc \
FrequencyDisplayPlot.moc.cc \
TimeDomainDisplayPlot.moc.cc \
WaterfallDisplayPlot.moc.cc \
@@ -49,11 +51,14 @@ libgnuradio_qtgui_la_SOURCES = \
waterfallGlobalData.cc \
ConstellationDisplayPlot.cc \
spectrumdisplayform.cc \
+ timedisplayform.cc \
SpectrumGUIClass.cc \
spectrumUpdateEvents.cc \
plot_waterfall.cc \
qtgui_sink_c.cc \
qtgui_sink_f.cc \
+ qtgui_time_sink_c.cc \
+ qtgui_time_sink_f.cc \
qtgui_util.cc
nodist_libgnuradio_qtgui_la_SOURCES=$(QMAKE_SOURCES)
@@ -68,10 +73,14 @@ grinclude_HEADERS = \
highResTimeFunctions.h \
plot_waterfall.h \
spectrumdisplayform.h \
+ timedisplayform.h \
SpectrumGUIClass.h \
spectrumUpdateEvents.h \
+ gr_qtgui_api.h \
qtgui_sink_c.h \
qtgui_sink_f.h \
+ qtgui_time_sink_c.h \
+ qtgui_time_sink_f.h \
qtgui_util.h
#QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
index 1a519591d..b472470c6 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef SPECTRUM_GUI_CLASS_CPP
#define SPECTRUM_GUI_CLASS_CPP
diff --git a/gr-qtgui/lib/SpectrumGUIClass.h b/gr-qtgui/lib/SpectrumGUIClass.h
index 48f45a0f5..ad06674f5 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.h
+++ b/gr-qtgui/lib/SpectrumGUIClass.h
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef SPECTRUM_GUI_CLASS_HPP
#define SPECTRUM_GUI_CLASS_HPP
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
index be25a6cde..f635a2b0c 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef TIME_DOMAIN_DISPLAY_PLOT_C
#define TIME_DOMAIN_DISPLAY_PLOT_C
@@ -5,7 +27,8 @@
#include <qwt_scale_draw.h>
#include <qwt_legend.h>
-
+#include <QColor>
+#include <iostream>
class TimePrecisionClass
{
@@ -70,16 +93,14 @@ private:
std::string _unitType;
};
-TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent)
+TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
+ : QwtPlot(parent), _nplots(nplots)
{
- timespec_reset(&_lastReplot);
-
resize(parent->width(), parent->height());
_numPoints = 1024;
- _realDataPoints = new double[_numPoints];
- _imagDataPoints = new double[_numPoints];
_xAxisPoints = new double[_numPoints];
+ memset(_xAxisPoints, 0x0, _numPoints*sizeof(double));
_zoomer = new TimeDomainDisplayZoomer(canvas(), 0);
_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
@@ -96,41 +117,40 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent)
canvas()->setPalette(palette);
setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
- set_xaxis(0, _numPoints);
+ setXaxis(0, _numPoints);
setAxisTitle(QwtPlot::xBottom, "Time (sec)");
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
- set_yaxis(-2.0, 2.0);
- setAxisTitle(QwtPlot::yLeft, "Normalized Voltage");
+ setYaxis(-2.0, 2.0);
+ setAxisTitle(QwtPlot::yLeft, "Amplitude");
+ QList<QColor> colors;
+ colors << QColor(Qt::blue) << QColor(Qt::red) << QColor(Qt::green)
+ << QColor(Qt::black) << QColor(Qt::cyan) << QColor(Qt::magenta)
+ << QColor(Qt::yellow) << QColor(Qt::gray) << QColor(Qt::darkRed)
+ << QColor(Qt::darkGreen) << QColor(Qt::darkBlue) << QColor(Qt::darkGray);
+
+ int ncolors = colors.size();
+
+ // Setup dataPoints and plot vectors
// Automatically deleted when parent is deleted
- _real_plot_curve = new QwtPlotCurve("Real Data");
- _real_plot_curve->attach(this);
- _real_plot_curve->setPen(QPen(Qt::blue));
- _real_plot_curve->setRawData(_xAxisPoints, _realDataPoints, _numPoints);
-
- _imag_plot_curve = new QwtPlotCurve("Imaginary Data");
- _imag_plot_curve->attach(this);
- _imag_plot_curve->setPen(QPen(Qt::magenta));
- _imag_plot_curve->setRawData(_xAxisPoints, _imagDataPoints, _numPoints);
- // _imag_plot_curve->setVisible(false);
-
- memset(_realDataPoints, 0x0, _numPoints*sizeof(double));
- memset(_imagDataPoints, 0x0, _numPoints*sizeof(double));
- memset(_xAxisPoints, 0x0, _numPoints*sizeof(double));
+ for(int i = 0; i < _nplots; i++) {
+ _dataPoints.push_back(new double[_numPoints]);
+ memset(_dataPoints[i], 0x0, _numPoints*sizeof(double));
+
+ _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i)));
+ _plot_curve[i]->attach(this);
+ _plot_curve[i]->setPen(QPen(colors[i]));
+ _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints);
+ }
_sampleRate = 1;
_resetXAxisPoints();
-#if QT_VERSION < 0x040000
- _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
- Qt::RightButton, Qt::ControlModifier);
-#else
_zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
- Qt::RightButton, Qt::ControlModifier);
-#endif
+ Qt::RightButton, Qt::ControlModifier);
_zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
- Qt::RightButton);
+ Qt::RightButton);
_panner = new QwtPlotPanner(canvas());
_panner->setAxisEnabled(QwtPlot::yRight, false);
@@ -164,29 +184,40 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent)
this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) ));
}
-TimeDomainDisplayPlot::~TimeDomainDisplayPlot(){
- delete[] _realDataPoints;
- delete[] _imagDataPoints;
+TimeDomainDisplayPlot::~TimeDomainDisplayPlot()
+{
+ for(int i = 0; i < _nplots; i++)
+ delete [] _dataPoints[i];
delete[] _xAxisPoints;
- // _fft_plot_curves deleted when parent deleted
// _zoomer and _panner deleted when parent deleted
}
void
-TimeDomainDisplayPlot::set_yaxis(double min, double max)
+TimeDomainDisplayPlot::setYaxis(double min, double max)
{
setAxisScale(QwtPlot::yLeft, min, max);
_zoomer->setZoomBase();
}
void
-TimeDomainDisplayPlot::set_xaxis(double min, double max)
+TimeDomainDisplayPlot::setXaxis(double min, double max)
{
setAxisScale(QwtPlot::xBottom, min, max);
_zoomer->setZoomBase();
}
+void
+TimeDomainDisplayPlot::setTitle(int which, QString title)
+{
+ _plot_curve[which]->setTitle(title);
+}
+
+void
+TimeDomainDisplayPlot::setColor(int which, QString color)
+{
+ _plot_curve[which]->setPen(QPen(color));
+}
void TimeDomainDisplayPlot::replot()
{
@@ -196,47 +227,37 @@ void TimeDomainDisplayPlot::replot()
void
TimeDomainDisplayPlot::resizeSlot( QSize *s )
{
- resize(s->width(), s->height());
+ // -10 is to spare some room for the legend and x-axis label
+ resize(s->width()-10, s->height()-10);
}
-void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints,
- const double* imagDataPoints,
+void TimeDomainDisplayPlot::PlotNewData(const std::vector<double*> dataPoints,
const int64_t numDataPoints,
const double timeInterval)
{
- if((numDataPoints > 0) &&
- (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
-
+ if((numDataPoints > 0)) {
if(numDataPoints != _numPoints){
_numPoints = numDataPoints;
- delete[] _realDataPoints;
- delete[] _imagDataPoints;
delete[] _xAxisPoints;
- _realDataPoints = new double[_numPoints];
- _imagDataPoints = new double[_numPoints];
_xAxisPoints = new double[_numPoints];
-
- _real_plot_curve->setRawData(_xAxisPoints, _realDataPoints, _numPoints);
- _imag_plot_curve->setRawData(_xAxisPoints, _imagDataPoints, _numPoints);
-
- set_xaxis(0, numDataPoints);
+ for(int i = 0; i < _nplots; i++) {
+ delete[] _dataPoints[i];
+ _dataPoints[i] = new double[_numPoints];
+ _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints);
+ }
+
+ setXaxis(0, numDataPoints);
_resetXAxisPoints();
}
- memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double));
- memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double));
-
- _lastReplot = get_highres_clock();
+ for(int i = 0; i < _nplots; i++) {
+ memcpy(_dataPoints[i], dataPoints[i], numDataPoints*sizeof(double));
+ }
}
}
-void TimeDomainDisplayPlot::SetImaginaryDataVisible(const bool visibleFlag)
-{
- _imag_plot_curve->setVisible(visibleFlag);
-}
-
void TimeDomainDisplayPlot::_resetXAxisPoints()
{
double delt = 1.0/_sampleRate;
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h
index 01338300c..4c7b1e319 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.h
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h
@@ -1,8 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef TIME_DOMAIN_DISPLAY_PLOT_HPP
#define TIME_DOMAIN_DISPLAY_PLOT_HPP
#include <stdint.h>
#include <cstdio>
+#include <vector>
#include <qwt_plot.h>
#include <qwt_painter.h>
#include <qwt_plot_canvas.h>
@@ -21,20 +44,20 @@ class TimeDomainDisplayPlot:public QwtPlot{
Q_OBJECT
public:
- TimeDomainDisplayPlot(QWidget*);
+ TimeDomainDisplayPlot(int nplots, QWidget*);
virtual ~TimeDomainDisplayPlot();
- void PlotNewData(const double* realDataPoints, const double* imagDataPoints,
+ void PlotNewData(const std::vector<double*> dataPoints,
const int64_t numDataPoints, const double timeInterval);
- void SetImaginaryDataVisible(const bool);
-
virtual void replot();
- void set_yaxis(double min, double max);
- void set_xaxis(double min, double max);
-
public slots:
+ void setYaxis(double min, double max);
+ void setXaxis(double min, double max);
+ void setTitle(int which, QString title);
+ void setColor(int which, QString color);
+
void resizeSlot( QSize *s );
void SetSampleRate(double sr, double units,
const std::string &strunits);
@@ -52,8 +75,8 @@ protected:
private:
void _resetXAxisPoints();
- QwtPlotCurve* _real_plot_curve;
- QwtPlotCurve* _imag_plot_curve;
+ int _nplots;
+ std::vector<QwtPlotCurve*> _plot_curve;
QwtPlotPanner* _panner;
QwtPlotZoomer* _zoomer;
@@ -61,14 +84,11 @@ private:
QwtDblClickPlotPicker *_picker;
QwtPlotMagnifier *_magnifier;
- double* _realDataPoints;
- double* _imagDataPoints;
+ std::vector<double*> _dataPoints;
double* _xAxisPoints;
double _sampleRate;
- timespec _lastReplot;
-
int64_t _numPoints;
};
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index 2234f4238..52381a9f6 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef WATERFALL_DISPLAY_PLOT_C
#define WATERFALL_DISPLAY_PLOT_C
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h
index faa48d6aa..583bf9407 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.h
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef WATERFALL_DISPLAY_PLOT_HPP
#define WATERFALL_DISPLAY_PLOT_HPP
diff --git a/gr-qtgui/lib/gr_qtgui_api.h b/gr-qtgui/lib/gr_qtgui_api.h
new file mode 100644
index 000000000..65033a093
--- /dev/null
+++ b/gr-qtgui/lib/gr_qtgui_api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_QTGUI_API_H
+#define INCLUDED_GR_QTGUI_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef libgnuradio_qtgui_EXPORTS
+# define GR_QTGUI_API __GR_ATTR_EXPORT
+#else
+# define GR_QTGUI_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_GR_QTGUI_API_H */
diff --git a/gr-qtgui/lib/qtgui_sink_c.h b/gr-qtgui/lib/qtgui_sink_c.h
index fb0cb6c5f..b0946885c 100644
--- a/gr-qtgui/lib/qtgui_sink_c.h
+++ b/gr-qtgui/lib/qtgui_sink_c.h
@@ -24,6 +24,7 @@
#define INCLUDED_QTGUI_SINK_C_H
#include <Python.h>
+#include <gr_qtgui_api.h>
#include <gr_block.h>
#include <gr_firdes.h>
#include <gri_fft.h>
@@ -33,17 +34,17 @@
class qtgui_sink_c;
typedef boost::shared_ptr<qtgui_sink_c> qtgui_sink_c_sptr;
-qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+GR_QTGUI_API qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
double fc=0, double bandwidth=1.0,
const std::string &name="Spectrum Display",
bool plotfreq=true, bool plotwaterfall=true,
bool plottime=true, bool plotconst=true,
QWidget *parent=NULL);
-class qtgui_sink_c : public gr_block
+class GR_QTGUI_API qtgui_sink_c : public gr_block
{
private:
- friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+ friend GR_QTGUI_API qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
diff --git a/gr-qtgui/lib/qtgui_sink_f.h b/gr-qtgui/lib/qtgui_sink_f.h
index 518aa3846..30db05eea 100644
--- a/gr-qtgui/lib/qtgui_sink_f.h
+++ b/gr-qtgui/lib/qtgui_sink_f.h
@@ -24,6 +24,7 @@
#define INCLUDED_QTGUI_SINK_F_H
#include <Python.h>
+#include <gr_qtgui_api.h>
#include <gr_block.h>
#include <gr_firdes.h>
#include <gri_fft.h>
@@ -34,17 +35,17 @@
class qtgui_sink_f;
typedef boost::shared_ptr<qtgui_sink_f> qtgui_sink_f_sptr;
-qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
double fc=0, double bw=1.0,
const std::string &name="Spectrum Display",
bool plotfreq=true, bool plotwaterfall=true,
bool plottime=true, bool plotconst=true,
QWidget *parent=NULL);
-class qtgui_sink_f : public gr_block
+class GR_QTGUI_API qtgui_sink_f : public gr_block
{
private:
- friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+ friend GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
diff --git a/gr-qtgui/lib/qtgui_time_sink_c.cc b/gr-qtgui/lib/qtgui_time_sink_c.cc
new file mode 100644
index 000000000..6c4793ea1
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_time_sink_c.cc
@@ -0,0 +1,199 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtgui_time_sink_c.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+#include <QTimer>
+
+qtgui_time_sink_c_sptr
+qtgui_make_time_sink_c (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+{
+ return gnuradio::get_initial_sptr(new qtgui_time_sink_c (size, bw, name,
+ nconnections, parent));
+}
+
+qtgui_time_sink_c::qtgui_time_sink_c (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_block ("time_sink_c",
+ gr_make_io_signature (nconnections, nconnections, sizeof(gr_complex)),
+ gr_make_io_signature (0, 0, 0)),
+ d_size(size), d_bandwidth(bw), d_name(name),
+ d_nconnections(2*nconnections), d_parent(parent)
+{
+ d_main_gui = NULL;
+
+ d_index = 0;
+
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(new double[d_size]);
+ }
+
+ initialize();
+}
+
+qtgui_time_sink_c::~qtgui_time_sink_c()
+{
+ // d_main_gui is a qwidget destroyed with its parent
+ for(int i = 0; i < d_nconnections; i++) {
+ delete [] d_residbufs[i];
+ }
+}
+
+void
+qtgui_time_sink_c::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned int ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = std::min(d_size, 8191);
+ }
+}
+
+void
+qtgui_time_sink_c::initialize()
+{
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new TimeDisplayForm(d_nconnections, d_parent);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ timespec_reset(&d_last_time);
+}
+
+
+void
+qtgui_time_sink_c::exec_()
+{
+ d_qApplication->exec();
+}
+
+QWidget*
+qtgui_time_sink_c::qwidget()
+{
+ return d_main_gui;
+}
+
+PyObject*
+qtgui_time_sink_c::pyqwidget()
+{
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+}
+
+void
+qtgui_time_sink_c::set_time_domain_axis(double min, double max)
+{
+ d_main_gui->setTimeDomainAxis(min, max);
+}
+
+void
+qtgui_time_sink_c::set_update_time(double t)
+{
+ d_update_time = t;
+ d_main_gui->setUpdateTime(d_update_time);
+}
+
+void
+qtgui_time_sink_c::set_title(int which, const std::string &title)
+{
+ d_main_gui->setTitle(which, title.c_str());
+}
+
+void
+qtgui_time_sink_c::set_color(int which, const std::string &color)
+{
+ d_main_gui->setColor(which, color.c_str());
+}
+
+int
+qtgui_time_sink_c::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int n=0, j=0, idx=0;
+ const gr_complex *in = (const gr_complex*)input_items[idx];
+
+ for(int i=0; i < noutput_items; i+=d_size) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_size-d_index;
+ idx = 0;
+
+ // If we have enough input for one full plot, do it
+ if(datasize >= resid) {
+ d_current_time = get_highres_clock();
+
+ // Fill up residbufs with d_size number of items
+ for(n = 0; n < d_nconnections; n+=2) {
+ in = (const gr_complex*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k].real();
+ d_residbufs[n+1][d_index+k] = in[j+k].imag();
+ }
+ }
+
+ // Update the plot if its time
+ if(diff_timespec(d_current_time, d_last_time) > d_update_time) {
+ d_last_time = d_current_time;
+ d_qApplication->postEvent(d_main_gui,
+ new TimeUpdateEvent(d_residbufs, d_size));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbufs for next time
+ else {
+ for(n = 0; n < d_nconnections; n+=2) {
+ in = (const gr_complex*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k].real();
+ d_residbufs[n+1][d_index+k] = in[j+k].imag();
+ }
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ consume_each(j);
+ return j;
+}
diff --git a/gr-qtgui/lib/qtgui_time_sink_c.h b/gr-qtgui/lib/qtgui_time_sink_c.h
new file mode 100644
index 000000000..aa46ab3a7
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_time_sink_c.h
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_QTGUI_TIME_SINK_C_H
+#define INCLUDED_QTGUI_TIME_SINK_C_H
+
+#include <Python.h>
+#include <gr_qtgui_api.h>
+#include <gr_block.h>
+#include <gr_firdes.h>
+#include <gri_fft.h>
+#include <qapplication.h>
+#include <timedisplayform.h>
+
+class qtgui_time_sink_c;
+typedef boost::shared_ptr<qtgui_time_sink_c> qtgui_time_sink_c_sptr;
+
+GR_QTGUI_API qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnectons=1,
+ QWidget *parent=NULL);
+
+class GR_QTGUI_API qtgui_time_sink_c : public gr_block
+{
+private:
+ friend GR_QTGUI_API qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ int d_size;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ int d_index;
+ std::vector<double*> d_residbufs;
+
+ double d_update_time;
+
+ QWidget *d_parent;
+ TimeDisplayForm *d_main_gui;
+
+ timespec d_current_time;
+ timespec d_last_time;
+
+public:
+ ~qtgui_time_sink_c();
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+
+ QApplication *d_qApplication;
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_C_H */
diff --git a/gr-qtgui/lib/qtgui_time_sink_f.cc b/gr-qtgui/lib/qtgui_time_sink_f.cc
new file mode 100644
index 000000000..28789c163
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_time_sink_f.cc
@@ -0,0 +1,197 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtgui_time_sink_f.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+#include <QTimer>
+
+qtgui_time_sink_f_sptr
+qtgui_make_time_sink_f (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+{
+ return gnuradio::get_initial_sptr(new qtgui_time_sink_f (size, bw, name,
+ nconnections, parent));
+}
+
+qtgui_time_sink_f::qtgui_time_sink_f (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_block ("time_sink_f",
+ gr_make_io_signature (nconnections, nconnections, sizeof(float)),
+ gr_make_io_signature (0, 0, 0)),
+ d_size(size), d_bandwidth(bw), d_name(name),
+ d_nconnections(nconnections), d_parent(parent)
+{
+ d_main_gui = NULL;
+
+ d_index = 0;
+
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(new double[d_size]);
+ }
+
+ initialize();
+}
+
+qtgui_time_sink_f::~qtgui_time_sink_f()
+{
+ // d_main_gui is a qwidget destroyed with its parent
+ for(int i = 0; i < d_nconnections; i++) {
+ delete [] d_residbufs[i];
+ }
+}
+
+void
+qtgui_time_sink_f::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned int ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = std::min(d_size, 8191);
+ }
+}
+
+void
+qtgui_time_sink_f::initialize()
+{
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new TimeDisplayForm(d_nconnections, d_parent);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ timespec_reset(&d_last_time);
+}
+
+
+void
+qtgui_time_sink_f::exec_()
+{
+ d_qApplication->exec();
+}
+
+QWidget*
+qtgui_time_sink_f::qwidget()
+{
+ return d_main_gui;
+}
+
+PyObject*
+qtgui_time_sink_f::pyqwidget()
+{
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+}
+
+void
+qtgui_time_sink_f::set_time_domain_axis(double min, double max)
+{
+ d_main_gui->setTimeDomainAxis(min, max);
+}
+
+void
+qtgui_time_sink_f::set_update_time(double t)
+{
+ d_update_time = t;
+ d_main_gui->setUpdateTime(d_update_time);
+}
+
+void
+qtgui_time_sink_f::set_title(int which, const std::string &title)
+{
+ d_main_gui->setTitle(which, title.c_str());
+}
+
+void
+qtgui_time_sink_f::set_color(int which, const std::string &color)
+{
+ d_main_gui->setColor(which, color.c_str());
+}
+
+int
+qtgui_time_sink_f::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int n=0, j=0, idx=0;
+ const float *in = (const float*)input_items[idx];
+
+ for(int i=0; i < noutput_items; i+=d_size) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_size-d_index;
+ idx = 0;
+
+ // If we have enough input for one full plot, do it
+ if(datasize >= resid) {
+ d_current_time = get_highres_clock();
+
+ // Fill up residbufs with d_size number of items
+ for(n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k];
+ }
+ }
+
+ // Update the plot if its time
+ if(diff_timespec(d_current_time, d_last_time) > d_update_time) {
+ d_last_time = d_current_time;
+ d_qApplication->postEvent(d_main_gui,
+ new TimeUpdateEvent(d_residbufs, d_size));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbufs for next time
+ else {
+ for(n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k];
+ }
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ consume_each(j);
+ return j;
+}
diff --git a/gr-qtgui/lib/qtgui_time_sink_f.h b/gr-qtgui/lib/qtgui_time_sink_f.h
new file mode 100644
index 000000000..29fca79ee
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_time_sink_f.h
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_QTGUI_TIME_SINK_F_H
+#define INCLUDED_QTGUI_TIME_SINK_F_H
+
+#include <Python.h>
+#include <gr_qtgui_api.h>
+#include <gr_block.h>
+#include <gr_firdes.h>
+#include <gri_fft.h>
+#include <qapplication.h>
+#include <timedisplayform.h>
+
+class qtgui_time_sink_f;
+typedef boost::shared_ptr<qtgui_time_sink_f> qtgui_time_sink_f_sptr;
+
+GR_QTGUI_API qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnectons=1,
+ QWidget *parent=NULL);
+
+class GR_QTGUI_API qtgui_time_sink_f : public gr_block
+{
+private:
+ friend GR_QTGUI_API qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ int d_size;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ int d_index;
+ std::vector<double*> d_residbufs;
+
+ double d_update_time;
+
+ QWidget *d_parent;
+ TimeDisplayForm *d_main_gui;
+
+ timespec d_current_time;
+ timespec d_last_time;
+
+public:
+ ~qtgui_time_sink_f();
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+
+ QApplication *d_qApplication;
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_F_H */
diff --git a/gr-qtgui/lib/qtgui_util.h b/gr-qtgui/lib/qtgui_util.h
index a519c66a2..5b129c7b5 100644
--- a/gr-qtgui/lib/qtgui_util.h
+++ b/gr-qtgui/lib/qtgui_util.h
@@ -24,12 +24,12 @@
#define INCLUDED_QTGUI_UTIL_H
#include <qevent.h>
-
+#include <gr_qtgui_api.h>
#include <qwt_plot_picker.h>
#include <qwt_picker_machine.h>
-class QwtDblClickPlotPicker: public QwtPlotPicker
+class GR_QTGUI_API QwtDblClickPlotPicker: public QwtPlotPicker
{
public:
QwtDblClickPlotPicker(QwtPlotCanvas *);
@@ -38,7 +38,7 @@ public:
virtual QwtPickerMachine * stateMachine(int) const;
};
-class QwtPickerDblClickPointMachine: public QwtPickerMachine
+class GR_QTGUI_API QwtPickerDblClickPointMachine: public QwtPickerMachine
{
public:
QwtPickerDblClickPointMachine();
diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc
index 53a205fb7..ae4caf31a 100644
--- a/gr-qtgui/lib/spectrumUpdateEvents.cc
+++ b/gr-qtgui/lib/spectrumUpdateEvents.cc
@@ -177,4 +177,47 @@ SpectrumFrequencyRangeEvent::GetStopFrequency() const
return _stopFrequency;
}
+
+/***************************************************************************/
+#include <iostream>
+TimeUpdateEvent::TimeUpdateEvent(const std::vector<double*> timeDomainPoints,
+ const uint64_t numTimeDomainDataPoints)
+ : QEvent(QEvent::Type(10005))
+{
+ if(numTimeDomainDataPoints < 1) {
+ _numTimeDomainDataPoints = 1;
+ }
+ else {
+ _numTimeDomainDataPoints = numTimeDomainDataPoints;
+ }
+
+ _nplots = timeDomainPoints.size();
+ for(size_t i = 0; i < _nplots; i++) {
+ _dataTimeDomainPoints.push_back(new double[_numTimeDomainDataPoints]);
+ if(numTimeDomainDataPoints > 0) {
+ memcpy(_dataTimeDomainPoints[i], timeDomainPoints[i],
+ _numTimeDomainDataPoints*sizeof(double));
+ }
+ }
+}
+
+TimeUpdateEvent::~TimeUpdateEvent()
+{
+ for(size_t i = 0; i < _nplots; i++) {
+ delete[] _dataTimeDomainPoints[i];
+ }
+}
+
+const std::vector<double*>
+TimeUpdateEvent::getTimeDomainPoints() const
+{
+ return _dataTimeDomainPoints;
+}
+
+uint64_t
+TimeUpdateEvent::getNumTimeDomainDataPoints() const
+{
+ return _numTimeDomainDataPoints;
+}
+
#endif /* SPECTRUM_UPDATE_EVENTS_C */
diff --git a/gr-qtgui/lib/spectrumUpdateEvents.h b/gr-qtgui/lib/spectrumUpdateEvents.h
index ccc072c3e..a5e359a4c 100644
--- a/gr-qtgui/lib/spectrumUpdateEvents.h
+++ b/gr-qtgui/lib/spectrumUpdateEvents.h
@@ -5,6 +5,7 @@
#include <QEvent>
#include <QString>
#include <complex>
+#include <vector>
#include <highResTimeFunctions.h>
class SpectrumUpdateEvent:public QEvent{
@@ -89,4 +90,27 @@ private:
};
+class TimeUpdateEvent: public QEvent
+{
+public:
+ TimeUpdateEvent(const std::vector<double*> timeDomainPoints,
+ const uint64_t numTimeDomainDataPoints);
+
+ ~TimeUpdateEvent();
+
+ int which() const;
+ const std::vector<double*> getTimeDomainPoints() const;
+ uint64_t getNumTimeDomainDataPoints() const;
+ timespec getDataTimestamp() const;
+ bool getRepeatDataFlag() const;
+
+protected:
+
+private:
+ size_t _nplots;
+ std::vector<double*> _dataTimeDomainPoints;
+ uint64_t _numTimeDomainDataPoints;
+};
+
+
#endif /* SPECTRUM_UPDATE_EVENTS_H */
diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc
index 238c9889f..991f51f47 100644
--- a/gr-qtgui/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/lib/spectrumdisplayform.cc
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#include <cmath>
#include <QColorDialog>
#include <QMessageBox>
@@ -14,13 +36,16 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
_frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame);
_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame);
- _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame);
+ _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame);
_constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame);
_numRealDataPoints = 1024;
_realFFTDataPoints = new double[_numRealDataPoints];
_averagedValues = new double[_numRealDataPoints];
_historyVector = new std::vector<double*>;
+ _timeDomainDisplayPlot->setTitle(0, "real");
+ _timeDomainDisplayPlot->setTitle(1, "imag");
+
AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500
MinHoldCheckBox_toggled( false );
MaxHoldCheckBox_toggled( false );
@@ -119,13 +144,17 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate
//_lastSpectrumEvent = (SpectrumUpdateEvent)(*spectrumUpdateEvent);
const std::complex<float>* complexDataPoints = spectrumUpdateEvent->getFFTPoints();
const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints();
- const double* realTimeDomainDataPoints = spectrumUpdateEvent->getRealTimeDomainPoints();
- const double* imagTimeDomainDataPoints = spectrumUpdateEvent->getImagTimeDomainPoints();
const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints();
const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp();
const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag();
const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag();
const timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp();
+ double* realTimeDomainDataPoints = (double*)spectrumUpdateEvent->getRealTimeDomainPoints();
+ double* imagTimeDomainDataPoints = (double*)spectrumUpdateEvent->getImagTimeDomainPoints();
+
+ std::vector<double*> timeDomainDataPoints;
+ timeDomainDataPoints.push_back(realTimeDomainDataPoints);
+ timeDomainDataPoints.push_back(imagTimeDomainDataPoints);
// REMEMBER: The dataTimestamp is NOT valid when the repeat data flag is true...
ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints);
@@ -210,11 +239,10 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate
_peakAmplitude, d_update_time);
}
if(tabindex == d_plot_time) {
- _timeDomainDisplayPlot->PlotNewData(realTimeDomainDataPoints,
- imagTimeDomainDataPoints,
+ _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints,
numTimeDomainDataPoints,
d_update_time);
- }
+ }
if(tabindex == d_plot_constellation) {
_constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints,
imagTimeDomainDataPoints,
@@ -673,7 +701,7 @@ SpectrumDisplayForm::ToggleTabConstellation(const bool state)
void
SpectrumDisplayForm::SetTimeDomainAxis(double min, double max)
{
- _timeDomainDisplayPlot->set_yaxis(min, max);
+ _timeDomainDisplayPlot->setYaxis(min, max);
}
void
diff --git a/gr-qtgui/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h
index 860edf2d1..30303a36f 100644
--- a/gr-qtgui/lib/spectrumdisplayform.h
+++ b/gr-qtgui/lib/spectrumdisplayform.h
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef SPECTRUM_DISPLAY_FORM_H
#define SPECTRUM_DISPLAY_FORM_H
diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc
new file mode 100644
index 000000000..cc4ac9951
--- /dev/null
+++ b/gr-qtgui/lib/timedisplayform.cc
@@ -0,0 +1,177 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <cmath>
+#include <QColorDialog>
+#include <QMessageBox>
+#include <timedisplayform.h>
+#include <iostream>
+
+TimeDisplayForm::TimeDisplayForm(int nplots, QWidget* parent)
+ : QWidget(parent)
+{
+ _systemSpecifiedFlag = false;
+ _intValidator = new QIntValidator(this);
+ _intValidator->setBottom(0);
+
+ _layout = new QGridLayout(this);
+ _timeDomainDisplayPlot = new TimeDomainDisplayPlot(nplots, this);
+ _layout->addWidget(_timeDomainDisplayPlot, 0, 0);
+
+ _numRealDataPoints = 1024;
+
+ setLayout(_layout);
+
+ Reset();
+
+ // Create a timer to update plots at the specified rate
+ displayTimer = new QTimer(this);
+ connect(displayTimer, SIGNAL(timeout()), this, SLOT(updateGuiTimer()));
+
+ connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onTimePlotPointSelected(const QPointF)));
+}
+
+TimeDisplayForm::~TimeDisplayForm()
+{
+ // Qt deletes children when parent is deleted
+
+ // Don't worry about deleting Display Plots - they are deleted when parents are deleted
+ delete _intValidator;
+
+ displayTimer->stop();
+ delete displayTimer;
+}
+
+void
+TimeDisplayForm::newData( const TimeUpdateEvent* spectrumUpdateEvent)
+{
+ const std::vector<double*> timeDomainDataPoints = spectrumUpdateEvent->getTimeDomainPoints();
+ const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints();
+
+ _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints,
+ numTimeDomainDataPoints,
+ d_update_time);
+}
+
+void
+TimeDisplayForm::resizeEvent( QResizeEvent *e )
+{
+ QSize s = size();
+ emit _timeDomainDisplayPlot->resizeSlot(&s);
+}
+
+void
+TimeDisplayForm::customEvent( QEvent * e)
+{
+ if(e->type() == 10005) {
+ TimeUpdateEvent* timeUpdateEvent = (TimeUpdateEvent*)e;
+ newData(timeUpdateEvent);
+ }
+ //else if(e->type() == 10008){
+ //setWindowTitle(((SpectrumWindowCaptionEvent*)e)->getLabel());
+ //}
+ //else if(e->type() == 10009){
+ //Reset();
+ //if(_systemSpecifiedFlag){
+ // _system->ResetPendingGUIUpdateEvents();
+ //}
+ //}
+}
+
+void
+TimeDisplayForm::updateGuiTimer()
+{
+ _timeDomainDisplayPlot->canvas()->update();
+}
+
+void
+TimeDisplayForm::onTimePlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 3);
+}
+
+void
+TimeDisplayForm::setFrequencyRange(const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency)
+{
+ double fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency));
+
+ if(fdiff > 0) {
+ std::string strtime[4] = {"sec", "ms", "us", "ns"};
+ double units10 = floor(log10(fdiff));
+ double units3 = std::max(floor(units10 / 3.0), 0.0);
+ double units = pow(10, (units10-fmod(units10, 3.0)));
+ int iunit = static_cast<int>(units3);
+
+ _startFrequency = newStartFrequency;
+ _stopFrequency = newStopFrequency;
+
+ _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency,
+ units, strtime[iunit]);
+ }
+}
+
+void
+TimeDisplayForm::Reset()
+{
+}
+
+
+void
+TimeDisplayForm::closeEvent( QCloseEvent *e )
+{
+ //if(_systemSpecifiedFlag){
+ // _system->SetWindowOpenFlag(false);
+ //}
+
+ qApp->processEvents();
+
+ QWidget::closeEvent(e);
+}
+
+void
+TimeDisplayForm::setTimeDomainAxis(double min, double max)
+{
+ _timeDomainDisplayPlot->setYaxis(min, max);
+}
+
+void
+TimeDisplayForm::setUpdateTime(double t)
+{
+ d_update_time = t;
+ // QTimer class takes millisecond input
+ displayTimer->start(d_update_time*1000);
+}
+
+void
+TimeDisplayForm::setTitle(int which, QString title)
+{
+ _timeDomainDisplayPlot->setTitle(which, title);
+}
+
+void
+TimeDisplayForm::setColor(int which, QString color)
+{
+ _timeDomainDisplayPlot->setColor(which, color);
+}
diff --git a/gr-qtgui/lib/timedisplayform.h b/gr-qtgui/lib/timedisplayform.h
new file mode 100644
index 000000000..1216a1ef5
--- /dev/null
+++ b/gr-qtgui/lib/timedisplayform.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TIME_DISPLAY_FORM_H
+#define TIME_DISPLAY_FORM_H
+
+#include <spectrumUpdateEvents.h>
+#include <FrequencyDisplayPlot.h>
+#include <WaterfallDisplayPlot.h>
+#include <TimeDomainDisplayPlot.h>
+#include <ConstellationDisplayPlot.h>
+#include <QtGui/QApplication>
+#include <QtGui/QGridLayout>
+#include <QValidator>
+#include <QTimer>
+#include <vector>
+
+class TimeDisplayForm : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ TimeDisplayForm(int nplots=1, QWidget* parent = 0);
+ ~TimeDisplayForm();
+
+ void Reset();
+
+public slots:
+ void resizeEvent( QResizeEvent * e );
+ void customEvent( QEvent * e );
+ void setFrequencyRange( const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency );
+ void closeEvent( QCloseEvent * e );
+
+ void setTimeDomainAxis(double min, double max);
+
+ void setUpdateTime(double t);
+
+ void setTitle(int which, QString title);
+ void setColor(int which, QString color);
+
+private slots:
+ void newData( const TimeUpdateEvent* );
+ void updateGuiTimer();
+
+ void onTimePlotPointSelected(const QPointF p);
+
+signals:
+ void plotPointSelected(const QPointF p, int type);
+
+private:
+ uint64_t _numRealDataPoints;
+ QIntValidator* _intValidator;
+
+ QGridLayout *_layout;
+ TimeDomainDisplayPlot* _timeDomainDisplayPlot;
+ bool _systemSpecifiedFlag;
+ double _startFrequency;
+ double _stopFrequency;
+
+ QTimer *displayTimer;
+ double d_update_time;
+};
+
+#endif /* TIME_DISPLAY_FORM_H */
diff --git a/gr-qtgui/swig/Makefile.am b/gr-qtgui/swig/Makefile.am
index 8c695ba5b..1d8319987 100644
--- a/gr-qtgui/swig/Makefile.am
+++ b/gr-qtgui/swig/Makefile.am
@@ -51,4 +51,7 @@ qtgui_swig_la_swig_libadd = \
# additional SWIG files to be installed
qtgui_swig_swiginclude_headers = \
- qtgui.i
+ qtgui_sink_c.i \
+ qtgui_sink_f.i \
+ qtgui_time_sink_c.i \
+ qtgui_time_sink_f.i
diff --git a/gr-qtgui/swig/qtgui.i b/gr-qtgui/swig/qtgui_sink_c.i
index 77c6ccdd7..ff6241482 100644
--- a/gr-qtgui/swig/qtgui.i
+++ b/gr-qtgui/swig/qtgui_sink_c.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2009 Free Software Foundation, Inc.
+ * Copyright 2008,2009,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,7 +24,6 @@
%{
#include <qtgui_sink_c.h>
-#include <qtgui_sink_f.h>
%}
GR_SWIG_BLOCK_MAGIC(qtgui,sink_c)
@@ -65,47 +64,3 @@ public:
void set_constellation_pen_size(int size);
void set_update_time(double t);
};
-
-
-
-/*********************************************************************/
-
-
-GR_SWIG_BLOCK_MAGIC(qtgui,sink_f)
-
-qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
- double fc=0, double bw=0.0,
- const std::string &name="Display",
- bool plotfreq=true, bool plotwaterfall=true,
- bool plottime=true, bool plotconst=true,
- QWidget *parent=NULL);
-
-class qtgui_sink_f : public gr_block
-{
-private:
- friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- bool plotfreq, bool plotwaterfall,
- bool plottime, bool plotconst,
- QWidget *parent);
- qtgui_sink_f (int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- bool plotfreq, bool plotwaterfall,
- bool plottime, bool plotconst,
- QWidget *parent);
-
-public:
- void exec_();
- PyObject* pyqwidget();
-
- void set_frequency_range(const double centerfreq,
- const double bandwidth);
- void set_time_domain_axis(double min, double max);
- void set_constellation_axis(double xmin, double xmax,
- double ymin, double ymax);
- void set_frequency_axis(double min, double max);
- void set_constellation_pen_size(int size);
- void set_update_time(double t);
-};
diff --git a/gr-qtgui/swig/qtgui_sink_f.i b/gr-qtgui/swig/qtgui_sink_f.i
new file mode 100644
index 000000000..c5eb656b9
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_sink_f.i
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_sink_f.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(qtgui,sink_f)
+
+qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+ double fc=0, double bw=0.0,
+ const std::string &name="Display",
+ bool plotfreq=true, bool plotwaterfall=true,
+ bool plottime=true, bool plotconst=true,
+ QWidget *parent=NULL);
+
+class qtgui_sink_f : public gr_block
+{
+private:
+ friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+ qtgui_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+
+public:
+ void exec_();
+ PyObject* pyqwidget();
+
+ void set_frequency_range(const double centerfreq,
+ const double bandwidth);
+ void set_time_domain_axis(double min, double max);
+ void set_constellation_axis(double xmin, double xmax,
+ double ymin, double ymax);
+ void set_frequency_axis(double min, double max);
+ void set_constellation_pen_size(int size);
+ void set_update_time(double t);
+};
diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i
index c250cdd04..5a4ffd6fb 100644
--- a/gr-qtgui/swig/qtgui_swig.i
+++ b/gr-qtgui/swig/qtgui_swig.i
@@ -25,8 +25,11 @@
%{
#include <qtgui_sink_c.h>
#include <qtgui_sink_f.h>
+#include <qtgui_time_sink_c.h>
+#include <qtgui_time_sink_f.h>
%}
-%include "qtgui.i"
-
-
+%include "qtgui_sink_c.i"
+%include "qtgui_sink_f.i"
+%include "qtgui_time_sink_c.i"
+%include "qtgui_time_sink_f.i"
diff --git a/gr-qtgui/swig/qtgui_time_sink_c.i b/gr-qtgui/swig/qtgui_time_sink_c.i
new file mode 100644
index 000000000..8f5c9f4f0
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_time_sink_c.i
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_time_sink_c.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(qtgui,time_sink_c)
+
+qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections=1,
+ QWidget *parent=NULL);
+
+class qtgui_time_sink_c : public gr_block
+{
+private:
+ friend qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+public:
+ void exec_();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+};
diff --git a/gr-qtgui/swig/qtgui_time_sink_f.i b/gr-qtgui/swig/qtgui_time_sink_f.i
new file mode 100644
index 000000000..b92efe7be
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_time_sink_f.i
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_time_sink_f.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(qtgui,time_sink_f)
+
+qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections=1,
+ QWidget *parent=NULL);
+
+class qtgui_time_sink_f : public gr_block
+{
+private:
+ friend qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+public:
+ void exec_();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+};
diff --git a/gr-uhd/Makefile.am b/gr-uhd/Makefile.am
index 2e2d0fbe9..f9473bea3 100644
--- a/gr-uhd/Makefile.am
+++ b/gr-uhd/Makefile.am
@@ -27,3 +27,5 @@ if PYTHON
SUBDIRS += swig grc
endif
+pkgconfigdir = $(libdir)/pkgconfig
+dist_pkgconfig_DATA = gnuradio-uhd.pc
diff --git a/gr-uhd/gnuradio-uhd.pc.in b/gr-uhd/gnuradio-uhd.pc.in
new file mode 100644
index 000000000..383ad6011
--- /dev/null
+++ b/gr-uhd/gnuradio-uhd.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-qtgui
+Description: GNU Radio blocks for UHD
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-uhd
+Cflags: -I${includedir}
diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h
index 0475957de..320d07d41 100644
--- a/gr-uhd/include/gr_uhd_usrp_sink.h
+++ b/gr-uhd/include/gr_uhd_usrp_sink.h
@@ -101,6 +101,14 @@ public:
virtual void set_gain(double gain, size_t chan = 0) = 0;
/*!
+ * Set the named gain on the dboard.
+ * \param gain the gain in dB
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_gain(double gain, const std::string &name, size_t chan = 0) = 0;
+
+ /*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
@@ -108,6 +116,22 @@ public:
virtual double get_gain(size_t chan = 0) = 0;
/*!
+ * Get the actual dboard gain setting of named stage.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual double get_gain(const std::string &name, size_t chan = 0) = 0;
+
+ /*!
+ * Get the actual dboard gain setting of named stage.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0;
+
+ /*!
* Get the settable gain range.
* \param chan the channel index 0 to N-1
* \return the gain range in dB
@@ -115,6 +139,14 @@ public:
virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0;
/*!
+ * Get the settable gain range.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(const std::string &name, size_t chan = 0) = 0;
+
+ /*!
* Set the antenna to use.
* \param ant the antenna string
* \param chan the channel index 0 to N-1
diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h
index 038f9a91e..36331f782 100644
--- a/gr-uhd/include/gr_uhd_usrp_source.h
+++ b/gr-uhd/include/gr_uhd_usrp_source.h
@@ -101,6 +101,14 @@ public:
virtual void set_gain(double gain, size_t chan = 0) = 0;
/*!
+ * Set the named gain on the dboard.
+ * \param gain the gain in dB
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_gain(double gain, const std::string &name, size_t chan = 0) = 0;
+
+ /*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
@@ -108,6 +116,22 @@ public:
virtual double get_gain(size_t chan = 0) = 0;
/*!
+ * Get the actual dboard gain setting of named stage.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual double get_gain(const std::string &name, size_t chan = 0) = 0;
+
+ /*!
+ * Get the actual dboard gain setting of named stage.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0;
+
+ /*!
* Get the settable gain range.
* \param chan the channel index 0 to N-1
* \return the gain range in dB
@@ -115,6 +139,14 @@ public:
virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0;
/*!
+ * Get the settable gain range.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(const std::string &name, size_t chan = 0) = 0;
+
+ /*!
* Set the antenna to use.
* \param ant the antenna string
* \param chan the channel index 0 to N-1
diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc
index d44af25ab..ce9d89d8d 100644
--- a/gr-uhd/lib/gr_uhd_usrp_sink.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc
@@ -76,14 +76,30 @@ public:
return _dev->set_tx_gain(gain, chan);
}
+ void set_gain(double gain, const std::string &name, size_t chan){
+ return _dev->set_tx_gain(gain, name, chan);
+ }
+
double get_gain(size_t chan){
return _dev->get_tx_gain(chan);
}
+ double get_gain(const std::string &name, size_t chan){
+ return _dev->get_tx_gain(name, chan);
+ }
+
+ std::vector<std::string> get_gain_names(size_t chan){
+ return _dev->get_tx_gain_names(chan);
+ }
+
uhd::gain_range_t get_gain_range(size_t chan){
return _dev->get_tx_gain_range(chan);
}
+ uhd::gain_range_t get_gain_range(const std::string &name, size_t chan){
+ return _dev->get_tx_gain_range(name, chan);
+ }
+
void set_antenna(const std::string &ant, size_t chan){
return _dev->set_tx_antenna(ant, chan);
}
diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc
index fed8e6624..9983489c3 100644
--- a/gr-uhd/lib/gr_uhd_usrp_source.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_source.cc
@@ -78,14 +78,30 @@ public:
return _dev->set_rx_gain(gain, chan);
}
+ void set_gain(double gain, const std::string &name, size_t chan){
+ return _dev->set_rx_gain(gain, name, chan);
+ }
+
double get_gain(size_t chan){
return _dev->get_rx_gain(chan);
}
+ double get_gain(const std::string &name, size_t chan){
+ return _dev->get_rx_gain(name, chan);
+ }
+
+ std::vector<std::string> get_gain_names(size_t chan){
+ return _dev->get_rx_gain_names(chan);
+ }
+
uhd::gain_range_t get_gain_range(size_t chan){
return _dev->get_rx_gain_range(chan);
}
+ uhd::gain_range_t get_gain_range(const std::string &name, size_t chan){
+ return _dev->get_rx_gain_range(name, chan);
+ }
+
void set_antenna(const std::string &ant, size_t chan){
return _dev->set_rx_antenna(ant, chan);
}
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i
index 3ffcc7aea..9bdb962c9 100644
--- a/gr-uhd/swig/uhd_swig.i
+++ b/gr-uhd/swig/uhd_swig.i
@@ -100,6 +100,7 @@
////////////////////////////////////////////////////////////////////////
%include stdint.i
%include <uhd/types/serial.hpp>
+%template(byte_vector_t) std::vector<uint8_t>;
%include <uhd/usrp/dboard_iface.hpp>
%template(dboard_iface_sptr) boost::shared_ptr<uhd::usrp::dboard_iface>;
@@ -129,6 +130,6 @@ static const size_t ALL_MBOARDS;
%goops %{
(use-modules (gnuradio gnuradio_core_runtime))
%}
-#endif /* SWIGGUILE */
+#endif /* SWIGGUILE */
#endif /* GR_HAVE_UHD */
diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py
index b2d406bbd..89a169355 100644
--- a/grc/python/FlowGraph.py
+++ b/grc/python/FlowGraph.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008, 2009 Free Software Foundation, Inc.
+Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -48,15 +48,16 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
#return from cache
return self._eval_cache[my_hash]
- def _get_io_signaturev(self, pad_key):
+ def get_io_signaturev(self, direction):
"""
Get a list of io signatures for this flow graph.
- The pad key determines the directionality of the io signature.
- @param pad_key a string of pad_source or pad_sink
+ @param direction a string of 'in' or 'out'
@return a list of dicts with: type, label, vlen, size
"""
- pads = filter(lambda b: b.get_key() == pad_key, self.get_enabled_blocks())
- sorted_pads = sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
+ sorted_pads = {
+ 'in': self.get_pad_sources(),
+ 'out': self.get_pad_sinks(),
+ }[direction]
#load io signature
return [{
'label': str(pad.get_param('label').get_evaluated()),
@@ -65,19 +66,21 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
'size': pad.get_param('type').get_opt('size'),
} for pad in sorted_pads]
- def get_input_signaturev(self):
+ def get_pad_sources(self):
"""
- Get the io signature for the input side of this flow graph.
- @return a list of io signature structures
+ Get a list of pad source blocks sorted by id order.
+ @return a list of pad source blocks in this flow graph
"""
- return self._get_io_signaturev('pad_source')
+ pads = filter(lambda b: b.get_key() == 'pad_source', self.get_enabled_blocks())
+ return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
- def get_output_signaturev(self):
+ def get_pad_sinks(self):
"""
- Get the io signature for the output side of this flow graph.
- @return a list of io signature structures
+ Get a list of pad sink blocks sorted by id order.
+ @return a list of pad sink blocks in this flow graph
"""
- return self._get_io_signaturev('pad_sink')
+ pads = filter(lambda b: b.get_key() == 'pad_sink', self.get_enabled_blocks())
+ return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
def get_imports(self):
"""
diff --git a/grc/python/convert_hier.py b/grc/python/convert_hier.py
index befddccea..c6ca5b769 100644
--- a/grc/python/convert_hier.py
+++ b/grc/python/convert_hier.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008 Free Software Foundation, Inc.
+Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -23,11 +23,11 @@ from .. base import odict
def convert_hier(flow_graph, python_file):
#extract info from the flow graph
- input_sigs = flow_graph.get_input_signaturev()
- output_sigs = flow_graph.get_output_signaturev()
+ input_sigs = flow_graph.get_io_signaturev('in')
+ output_sigs = flow_graph.get_io_signaturev('out')
parameters = flow_graph.get_parameters()
block_key = flow_graph.get_option('id')
- block_name = flow_graph.get_option('title')
+ block_name = flow_graph.get_option('title') or flow_graph.get_option('id').replace('_', ' ').title()
block_category = flow_graph.get_option('category')
block_desc = flow_graph.get_option('description')
block_author = flow_graph.get_option('author')
@@ -56,19 +56,21 @@ def convert_hier(flow_graph, python_file):
params_n.append(param_n)
block_n['param'] = params_n
#sink data
+ block_n['sink'] = list()
for input_sig in input_sigs:
sink_n = odict()
sink_n['name'] = input_sig['label']
sink_n['type'] = input_sig['type']
sink_n['vlen'] = input_sig['vlen']
- block_n['sink'] = sink_n
+ block_n['sink'].append(sink_n)
#source data
+ block_n['source'] = list()
for output_sig in output_sigs:
source_n = odict()
source_n['name'] = output_sig['label']
source_n['type'] = output_sig['type']
source_n['vlen'] = output_sig['vlen']
- block_n['source'] = source_n
+ block_n['source'].append(source_n)
#doc data
block_n['doc'] = "%s\n%s\n%s"%(block_author, block_desc, python_file)
#write the block_n to file
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 7a74cf84c..d5e53b52b 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -74,8 +74,8 @@ class $(class_name)(gr.top_block):
def __init__($param_str):
gr.top_block.__init__(self, "$title")
#elif $generate_options == 'hb'
- #set $in_sigs = $flow_graph.get_input_signaturev()
- #set $out_sigs = $flow_graph.get_output_signaturev()
+ #set $in_sigs = $flow_graph.get_io_signaturev('in')
+ #set $out_sigs = $flow_graph.get_io_signaturev('out')
class $(class_name)(gr.hier_block2):
#def make_io_sig($io_sigs)
#set $size_strs = ['%s*%s'%(io_sig['size'], io_sig['vlen']) for io_sig in $io_sigs]
@@ -153,11 +153,13 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))])
## The port name should be the id of the parent block.
## However, port names for IO pads should be self.
########################################################
-#def make_port_name($port)
- #if $port.get_parent().get_key().startswith('pad_')
-self#slurp
+#def make_port_sig($port)
+ #if $port.get_parent().get_key() == 'pad_source'
+(self, $flow_graph.get_pad_sources().index($port.get_parent()))#slurp
+ #elif $port.get_parent().get_key() == 'pad_sink'
+(self, $flow_graph.get_pad_sinks().index($port.get_parent()))#slurp
#else
-self.$port.get_parent().get_id()#slurp
+(self.$port.get_parent().get_id(), $port.get_key())#slurp
#end if
#end def
#if $connections
@@ -175,7 +177,7 @@ self.$port.get_parent().get_id()#slurp
#end if
##do not generate connections with virtual sinks
#if not $sink.get_parent().is_virtual_sink()
- self.connect(($make_port_name($source), $source.get_key()), ($make_port_name($sink), $sink.get_key()))
+ self.connect($make_port_sig($source), $make_port_sig($sink))
#end if
#end for