summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-qtgui/CMakeLists.txt5
-rwxr-xr-xgr-qtgui/examples/pyqt_const_c.py172
-rwxr-xr-xgr-qtgui/examples/pyqt_freq_c.py2
-rwxr-xr-xgr-qtgui/examples/pyqt_waterfall_c.py175
-rwxr-xr-xgr-qtgui/examples/pyqt_waterfall_f.py174
-rw-r--r--gr-qtgui/include/qtgui/CMakeLists.txt (renamed from gr-qtgui/include/CMakeLists.txt)26
-rw-r--r--gr-qtgui/include/qtgui/api.h (renamed from gr-qtgui/include/gr_qtgui_api.h)10
-rw-r--r--gr-qtgui/include/qtgui/const_sink_c.h80
-rw-r--r--gr-qtgui/include/qtgui/freq_sink_c.h95
-rw-r--r--gr-qtgui/include/qtgui/freq_sink_f.h95
-rw-r--r--gr-qtgui/include/qtgui/qtgui_sink_c.h (renamed from gr-qtgui/include/qtgui_sink_c.h)0
-rw-r--r--gr-qtgui/include/qtgui/qtgui_sink_f.h (renamed from gr-qtgui/include/qtgui_sink_f.h)0
-rw-r--r--gr-qtgui/include/qtgui/time_sink_c.h86
-rw-r--r--gr-qtgui/include/qtgui/time_sink_f.h84
-rw-r--r--gr-qtgui/include/qtgui/utils.h (renamed from gr-qtgui/include/qtgui_util.h)14
-rw-r--r--gr-qtgui/include/qtgui/waterfall_sink_c.h94
-rw-r--r--gr-qtgui/include/qtgui/waterfall_sink_f.h93
-rw-r--r--gr-qtgui/include/qtgui_const_sink_c.h99
-rw-r--r--gr-qtgui/include/qtgui_freq_sink_c.h134
-rw-r--r--gr-qtgui/include/qtgui_freq_sink_f.h133
-rw-r--r--gr-qtgui/include/qtgui_time_sink_c.h101
-rw-r--r--gr-qtgui/include/qtgui_time_sink_f.h97
-rw-r--r--gr-qtgui/include/qtgui_waterfall_sink_c.h122
-rw-r--r--gr-qtgui/include/qtgui_waterfall_sink_f.h122
-rw-r--r--gr-qtgui/lib/CMakeLists.txt20
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.h1
-rw-r--r--gr-qtgui/lib/DisplayPlot.h2
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.h1
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.h1
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.h1
-rw-r--r--gr-qtgui/lib/const_sink_c_impl.cc233
-rw-r--r--gr-qtgui/lib/const_sink_c_impl.h81
-rw-r--r--gr-qtgui/lib/freq_sink_c_impl.cc371
-rw-r--r--gr-qtgui/lib/freq_sink_c_impl.h110
-rw-r--r--gr-qtgui/lib/freq_sink_f_impl.cc366
-rw-r--r--gr-qtgui/lib/freq_sink_f_impl.h110
-rw-r--r--gr-qtgui/lib/freqdisplayform.cc12
-rw-r--r--gr-qtgui/lib/freqdisplayform.h4
-rw-r--r--gr-qtgui/lib/qtgui_const_sink_c.cc214
-rw-r--r--gr-qtgui/lib/qtgui_freq_sink_c.cc345
-rw-r--r--gr-qtgui/lib/qtgui_freq_sink_f.cc336
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_c.cc215
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_f.cc205
-rw-r--r--gr-qtgui/lib/qtgui_util.cc2
-rw-r--r--gr-qtgui/lib/qtgui_waterfall_sink_c.cc304
-rw-r--r--gr-qtgui/lib/qtgui_waterfall_sink_f.cc298
-rw-r--r--gr-qtgui/lib/time_sink_c_impl.cc235
-rw-r--r--gr-qtgui/lib/time_sink_c_impl.h82
-rw-r--r--gr-qtgui/lib/time_sink_f_impl.cc233
-rw-r--r--gr-qtgui/lib/time_sink_f_impl.h82
-rw-r--r--gr-qtgui/lib/waterfall_sink_c_impl.cc354
-rw-r--r--gr-qtgui/lib/waterfall_sink_c_impl.h106
-rw-r--r--gr-qtgui/lib/waterfall_sink_f_impl.cc350
-rw-r--r--gr-qtgui/lib/waterfall_sink_f_impl.h107
-rw-r--r--gr-qtgui/lib/waterfalldisplayform.cc12
-rw-r--r--gr-qtgui/lib/waterfalldisplayform.h4
-rw-r--r--gr-qtgui/swig/CMakeLists.txt9
-rw-r--r--gr-qtgui/swig/qtgui_const_sink_c.i58
-rw-r--r--gr-qtgui/swig/qtgui_freq_sink_c.i57
-rw-r--r--gr-qtgui/swig/qtgui_freq_sink_f.i57
-rw-r--r--gr-qtgui/swig/qtgui_swig.i46
-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-qtgui/swig/qtgui_waterfall_sink_c.i51
-rw-r--r--gr-qtgui/swig/qtgui_waterfall_sink_f.i51
65 files changed, 4071 insertions, 3180 deletions
diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txt
index 1f69b2f821..ca23aabb77 100644
--- a/gr-qtgui/CMakeLists.txt
+++ b/gr-qtgui/CMakeLists.txt
@@ -46,8 +46,11 @@ GR_REGISTER_COMPONENT("gr-qtgui" ENABLE_GR_QTGUI
Boost_FOUND
QT4_FOUND
QWT_FOUND
+ ENABLE_GRUEL
+ ENABLE_VOLK
ENABLE_GR_CORE
ENABLE_GR_FFT
+ ENABLE_GR_FILTER
PYTHONLIBS_FOUND
${qt_gui_python_deps}
)
@@ -104,7 +107,7 @@ CPACK_COMPONENT("qtgui_swig"
########################################################################
# Add subdirectories
########################################################################
-add_subdirectory(include)
+add_subdirectory(include/qtgui)
add_subdirectory(lib)
add_subdirectory(doc)
if(ENABLE_PYTHON)
diff --git a/gr-qtgui/examples/pyqt_const_c.py b/gr-qtgui/examples/pyqt_const_c.py
new file mode 100755
index 0000000000..e3cc3e527e
--- /dev/null
+++ b/gr-qtgui/examples/pyqt_const_c.py
@@ -0,0 +1,172 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+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.5, 0)
+ src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.5, 0)
+ src = gr.add_cc()
+ channel = gr.channel_model(0.001)
+ thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ self.snk1 = qtgui.const_sink_c(npts, "Constellation Example", 1)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, channel, thr, (self.snk1, 0))
+
+ 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)
+
+ 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/examples/pyqt_freq_c.py b/gr-qtgui/examples/pyqt_freq_c.py
index 25cd43e09f..0422046204 100755
--- a/gr-qtgui/examples/pyqt_freq_c.py
+++ b/gr-qtgui/examples/pyqt_freq_c.py
@@ -146,7 +146,7 @@ class my_top_block(gr.top_block):
thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
self.snk1 = qtgui.freq_sink_c(npts, gr.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
- "Complex Freq Example", 2)
+ "Complex Freq Example", 3)
self.connect(src1, (src,0))
self.connect(src2, (src,1))
diff --git a/gr-qtgui/examples/pyqt_waterfall_c.py b/gr-qtgui/examples/pyqt_waterfall_c.py
new file mode 100755
index 0000000000..2daf40a8db
--- /dev/null
+++ b/gr-qtgui/examples/pyqt_waterfall_c.py
@@ -0,0 +1,175 @@
+#!/usr/bin/env python
+#
+# Copyright 2012 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+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.waterfall_sink_c(npts, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, Rs,
+ "Complex Waterfall Example", 1)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, channel, thr, (self.snk1, 0))
+
+ 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)
+
+ #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/examples/pyqt_waterfall_f.py b/gr-qtgui/examples/pyqt_waterfall_f.py
new file mode 100755
index 0000000000..7de0c1b3d7
--- /dev/null
+++ b/gr-qtgui/examples/pyqt_waterfall_f.py
@@ -0,0 +1,174 @@
+#!/usr/bin/env python
+#
+# Copyright 2012 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+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)
+ self.snk1 = qtgui.waterfall_sink_f(npts, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, Rs,
+ "Real Waterfall Example", 1)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, thr, (self.snk1, 0))
+
+ 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)
+
+ #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/include/CMakeLists.txt b/gr-qtgui/include/qtgui/CMakeLists.txt
index 68c33a6a50..b2a979fa3c 100644
--- a/gr-qtgui/include/CMakeLists.txt
+++ b/gr-qtgui/include/qtgui/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,17 +21,17 @@
# Install the header files
########################################################################
install(FILES
- gr_qtgui_api.h
- qtgui_time_sink_c.h
- qtgui_time_sink_f.h
- qtgui_freq_sink_c.h
- qtgui_freq_sink_f.h
- qtgui_const_sink_c.h
- qtgui_waterfall_sink_c.h
- qtgui_waterfall_sink_f.h
- qtgui_sink_c.h
- qtgui_sink_f.h
- qtgui_util.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ api.h
+ time_sink_c.h
+ time_sink_f.h
+ freq_sink_c.h
+ freq_sink_f.h
+ const_sink_c.h
+# qtgui_waterfall_sink_c.h
+# qtgui_waterfall_sink_f.h
+# qtgui_sink_c.h
+# qtgui_sink_f.h
+ utils.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/qtgui
COMPONENT "qtgui_devel"
)
diff --git a/gr-qtgui/include/gr_qtgui_api.h b/gr-qtgui/include/qtgui/api.h
index c39add1e82..e88948e07b 100644
--- a/gr-qtgui/include/gr_qtgui_api.h
+++ b/gr-qtgui/include/qtgui/api.h
@@ -19,15 +19,15 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_GR_QTGUI_API_H
-#define INCLUDED_GR_QTGUI_API_H
+#ifndef INCLUDED_QTGUI_API_H
+#define INCLUDED_QTGUI_API_H
#include <gruel/attributes.h>
#ifdef gnuradio_qtgui_EXPORTS
-# define GR_QTGUI_API __GR_ATTR_EXPORT
+# define QTGUI_API __GR_ATTR_EXPORT
#else
-# define GR_QTGUI_API __GR_ATTR_IMPORT
+# define QTGUI_API __GR_ATTR_IMPORT
#endif
-#endif /* INCLUDED_GR_QTGUI_API_H */
+#endif /* INCLUDED_QTGUI_API_H */
diff --git a/gr-qtgui/include/qtgui/const_sink_c.h b/gr-qtgui/include/qtgui/const_sink_c.h
new file mode 100644
index 0000000000..1236e18b49
--- /dev/null
+++ b/gr-qtgui/include/qtgui/const_sink_c.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_CONST_SINK_C_H
+#define INCLUDED_QTGUI_CONST_SINK_C_H
+
+#include <qtgui/api.h>
+#include <gr_sync_block.h>
+
+#include <Python.h>
+#include <qapplication.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display the IQ constellation of multiple signals.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a complex
+ * streams and plots them on an IQ constellation plot.
+ */
+ class QTGUI_API const_sink_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::qtgui::const_sink_c::sptr
+ typedef boost::shared_ptr<const_sink_c> sptr;
+
+ /*!
+ * \brief Build a complex PSD sink.
+ *
+ * \param size number of points to plot at once
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(int size,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ virtual void exec_() = 0;
+ virtual PyObject* pyqwidget() = 0;
+
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(int which, const std::string &title) = 0;
+ virtual void set_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_CONST_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui/freq_sink_c.h b/gr-qtgui/include/qtgui/freq_sink_c.h
new file mode 100644
index 0000000000..a90a6d3201
--- /dev/null
+++ b/gr-qtgui/include/qtgui/freq_sink_c.h
@@ -0,0 +1,95 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_FREQ_SINK_C_H
+#define INCLUDED_QTGUI_FREQ_SINK_C_H
+
+#include <qtgui/api.h>
+#include <gr_sync_block.h>
+
+#include <Python.h>
+#include <qapplication.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display multiple signals in frequency.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a complex
+ * streams and plots the PSD. Each signal is plotted with a
+ * different color, and the \a set_title and \a set_color
+ * functions can be used to change the lable and color for a given
+ * input number.
+ */
+ class QTGUI_API freq_sink_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::qtgui::freq_sink_c::sptr
+ typedef boost::shared_ptr<freq_sink_c> sptr;
+
+ /*!
+ * \brief Build a complex PSD sink.
+ *
+ * \param size size of the FFT to compute and display
+ * \param wintype (type of window to appy; see filter/firdes.h)
+ * \param fc center frequency of signal (use for x-axis labels)
+ * \param bw bandwidth of signal (used to set x-axis labels)
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ virtual void exec_() = 0;
+ virtual PyObject* pyqwidget() = 0;
+
+ virtual void set_fft_size(const int fftsize) = 0;
+ virtual int fft_size() const = 0;
+ virtual void set_fft_average(const float fftavg) = 0;
+ virtual float fft_average() const = 0;
+
+ virtual void set_frequency_range(const double centerfreq, const double bandwidth) = 0;
+ virtual void set_fft_power_db(double min, double max) = 0;
+
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(int which, const std::string &title) = 0;
+ virtual void set_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_FREQ_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui/freq_sink_f.h b/gr-qtgui/include/qtgui/freq_sink_f.h
new file mode 100644
index 0000000000..98bd3de9a3
--- /dev/null
+++ b/gr-qtgui/include/qtgui/freq_sink_f.h
@@ -0,0 +1,95 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_FREQ_SINK_F_H
+#define INCLUDED_QTGUI_FREQ_SINK_F_H
+
+#include <qtgui/api.h>
+#include <gr_sync_block.h>
+
+#include <Python.h>
+#include <qapplication.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display multiple signals in frequency.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a floating
+ * point streams and plots the PSD. Each signal is plotted with a
+ * different color, and the \a set_title and \a set_color
+ * functions can be used to change the lable and color for a given
+ * input number.
+ */
+ class QTGUI_API freq_sink_f : virtual public gr_sync_block
+ {
+ public:
+ // gr::qtgui::freq_sink_f::sptr
+ typedef boost::shared_ptr<freq_sink_f> sptr;
+
+ /*!
+ * \brief Build a floating point PSD sink.
+ *
+ * \param size size of the FFT to compute and display
+ * \param wintype (type of window to appy; see filter/firdes.h)
+ * \param fc center frequency of signal (use for x-axis labels)
+ * \param bw bandwidth of signal (used to set x-axis labels)
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ virtual void exec_() = 0;
+ virtual PyObject* pyqwidget() = 0;
+
+ virtual void set_fft_size(const int fftsize) = 0;
+ virtual int fft_size() const = 0;
+ virtual void set_fft_average(const float fftavg) = 0;
+ virtual float fft_average() const = 0;
+
+ virtual void set_frequency_range(const double centerfreq, const double bandwidth) = 0;
+ virtual void set_fft_power_db(double min, double max) = 0;
+
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(int which, const std::string &title) = 0;
+ virtual void set_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_FREQ_SINK_F_H */
diff --git a/gr-qtgui/include/qtgui_sink_c.h b/gr-qtgui/include/qtgui/qtgui_sink_c.h
index 2d3279f401..2d3279f401 100644
--- a/gr-qtgui/include/qtgui_sink_c.h
+++ b/gr-qtgui/include/qtgui/qtgui_sink_c.h
diff --git a/gr-qtgui/include/qtgui_sink_f.h b/gr-qtgui/include/qtgui/qtgui_sink_f.h
index ea49b11d34..ea49b11d34 100644
--- a/gr-qtgui/include/qtgui_sink_f.h
+++ b/gr-qtgui/include/qtgui/qtgui_sink_f.h
diff --git a/gr-qtgui/include/qtgui/time_sink_c.h b/gr-qtgui/include/qtgui/time_sink_c.h
new file mode 100644
index 0000000000..7b970e8ad3
--- /dev/null
+++ b/gr-qtgui/include/qtgui/time_sink_c.h
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 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 <qtgui/api.h>
+#include <gr_sync_block.h>
+
+#include <Python.h>
+#include <qapplication.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display multiple signals in time.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a complex
+ * streams and plots them in the time domain. For each signal, both
+ * the signal's I and Q parts are plotted, and they are all plotted
+ * with a different color, and the \a set_title and \a set_color
+ * functions can be used to change the lable and color for a given
+ * input number.
+ */
+ class QTGUI_API time_sink_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::qtgui::time_sink_c::sptr
+ typedef boost::shared_ptr<time_sink_c> sptr;
+
+ /*!
+ * \brief Build complex time sink
+ *
+ * \param size number of points to plot at once
+ * \param bw bandwidth of signal (used to set x-axis labels)
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ virtual void exec_() = 0;
+ virtual PyObject* pyqwidget() = 0;
+
+ virtual void set_time_domain_axis(double min, double max) = 0;
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(int which, const std::string &title) = 0;
+ virtual void set_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui/time_sink_f.h b/gr-qtgui/include/qtgui/time_sink_f.h
new file mode 100644
index 0000000000..5722fbacca
--- /dev/null
+++ b/gr-qtgui/include/qtgui/time_sink_f.h
@@ -0,0 +1,84 @@
+/* -*- 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 <qtgui/api.h>
+#include <gr_sync_block.h>
+
+#include <Python.h>
+#include <qapplication.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display multiple signals in time.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a float streams
+ * and plots them in the time domain. Each signal is plotted with a
+ * different color, and the \a set_title and \a set_color functions
+ * can be used to change the lable and color for a given input number.
+ */
+ class QTGUI_API time_sink_f : virtual public gr_sync_block
+ {
+ public:
+ // gr::qtgui::time_sink_f::sptr
+ typedef boost::shared_ptr<time_sink_f> sptr;
+
+ /*!
+ * \brief Build floating point time sink
+ *
+ * \param size number of points to plot at once
+ * \param bw bandwidth of signal (used to set x-axis labels)
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ virtual void exec_() = 0;
+ virtual PyObject* pyqwidget() = 0;
+
+ virtual void set_time_domain_axis(double min, double max) = 0;
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(int which, const std::string &title) = 0;
+ virtual void set_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_F_H */
diff --git a/gr-qtgui/include/qtgui_util.h b/gr-qtgui/include/qtgui/utils.h
index 1d91e7fd1f..f490c48567 100644
--- a/gr-qtgui/include/qtgui_util.h
+++ b/gr-qtgui/include/qtgui/utils.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2011 Free Software Foundation, Inc.
+ * Copyright 2011,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,15 +20,15 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_QTGUI_UTIL_H
-#define INCLUDED_QTGUI_UTIL_H
+#ifndef INCLUDED_QTGUI_UTILS_H
+#define INCLUDED_QTGUI_UTILS_H
#include <qevent.h>
-#include <gr_qtgui_api.h>
+#include <qtgui/api.h>
#include <qwt_plot_picker.h>
#include <qwt_picker_machine.h>
-class GR_QTGUI_API QwtDblClickPlotPicker: public QwtPlotPicker
+class QTGUI_API QwtDblClickPlotPicker: public QwtPlotPicker
{
public:
QwtDblClickPlotPicker(QwtPlotCanvas *);
@@ -37,7 +37,7 @@ public:
virtual QwtPickerMachine * stateMachine(int) const;
};
-class GR_QTGUI_API QwtPickerDblClickPointMachine: public QwtPickerMachine
+class QTGUI_API QwtPickerDblClickPointMachine: public QwtPickerMachine
{
public:
QwtPickerDblClickPointMachine();
@@ -52,4 +52,4 @@ public:
const QEvent *e);
};
-#endif /* INCLUDED_QTGUI_UTIL_H */
+#endif /* INCLUDED_QTGUI_UTILS_H */
diff --git a/gr-qtgui/include/qtgui/waterfall_sink_c.h b/gr-qtgui/include/qtgui/waterfall_sink_c.h
new file mode 100644
index 0000000000..6608dcf34b
--- /dev/null
+++ b/gr-qtgui/include/qtgui/waterfall_sink_c.h
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_WATERFALL_SINK_C_H
+#define INCLUDED_QTGUI_WATERFALL_SINK_C_H
+
+#include <qtgui/api.h>
+#include <gr_sync_block.h>
+
+#include <Python.h>
+#include <qapplication.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display multiple signals on a
+ * waterfall (spectrogram) plot.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a complex
+ * streams and plots a waterfall (spectrogram) plot.
+ */
+ class QTGUI_API waterfall_sink_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::qtgui::waterfall_sink_c::sptr
+ typedef boost::shared_ptr<waterfall_sink_c> sptr;
+
+
+ /*!
+ * \brief Build a complex waterfall sink.
+ *
+ * \param size size of the FFT to compute and display
+ * \param wintype (type of window to appy; see filter/firdes.h)
+ * \param fc center frequency of signal (use for x-axis labels)
+ * \param bw bandwidth of signal (used to set x-axis labels)
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(int size, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ virtual void exec_() = 0;
+ virtual PyObject* pyqwidget() = 0;
+
+ virtual void set_fft_size(const int fftsize) = 0;
+ virtual int fft_size() const = 0;
+ virtual void set_fft_average(const float fftavg) = 0;
+ virtual float fft_average() const = 0;
+
+ virtual void set_frequency_range(const double centerfreq,
+ const double bandwidth) = 0;
+
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(int which, const std::string &title) = 0;
+ virtual void set_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_WATERFALL_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui/waterfall_sink_f.h b/gr-qtgui/include/qtgui/waterfall_sink_f.h
new file mode 100644
index 0000000000..ed69828ab7
--- /dev/null
+++ b/gr-qtgui/include/qtgui/waterfall_sink_f.h
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_WATERFALL_SINK_F_H
+#define INCLUDED_QTGUI_WATERFALL_SINK_F_H
+
+#include <qtgui/api.h>
+#include <gr_sync_block.h>
+
+#include <Python.h>
+#include <qapplication.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display multiple signals on a
+ * waterfall (spectrogram) plot.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a floating
+ * point streams and plots a waterfall (spectrogram) plot.
+ */
+ class QTGUI_API waterfall_sink_f : virtual public gr_sync_block
+ {
+ public:
+ // gr::qtgui::waterfall_sink_f::sptr
+ typedef boost::shared_ptr<waterfall_sink_f> sptr;
+
+ /*!
+ * \brief Build a floating point waterfall sink.
+ *
+ * \param size size of the FFT to compute and display
+ * \param wintype (type of window to appy; see filter/firdes.h)
+ * \param fc center frequency of signal (use for x-axis labels)
+ * \param bw bandwidth of signal (used to set x-axis labels)
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(int size, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ virtual void exec_() = 0;
+ virtual PyObject* pyqwidget() = 0;
+
+ virtual void set_fft_size(const int fftsize) = 0;
+ virtual int fft_size() const = 0;
+ virtual void set_fft_average(const float fftavg) = 0;
+ virtual float fft_average() const = 0;
+
+ virtual void set_frequency_range(const double centerfreq,
+ const double bandwidth) = 0;
+
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(int which, const std::string &title) = 0;
+ virtual void set_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, Qt::PenStyle style) = 0;
+ virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_WATERFALL_SINK_F_H */
diff --git a/gr-qtgui/include/qtgui_const_sink_c.h b/gr-qtgui/include/qtgui_const_sink_c.h
deleted file mode 100644
index cb35245cf6..0000000000
--- a/gr-qtgui/include/qtgui_const_sink_c.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_CONST_SINK_C_H
-#define INCLUDED_QTGUI_CONST_SINK_C_H
-
-#include <Python.h>
-#include <gr_qtgui_api.h>
-#include <gr_sync_block.h>
-#include <gr_firdes.h>
-#include <gri_fft.h>
-#include <qapplication.h>
-#include <constellationdisplayform.h>
-
-class qtgui_const_sink_c;
-typedef boost::shared_ptr<qtgui_const_sink_c> qtgui_const_sink_c_sptr;
-
-GR_QTGUI_API qtgui_const_sink_c_sptr
-qtgui_make_const_sink_c(int size,
- const std::string &name,
- int nconnectons=1,
- QWidget *parent=NULL);
-
-/*!
- * \brief A graphical sink to display the IQ constellation of multiple signals.
- * \ingroup qtgui_blk
- *
- * This is a QT-based graphical sink the takes set of a complex
- * streams and plots them on an IQ constellation plot.
- */
-class GR_QTGUI_API qtgui_const_sink_c : public gr_sync_block
-{
-private:
- friend GR_QTGUI_API qtgui_const_sink_c_sptr
- qtgui_make_const_sink_c(int size,
- const std::string &name,
- int nconnections,
- QWidget *parent);
- qtgui_const_sink_c(int size,
- const std::string &name,
- int nconnections,
- QWidget *parent=NULL);
-
- void initialize();
-
- int d_size;
- std::string d_name;
- int d_nconnections;
-
- int d_index;
- std::vector<double*> d_residbufs_real;
- std::vector<double*> d_residbufs_imag;
-
- QWidget *d_parent;
- ConstellationDisplayForm *d_main_gui;
-
- gruel::high_res_timer_type d_update_time;
- gruel::high_res_timer_type d_current_time;
- gruel::high_res_timer_type d_last_time;
-
-public:
- ~qtgui_const_sink_c();
- void exec_();
- QWidget* qwidget();
- PyObject* pyqwidget();
-
- void set_update_time(double t);
- void set_title(int which, const std::string &title);
- void set_color(int which, const std::string &color);
-
- void set_resize(int width, int height);
-
- QApplication *d_qApplication;
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_QTGUI_CONST_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui_freq_sink_c.h b/gr-qtgui/include/qtgui_freq_sink_c.h
deleted file mode 100644
index fda185039d..0000000000
--- a/gr-qtgui/include/qtgui_freq_sink_c.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_FREQ_SINK_C_H
-#define INCLUDED_QTGUI_FREQ_SINK_C_H
-
-#include <Python.h>
-#include <gr_qtgui_api.h>
-#include <gr_sync_block.h>
-#include <gr_firdes.h>
-#include <fft/fft.h>
-#include <qapplication.h>
-#include <freqdisplayform.h>
-#include <gruel/thread.h>
-
-class qtgui_freq_sink_c;
-typedef boost::shared_ptr<qtgui_freq_sink_c> qtgui_freq_sink_c_sptr;
-
-GR_QTGUI_API qtgui_freq_sink_c_sptr
-qtgui_make_freq_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-/*!
- * \brief A graphical sink to display multiple signals in time.
- * \ingroup qtgui_blk
- *
- * This is a QT-based graphical sink the takes set of a complex
- * streams and plots them in the time domain. For each signal, both
- * the signal's I and Q parts are plotted, and they are all plotted
- * with a different color, and the \a set_title and \a set_color
- * functions can be used to change the lable and color for a given
- * input number.
- */
-class GR_QTGUI_API qtgui_freq_sink_c : public gr_sync_block
-{
-private:
- friend GR_QTGUI_API qtgui_freq_sink_c_sptr
- qtgui_make_freq_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent);
-
- qtgui_freq_sink_c(int size, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent=NULL);
-
- void forecast(int noutput_items, gr_vector_int &ninput_items_required);
-
- void initialize();
-
- gruel::mutex d_mutex;
-
- int d_fftsize;
- float d_fftavg;
- gr_firdes::win_type d_wintype;
- std::vector<float> d_window;
- double d_center_freq;
- double d_bandwidth;
- std::string d_name;
- int d_nconnections;
-
-
- bool d_shift;
- gr::fft::fft_complex *d_fft;
-
- int d_index;
- std::vector<gr_complex*> d_residbufs;
- std::vector<double*> d_magbufs;
- float *d_fbuf;
-
- QWidget *d_parent;
- FreqDisplayForm *d_main_gui;
-
- gruel::high_res_timer_type d_update_time;
- gruel::high_res_timer_type d_last_time;
-
- void windowreset();
- void buildwindow();
- void fftresize();
- void fft(float *data_out, const gr_complex *data_in, int size);
-
-public:
- ~qtgui_freq_sink_c();
- void exec_();
- QWidget* qwidget();
- PyObject* pyqwidget();
-
- void set_fft_size(const int fftsize);
- int fft_size() const;
- void set_fft_average(const float fftavg);
- float fft_average() const;
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
- void set_fft_power_db(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);
-
- void set_resize(int width, int height);
-
- QApplication *d_qApplication;
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_QTGUI_FREQ_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui_freq_sink_f.h b/gr-qtgui/include/qtgui_freq_sink_f.h
deleted file mode 100644
index 612e711077..0000000000
--- a/gr-qtgui/include/qtgui_freq_sink_f.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_FREQ_SINK_F_H
-#define INCLUDED_QTGUI_FREQ_SINK_F_H
-
-#include <Python.h>
-#include <gr_qtgui_api.h>
-#include <gr_sync_block.h>
-#include <gr_firdes.h>
-#include <fft/fft.h>
-#include <qapplication.h>
-#include <freqdisplayform.h>
-#include <gruel/thread.h>
-
-class qtgui_freq_sink_f;
-typedef boost::shared_ptr<qtgui_freq_sink_f> qtgui_freq_sink_f_sptr;
-
-GR_QTGUI_API qtgui_freq_sink_f_sptr
-qtgui_make_freq_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-/*!
- * \brief A graphical sink to display multiple signals in time.
- * \ingroup qtgui_blk
- *
- * This is a QT-based graphical sink the takes set of a complex
- * streams and plots them in the time domain. For each signal, both
- * the signal's I and Q parts are plotted, and they are all plotted
- * with a different color, and the \a set_title and \a set_color
- * functions can be used to change the lable and color for a given
- * input number.
- */
-class GR_QTGUI_API qtgui_freq_sink_f : public gr_sync_block
-{
-private:
- friend GR_QTGUI_API qtgui_freq_sink_f_sptr
- qtgui_make_freq_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent);
-
- qtgui_freq_sink_f(int size, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent=NULL);
-
- void forecast(int noutput_items, gr_vector_int &ninput_items_required);
-
- void initialize();
-
- gruel::mutex d_mutex;
-
- int d_fftsize;
- float d_fftavg;
- gr_firdes::win_type d_wintype;
- std::vector<float> d_window;
- double d_center_freq;
- double d_bandwidth;
- std::string d_name;
- int d_nconnections;
-
- bool d_shift;
- gr::fft::fft_complex *d_fft;
-
- int d_index;
- std::vector<float*> d_residbufs;
- std::vector<double*> d_magbufs;
- float *d_fbuf;
-
- QWidget *d_parent;
- FreqDisplayForm *d_main_gui;
-
- gruel::high_res_timer_type d_update_time;
- gruel::high_res_timer_type d_last_time;
-
- void windowreset();
- void buildwindow();
- void fftresize();
- void fft(float *data_out, const float *data_in, int size);
-
-public:
- ~qtgui_freq_sink_f();
- void exec_();
- QWidget* qwidget();
- PyObject* pyqwidget();
-
- void set_fft_size(const int fftsize);
- int fft_size() const;
- void set_fft_average(const float fftavg);
- float fft_average() const;
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
- void set_fft_power_db(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);
-
- void set_resize(int width, int height);
-
- QApplication *d_qApplication;
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_QTGUI_FREQ_SINK_F_H */
diff --git a/gr-qtgui/include/qtgui_time_sink_c.h b/gr-qtgui/include/qtgui_time_sink_c.h
deleted file mode 100644
index 95cf511994..0000000000
--- a/gr-qtgui/include/qtgui_time_sink_c.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- 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_sync_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);
-
-/*!
- * \brief A graphical sink to display multiple signals in time.
- * \ingroup qtgui_blk
- *
- * This is a QT-based graphical sink the takes set of a complex
- * streams and plots them in the time domain. For each signal, both
- * the signal's I and Q parts are plotted, and they are all plotted
- * with a different color, and the \a set_title and \a set_color
- * functions can be used to change the lable and color for a given
- * input number.
- */
-class GR_QTGUI_API qtgui_time_sink_c : public gr_sync_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 initialize();
-
- int d_size;
- double d_bandwidth;
- std::string d_name;
- int d_nconnections;
-
- int d_index;
- std::vector<double*> d_residbufs;
-
- QWidget *d_parent;
- TimeDisplayForm *d_main_gui;
-
- gruel::high_res_timer_type d_update_time;
- gruel::high_res_timer_type 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);
-
- void set_resize(int width, int height);
-
- QApplication *d_qApplication;
-
- int work (int noutput_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/include/qtgui_time_sink_f.h b/gr-qtgui/include/qtgui_time_sink_f.h
deleted file mode 100644
index 09db60f79f..0000000000
--- a/gr-qtgui/include/qtgui_time_sink_f.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- 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_sync_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);
-
-/*!
- * \brief A graphical sink to display multiple signals in time.
- * \ingroup qtgui_blk
- *
- * This is a QT-based graphical sink the takes set of a float streams
- * and plots them in the time domain. Each signal is plotted with a
- * different color, and the \a set_title and \a set_color functions
- * can be used to change the lable and color for a given input number.
- */
-class GR_QTGUI_API qtgui_time_sink_f : public gr_sync_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 initialize();
-
- int d_size;
- double d_bandwidth;
- std::string d_name;
- int d_nconnections;
-
- int d_index;
- std::vector<double*> d_residbufs;
-
- QWidget *d_parent;
- TimeDisplayForm *d_main_gui;
-
- gruel::high_res_timer_type d_update_time;
- gruel::high_res_timer_type 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 work (int noutput_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/include/qtgui_waterfall_sink_c.h b/gr-qtgui/include/qtgui_waterfall_sink_c.h
deleted file mode 100644
index 90ba6533ef..0000000000
--- a/gr-qtgui/include/qtgui_waterfall_sink_c.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_WATERFALL_SINK_C_H
-#define INCLUDED_QTGUI_WATERFALL_SINK_C_H
-
-#include <Python.h>
-#include <gr_qtgui_api.h>
-#include <gr_sync_block.h>
-#include <gr_firdes.h>
-#include <fft/fft.h>
-#include <qapplication.h>
-#include <waterfalldisplayform.h>
-
-class qtgui_waterfall_sink_c;
-typedef boost::shared_ptr<qtgui_waterfall_sink_c> qtgui_waterfall_sink_c_sptr;
-
-GR_QTGUI_API qtgui_waterfall_sink_c_sptr
-qtgui_make_waterfall_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-/*!
- * \brief A graphical sink to display multiple signals in time.
- * \ingroup qtgui_blk
- *
- * This is a QT-based graphical sink the takes set of a complex
- * streams and plots them in the time domain. For each signal, both
- * the signal's I and Q parts are plotted, and they are all plotted
- * with a different color, and the \a set_title and \a set_color
- * functions can be used to change the lable and color for a given
- * input number.
- */
-class GR_QTGUI_API qtgui_waterfall_sink_c : public gr_sync_block
-{
-private:
- friend GR_QTGUI_API qtgui_waterfall_sink_c_sptr
- qtgui_make_waterfall_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent);
-
- qtgui_waterfall_sink_c(int size, int wintype,
- double fc, 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_fftsize;
- gr_firdes::win_type d_wintype;
- std::vector<float> d_window;
- double d_center_freq;
- double d_bandwidth;
- std::string d_name;
- int d_nconnections;
-
- bool d_shift;
- gr::fft::fft_complex *d_fft;
-
- int d_index;
- std::vector<gr_complex*> d_residbufs;
- std::vector<double*> d_magbufs;
-
- QWidget *d_parent;
- WaterfallDisplayForm *d_main_gui;
-
- gruel::high_res_timer_type d_update_time;
- gruel::high_res_timer_type d_last_time;
-
- void windowreset();
- void buildwindow();
- void fftresize();
- void fft(float *data_out, const gr_complex *data_in, int size);
-
-public:
- ~qtgui_waterfall_sink_c();
- void exec_();
- QWidget* qwidget();
- PyObject* pyqwidget();
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
-
- void set_update_time(double t);
- void set_title(int which, const std::string &title);
- void set_color(int which, const std::string &color);
-
- void set_resize(int width, int height);
-
- QApplication *d_qApplication;
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_QTGUI_WATERFALL_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui_waterfall_sink_f.h b/gr-qtgui/include/qtgui_waterfall_sink_f.h
deleted file mode 100644
index f4ac33d2b0..0000000000
--- a/gr-qtgui/include/qtgui_waterfall_sink_f.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_WATERFALL_SINK_F_H
-#define INCLUDED_QTGUI_WATERFALL_SINK_F_H
-
-#include <Python.h>
-#include <gr_qtgui_api.h>
-#include <gr_sync_block.h>
-#include <gr_firdes.h>
-#include <fft/fft.h>
-#include <qapplication.h>
-#include <waterfalldisplayform.h>
-
-class qtgui_waterfall_sink_f;
-typedef boost::shared_ptr<qtgui_waterfall_sink_f> qtgui_waterfall_sink_f_sptr;
-
-GR_QTGUI_API qtgui_waterfall_sink_f_sptr
-qtgui_make_waterfall_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-/*!
- * \brief A graphical sink to display multiple signals in time.
- * \ingroup qtgui_blk
- *
- * This is a QT-based graphical sink the takes set of a complex
- * streams and plots them in the time domain. For each signal, both
- * the signal's I and Q parts are plotted, and they are all plotted
- * with a different color, and the \a set_title and \a set_color
- * functions can be used to change the lable and color for a given
- * input number.
- */
-class GR_QTGUI_API qtgui_waterfall_sink_f : public gr_sync_block
-{
-private:
- friend GR_QTGUI_API qtgui_waterfall_sink_f_sptr
- qtgui_make_waterfall_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent);
-
- qtgui_waterfall_sink_f(int size, int wintype,
- double fc, 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_fftsize;
- gr_firdes::win_type d_wintype;
- std::vector<float> d_window;
- double d_center_freq;
- double d_bandwidth;
- std::string d_name;
- int d_nconnections;
-
- bool d_shift;
- gr::fft::fft_complex *d_fft;
-
- int d_index;
- std::vector<float*> d_residbufs;
- std::vector<double*> d_magbufs;
-
- QWidget *d_parent;
- WaterfallDisplayForm *d_main_gui;
-
- gruel::high_res_timer_type d_update_time;
- gruel::high_res_timer_type d_last_time;
-
- void windowreset();
- void buildwindow();
- void fftresize();
- void fft(float *data_out, const float *data_in, int size);
-
-public:
- ~qtgui_waterfall_sink_f();
- void exec_();
- QWidget* qwidget();
- PyObject* pyqwidget();
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
-
- void set_update_time(double t);
- void set_title(int which, const std::string &title);
- void set_color(int which, const std::string &color);
-
- void set_resize(int width, int height);
-
- QApplication *d_qApplication;
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_QTGUI_WATERFALL_SINK_F_H */
diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt
index a8b38b98ce..1ecfab961b 100644
--- a/gr-qtgui/lib/CMakeLists.txt
+++ b/gr-qtgui/lib/CMakeLists.txt
@@ -62,15 +62,15 @@ set(qtgui_srcs
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_freq_sink_c.cc
- qtgui_freq_sink_f.cc
- qtgui_const_sink_c.cc
- qtgui_waterfall_sink_c.cc
- qtgui_waterfall_sink_f.cc
+# qtgui_sink_c.cc
+# qtgui_sink_f.cc
+ time_sink_c_impl.cc
+ time_sink_f_impl.cc
+ freq_sink_c_impl.cc
+ freq_sink_f_impl.cc
+ const_sink_c_impl.cc
+ waterfall_sink_c_impl.cc
+ waterfall_sink_f_impl.cc
qtgui_util.cc
)
@@ -80,6 +80,7 @@ set(qtgui_srcs
include_directories(
${GNURADIO_CORE_INCLUDE_DIRS}
${GR_FFT_INCLUDE_DIRS}
+ ${GR_FILTER_INCLUDE_DIRS}
${GR_QTGUI_INCLUDE_DIRS}
${VOLK_INCLUDE_DIRS}
)
@@ -102,6 +103,7 @@ include_directories(${PYTHON_INCLUDE_PATH}) #deprecated for dirs (cmake 2.6)
list(APPEND qtgui_libs
gnuradio-core
gnuradio-fft
+ gnuradio-filter
volk
${QT_LIBRARIES}
${QWT_LIBRARIES}
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h
index 261ac3b2c3..f3cbeef1cb 100644
--- a/gr-qtgui/lib/ConstellationDisplayPlot.h
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.h
@@ -26,7 +26,6 @@
#include <stdint.h>
#include <cstdio>
#include <vector>
-#include <qtgui_util.h>
#include "DisplayPlot.h"
class ConstellationDisplayPlot : public DisplayPlot
diff --git a/gr-qtgui/lib/DisplayPlot.h b/gr-qtgui/lib/DisplayPlot.h
index 9cf276bc35..975a92a18d 100644
--- a/gr-qtgui/lib/DisplayPlot.h
+++ b/gr-qtgui/lib/DisplayPlot.h
@@ -37,7 +37,7 @@
#include <qwt_plot_magnifier.h>
#include <qwt_plot_marker.h>
#include <qwt_symbol.h>
-#include <qtgui_util.h>
+#include <qtgui/utils.h>
#if QWT_VERSION >= 0x060000
#include <qwt_compat.h>
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h
index ba2b686e64..17bb9d2391 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.h
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.h
@@ -26,7 +26,6 @@
#include <stdint.h>
#include <cstdio>
#include <vector>
-#include <qtgui_util.h>
#include "DisplayPlot.h"
class FrequencyDisplayPlot: public DisplayPlot
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h
index 538e0e8c0b..9c07e96ba0 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.h
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h
@@ -26,7 +26,6 @@
#include <stdint.h>
#include <cstdio>
#include <vector>
-#include <qtgui_util.h>
#include "DisplayPlot.h"
class TimeDomainDisplayPlot: public DisplayPlot
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h
index ba1e864dc5..abc663dec7 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.h
@@ -27,7 +27,6 @@
#include <cstdio>
#include <vector>
#include <qwt_plot_spectrogram.h>
-#include <qtgui_util.h>
#include "DisplayPlot.h"
#include "waterfallGlobalData.h"
#include <gruel/high_res_timer.h>
diff --git a/gr-qtgui/lib/const_sink_c_impl.cc b/gr-qtgui/lib/const_sink_c_impl.cc
new file mode 100644
index 0000000000..06d2aef99e
--- /dev/null
+++ b/gr-qtgui/lib/const_sink_c_impl.cc
@@ -0,0 +1,233 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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 "const_sink_c_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <volk/volk.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace qtgui {
+
+ const_sink_c::sptr const_sink_c::make(int size,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ {
+ return gnuradio::get_initial_sptr
+ (new const_sink_c_impl(size, name, nconnections, parent));
+ }
+
+ const_sink_c_impl::const_sink_c_impl(int size,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_block("const_sink_c",
+ gr_make_io_signature(nconnections, nconnections, sizeof(gr_complex)),
+ gr_make_io_signature(0, 0, 0)),
+ d_size(size), 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_real.push_back(gr::fft::malloc_double(d_size));
+ d_residbufs_imag.push_back(gr::fft::malloc_double(d_size));
+ }
+
+ // Set alignment properties for VOLK
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+
+ initialize();
+ }
+
+ const_sink_c_impl::~const_sink_c_impl()
+ {
+ // d_main_gui is a qwidget destroyed with its parent
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs_real[i]);
+ gr::fft::free(d_residbufs_imag[i]);
+ }
+ }
+
+ void
+ const_sink_c_impl::initialize()
+ {
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new ConstellationDisplayForm(d_nconnections, d_parent);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ d_last_time = 0;
+ }
+
+ void
+ const_sink_c_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ const_sink_c_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+ PyObject*
+ const_sink_c_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+
+ void
+ const_sink_c_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ }
+
+ void
+ const_sink_c_impl::set_title(int which, const std::string &title)
+ {
+ d_main_gui->setTitle(which, title.c_str());
+ }
+
+ void
+ const_sink_c_impl::set_color(int which, const std::string &color)
+ {
+ d_main_gui->setColor(which, color.c_str());
+ }
+
+ void
+ const_sink_c_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ const_sink_c_impl::set_line_style(int which, Qt::PenStyle style)
+ {
+ d_main_gui->setLineStyle(which, style);
+ }
+
+ void
+ const_sink_c_impl::set_line_marker(int which, QwtSymbol::Style marker)
+ {
+ d_main_gui->setLineMarker(which, marker);
+ }
+
+ void
+ const_sink_c_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ int
+ const_sink_c_impl::work(int noutput_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) {
+
+ // Fill up residbufs with d_size number of items
+ for(n = 0; n < d_nconnections; n++) {
+ in = (const gr_complex*)input_items[idx++];
+ if(is_unaligned()) {
+ volk_32fc_deinterleave_64f_x2_u(&d_residbufs_real[n][d_index],
+ &d_residbufs_imag[n][d_index],
+ &in[j], resid);
+ }
+ else {
+ volk_32fc_deinterleave_64f_x2_a(&d_residbufs_real[n][d_index],
+ &d_residbufs_imag[n][d_index],
+ &in[j], resid);
+ }
+ }
+
+ // Update the plot if its time
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = gruel::high_res_timer_now();
+ d_qApplication->postEvent(d_main_gui,
+ new ConstUpdateEvent(d_residbufs_real,
+ d_residbufs_imag,
+ 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 gr_complex*)input_items[idx++];
+ if(is_unaligned()) {
+ volk_32fc_deinterleave_64f_x2_u(&d_residbufs_real[n][d_index],
+ &d_residbufs_imag[n][d_index],
+ &in[j], datasize);
+ }
+ else {
+ volk_32fc_deinterleave_64f_x2_a(&d_residbufs_real[n][d_index],
+ &d_residbufs_imag[n][d_index],
+ &in[j], datasize);
+ }
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/const_sink_c_impl.h b/gr-qtgui/lib/const_sink_c_impl.h
new file mode 100644
index 0000000000..52a128f3cc
--- /dev/null
+++ b/gr-qtgui/lib/const_sink_c_impl.h
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_CONST_SINK_C_IMPL_H
+#define INCLUDED_QTGUI_CONST_SINK_C_IMPL_H
+
+#include <qtgui/const_sink_c.h>
+#include <gruel/high_res_timer.h>
+#include <gruel/thread.h>
+#include <constellationdisplayform.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API const_sink_c_impl : public const_sink_c
+ {
+ private:
+ void initialize();
+
+ int d_size;
+ std::string d_name;
+ int d_nconnections;
+
+ int d_index;
+ std::vector<double*> d_residbufs_real;
+ std::vector<double*> d_residbufs_imag;
+
+ QWidget *d_parent;
+ ConstellationDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_update_time;
+ gruel::high_res_timer_type d_last_time;
+
+ public:
+ const_sink_c_impl(int size,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+ ~const_sink_c_impl();
+
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
+
+ void set_size(int width, int height);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_CONST_SINK_C_IMPL_H */
diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc
new file mode 100644
index 0000000000..8d3a2d037e
--- /dev/null
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -0,0 +1,371 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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 "freq_sink_c_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <volk/volk.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace qtgui {
+
+ freq_sink_c::sptr freq_sink_c::make(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ {
+ return gnuradio::get_initial_sptr
+ (new freq_sink_c_impl(fftsize, wintype,
+ fc, bw, name,
+ nconnections,
+ parent));
+ }
+
+ freq_sink_c_impl::freq_sink_c_impl(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_block("freq_sink_c",
+ gr_make_io_signature(1, -1, sizeof(gr_complex)),
+ gr_make_io_signature(0, 0, 0)),
+ d_fftsize(fftsize), d_fftavg(1.0),
+ d_wintype((filter::firdes::win_type)(wintype)),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
+ d_nconnections(nconnections), d_parent(parent)
+ {
+ d_main_gui = NULL;
+
+ // Perform fftshift operation;
+ // this is usually desired when plotting
+ d_shift = true;
+
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+ d_fbuf = gr::fft::malloc_float(d_fftsize);
+
+ d_index = 0;
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(gr::fft::malloc_complex(d_fftsize));
+ d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
+ }
+
+ buildwindow();
+
+ initialize();
+ }
+
+ freq_sink_c_impl::~freq_sink_c_impl()
+ {
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+ }
+ delete d_fft;
+ delete d_fbuf;
+ }
+
+ void
+ freq_sink_c_impl::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_fftsize, 8191);
+ }
+ }
+
+ void
+ freq_sink_c_impl::initialize()
+ {
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new FreqDisplayForm(d_nconnections, d_parent);
+ d_main_gui->SetFFTSize(d_fftsize);
+ d_main_gui->SetFFTWindowType(d_wintype);
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ d_center_freq - d_bandwidth/2.0,
+ d_center_freq + d_bandwidth/2.0);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ d_last_time = 0;
+ }
+
+ void
+ freq_sink_c_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ freq_sink_c_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+ PyObject*
+ freq_sink_c_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+
+ void
+ freq_sink_c_impl::set_fft_size(const int fftsize)
+ {
+ d_fftsize = fftsize;
+ d_main_gui->SetFFTSize(fftsize);
+ }
+
+ int
+ freq_sink_c_impl::fft_size() const
+ {
+ return d_fftsize;
+ }
+
+ void
+ freq_sink_c_impl::set_fft_average(const float fftavg)
+ {
+ d_fftavg = fftavg;
+ d_main_gui->SetFFTAverage(fftavg);
+ }
+
+ float
+ freq_sink_c_impl::fft_average() const
+ {
+ return d_fftavg;
+ }
+
+ void
+ freq_sink_c_impl::set_frequency_range(const double centerfreq,
+ const double bandwidth)
+ {
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+ }
+
+ void
+ freq_sink_c_impl::set_fft_power_db(double min, double max)
+ {
+ d_main_gui->SetFrequencyAxis(min, max);
+ }
+
+ void
+ freq_sink_c_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ }
+
+ void
+ freq_sink_c_impl::set_title(int which, const std::string &title)
+ {
+ d_main_gui->setTitle(which, title.c_str());
+ }
+
+ void
+ freq_sink_c_impl::set_color(int which, const std::string &color)
+ {
+ d_main_gui->setColor(which, color.c_str());
+ }
+
+ void
+ freq_sink_c_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ freq_sink_c_impl::set_line_style(int which, Qt::PenStyle style)
+ {
+ d_main_gui->setLineStyle(which, style);
+ }
+
+ void
+ freq_sink_c_impl::set_line_marker(int which, QwtSymbol::Style marker)
+ {
+ d_main_gui->setLineMarker(which, marker);
+ }
+
+ void
+ freq_sink_c_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ void
+ freq_sink_c_impl::fft(float *data_out, const gr_complex *data_in, int size)
+ {
+ if(d_window.size()) {
+ volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), data_in,
+ &d_window.front(), size);
+ }
+ else {
+ memcpy(d_fft->get_inbuf(), data_in, sizeof(gr_complex)*size);
+ }
+
+ d_fft->execute(); // compute the fft
+
+ volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(),
+ size, 1.0, size);
+
+ // Perform shift operation
+ unsigned int len = (unsigned int)(floor(size/2.0));
+ float *tmp = (float*)malloc(sizeof(float)*len);
+ memcpy(tmp, &data_out[0], sizeof(float)*len);
+ memcpy(&data_out[0], &data_out[len], sizeof(float)*(size - len));
+ memcpy(&data_out[size - len], tmp, sizeof(float)*len);
+ free(tmp);
+ }
+
+ void
+ freq_sink_c_impl::windowreset()
+ {
+ filter::firdes::win_type newwintype;
+ newwintype = d_main_gui->GetFFTWindowType();
+ if(d_wintype != newwintype) {
+ d_wintype = newwintype;
+ buildwindow();
+ }
+ }
+
+ void
+ freq_sink_c_impl::buildwindow()
+ {
+ d_window.clear();
+ if(d_wintype != 0) {
+ d_window = filter::firdes::window(d_wintype, d_fftsize, 6.76);
+ }
+ }
+
+ void
+ freq_sink_c_impl::fftresize()
+ {
+ gruel::scoped_lock lock(d_mutex);
+
+ int newfftsize = d_main_gui->GetFFTSize();
+ d_fftavg = d_main_gui->GetFFTAverage();
+
+ if(newfftsize != d_fftsize) {
+ // Resize residbuf and replace data
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+
+ d_residbufs[i] = gr::fft::malloc_complex(newfftsize);
+ d_magbufs[i] = gr::fft::malloc_double(newfftsize);
+
+ memset(d_magbufs[i], 0, newfftsize*sizeof(double));
+ }
+
+ // Set new fft size and reset buffer index
+ // (throws away any currently held data, but who cares?)
+ d_fftsize = newfftsize;
+ d_index = 0;
+
+ // Reset window to reflect new size
+ buildwindow();
+
+ // Reset FFTW plan for new size
+ delete d_fft;
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+
+ gr::fft::free(d_fbuf);
+ d_fbuf = gr::fft::malloc_float(d_fftsize);
+ }
+ }
+
+ int
+ freq_sink_c_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int j=0;
+ const gr_complex *in = (const gr_complex*)input_items[0];
+
+ // Update the FFT size from the application
+ fftresize();
+ windowreset();
+
+ for(int i=0; i < noutput_items; i+=d_fftsize) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_fftsize-d_index;
+
+ // If we have enough input for one full FFT, do it
+ if(datasize >= resid) {
+
+ for(int n = 0; n < d_nconnections; n++) {
+ // Fill up residbuf with d_fftsize number of items
+ in = (const gr_complex*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*resid);
+
+ fft(d_fbuf, d_residbufs[n], d_fftsize);
+ for(int x = 0; x < d_fftsize; x++) {
+ d_magbufs[n][x] = (double)((1.0-d_fftavg)*d_magbufs[n][x] + (d_fftavg)*d_fbuf[x]);
+ }
+
+ //volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
+ }
+
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = gruel::high_res_timer_now();
+ d_qApplication->postEvent(d_main_gui,
+ new FreqUpdateEvent(d_magbufs, d_fftsize));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbuf for next time
+ else {
+ for(int n = 0; n < d_nconnections; n++) {
+ in = (const gr_complex*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*datasize);
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h
new file mode 100644
index 0000000000..ab2bc8c075
--- /dev/null
+++ b/gr-qtgui/lib/freq_sink_c_impl.h
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_FREQ_SINK_C_IMPL_H
+#define INCLUDED_QTGUI_FREQ_SINK_C_IMPL_H
+
+#include <qtgui/freq_sink_c.h>
+#include <filter/firdes.h>
+#include <fft/fft.h>
+#include <gruel/high_res_timer.h>
+#include <gruel/thread.h>
+#include <freqdisplayform.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API freq_sink_c_impl : public freq_sink_c
+ {
+ private:
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ gruel::mutex d_mutex;
+
+ int d_fftsize;
+ float d_fftavg;
+ filter::firdes::win_type d_wintype;
+ std::vector<float> d_window;
+ double d_center_freq;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ bool d_shift;
+ gr::fft::fft_complex *d_fft;
+
+ int d_index;
+ std::vector<gr_complex*> d_residbufs;
+ std::vector<double*> d_magbufs;
+ float *d_fbuf;
+
+ QWidget *d_parent;
+ FreqDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_update_time;
+ gruel::high_res_timer_type d_last_time;
+
+ void windowreset();
+ void buildwindow();
+ void fftresize();
+ void fft(float *data_out, const gr_complex *data_in, int size);
+
+ public:
+ freq_sink_c_impl(int size, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+ ~freq_sink_c_impl();
+
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_fft_size(const int fftsize);
+ int fft_size() const;
+ void set_fft_average(const float fftavg);
+ float fft_average() const;
+
+ void set_frequency_range(const double centerfreq, const double bandwidth);
+ void set_fft_power_db(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);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
+
+ void set_size(int width, int height);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_FREQ_SINK_C_IMPL_H */
diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc
new file mode 100644
index 0000000000..a876c259c1
--- /dev/null
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -0,0 +1,366 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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 "freq_sink_f_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <volk/volk.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace qtgui {
+
+ freq_sink_f::sptr freq_sink_f::make(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ {
+ return gnuradio::get_initial_sptr
+ (new freq_sink_f_impl(fftsize, wintype,
+ fc, bw, name,
+ nconnections,
+ parent));
+ }
+
+ freq_sink_f_impl::freq_sink_f_impl(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_block("freq_sink_f",
+ gr_make_io_signature(1, -1, sizeof(float)),
+ gr_make_io_signature(0, 0, 0)),
+ d_fftsize(fftsize), d_fftavg(1.0),
+ d_wintype((filter::firdes::win_type)(wintype)),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
+ d_nconnections(nconnections), d_parent(parent)
+ {
+ d_main_gui = NULL;
+
+ // Perform fftshift operation;
+ // this is usually desired when plotting
+ d_shift = true;
+
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+ d_fbuf = gr::fft::malloc_float(d_fftsize);
+
+ d_index = 0;
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(gr::fft::malloc_float(d_fftsize));
+ d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
+ }
+
+ buildwindow();
+
+ initialize();
+ }
+
+ freq_sink_f_impl::~freq_sink_f_impl()
+ {
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+ }
+ delete d_fft;
+ gr::fft::free(d_fbuf);
+ }
+
+ void
+ freq_sink_f_impl::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_fftsize, 8191);
+ }
+ }
+
+ void
+ freq_sink_f_impl::initialize()
+ {
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new FreqDisplayForm(d_nconnections, d_parent);
+ d_main_gui->SetFFTSize(d_fftsize);
+ d_main_gui->SetFFTWindowType(d_wintype);
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ d_center_freq - d_bandwidth/2.0,
+ d_center_freq + d_bandwidth/2.0);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ d_last_time = 0;
+ }
+
+ void
+ freq_sink_f_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ freq_sink_f_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+ PyObject*
+ freq_sink_f_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+
+ void
+ freq_sink_f_impl::set_fft_size(const int fftsize)
+ {
+ d_fftsize = fftsize;
+ d_main_gui->SetFFTSize(fftsize);
+ }
+
+ int
+ freq_sink_f_impl::fft_size() const
+ {
+ return d_fftsize;
+ }
+
+ void
+ freq_sink_f_impl::set_fft_average(const float fftavg)
+ {
+ d_fftavg = fftavg;
+ d_main_gui->SetFFTAverage(fftavg);
+ }
+
+ float
+ freq_sink_f_impl::fft_average() const
+ {
+ return d_fftavg;
+ }
+
+ void
+ freq_sink_f_impl::set_frequency_range(const double centerfreq,
+ const double bandwidth)
+ {
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+ }
+
+ void
+ freq_sink_f_impl::set_fft_power_db(double min, double max)
+ {
+ d_main_gui->SetFrequencyAxis(min, max);
+ }
+
+ void
+ freq_sink_f_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ }
+
+ void
+ freq_sink_f_impl::set_title(int which, const std::string &title)
+ {
+ d_main_gui->setTitle(which, title.c_str());
+ }
+
+ void
+ freq_sink_f_impl::set_color(int which, const std::string &color)
+ {
+ d_main_gui->setColor(which, color.c_str());
+ }
+
+ void
+ freq_sink_f_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ freq_sink_f_impl::set_line_style(int which, Qt::PenStyle style)
+ {
+ d_main_gui->setLineStyle(which, style);
+ }
+
+ void
+ freq_sink_f_impl::set_line_marker(int which, QwtSymbol::Style marker)
+ {
+ d_main_gui->setLineMarker(which, marker);
+ }
+
+
+ void
+ freq_sink_f_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ void
+ freq_sink_f_impl::fft(float *data_out, const float *data_in, int size)
+ {
+ // float to complex conversion
+ gr_complex *dst = d_fft->get_inbuf();
+ for (int i = 0; i < size; i++)
+ dst[i] = data_in[i];
+
+ if(d_window.size()) {
+ volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), dst,
+ &d_window.front(), size);
+ }
+
+ d_fft->execute(); // compute the fft
+ volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(),
+ size, 1.0, size);
+ }
+
+ void
+ freq_sink_f_impl::windowreset()
+ {
+ gruel::scoped_lock lock(d_mutex);
+
+ filter::firdes::win_type newwintype;
+ newwintype = d_main_gui->GetFFTWindowType();
+ if(d_wintype != newwintype) {
+ d_wintype = newwintype;
+ buildwindow();
+ }
+ }
+
+ void
+ freq_sink_f_impl::buildwindow()
+ {
+ d_window.clear();
+ if(d_wintype != 0) {
+ d_window = filter::firdes::window(d_wintype, d_fftsize, 6.76);
+ }
+ }
+
+ void
+ freq_sink_f_impl::fftresize()
+ {
+ gruel::scoped_lock lock(d_mutex);
+
+ int newfftsize = d_main_gui->GetFFTSize();
+ d_fftavg = d_main_gui->GetFFTAverage();
+
+ if(newfftsize != d_fftsize) {
+ // Resize residbuf and replace data
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+
+ d_residbufs[i] = gr::fft::malloc_float(newfftsize);
+ d_magbufs[i] = gr::fft::malloc_double(newfftsize);
+
+ memset(d_magbufs[i], 0, newfftsize*sizeof(double));
+ }
+
+ // Set new fft size and reset buffer index
+ // (throws away any currently held data, but who cares?)
+ d_fftsize = newfftsize;
+ d_index = 0;
+
+ // Reset window to reflect new size
+ buildwindow();
+
+ // Reset FFTW plan for new size
+ delete d_fft;
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+
+ gr::fft::free(d_fbuf);
+ d_fbuf = gr::fft::malloc_float(d_fftsize);
+ }
+ }
+
+ int
+ freq_sink_f_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int j=0;
+ const float *in = (const float*)input_items[0];
+
+ // Update the FFT size from the application
+ fftresize();
+ windowreset();
+
+ for(int i=0; i < noutput_items; i+=d_fftsize) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_fftsize-d_index;
+
+ // If we have enough input for one full FFT, do it
+ if(datasize >= resid) {
+
+ for(int n = 0; n < d_nconnections; n++) {
+ // Fill up residbuf with d_fftsize number of items
+ in = (const float*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*resid);
+
+ fft(d_fbuf, d_residbufs[n], d_fftsize);
+ for(int x = 0; x < d_fftsize; x++) {
+ d_magbufs[n][x] = (double)((1.0-d_fftavg)*d_magbufs[n][x] + (d_fftavg)*d_fbuf[x]);
+ }
+ //volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
+ }
+
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = gruel::high_res_timer_now();
+ d_qApplication->postEvent(d_main_gui,
+ new FreqUpdateEvent(d_magbufs, d_fftsize));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbuf for next time
+ else {
+ for(int n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*datasize);
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/freq_sink_f_impl.h b/gr-qtgui/lib/freq_sink_f_impl.h
new file mode 100644
index 0000000000..d1cc3728ad
--- /dev/null
+++ b/gr-qtgui/lib/freq_sink_f_impl.h
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_FREQ_SINK_F_IMPL_H
+#define INCLUDED_QTGUI_FREQ_SINK_F_IMPL_H
+
+#include <qtgui/freq_sink_f.h>
+#include <filter/firdes.h>
+#include <fft/fft.h>
+#include <gruel/high_res_timer.h>
+#include <gruel/thread.h>
+#include <freqdisplayform.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API freq_sink_f_impl : public freq_sink_f
+ {
+ private:
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ gruel::mutex d_mutex;
+
+ int d_fftsize;
+ float d_fftavg;
+ filter::firdes::win_type d_wintype;
+ std::vector<float> d_window;
+ double d_center_freq;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ bool d_shift;
+ gr::fft::fft_complex *d_fft;
+
+ int d_index;
+ std::vector<float*> d_residbufs;
+ std::vector<double*> d_magbufs;
+ float *d_fbuf;
+
+ QWidget *d_parent;
+ FreqDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_update_time;
+ gruel::high_res_timer_type d_last_time;
+
+ void windowreset();
+ void buildwindow();
+ void fftresize();
+ void fft(float *data_out, const float *data_in, int size);
+
+ public:
+ freq_sink_f_impl(int size, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+ ~freq_sink_f_impl();
+
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_fft_size(const int fftsize);
+ int fft_size() const;
+ void set_fft_average(const float fftavg);
+ float fft_average() const;
+
+ void set_frequency_range(const double centerfreq, const double bandwidth);
+ void set_fft_power_db(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);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
+
+ void set_size(int width, int height);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_FREQ_SINK_F_IMPL_H */
diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc
index d186a5a33e..e8d4ac475d 100644
--- a/gr-qtgui/lib/freqdisplayform.cc
+++ b/gr-qtgui/lib/freqdisplayform.cc
@@ -101,6 +101,12 @@ FreqDisplayForm::GetFFTAverage() const
return _fftavg;
}
+gr::filter::firdes::win_type
+FreqDisplayForm::GetFFTWindowType() const
+{
+ return _fftwintype;
+}
+
void
FreqDisplayForm::SetFFTSize(const int newsize)
{
@@ -115,6 +121,12 @@ FreqDisplayForm::SetFFTAverage(const float newavg)
}
void
+FreqDisplayForm::SetFFTWindowType(const gr::filter::firdes::win_type newwin)
+{
+ _fftwintype = newwin;
+}
+
+void
FreqDisplayForm::SetFrequencyRange(const double newCenterFrequency,
const double newStartFrequency,
const double newStopFrequency)
diff --git a/gr-qtgui/lib/freqdisplayform.h b/gr-qtgui/lib/freqdisplayform.h
index 5039ecc6d7..ffce317c4f 100644
--- a/gr-qtgui/lib/freqdisplayform.h
+++ b/gr-qtgui/lib/freqdisplayform.h
@@ -27,6 +27,7 @@
#include <FrequencyDisplayPlot.h>
#include <QtGui/QtGui>
#include <vector>
+#include <filter/firdes.h>
#include "displayform.h"
@@ -42,12 +43,14 @@ class FreqDisplayForm : public DisplayForm
int GetFFTSize() const;
float GetFFTAverage() const;
+ gr::filter::firdes::win_type GetFFTWindowType() const;
public slots:
void customEvent(QEvent *e);
void SetFFTSize(const int);
void SetFFTAverage(const float);
+ void SetFFTWindowType(const gr::filter::firdes::win_type);
void SetFrequencyRange(const double newCenterFrequency,
const double newStartFrequency,
@@ -66,6 +69,7 @@ private:
int _fftsize;
float _fftavg;
+ gr::filter::firdes::win_type _fftwintype;
};
#endif /* FREQ_DISPLAY_FORM_H */
diff --git a/gr-qtgui/lib/qtgui_const_sink_c.cc b/gr-qtgui/lib/qtgui_const_sink_c.cc
deleted file mode 100644
index 2e74930fa2..0000000000
--- a/gr-qtgui/lib/qtgui_const_sink_c.cc
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_const_sink_c.h>
-#include <gr_io_signature.h>
-#include <string.h>
-#include <volk/volk.h>
-#include <fft/fft.h>
-
-#include <QTimer>
-
-qtgui_const_sink_c_sptr
-qtgui_make_const_sink_c(int size,
- const std::string &name,
- int nconnections,
- QWidget *parent)
-{
- return gnuradio::get_initial_sptr
- (new qtgui_const_sink_c(size, name, nconnections, parent));
-}
-
-qtgui_const_sink_c::qtgui_const_sink_c(int size,
- const std::string &name,
- int nconnections,
- QWidget *parent)
- : gr_sync_block("const_sink_c",
- gr_make_io_signature(nconnections, nconnections, sizeof(gr_complex)),
- gr_make_io_signature(0, 0, 0)),
- d_size(size), 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_real.push_back(gr::fft::malloc_double(d_size));
- d_residbufs_imag.push_back(gr::fft::malloc_double(d_size));
- }
-
- // Set alignment properties for VOLK
- const int alignment_multiple =
- volk_get_alignment() / sizeof(gr_complex);
- set_alignment(std::max(1,alignment_multiple));
-
- initialize();
-}
-
-qtgui_const_sink_c::~qtgui_const_sink_c()
-{
- // d_main_gui is a qwidget destroyed with its parent
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs_real[i]);
- gr::fft::free(d_residbufs_imag[i]);
- }
-}
-
-void
-qtgui_const_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 ConstellationDisplayForm(d_nconnections, d_parent);
-
- // initialize update time to 10 times a second
- set_update_time(0.1);
- d_last_time = 0;
-}
-
-
-void
-qtgui_const_sink_c::exec_()
-{
- d_qApplication->exec();
-}
-
-QWidget*
-qtgui_const_sink_c::qwidget()
-{
- return d_main_gui;
-}
-
-PyObject*
-qtgui_const_sink_c::pyqwidget()
-{
- PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
- PyObject *retarg = Py_BuildValue("N", w);
- return retarg;
-}
-
-void
-qtgui_const_sink_c::set_update_time(double t)
-{
- //convert update time to ticks
- gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
- d_update_time = t * tps;
- d_main_gui->setUpdateTime(t);
-}
-
-void
-qtgui_const_sink_c::set_title(int which, const std::string &title)
-{
- d_main_gui->setTitle(which, title.c_str());
-}
-
-void
-qtgui_const_sink_c::set_color(int which, const std::string &color)
-{
- d_main_gui->setColor(which, color.c_str());
-}
-
-void
-qtgui_const_sink_c::set_resize(int width, int height)
-{
- d_main_gui->resize(QSize(width, height));
-}
-
-int
-qtgui_const_sink_c::work(int noutput_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 = gruel::high_res_timer_now();
-
- // Fill up residbufs with d_size number of items
- for(n = 0; n < d_nconnections; n++) {
- in = (const gr_complex*)input_items[idx++];
- if(is_unaligned()) {
- volk_32fc_deinterleave_64f_x2_u(d_residbufs_real[n],
- d_residbufs_imag[n],
- &in[j], resid);
- }
- else {
- volk_32fc_deinterleave_64f_x2_a(d_residbufs_real[n],
- d_residbufs_imag[n],
- &in[j], resid);
- }
- }
-
- // Update the plot if its time
- if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
- d_last_time = gruel::high_res_timer_now();
- d_qApplication->postEvent(d_main_gui,
- new ConstUpdateEvent(d_residbufs_real,
- d_residbufs_imag,
- 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 gr_complex*)input_items[idx++];
- if(is_unaligned()) {
- volk_32fc_deinterleave_64f_x2_u(&d_residbufs_real[n][d_index],
- &d_residbufs_imag[n][d_index],
- &in[j], resid);
- }
- else {
- volk_32fc_deinterleave_64f_x2_a(&d_residbufs_real[n][d_index],
- &d_residbufs_imag[n][d_index],
- &in[j], resid);
- }
- }
- d_index += datasize;
- j += datasize;
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-qtgui/lib/qtgui_freq_sink_c.cc b/gr-qtgui/lib/qtgui_freq_sink_c.cc
deleted file mode 100644
index 7d6c3d7c00..0000000000
--- a/gr-qtgui/lib/qtgui_freq_sink_c.cc
+++ /dev/null
@@ -1,345 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_freq_sink_c.h>
-#include <gr_io_signature.h>
-#include <string.h>
-
-#include <QTimer>
-#include <volk/volk.h>
-
-qtgui_freq_sink_c_sptr
-qtgui_make_freq_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
-{
- return gnuradio::get_initial_sptr
- (new qtgui_freq_sink_c(fftsize, wintype,
- fc, bw, name,
- nconnections,
- parent));
-}
-
-qtgui_freq_sink_c::qtgui_freq_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
- : gr_sync_block("freq_sink_c",
- gr_make_io_signature(1, -1, sizeof(gr_complex)),
- gr_make_io_signature(0, 0, 0)),
- d_fftsize(fftsize), d_fftavg(1.0),
- d_wintype((gr_firdes::win_type)(wintype)),
- d_center_freq(fc), d_bandwidth(bw), d_name(name),
- d_nconnections(nconnections), d_parent(parent)
-{
- d_main_gui = NULL;
-
- // Perform fftshift operation;
- // this is usually desired when plotting
- d_shift = true;
-
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
- d_fbuf = gr::fft::malloc_float(d_fftsize);
-
- d_index = 0;
- for(int i = 0; i < d_nconnections; i++) {
- d_residbufs.push_back(gr::fft::malloc_complex(d_fftsize));
- d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
- }
-
- buildwindow();
-
- initialize();
-}
-
-qtgui_freq_sink_c::~qtgui_freq_sink_c()
-{
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
- }
- delete d_fft;
- delete d_fbuf;
-}
-
-void
-qtgui_freq_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_fftsize, 8191);
- }
-}
-
-void
-qtgui_freq_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 FreqDisplayForm(d_nconnections, d_parent);
- d_main_gui->SetFFTSize(d_fftsize);
- d_main_gui->SetFrequencyRange(d_center_freq,
- d_center_freq - d_bandwidth/2.0,
- d_center_freq + d_bandwidth/2.0);
-
- // initialize update time to 10 times a second
- set_update_time(0.1);
- d_last_time = 0;
-}
-
-void
-qtgui_freq_sink_c::exec_()
-{
- d_qApplication->exec();
-}
-
-QWidget*
-qtgui_freq_sink_c::qwidget()
-{
- return d_main_gui;
-}
-
-PyObject*
-qtgui_freq_sink_c::pyqwidget()
-{
- PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
- PyObject *retarg = Py_BuildValue("N", w);
- return retarg;
-}
-
-void
-qtgui_freq_sink_c::set_fft_size(const int fftsize)
-{
- d_fftsize = fftsize;
- d_main_gui->SetFFTSize(fftsize);
-}
-
-int
-qtgui_freq_sink_c::fft_size() const
-{
- return d_fftsize;
-}
-
-void
-qtgui_freq_sink_c::set_fft_average(const float fftavg)
-{
- d_fftavg = fftavg;
- d_main_gui->SetFFTAverage(fftavg);
-}
-
-float
-qtgui_freq_sink_c::fft_average() const
-{
- return d_fftavg;
-}
-
-void
-qtgui_freq_sink_c::set_frequency_range(const double centerfreq,
- const double bandwidth)
-{
- d_center_freq = centerfreq;
- d_bandwidth = bandwidth;
- d_main_gui->SetFrequencyRange(d_center_freq,
- -d_bandwidth/2.0,
- d_bandwidth/2.0);
-}
-
-void
-qtgui_freq_sink_c::set_fft_power_db(double min, double max)
-{
- d_main_gui->SetFrequencyAxis(min, max);
-}
-
-void
-qtgui_freq_sink_c::set_update_time(double t)
-{
- //convert update time to ticks
- gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
- d_update_time = t * tps;
- d_main_gui->setUpdateTime(t);
-}
-
-void
-qtgui_freq_sink_c::set_title(int which, const std::string &title)
-{
- d_main_gui->setTitle(which, title.c_str());
-}
-
-void
-qtgui_freq_sink_c::set_color(int which, const std::string &color)
-{
- d_main_gui->setColor(which, color.c_str());
-}
-
-void
-qtgui_freq_sink_c::set_resize(int width, int height)
-{
- d_main_gui->resize(QSize(width, height));
-}
-
-void
-qtgui_freq_sink_c::fft(float *data_out, const gr_complex *data_in, int size)
-{
- if(d_window.size()) {
- volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), data_in, &d_window.front(), size);
- }
- else {
- memcpy(d_fft->get_inbuf(), data_in, sizeof(gr_complex)*size);
- }
-
- d_fft->execute(); // compute the fft
-
- volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(), size, 1.0, size);
-
- // Perform shift operation
- unsigned int len = (unsigned int)(floor(size/2.0));
- float *tmp = (float*)malloc(sizeof(float)*len);
- memcpy(tmp, &data_out[0], sizeof(float)*len);
- memcpy(&data_out[0], &data_out[len], sizeof(float)*(size - len));
- memcpy(&data_out[size - len], tmp, sizeof(float)*len);
- free(tmp);
-}
-
-void
-qtgui_freq_sink_c::windowreset()
-{
- //gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType();
- //if(d_wintype != newwintype) {
- // d_wintype = newwintype;
- // buildwindow();
- //}
-}
-
-void
-qtgui_freq_sink_c::buildwindow()
-{
- d_window.clear();
- if(d_wintype != 0) {
- d_window = gr_firdes::window(d_wintype, d_fftsize, 6.76);
- }
-}
-
-void
-qtgui_freq_sink_c::fftresize()
-{
- gruel::scoped_lock lock(d_mutex);
-
- int newfftsize = d_main_gui->GetFFTSize();
- d_fftavg = d_main_gui->GetFFTAverage();
-
- if(newfftsize != d_fftsize) {
- // Resize residbuf and replace data
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
-
- d_residbufs[i] = gr::fft::malloc_complex(newfftsize);
- d_magbufs[i] = gr::fft::malloc_double(newfftsize);
-
- memset(d_magbufs[i], 0, newfftsize*sizeof(double));
- }
-
- // Set new fft size and reset buffer index
- // (throws away any currently held data, but who cares?)
- d_fftsize = newfftsize;
- d_index = 0;
-
- // Reset window to reflect new size
- buildwindow();
-
- // Reset FFTW plan for new size
- delete d_fft;
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
-
- gr::fft::free(d_fbuf);
- d_fbuf = gr::fft::malloc_float(d_fftsize);
- }
-}
-
-int
-qtgui_freq_sink_c::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int j=0;
- const gr_complex *in = (const gr_complex*)input_items[0];
-
- // Update the FFT size from the application
- fftresize();
- windowreset();
-
- for(int i=0; i < noutput_items; i+=d_fftsize) {
- unsigned int datasize = noutput_items - i;
- unsigned int resid = d_fftsize-d_index;
-
- // If we have enough input for one full FFT, do it
- if(datasize >= resid) {
-
- for(int n = 0; n < d_nconnections; n++) {
- // Fill up residbuf with d_fftsize number of items
- in = (const gr_complex*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*resid);
-
- fft(d_fbuf, d_residbufs[n], d_fftsize);
- for(int x = 0; x < d_fftsize; x++) {
- d_magbufs[n][x] = (double)((1.0-d_fftavg)*d_magbufs[n][x] + (d_fftavg)*d_fbuf[x]);
- }
-
- //volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
- }
-
- if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
- d_last_time = gruel::high_res_timer_now();
- d_qApplication->postEvent(d_main_gui,
- new FreqUpdateEvent(d_magbufs, d_fftsize));
- }
-
- d_index = 0;
- j += resid;
- }
- // Otherwise, copy what we received into the residbuf for next time
- else {
- for(int n = 0; n < d_nconnections; n++) {
- in = (const gr_complex*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*datasize);
- }
- d_index += datasize;
- j += datasize;
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-qtgui/lib/qtgui_freq_sink_f.cc b/gr-qtgui/lib/qtgui_freq_sink_f.cc
deleted file mode 100644
index c219edda6d..0000000000
--- a/gr-qtgui/lib/qtgui_freq_sink_f.cc
+++ /dev/null
@@ -1,336 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_freq_sink_f.h>
-#include <gr_io_signature.h>
-#include <string.h>
-
-#include <QTimer>
-#include <volk/volk.h>
-
-qtgui_freq_sink_f_sptr
-qtgui_make_freq_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
-{
- return gnuradio::get_initial_sptr
- (new qtgui_freq_sink_f(fftsize, wintype,
- fc, bw, name,
- nconnections,
- parent));
-}
-
-qtgui_freq_sink_f::qtgui_freq_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
- : gr_sync_block("freq_sink_f",
- gr_make_io_signature(1, -1, sizeof(float)),
- gr_make_io_signature(0, 0, 0)),
- d_fftsize(fftsize), d_fftavg(1.0),
- d_wintype((gr_firdes::win_type)(wintype)),
- d_center_freq(fc), d_bandwidth(bw), d_name(name),
- d_nconnections(nconnections), d_parent(parent)
-{
- d_main_gui = NULL;
-
- // Perform fftshift operation;
- // this is usually desired when plotting
- d_shift = true;
-
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
- d_fbuf = gr::fft::malloc_float(d_fftsize);
-
- d_index = 0;
- for(int i = 0; i < d_nconnections; i++) {
- d_residbufs.push_back(gr::fft::malloc_float(d_fftsize));
- d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
- }
-
- buildwindow();
-
- initialize();
-}
-
-qtgui_freq_sink_f::~qtgui_freq_sink_f()
-{
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
- }
- delete d_fft;
- gr::fft::free(d_fbuf);
-}
-
-void
-qtgui_freq_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_fftsize, 8191);
- }
-}
-
-void
-qtgui_freq_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 FreqDisplayForm(d_nconnections, d_parent);
- d_main_gui->SetFFTSize(d_fftsize);
- d_main_gui->SetFrequencyRange(d_center_freq,
- d_center_freq - d_bandwidth/2.0,
- d_center_freq + d_bandwidth/2.0);
-
- // initialize update time to 10 times a second
- set_update_time(0.1);
- d_last_time = 0;
-}
-
-void
-qtgui_freq_sink_f::exec_()
-{
- d_qApplication->exec();
-}
-
-QWidget*
-qtgui_freq_sink_f::qwidget()
-{
- return d_main_gui;
-}
-
-PyObject*
-qtgui_freq_sink_f::pyqwidget()
-{
- PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
- PyObject *retarg = Py_BuildValue("N", w);
- return retarg;
-}
-
-void
-qtgui_freq_sink_f::set_fft_size(const int fftsize)
-{
- d_fftsize = fftsize;
- d_main_gui->SetFFTSize(fftsize);
-}
-
-int
-qtgui_freq_sink_f::fft_size() const
-{
- return d_fftsize;
-}
-
-void
-qtgui_freq_sink_f::set_fft_average(const float fftavg)
-{
- d_fftavg = fftavg;
- d_main_gui->SetFFTAverage(fftavg);
-}
-
-float
-qtgui_freq_sink_f::fft_average() const
-{
- return d_fftavg;
-}
-
-void
-qtgui_freq_sink_f::set_frequency_range(const double centerfreq,
- const double bandwidth)
-{
- d_center_freq = centerfreq;
- d_bandwidth = bandwidth;
- d_main_gui->SetFrequencyRange(d_center_freq,
- -d_bandwidth/2.0,
- d_bandwidth/2.0);
-}
-
-void
-qtgui_freq_sink_f::set_fft_power_db(double min, double max)
-{
- d_main_gui->SetFrequencyAxis(min, max);
-}
-
-void
-qtgui_freq_sink_f::set_update_time(double t)
-{
- //convert update time to ticks
- gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
- d_update_time = t * tps;
- d_main_gui->setUpdateTime(t);
-}
-
-void
-qtgui_freq_sink_f::set_title(int which, const std::string &title)
-{
- d_main_gui->setTitle(which, title.c_str());
-}
-
-void
-qtgui_freq_sink_f::set_color(int which, const std::string &color)
-{
- d_main_gui->setColor(which, color.c_str());
-}
-
-void
-qtgui_freq_sink_f::set_resize(int width, int height)
-{
- d_main_gui->resize(QSize(width, height));
-}
-
-void
-qtgui_freq_sink_f::fft(float *data_out, const float *data_in, int size)
-{
- // float to complex conversion
- gr_complex *dst = d_fft->get_inbuf();
- for (int i = 0; i < size; i++)
- dst[i] = data_in[i];
-
- if(d_window.size()) {
- volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), dst, &d_window.front(), size);
- }
-
- d_fft->execute(); // compute the fft
- volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(), size, 1.0, size);
-}
-
-void
-qtgui_freq_sink_f::windowreset()
-{
- //gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType();
- //if(d_wintype != newwintype) {
- // d_wintype = newwintype;
- // buildwindow();
- //}
-}
-
-void
-qtgui_freq_sink_f::buildwindow()
-{
- d_window.clear();
- if(d_wintype != 0) {
- d_window = gr_firdes::window(d_wintype, d_fftsize, 6.76);
- }
-}
-
-void
-qtgui_freq_sink_f::fftresize()
-{
- gruel::scoped_lock lock(d_mutex);
-
- int newfftsize = d_main_gui->GetFFTSize();
- d_fftavg = d_main_gui->GetFFTAverage();
-
- if(newfftsize != d_fftsize) {
-
- // Resize residbuf and replace data
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
-
- d_residbufs.push_back(gr::fft::malloc_float(newfftsize));
- d_magbufs.push_back(gr::fft::malloc_double(newfftsize));
- }
-
- // Set new fft size and reset buffer index
- // (throws away any currently held data, but who cares?)
- d_fftsize = newfftsize;
- d_index = 0;
-
- // Reset window to reflect new size
- buildwindow();
-
- // Reset FFTW plan for new size
- delete d_fft;
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
-
- gr::fft::free(d_fbuf);
- d_fbuf = gr::fft::malloc_float(d_fftsize);
- }
-}
-
-int
-qtgui_freq_sink_f::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int j=0;
- const float *in = (const float*)input_items[0];
-
- // Update the FFT size from the application
- fftresize();
- windowreset();
-
- for(int i=0; i < noutput_items; i+=d_fftsize) {
- unsigned int datasize = noutput_items - i;
- unsigned int resid = d_fftsize-d_index;
-
- // If we have enough input for one full FFT, do it
- if(datasize >= resid) {
-
- for(int n = 0; n < d_nconnections; n++) {
- // Fill up residbuf with d_fftsize number of items
- in = (const float*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*resid);
-
- fft(d_fbuf, d_residbufs[n], d_fftsize);
- for(int x = 0; x < d_fftsize; x++) {
- d_magbufs[n][x] = (double)((1.0-d_fftavg)*d_magbufs[n][x] + (d_fftavg)*d_fbuf[x]);
- }
- //volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
- }
-
- if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
- d_last_time = gruel::high_res_timer_now();
- d_qApplication->postEvent(d_main_gui,
- new FreqUpdateEvent(d_magbufs, d_fftsize));
- }
-
- d_index = 0;
- j += resid;
- }
- // Otherwise, copy what we received into the residbuf for next time
- else {
- for(int n = 0; n < d_nconnections; n++) {
- in = (const float*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*datasize);
- }
- d_index += datasize;
- j += datasize;
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-qtgui/lib/qtgui_time_sink_c.cc b/gr-qtgui/lib/qtgui_time_sink_c.cc
deleted file mode 100644
index ef9c39afb7..0000000000
--- a/gr-qtgui/lib/qtgui_time_sink_c.cc
+++ /dev/null
@@ -1,215 +0,0 @@
-/* -*- 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 <volk/volk.h>
-#include <fft/fft.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_sync_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(gr::fft::malloc_double(d_size));
- }
-
- // Set alignment properties for VOLK
- const int alignment_multiple =
- volk_get_alignment() / sizeof(gr_complex);
- set_alignment(std::max(1,alignment_multiple));
-
- 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++) {
- gr::fft::free(d_residbufs[i]);
- }
-}
-
-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);
- d_last_time = 0;
-}
-
-
-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)
-{
- //convert update time to ticks
- gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
- d_update_time = t * tps;
- d_main_gui->setUpdateTime(t);
-}
-
-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());
-}
-
-void
-qtgui_time_sink_c::set_resize(int width, int height)
-{
- d_main_gui->resize(QSize(width, height));
-}
-
-int
-qtgui_time_sink_c::work(int noutput_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) {
-
- // Fill up residbufs with d_size number of items
- for(n = 0; n < d_nconnections; n+=2) {
- in = (const gr_complex*)input_items[idx++];
- if(is_unaligned()) {
- volk_32fc_deinterleave_64f_x2_u(&d_residbufs[n][d_index],
- &d_residbufs[n+1][d_index],
- &in[j], resid);
- }
- else {
- volk_32fc_deinterleave_64f_x2_a(&d_residbufs[n][d_index],
- &d_residbufs[n+1][d_index],
- &in[j], resid);
- }
- }
-
- // Update the plot if its time
- if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
- d_last_time = gruel::high_res_timer_now();
- 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++];
- if(is_unaligned()) {
- volk_32fc_deinterleave_64f_x2_u(&d_residbufs[n][d_index],
- &d_residbufs[n+1][d_index],
- &in[j], datasize);
- }
- else {
- volk_32fc_deinterleave_64f_x2_a(&d_residbufs[n][d_index],
- &d_residbufs[n+1][d_index],
- &in[j], datasize);
- }
- }
- d_index += datasize;
- j += datasize;
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-qtgui/lib/qtgui_time_sink_f.cc b/gr-qtgui/lib/qtgui_time_sink_f.cc
deleted file mode 100644
index 9ce5acd6ac..0000000000
--- a/gr-qtgui/lib/qtgui_time_sink_f.cc
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -*- 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 <volk/volk.h>
-#include <fft/fft.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_sync_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(gr::fft::malloc_double(d_size));
- }
-
- // Set alignment properties for VOLK
- const int alignment_multiple =
- volk_get_alignment() / sizeof(gr_complex);
- set_alignment(std::max(1,alignment_multiple));
-
- 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++) {
- gr::fft::free(d_residbufs[i]);
- }
-}
-
-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);
- d_last_time = 0;
-}
-
-
-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)
-{
- //convert update time to ticks
- gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
- d_update_time = t * tps;
- d_main_gui->setUpdateTime(t);
-}
-
-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::work (int noutput_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) {
-
- // Fill up residbufs with d_size number of items
- for(n = 0; n < d_nconnections; n++) {
- in = (const float*)input_items[idx++];
- if(is_unaligned()) {
- volk_32f_convert_64f_u(&d_residbufs[n][d_index],
- &in[j], resid);
- }
- else {
- volk_32f_convert_64f_a(&d_residbufs[n][d_index],
- &in[j], resid);
- }
- }
-
- // Update the plot if its time
- if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
- d_last_time = gruel::high_res_timer_now();
- 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
- // because we set the output_multiple, this should never need to be called
- else {
- for(n = 0; n < d_nconnections; n++) {
- in = (const float*)input_items[idx++];
- if(is_unaligned()) {
- volk_32f_convert_64f_u(&d_residbufs[n][d_index],
- &in[j], datasize);
- }
- else {
- volk_32f_convert_64f_a(&d_residbufs[n][d_index],
- &in[j], datasize);
- }
- }
- d_index += datasize;
- j += datasize;
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-qtgui/lib/qtgui_util.cc b/gr-qtgui/lib/qtgui_util.cc
index 11ad2feb90..70dcb483fb 100644
--- a/gr-qtgui/lib/qtgui_util.cc
+++ b/gr-qtgui/lib/qtgui_util.cc
@@ -20,7 +20,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qtgui_util.h>
+#include <qtgui/utils.h>
#include <QDebug>
QwtPickerDblClickPointMachine::QwtPickerDblClickPointMachine()
diff --git a/gr-qtgui/lib/qtgui_waterfall_sink_c.cc b/gr-qtgui/lib/qtgui_waterfall_sink_c.cc
deleted file mode 100644
index 07f830d0e7..0000000000
--- a/gr-qtgui/lib/qtgui_waterfall_sink_c.cc
+++ /dev/null
@@ -1,304 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_waterfall_sink_c.h>
-#include <gr_io_signature.h>
-#include <string.h>
-
-#include <QTimer>
-#include <volk/volk.h>
-
-qtgui_waterfall_sink_c_sptr
-qtgui_make_waterfall_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
-{
- return gnuradio::get_initial_sptr
- (new qtgui_waterfall_sink_c(fftsize, wintype,
- fc, bw, name,
- nconnections,
- parent));
-}
-
-qtgui_waterfall_sink_c::qtgui_waterfall_sink_c(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
- : gr_sync_block("waterfall_sink_c",
- gr_make_io_signature(1, -1, sizeof(gr_complex)),
- gr_make_io_signature(0, 0, 0)),
- d_fftsize(fftsize),
- d_wintype((gr_firdes::win_type)(wintype)),
- d_center_freq(fc), d_bandwidth(bw), d_name(name),
- d_nconnections(nconnections), d_parent(parent)
-{
- d_main_gui = NULL;
-
- // Perform fftshift operation;
- // this is usually desired when plotting
- d_shift = true;
-
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
-
- d_index = 0;
- for(int i = 0; i < d_nconnections; i++) {
- d_residbufs.push_back(gr::fft::malloc_complex(d_fftsize));
- d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
- }
-
- buildwindow();
-
- initialize();
-}
-
-qtgui_waterfall_sink_c::~qtgui_waterfall_sink_c()
-{
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
- }
- delete d_fft;
-}
-
-void
-qtgui_waterfall_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_fftsize, 8191);
- }
-}
-
-void
-qtgui_waterfall_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 WaterfallDisplayForm(d_nconnections, d_parent);
- d_main_gui->SetFFTSize(d_fftsize);
- d_main_gui->SetFrequencyRange(d_center_freq,
- d_center_freq - d_bandwidth/2.0,
- d_center_freq + d_bandwidth/2.0);
-
- // initialize update time to 10 times a second
- set_update_time(0.1);
- d_last_time = 0;
-}
-
-void
-qtgui_waterfall_sink_c::exec_()
-{
- d_qApplication->exec();
-}
-
-QWidget*
-qtgui_waterfall_sink_c::qwidget()
-{
- return d_main_gui;
-}
-
-PyObject*
-qtgui_waterfall_sink_c::pyqwidget()
-{
- PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
- PyObject *retarg = Py_BuildValue("N", w);
- return retarg;
-}
-
-void
-qtgui_waterfall_sink_c::set_frequency_range(const double centerfreq,
- const double bandwidth)
-{
- d_center_freq = centerfreq;
- d_bandwidth = bandwidth;
- d_main_gui->SetFrequencyRange(d_center_freq,
- -d_bandwidth/2.0,
- d_bandwidth/2.0);
-}
-
-void
-qtgui_waterfall_sink_c::set_update_time(double t)
-{
- //convert update time to ticks
- gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
- d_update_time = t * tps;
- d_main_gui->setUpdateTime(t);
-}
-
-void
-qtgui_waterfall_sink_c::set_title(int which, const std::string &title)
-{
- d_main_gui->setTitle(which, title.c_str());
-}
-
-void
-qtgui_waterfall_sink_c::set_color(int which, const std::string &color)
-{
- d_main_gui->setColor(which, color.c_str());
-}
-
-void
-qtgui_waterfall_sink_c::set_resize(int width, int height)
-{
- d_main_gui->resize(QSize(width, height));
-}
-
-void
-qtgui_waterfall_sink_c::fft(float *data_out, const gr_complex *data_in, int size)
-{
- if(d_window.size()) {
- volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), data_in, &d_window.front(), size);
- }
- else {
- memcpy(d_fft->get_inbuf(), data_in, sizeof(gr_complex)*size);
- }
-
- d_fft->execute(); // compute the fft
-
- volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(), size, 1.0, size);
-
- // Perform shift operation
- unsigned int len = (unsigned int)(floor(size/2.0));
- float *tmp = (float*)malloc(sizeof(float)*len);
- memcpy(tmp, &data_out[0], sizeof(float)*len);
- memcpy(&data_out[0], &data_out[len], sizeof(float)*(size - len));
- memcpy(&data_out[size - len], tmp, sizeof(float)*len);
- free(tmp);
-}
-
-void
-qtgui_waterfall_sink_c::windowreset()
-{
- //gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType();
- //if(d_wintype != newwintype) {
- // d_wintype = newwintype;
- // buildwindow();
- //}
-}
-
-void
-qtgui_waterfall_sink_c::buildwindow()
-{
- d_window.clear();
- if(d_wintype != 0) {
- d_window = gr_firdes::window(d_wintype, d_fftsize, 6.76);
- }
-}
-
-void
-qtgui_waterfall_sink_c::fftresize()
-{
- int newfftsize = d_main_gui->GetFFTSize();
-
- if(newfftsize != d_fftsize) {
-
- // Resize residbuf and replace data
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
-
- d_residbufs[i] = gr::fft::malloc_complex(newfftsize);
- d_magbufs[i] = gr::fft::malloc_double(newfftsize);
- }
-
- // Set new fft size and reset buffer index
- // (throws away any currently held data, but who cares?)
- d_fftsize = newfftsize;
- d_index = 0;
-
- // Reset window to reflect new size
- buildwindow();
-
- // Reset FFTW plan for new size
- delete d_fft;
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
- }
-}
-
-int
-qtgui_waterfall_sink_c::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int j=0;
- const gr_complex *in = (const gr_complex*)input_items[0];
-
- // Update the FFT size from the application
- fftresize();
- windowreset();
-
- for(int i=0; i < noutput_items; i+=d_fftsize) {
- unsigned int datasize = noutput_items - i;
- unsigned int resid = d_fftsize-d_index;
-
- // If we have enough input for one full FFT, do it
- if(datasize >= resid) {
-
- float *fbuf = gr::fft::malloc_float(d_fftsize);
- for(int n = 0; n < d_nconnections; n++) {
- // Fill up residbuf with d_fftsize number of items
- in = (const gr_complex*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*resid);
-
- fft(fbuf, d_residbufs[n], d_fftsize);
- volk_32f_convert_64f_a(d_magbufs[n], fbuf, d_fftsize);
- }
- gr::fft::free(fbuf);
-
- if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
- d_last_time = gruel::high_res_timer_now();
- d_qApplication->postEvent(d_main_gui,
- new WaterfallUpdateEvent(d_magbufs,
- d_fftsize,
- d_last_time));
- }
-
- d_index = 0;
- j += resid;
- }
- // Otherwise, copy what we received into the residbuf for next time
- else {
- for(int n = 0; n < d_nconnections; n++) {
- in = (const gr_complex*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*datasize);
- }
- d_index += datasize;
- j += datasize;
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-qtgui/lib/qtgui_waterfall_sink_f.cc b/gr-qtgui/lib/qtgui_waterfall_sink_f.cc
deleted file mode 100644
index 7f7ebb3ede..0000000000
--- a/gr-qtgui/lib/qtgui_waterfall_sink_f.cc
+++ /dev/null
@@ -1,298 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_waterfall_sink_f.h>
-#include <gr_io_signature.h>
-#include <string.h>
-
-#include <QTimer>
-#include <volk/volk.h>
-
-qtgui_waterfall_sink_f_sptr
-qtgui_make_waterfall_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
-{
- return gnuradio::get_initial_sptr
- (new qtgui_waterfall_sink_f(fftsize, wintype,
- fc, bw, name,
- nconnections,
- parent));
-}
-
-qtgui_waterfall_sink_f::qtgui_waterfall_sink_f(int fftsize, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections,
- QWidget *parent)
- : gr_sync_block("waterfall_sink_f",
- gr_make_io_signature(1, -1, sizeof(float)),
- gr_make_io_signature(0, 0, 0)),
- d_fftsize(fftsize),
- d_wintype((gr_firdes::win_type)(wintype)),
- d_center_freq(fc), d_bandwidth(bw), d_name(name),
- d_nconnections(nconnections), d_parent(parent)
-{
- d_main_gui = NULL;
-
- // Perform fftshift operation;
- // this is usually desired when plotting
- d_shift = true;
-
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
-
- d_index = 0;
- for(int i = 0; i < d_nconnections; i++) {
- d_residbufs.push_back(gr::fft::malloc_float(d_fftsize));
- d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
- }
-
- buildwindow();
-
- initialize();
-}
-
-qtgui_waterfall_sink_f::~qtgui_waterfall_sink_f()
-{
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
- }
- delete d_fft;
-}
-
-void
-qtgui_waterfall_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_fftsize, 8191);
- }
-}
-
-void
-qtgui_waterfall_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 WaterfallDisplayForm(d_nconnections, d_parent);
- d_main_gui->SetFFTSize(d_fftsize);
- d_main_gui->SetFrequencyRange(d_center_freq,
- d_center_freq - d_bandwidth/2.0,
- d_center_freq + d_bandwidth/2.0);
-
- // initialize update time to 10 times a second
- set_update_time(0.1);
- d_last_time = 0;
-}
-
-void
-qtgui_waterfall_sink_f::exec_()
-{
- d_qApplication->exec();
-}
-
-QWidget*
-qtgui_waterfall_sink_f::qwidget()
-{
- return d_main_gui;
-}
-
-PyObject*
-qtgui_waterfall_sink_f::pyqwidget()
-{
- PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
- PyObject *retarg = Py_BuildValue("N", w);
- return retarg;
-}
-
-void
-qtgui_waterfall_sink_f::set_frequency_range(const double centerfreq,
- const double bandwidth)
-{
- d_center_freq = centerfreq;
- d_bandwidth = bandwidth;
- d_main_gui->SetFrequencyRange(d_center_freq,
- -d_bandwidth/2.0,
- d_bandwidth/2.0);
-}
-
-void
-qtgui_waterfall_sink_f::set_update_time(double t)
-{
- //convert update time to ticks
- gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
- d_update_time = t * tps;
- d_main_gui->setUpdateTime(t);
-}
-
-void
-qtgui_waterfall_sink_f::set_title(int which, const std::string &title)
-{
- d_main_gui->setTitle(which, title.c_str());
-}
-
-void
-qtgui_waterfall_sink_f::set_color(int which, const std::string &color)
-{
- d_main_gui->setColor(which, color.c_str());
-}
-
-void
-qtgui_waterfall_sink_f::set_resize(int width, int height)
-{
- d_main_gui->resize(QSize(width, height));
-}
-
-void
-qtgui_waterfall_sink_f::fft(float *data_out, const float *data_in, int size)
-{
- // float to complex conversion
- gr_complex *dst = d_fft->get_inbuf();
- for (int i = 0; i < size; i++)
- dst[i] = data_in[i];
-
- if(d_window.size()) {
- volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), dst, &d_window.front(), size);
- }
-
- d_fft->execute(); // compute the fft
-
- volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(), size, 1.0, size);
-}
-
-void
-qtgui_waterfall_sink_f::windowreset()
-{
- //gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType();
- //if(d_wintype != newwintype) {
- // d_wintype = newwintype;
- // buildwindow();
- //}
-}
-
-void
-qtgui_waterfall_sink_f::buildwindow()
-{
- d_window.clear();
- if(d_wintype != 0) {
- d_window = gr_firdes::window(d_wintype, d_fftsize, 6.76);
- }
-}
-
-void
-qtgui_waterfall_sink_f::fftresize()
-{
- int newfftsize = d_fftsize;
-
- if(newfftsize != d_fftsize) {
-
- // Resize residbuf and replace data
- for(int i = 0; i < d_nconnections; i++) {
- gr::fft::free(d_residbufs[i]);
- gr::fft::free(d_magbufs[i]);
-
- d_residbufs.push_back(gr::fft::malloc_float(newfftsize));
- d_magbufs.push_back(gr::fft::malloc_double(newfftsize));
- }
-
- // Set new fft size and reset buffer index
- // (throws away any currently held data, but who cares?)
- d_fftsize = newfftsize;
- d_index = 0;
-
- // Reset window to reflect new size
- buildwindow();
-
- // Reset FFTW plan for new size
- delete d_fft;
- d_fft = new gr::fft::fft_complex(d_fftsize, true);
- }
-}
-
-int
-qtgui_waterfall_sink_f::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int j=0;
- const float *in = (const float*)input_items[0];
-
- // Update the FFT size from the application
- fftresize();
- windowreset();
-
- for(int i=0; i < noutput_items; i+=d_fftsize) {
- unsigned int datasize = noutput_items - i;
- unsigned int resid = d_fftsize-d_index;
-
- // If we have enough input for one full FFT, do it
- if(datasize >= resid) {
-
- float *fbuf = gr::fft::malloc_float(d_fftsize);
- for(int n = 0; n < d_nconnections; n++) {
- // Fill up residbuf with d_fftsize number of items
- in = (const float*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*resid);
-
- fft(fbuf, d_residbufs[n], d_fftsize);
- volk_32f_convert_64f_a(d_magbufs[n], fbuf, d_fftsize);
- }
- gr::fft::free(fbuf);
-
- if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
- d_last_time = gruel::high_res_timer_now();
- d_qApplication->postEvent(d_main_gui,
- new WaterfallUpdateEvent(d_magbufs,
- d_fftsize,
- d_last_time));
- }
-
- d_index = 0;
- j += resid;
- }
- // Otherwise, copy what we received into the residbuf for next time
- else {
- for(int n = 0; n < d_nconnections; n++) {
- in = (const float*)input_items[n];
- memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*datasize);
- }
- d_index += datasize;
- j += datasize;
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc
new file mode 100644
index 0000000000..fc090501d2
--- /dev/null
+++ b/gr-qtgui/lib/time_sink_c_impl.cc
@@ -0,0 +1,235 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 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 "time_sink_c_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <volk/volk.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace qtgui {
+
+ time_sink_c::sptr time_sink_c::make(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ {
+ return gnuradio::get_initial_sptr
+ (new time_sink_c_impl(size, bw, name, nconnections, parent));
+ }
+
+ time_sink_c_impl::time_sink_c_impl(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_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(gr::fft::malloc_double(d_size));
+ }
+
+ // Set alignment properties for VOLK
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+
+ initialize();
+ }
+
+ time_sink_c_impl::~time_sink_c_impl()
+ {
+ // d_main_gui is a qwidget destroyed with its parent
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ }
+ }
+
+ void
+ time_sink_c_impl::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);
+ d_last_time = 0;
+ }
+
+ void
+ time_sink_c_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ time_sink_c_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+ PyObject*
+ time_sink_c_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+
+ void
+ time_sink_c_impl::set_time_domain_axis(double min, double max)
+ {
+ d_main_gui->setTimeDomainAxis(min, max);
+ }
+
+ void
+ time_sink_c_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ }
+
+ void
+ time_sink_c_impl::set_title(int which, const std::string &title)
+ {
+ d_main_gui->setTitle(which, title.c_str());
+ }
+
+ void
+ time_sink_c_impl::set_color(int which, const std::string &color)
+ {
+ d_main_gui->setColor(which, color.c_str());
+ }
+
+ void
+ time_sink_c_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ time_sink_c_impl::set_line_style(int which, Qt::PenStyle style)
+ {
+ d_main_gui->setLineStyle(which, style);
+ }
+
+ void
+ time_sink_c_impl::set_line_marker(int which, QwtSymbol::Style marker)
+ {
+ d_main_gui->setLineMarker(which, marker);
+ }
+
+ void
+ time_sink_c_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ int
+ time_sink_c_impl::work(int noutput_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) {
+
+ // Fill up residbufs with d_size number of items
+ for(n = 0; n < d_nconnections; n+=2) {
+ in = (const gr_complex*)input_items[idx++];
+ if(is_unaligned()) {
+ volk_32fc_deinterleave_64f_x2_u(&d_residbufs[n][d_index],
+ &d_residbufs[n+1][d_index],
+ &in[j], resid);
+ }
+ else {
+ volk_32fc_deinterleave_64f_x2_a(&d_residbufs[n][d_index],
+ &d_residbufs[n+1][d_index],
+ &in[j], resid);
+ }
+ }
+
+ // Update the plot if its time
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = gruel::high_res_timer_now();
+ 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++];
+ if(is_unaligned()) {
+ volk_32fc_deinterleave_64f_x2_u(&d_residbufs[n][d_index],
+ &d_residbufs[n+1][d_index],
+ &in[j], datasize);
+ }
+ else {
+ volk_32fc_deinterleave_64f_x2_a(&d_residbufs[n][d_index],
+ &d_residbufs[n+1][d_index],
+ &in[j], datasize);
+ }
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h
new file mode 100644
index 0000000000..8509f73973
--- /dev/null
+++ b/gr-qtgui/lib/time_sink_c_impl.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 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_IMPL_H
+#define INCLUDED_QTGUI_TIME_SINK_C_IMPL_H
+
+#include <qtgui/time_sink_c.h>
+#include <fft/fft.h>
+#include <timedisplayform.h>
+#include <gruel/high_res_timer.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API time_sink_c_impl : public time_sink_c
+ {
+ private:
+ void initialize();
+
+ int d_size;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ int d_index;
+ std::vector<double*> d_residbufs;
+
+ QWidget *d_parent;
+ TimeDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_update_time;
+ gruel::high_res_timer_type d_last_time;
+
+ public:
+ time_sink_c_impl(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+ ~time_sink_c_impl();
+
+ 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);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
+
+ void set_size(int width, int height);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_C_IMPL_H */
diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc
new file mode 100644
index 0000000000..d93d267924
--- /dev/null
+++ b/gr-qtgui/lib/time_sink_f_impl.cc
@@ -0,0 +1,233 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 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 "time_sink_f_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <volk/volk.h>
+#include <fft/fft.h>
+
+#include <QTimer>
+
+namespace gr {
+ namespace qtgui {
+
+ time_sink_f::sptr time_sink_f::make(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ {
+ return gnuradio::get_initial_sptr
+ (new time_sink_f_impl(size, bw, name, nconnections, parent));
+ }
+
+ time_sink_f_impl::time_sink_f_impl(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_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(gr::fft::malloc_double(d_size));
+ }
+
+ // Set alignment properties for VOLK
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+
+ initialize();
+ }
+
+ time_sink_f_impl::~time_sink_f_impl()
+ {
+ // d_main_gui is a qwidget destroyed with its parent
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ }
+ }
+
+ void
+ time_sink_f_impl::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);
+ d_last_time = 0;
+ }
+
+ void
+ time_sink_f_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ time_sink_f_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+ PyObject*
+ time_sink_f_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+
+ void
+ time_sink_f_impl::set_time_domain_axis(double min, double max)
+ {
+ d_main_gui->setTimeDomainAxis(min, max);
+ }
+
+ void
+ time_sink_f_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ }
+
+ void
+ time_sink_f_impl::set_title(int which, const std::string &title)
+ {
+ d_main_gui->setTitle(which, title.c_str());
+ }
+
+ void
+ time_sink_f_impl::set_color(int which, const std::string &color)
+ {
+ d_main_gui->setColor(which, color.c_str());
+ }
+
+ void
+ time_sink_f_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ time_sink_f_impl::set_line_style(int which, Qt::PenStyle style)
+ {
+ d_main_gui->setLineStyle(which, style);
+ }
+
+ void
+ time_sink_f_impl::set_line_marker(int which, QwtSymbol::Style marker)
+ {
+ d_main_gui->setLineMarker(which, marker);
+ }
+
+ void
+ time_sink_f_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ int
+ time_sink_f_impl::work(int noutput_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) {
+
+ // Fill up residbufs with d_size number of items
+ for(n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[idx++];
+ if(is_unaligned()) {
+ volk_32f_convert_64f_u(&d_residbufs[n][d_index],
+ &in[j], resid);
+ }
+ else {
+ volk_32f_convert_64f_a(&d_residbufs[n][d_index],
+ &in[j], resid);
+ }
+ }
+
+ // Update the plot if its time
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = gruel::high_res_timer_now();
+ 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
+ // because we set the output_multiple, this should never need to be called
+ else {
+ for(n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[idx++];
+ if(is_unaligned()) {
+ volk_32f_convert_64f_u(&d_residbufs[n][d_index],
+ &in[j], datasize);
+ }
+ else {
+ volk_32f_convert_64f_a(&d_residbufs[n][d_index],
+ &in[j], datasize);
+ }
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h
new file mode 100644
index 0000000000..65dd3645db
--- /dev/null
+++ b/gr-qtgui/lib/time_sink_f_impl.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 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_IMPL_H
+#define INCLUDED_QTGUI_TIME_SINK_F_IMPL_H
+
+#include <qtgui/time_sink_f.h>
+#include <fft/fft.h>
+#include <timedisplayform.h>
+#include <gruel/high_res_timer.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API time_sink_f_impl : public time_sink_f
+ {
+ private:
+ void initialize();
+
+ int d_size;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ int d_index;
+ std::vector<double*> d_residbufs;
+
+ QWidget *d_parent;
+ TimeDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_update_time;
+ gruel::high_res_timer_type d_last_time;
+
+ public:
+ time_sink_f_impl(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+ ~time_sink_f_impl();
+
+ 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);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
+
+ void set_size(int width, int height);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_F_IMPL_H */
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc b/gr-qtgui/lib/waterfall_sink_c_impl.cc
new file mode 100644
index 0000000000..fa2e028783
--- /dev/null
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc
@@ -0,0 +1,354 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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 "waterfall_sink_c_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace qtgui {
+
+ waterfall_sink_c::sptr
+ waterfall_sink_c::make(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ {
+ return gnuradio::get_initial_sptr
+ (new waterfall_sink_c_impl(fftsize, wintype,
+ fc, bw, name,
+ nconnections,
+ parent));
+ }
+
+ waterfall_sink_c_impl::waterfall_sink_c_impl(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_block("waterfall_sink_c",
+ gr_make_io_signature(1, -1, sizeof(gr_complex)),
+ gr_make_io_signature(0, 0, 0)),
+ d_fftsize(fftsize), d_fftavg(1.0),
+ d_wintype((filter::firdes::win_type)(wintype)),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
+ d_nconnections(nconnections), d_parent(parent)
+ {
+ d_main_gui = NULL;
+
+ // Perform fftshift operation;
+ // this is usually desired when plotting
+ d_shift = true;
+
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+
+ d_index = 0;
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(gr::fft::malloc_complex(d_fftsize));
+ d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
+ }
+
+ buildwindow();
+
+ initialize();
+ }
+
+ waterfall_sink_c_impl::~waterfall_sink_c_impl()
+ {
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+ }
+ delete d_fft;
+ }
+
+ void
+ waterfall_sink_c_impl::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_fftsize, 8191);
+ }
+ }
+
+ void
+ waterfall_sink_c_impl::initialize()
+ {
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new WaterfallDisplayForm(d_nconnections, d_parent);
+ d_main_gui->SetFFTSize(d_fftsize);
+ d_main_gui->SetFFTWindowType(d_wintype);
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ d_center_freq - d_bandwidth/2.0,
+ d_center_freq + d_bandwidth/2.0);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ d_last_time = 0;
+ }
+
+ void
+ waterfall_sink_c_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ waterfall_sink_c_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+ PyObject*
+ waterfall_sink_c_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+
+ void
+ waterfall_sink_c_impl::set_fft_size(const int fftsize)
+ {
+ d_fftsize = fftsize;
+ d_main_gui->SetFFTSize(fftsize);
+ }
+
+ int
+ waterfall_sink_c_impl::fft_size() const
+ {
+ return d_fftsize;
+ }
+
+ void
+ waterfall_sink_c_impl::set_fft_average(const float fftavg)
+ {
+ d_fftavg = fftavg;
+ d_main_gui->SetFFTAverage(fftavg);
+ }
+
+ float
+ waterfall_sink_c_impl::fft_average() const
+ {
+ return d_fftavg;
+ }
+
+ void
+ waterfall_sink_c_impl::set_frequency_range(const double centerfreq,
+ const double bandwidth)
+ {
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+ }
+
+ void
+ waterfall_sink_c_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ }
+
+ void
+ waterfall_sink_c_impl::set_title(int which, const std::string &title)
+ {
+ d_main_gui->setTitle(which, title.c_str());
+ }
+
+ void
+ waterfall_sink_c_impl::set_color(int which, const std::string &color)
+ {
+ d_main_gui->setColor(which, color.c_str());
+ }
+
+ void
+ waterfall_sink_c_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ waterfall_sink_c_impl::set_line_style(int which, Qt::PenStyle style)
+ {
+ d_main_gui->setLineStyle(which, style);
+ }
+
+ void
+ waterfall_sink_c_impl::set_line_marker(int which, QwtSymbol::Style marker)
+ {
+ d_main_gui->setLineMarker(which, marker);
+ }
+
+ void
+ waterfall_sink_c_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ void
+ waterfall_sink_c_impl::fft(float *data_out, const gr_complex *data_in, int size)
+ {
+ if(d_window.size()) {
+ volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), data_in, &d_window.front(), size);
+ }
+ else {
+ memcpy(d_fft->get_inbuf(), data_in, sizeof(gr_complex)*size);
+ }
+
+ d_fft->execute(); // compute the fft
+
+ volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(), size, 1.0, size);
+
+ // Perform shift operation
+ unsigned int len = (unsigned int)(floor(size/2.0));
+ float *tmp = (float*)malloc(sizeof(float)*len);
+ memcpy(tmp, &data_out[0], sizeof(float)*len);
+ memcpy(&data_out[0], &data_out[len], sizeof(float)*(size - len));
+ memcpy(&data_out[size - len], tmp, sizeof(float)*len);
+ free(tmp);
+ }
+
+ void
+ waterfall_sink_c_impl::windowreset()
+ {
+ filter::firdes::win_type newwintype;
+ newwintype = d_main_gui->GetFFTWindowType();
+ if(d_wintype != newwintype) {
+ d_wintype = newwintype;
+ buildwindow();
+ }
+ }
+
+ void
+ waterfall_sink_c_impl::buildwindow()
+ {
+ d_window.clear();
+ if(d_wintype != 0) {
+ d_window = filter::firdes::window(d_wintype, d_fftsize, 6.76);
+ }
+ }
+
+ void
+ waterfall_sink_c_impl::fftresize()
+ {
+ int newfftsize = d_main_gui->GetFFTSize();
+
+ if(newfftsize != d_fftsize) {
+
+ // Resize residbuf and replace data
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+
+ d_residbufs[i] = gr::fft::malloc_complex(newfftsize);
+ d_magbufs[i] = gr::fft::malloc_double(newfftsize);
+ }
+
+ // Set new fft size and reset buffer index
+ // (throws away any currently held data, but who cares?)
+ d_fftsize = newfftsize;
+ d_index = 0;
+
+ // Reset window to reflect new size
+ buildwindow();
+
+ // Reset FFTW plan for new size
+ delete d_fft;
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+ }
+ }
+
+ int
+ waterfall_sink_c_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int j=0;
+ const gr_complex *in = (const gr_complex*)input_items[0];
+
+ // Update the FFT size from the application
+ fftresize();
+ windowreset();
+
+ for(int i=0; i < noutput_items; i+=d_fftsize) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_fftsize-d_index;
+
+ // If we have enough input for one full FFT, do it
+ if(datasize >= resid) {
+
+ float *fbuf = gr::fft::malloc_float(d_fftsize);
+ for(int n = 0; n < d_nconnections; n++) {
+ // Fill up residbuf with d_fftsize number of items
+ in = (const gr_complex*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*resid);
+
+ fft(fbuf, d_residbufs[n], d_fftsize);
+ volk_32f_convert_64f_a(d_magbufs[n], fbuf, d_fftsize);
+ }
+ gr::fft::free(fbuf);
+
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = gruel::high_res_timer_now();
+ d_qApplication->postEvent(d_main_gui,
+ new WaterfallUpdateEvent(d_magbufs,
+ d_fftsize,
+ d_last_time));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbuf for next time
+ else {
+ for(int n = 0; n < d_nconnections; n++) {
+ in = (const gr_complex*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(gr_complex)*datasize);
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.h b/gr-qtgui/lib/waterfall_sink_c_impl.h
new file mode 100644
index 0000000000..9b7a3bcd6a
--- /dev/null
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.h
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_WATERFALL_SINK_C_IMPL_H
+#define INCLUDED_QTGUI_WATERFALL_SINK_C_IMPL_H
+
+#include <qtgui/waterfall_sink_c.h>
+#include <filter/firdes.h>
+#include <fft/fft.h>
+#include <gruel/high_res_timer.h>
+#include <gruel/thread.h>
+#include <waterfalldisplayform.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API waterfall_sink_c_impl : public waterfall_sink_c
+ {
+ private:
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ int d_fftsize;
+ float d_fftavg;
+ filter::firdes::win_type d_wintype;
+ std::vector<float> d_window;
+ double d_center_freq;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ bool d_shift;
+ gr::fft::fft_complex *d_fft;
+
+ int d_index;
+ std::vector<gr_complex*> d_residbufs;
+ std::vector<double*> d_magbufs;
+
+ QWidget *d_parent;
+ WaterfallDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_update_time;
+ gruel::high_res_timer_type d_last_time;
+
+ void windowreset();
+ void buildwindow();
+ void fftresize();
+ void fft(float *data_out, const gr_complex *data_in, int size);
+
+ public:
+ waterfall_sink_c_impl(int size, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+ ~waterfall_sink_c_impl();
+
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_fft_size(const int fftsize);
+ int fft_size() const;
+ void set_fft_average(const float fftavg);
+ float fft_average() const;
+
+ void set_frequency_range(const double centerfreq, const double bandwidth);
+
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
+
+ void set_size(int width, int height);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_WATERFALL_SINK_C_IMPL_H */
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc b/gr-qtgui/lib/waterfall_sink_f_impl.cc
new file mode 100644
index 0000000000..8cf4d0615f
--- /dev/null
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc
@@ -0,0 +1,350 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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 "waterfall_sink_f_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace qtgui {
+
+ waterfall_sink_f::sptr
+ waterfall_sink_f::make(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ {
+ return gnuradio::get_initial_sptr
+ (new waterfall_sink_f_impl(fftsize, wintype,
+ fc, bw, name,
+ nconnections,
+ parent));
+ }
+
+ waterfall_sink_f_impl::waterfall_sink_f_impl(int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_block("waterfall_sink_f",
+ gr_make_io_signature(1, -1, sizeof(float)),
+ gr_make_io_signature(0, 0, 0)),
+ d_fftsize(fftsize), d_fftavg(1.0),
+ d_wintype((filter::firdes::win_type)(wintype)),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
+ d_nconnections(nconnections), d_parent(parent)
+ {
+ d_main_gui = NULL;
+
+ // Perform fftshift operation;
+ // this is usually desired when plotting
+ d_shift = true;
+
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+
+ d_index = 0;
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(gr::fft::malloc_float(d_fftsize));
+ d_magbufs.push_back(gr::fft::malloc_double(d_fftsize));
+ }
+
+ buildwindow();
+
+ initialize();
+ }
+
+ waterfall_sink_f_impl::~waterfall_sink_f_impl()
+ {
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+ }
+ delete d_fft;
+ }
+
+ void
+ waterfall_sink_f_impl::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_fftsize, 8191);
+ }
+ }
+
+ void
+ waterfall_sink_f_impl::initialize()
+ {
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new WaterfallDisplayForm(d_nconnections, d_parent);
+ d_main_gui->SetFFTSize(d_fftsize);
+ d_main_gui->SetFFTWindowType(d_wintype);
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ d_center_freq - d_bandwidth/2.0,
+ d_center_freq + d_bandwidth/2.0);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ d_last_time = 0;
+ }
+
+ void
+ waterfall_sink_f_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ waterfall_sink_f_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+ PyObject*
+ waterfall_sink_f_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+
+ void
+ waterfall_sink_f_impl::set_fft_size(const int fftsize)
+ {
+ d_fftsize = fftsize;
+ d_main_gui->SetFFTSize(fftsize);
+ }
+
+ int
+ waterfall_sink_f_impl::fft_size() const
+ {
+ return d_fftsize;
+ }
+
+ void
+ waterfall_sink_f_impl::set_fft_average(const float fftavg)
+ {
+ d_fftavg = fftavg;
+ d_main_gui->SetFFTAverage(fftavg);
+ }
+
+ float
+ waterfall_sink_f_impl::fft_average() const
+ {
+ return d_fftavg;
+ }
+
+ void
+ waterfall_sink_f_impl::set_frequency_range(const double centerfreq,
+ const double bandwidth)
+ {
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+ }
+
+ void
+ waterfall_sink_f_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gruel::high_res_timer_type tps = gruel::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ }
+
+ void
+ waterfall_sink_f_impl::set_title(int which, const std::string &title)
+ {
+ d_main_gui->setTitle(which, title.c_str());
+ }
+
+ void
+ waterfall_sink_f_impl::set_color(int which, const std::string &color)
+ {
+ d_main_gui->setColor(which, color.c_str());
+ }
+
+ void
+ waterfall_sink_f_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ waterfall_sink_f_impl::set_line_style(int which, Qt::PenStyle style)
+ {
+ d_main_gui->setLineStyle(which, style);
+ }
+
+ void
+ waterfall_sink_f_impl::set_line_marker(int which, QwtSymbol::Style marker)
+ {
+ d_main_gui->setLineMarker(which, marker);
+ }
+
+ void
+ waterfall_sink_f_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ void
+ waterfall_sink_f_impl::fft(float *data_out, const float *data_in, int size)
+ {
+ // float to complex conversion
+ gr_complex *dst = d_fft->get_inbuf();
+ for (int i = 0; i < size; i++)
+ dst[i] = data_in[i];
+
+ if(d_window.size()) {
+ volk_32fc_32f_multiply_32fc_a(d_fft->get_inbuf(), dst,
+ &d_window.front(), size);
+ }
+
+ d_fft->execute(); // compute the fft
+
+ volk_32fc_s32f_x2_power_spectral_density_32f_a(data_out, d_fft->get_outbuf(),
+ size, 1.0, size);
+ }
+
+ void
+ waterfall_sink_f_impl::windowreset()
+ {
+ filter::firdes::win_type newwintype;
+ newwintype = d_main_gui->GetFFTWindowType();
+ if(d_wintype != newwintype) {
+ d_wintype = newwintype;
+ buildwindow();
+ }
+ }
+
+ void
+ waterfall_sink_f_impl::buildwindow()
+ {
+ d_window.clear();
+ if(d_wintype != 0) {
+ d_window = filter::firdes::window(d_wintype, d_fftsize, 6.76);
+ }
+ }
+
+ void
+ waterfall_sink_f_impl::fftresize()
+ {
+ int newfftsize = d_fftsize;
+
+ if(newfftsize != d_fftsize) {
+
+ // Resize residbuf and replace data
+ for(int i = 0; i < d_nconnections; i++) {
+ gr::fft::free(d_residbufs[i]);
+ gr::fft::free(d_magbufs[i]);
+
+ d_residbufs[i] = gr::fft::malloc_float(newfftsize);
+ d_magbufs[i] = gr::fft::malloc_double(newfftsize);
+ }
+
+ // Set new fft size and reset buffer index
+ // (throws away any currently held data, but who cares?)
+ d_fftsize = newfftsize;
+ d_index = 0;
+
+ // Reset window to reflect new size
+ buildwindow();
+
+ // Reset FFTW plan for new size
+ delete d_fft;
+ d_fft = new gr::fft::fft_complex(d_fftsize, true);
+ }
+ }
+
+ int
+ waterfall_sink_f_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int j=0;
+ const float *in = (const float*)input_items[0];
+
+ // Update the FFT size from the application
+ fftresize();
+ windowreset();
+
+ for(int i=0; i < noutput_items; i+=d_fftsize) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_fftsize-d_index;
+
+ // If we have enough input for one full FFT, do it
+ if(datasize >= resid) {
+
+ float *fbuf = gr::fft::malloc_float(d_fftsize);
+ for(int n = 0; n < d_nconnections; n++) {
+ // Fill up residbuf with d_fftsize number of items
+ in = (const float*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*resid);
+
+ fft(fbuf, d_residbufs[n], d_fftsize);
+ volk_32f_convert_64f_a(d_magbufs[n], fbuf, d_fftsize);
+ }
+ gr::fft::free(fbuf);
+
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = gruel::high_res_timer_now();
+ d_qApplication->postEvent(d_main_gui,
+ new WaterfallUpdateEvent(d_magbufs,
+ d_fftsize,
+ d_last_time));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbuf for next time
+ else {
+ for(int n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[n];
+ memcpy(d_residbufs[n]+d_index, &in[j], sizeof(float)*datasize);
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.h b/gr-qtgui/lib/waterfall_sink_f_impl.h
new file mode 100644
index 0000000000..789a5a8ca3
--- /dev/null
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.h
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_WATERFALL_SINK_F_IMPL_H
+#define INCLUDED_QTGUI_WATERFALL_SINK_F_IMPL_H
+
+
+#include <qtgui/waterfall_sink_f.h>
+#include <filter/firdes.h>
+#include <fft/fft.h>
+#include <gruel/high_res_timer.h>
+#include <gruel/thread.h>
+#include <waterfalldisplayform.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API waterfall_sink_f_impl : public waterfall_sink_f
+ {
+ private:
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ int d_fftsize;
+ float d_fftavg;
+ filter::firdes::win_type d_wintype;
+ std::vector<float> d_window;
+ double d_center_freq;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ bool d_shift;
+ gr::fft::fft_complex *d_fft;
+
+ int d_index;
+ std::vector<float*> d_residbufs;
+ std::vector<double*> d_magbufs;
+
+ QWidget *d_parent;
+ WaterfallDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_update_time;
+ gruel::high_res_timer_type d_last_time;
+
+ void windowreset();
+ void buildwindow();
+ void fftresize();
+ void fft(float *data_out, const float *data_in, int size);
+
+ public:
+ waterfall_sink_f_impl(int size, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+ ~waterfall_sink_f_impl();
+
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_fft_size(const int fftsize);
+ int fft_size() const;
+ void set_fft_average(const float fftavg);
+ float fft_average() const;
+
+ void set_frequency_range(const double centerfreq, const double bandwidth);
+
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, Qt::PenStyle style);
+ void set_line_marker(int which, QwtSymbol::Style marker);
+
+ void set_size(int width, int height);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_WATERFALL_SINK_F_IMPL_H */
diff --git a/gr-qtgui/lib/waterfalldisplayform.cc b/gr-qtgui/lib/waterfalldisplayform.cc
index a436ed7db4..c2721a9fa1 100644
--- a/gr-qtgui/lib/waterfalldisplayform.cc
+++ b/gr-qtgui/lib/waterfalldisplayform.cc
@@ -101,6 +101,12 @@ WaterfallDisplayForm::GetFFTAverage() const
return _fftavg;
}
+gr::filter::firdes::win_type
+WaterfallDisplayForm::GetFFTWindowType() const
+{
+ return _fftwintype;
+}
+
void
WaterfallDisplayForm::SetFFTSize(const int newsize)
{
@@ -114,6 +120,12 @@ WaterfallDisplayForm::SetFFTAverage(const float newavg)
}
void
+WaterfallDisplayForm::SetFFTWindowType(const gr::filter::firdes::win_type newwin)
+{
+ _fftwintype = newwin;
+}
+
+void
WaterfallDisplayForm::SetFrequencyRange(const double newCenterFrequency,
const double newStartFrequency,
const double newStopFrequency)
diff --git a/gr-qtgui/lib/waterfalldisplayform.h b/gr-qtgui/lib/waterfalldisplayform.h
index 04c9a8088c..0235ddeeeb 100644
--- a/gr-qtgui/lib/waterfalldisplayform.h
+++ b/gr-qtgui/lib/waterfalldisplayform.h
@@ -27,6 +27,7 @@
#include <WaterfallDisplayPlot.h>
#include <QtGui/QtGui>
#include <vector>
+#include <filter/firdes.h>
#include "displayform.h"
@@ -42,12 +43,14 @@ class WaterfallDisplayForm : public DisplayForm
int GetFFTSize() const;
float GetFFTAverage() const;
+ gr::filter::firdes::win_type GetFFTWindowType() const;
public slots:
void customEvent(QEvent *e);
void SetFFTSize(const int);
void SetFFTAverage(const float);
+ void SetFFTWindowType(const gr::filter::firdes::win_type);
void SetFrequencyRange(const double newCenterFrequency,
const double newStartFrequency,
@@ -68,6 +71,7 @@ private:
int _fftsize;
float _fftavg;
+ gr::filter::firdes::win_type _fftwintype;
};
#endif /* WATERFALL_DISPLAY_FORM_H */
diff --git a/gr-qtgui/swig/CMakeLists.txt b/gr-qtgui/swig/CMakeLists.txt
index ecf04a233f..74545f4cfe 100644
--- a/gr-qtgui/swig/CMakeLists.txt
+++ b/gr-qtgui/swig/CMakeLists.txt
@@ -47,15 +47,6 @@ GR_SWIG_INSTALL(
install(FILES
qtgui_swig.i
- qtgui_sink_c.i
- qtgui_sink_f.i
- qtgui_time_sink_c.i
- qtgui_time_sink_f.i
- qtgui_freq_sink_c.i
- qtgui_freq_sink_f.i
- qtgui_const_sink_c.i
- qtgui_waterfall_sink_c.i
- qtgui_waterfall_sink_f.i
${CMAKE_CURRENT_BINARY_DIR}/qtgui_swig_doc.i
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
COMPONENT "qtgui_swig"
diff --git a/gr-qtgui/swig/qtgui_const_sink_c.i b/gr-qtgui/swig/qtgui_const_sink_c.i
deleted file mode 100644
index 68d1858df5..0000000000
--- a/gr-qtgui/swig/qtgui_const_sink_c.i
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_const_sink_c.h>
-%}
-
-GR_SWIG_BLOCK_MAGIC(qtgui,const_sink_c)
-
-qtgui_const_sink_c_sptr
-qtgui_make_const_sink_c(int size,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-class qtgui_const_sink_c : public gr_sync_block
-{
-private:
- friend qtgui_const_sink_c_sptr
- qtgui_make_const_sink_c(int size,
- const std::string &name,
- int nconnections,
- QWidget *parent);
- qtgui_const_sink_c(int size,
- const std::string &name,
- int nconnections,
- QWidget *parent=NULL);
-
-public:
- void exec_();
- PyObject* pyqwidget();
-
- void set_resize(double width, double height);
- 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_freq_sink_c.i b/gr-qtgui/swig/qtgui_freq_sink_c.i
deleted file mode 100644
index 67bae3e2b5..0000000000
--- a/gr-qtgui/swig/qtgui_freq_sink_c.i
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_freq_sink_c.h>
-%}
-
-GR_SWIG_BLOCK_MAGIC(qtgui,freq_sink_c)
-
-qtgui_freq_sink_c_sptr
-qtgui_make_freq_sink_c(int size, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-class qtgui_freq_sink_c : public gr_sync_block
-{
-public:
- void exec_();
- PyObject* pyqwidget();
-
- void set_fft_size(const int fftsize);
- int fft_size() const;
- void set_fft_average(const float fftavg);
- float fft_average() const;
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
- void set_fft_power_db(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);
-
- void set_resize(int width, int height);
-};
diff --git a/gr-qtgui/swig/qtgui_freq_sink_f.i b/gr-qtgui/swig/qtgui_freq_sink_f.i
deleted file mode 100644
index 015da87eb7..0000000000
--- a/gr-qtgui/swig/qtgui_freq_sink_f.i
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_freq_sink_f.h>
-%}
-
-GR_SWIG_BLOCK_MAGIC(qtgui,freq_sink_f)
-
-qtgui_freq_sink_f_sptr
-qtgui_make_freq_sink_f(int size, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-class qtgui_freq_sink_f : public gr_sync_block
-{
-public:
- void exec_();
- PyObject* pyqwidget();
-
- void set_fft_size(const int fftsize);
- int fft_size() const;
- void set_fft_average(const float fftavg);
- float fft_average() const;
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
- void set_fft_power_db(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);
-
- void set_resize(int width, int height);
-};
diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i
index 990ca38bf7..feef28fa02 100644
--- a/gr-qtgui/swig/qtgui_swig.i
+++ b/gr-qtgui/swig/qtgui_swig.i
@@ -20,29 +20,39 @@
* Boston, MA 02110-1301, USA.
*/
+#define QTGUI_API
+
%include "gnuradio.i"
//load generated python docstrings
%include "qtgui_swig_doc.i"
%{
-#include "qtgui_sink_c.h"
-#include "qtgui_sink_f.h"
-#include "qtgui_time_sink_c.h"
-#include "qtgui_time_sink_f.h"
-#include "qtgui_freq_sink_c.h"
-#include "qtgui_freq_sink_f.h"
-#include "qtgui_const_sink_c.h"
-#include "qtgui_waterfall_sink_c.h"
-#include "qtgui_waterfall_sink_f.h"
+//#include "qtgui/sink_c.h"
+//#include "qtgui/sink_f.h"
+#include "qtgui/time_sink_c.h"
+#include "qtgui/time_sink_f.h"
+#include "qtgui/freq_sink_c.h"
+#include "qtgui/freq_sink_f.h"
+#include "qtgui/const_sink_c.h"
+#include "qtgui/waterfall_sink_c.h"
+#include "qtgui/waterfall_sink_f.h"
%}
-%include "qtgui_sink_c.i"
-%include "qtgui_sink_f.i"
-%include "qtgui_time_sink_c.i"
-%include "qtgui_time_sink_f.i"
-%include "qtgui_freq_sink_c.i"
-%include "qtgui_freq_sink_f.i"
-%include "qtgui_const_sink_c.i"
-%include "qtgui_waterfall_sink_c.i"
-%include "qtgui_waterfall_sink_f.i"
+//%include "qtgui/sink_c.i"
+//%include "qtgui/sink_f.i"
+%include "qtgui/time_sink_c.h"
+%include "qtgui/time_sink_f.h"
+%include "qtgui/freq_sink_c.h"
+%include "qtgui/freq_sink_f.h"
+%include "qtgui/const_sink_c.h"
+%include "qtgui/waterfall_sink_c.h"
+%include "qtgui/waterfall_sink_f.h"
+
+GR_SWIG_BLOCK_MAGIC2(qtgui, time_sink_c);
+GR_SWIG_BLOCK_MAGIC2(qtgui, time_sink_f);
+GR_SWIG_BLOCK_MAGIC2(qtgui, freq_sink_c);
+GR_SWIG_BLOCK_MAGIC2(qtgui, freq_sink_f);
+GR_SWIG_BLOCK_MAGIC2(qtgui, const_sink_c);
+GR_SWIG_BLOCK_MAGIC2(qtgui, waterfall_sink_c);
+GR_SWIG_BLOCK_MAGIC2(qtgui, waterfall_sink_f);
diff --git a/gr-qtgui/swig/qtgui_time_sink_c.i b/gr-qtgui/swig/qtgui_time_sink_c.i
deleted file mode 100644
index b78ca5386b..0000000000
--- a/gr-qtgui/swig/qtgui_time_sink_c.i
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- 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_sync_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
deleted file mode 100644
index 9d59f93643..0000000000
--- a/gr-qtgui/swig/qtgui_time_sink_f.i
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- 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_sync_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-qtgui/swig/qtgui_waterfall_sink_c.i b/gr-qtgui/swig/qtgui_waterfall_sink_c.i
deleted file mode 100644
index 7fa1d914e2..0000000000
--- a/gr-qtgui/swig/qtgui_waterfall_sink_c.i
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_waterfall_sink_c.h>
-%}
-
-GR_SWIG_BLOCK_MAGIC(qtgui,waterfall_sink_c)
-
-qtgui_waterfall_sink_c_sptr
-qtgui_make_waterfall_sink_c(int size, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-class qtgui_waterfall_sink_c : public gr_sync_block
-{
-public:
- void exec_();
- PyObject* pyqwidget();
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
-
- void set_update_time(double t);
- void set_title(int which, const std::string &title);
- void set_color(int which, const std::string &color);
-
- void set_resize(int width, int height);
-};
diff --git a/gr-qtgui/swig/qtgui_waterfall_sink_f.i b/gr-qtgui/swig/qtgui_waterfall_sink_f.i
deleted file mode 100644
index 280981b425..0000000000
--- a/gr-qtgui/swig/qtgui_waterfall_sink_f.i
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012 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_waterfall_sink_f.h>
-%}
-
-GR_SWIG_BLOCK_MAGIC(qtgui,waterfall_sink_f)
-
-qtgui_waterfall_sink_f_sptr
-qtgui_make_waterfall_sink_f(int size, int wintype,
- double fc, double bw,
- const std::string &name,
- int nconnections=1,
- QWidget *parent=NULL);
-
-class qtgui_waterfall_sink_f : public gr_sync_block
-{
-public:
- void exec_();
- PyObject* pyqwidget();
-
- void set_frequency_range(const double centerfreq, const double bandwidth);
-
- void set_update_time(double t);
- void set_title(int which, const std::string &title);
- void set_color(int which, const std::string &color);
-
- void set_resize(int width, int height);
-};