[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11216 - in gnuradio/trunk: gnuradio-examples/python/d
From: |
trondeau |
Subject: |
[Commit-gnuradio] r11216 - in gnuradio/trunk: gnuradio-examples/python/digital gr-qtgui/src/lib gr-qtgui/src/python |
Date: |
Tue, 16 Jun 2009 22:32:17 -0600 (MDT) |
Author: trondeau
Date: 2009-06-16 22:32:16 -0600 (Tue, 16 Jun 2009)
New Revision: 11216
Added:
gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_loopback.py
gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_rx.py
gnuradio/trunk/gnuradio-examples/python/digital/qt_digital_window.ui
gnuradio/trunk/gnuradio-examples/python/digital/qt_rx_window.ui
Modified:
gnuradio/trunk/gnuradio-examples/python/digital/
gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am
gnuradio/trunk/gnuradio-examples/python/digital/receive_path.py
gnuradio/trunk/gnuradio-examples/python/digital/transmit_path.py
gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.cc
gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.h
gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.cc
gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.h
gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.cc
gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.h
gnuradio/trunk/gr-qtgui/src/python/usrp_display.py
Log:
Merging trondeau/qtdigital branch r11210-11215 to add some QT GUI's to the
digital examples for better visualization and understanding of the signals and
performance.
Property changes on: gnuradio/trunk/gnuradio-examples/python/digital
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital:10683-10688
/gnuradio/branches/developers/jblum/digital:10901-10941,10943-11199
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital:10540-10546
/gnuradio/branches/developers/trondeau/digital/gnuradio-examples/python/digital:11193-11205
+
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital:10683-10688
/gnuradio/branches/developers/jblum/digital:10901-10941,10943-11199
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital:10540-10546
/gnuradio/branches/developers/trondeau/digital/gnuradio-examples/python/digital:11193-11205
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital:11210-11215
Modified: gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am 2009-06-17
03:56:20 UTC (rev 11215)
+++ gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am 2009-06-17
04:32:16 UTC (rev 11216)
@@ -35,6 +35,8 @@
benchmark_loopback.py \
benchmark_rx.py \
benchmark_tx.py \
+ benchmark_qt_rx.py \
+ benchmark_qt_loopback.py\
gen_whitener.py \
rx_voice.py \
run_length.py \
Copied:
gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_loopback.py (from
rev 11215,
gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/benchmark_qt_loopback.py)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_loopback.py
(rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_loopback.py
2009-06-17 04:32:16 UTC (rev 11216)
@@ -0,0 +1,464 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, modulation_utils
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import random, time, struct, sys, os, math
+
+from threading import Thread
+
+# from current dir
+from transmit_path import transmit_path
+from receive_path import receive_path
+
+try:
+ from gnuradio.qtgui import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Please install gr-qtgui."
+ sys.exit(1)
+
+try:
+ from qt_digital_window import Ui_DigitalWindow
+except ImportError:
+ print "Error: could not find qt_digital_window.py:"
+ print "\t\"pyuic4 qt_digital_window.ui -o qt_digital_window.py\""
+ sys.exit(1)
+
+
+#print os.getpid()
+#raw_input()
+
+
+# ////////////////////////////////////////////////////////////////////
+# Define the QT Interface and Control Dialog
+# ////////////////////////////////////////////////////////////////////
+
+
+class dialog_box(QtGui.QMainWindow):
+ def __init__(self, snkTx, snkRx, fg, parent=None):
+
+ QtGui.QWidget.__init__(self, parent)
+ self.gui = Ui_DigitalWindow()
+ self.gui.setupUi(self)
+
+ self.fg = fg
+
+ self.set_sample_rate(self.fg.sample_rate())
+
+ self.set_snr(self.fg.snr())
+ self.set_frequency(self.fg.frequency_offset())
+ self.set_time_offset(self.fg.timing_offset())
+
+ self.set_gain_mu(self.fg.rx_gain_mu())
+ self.set_alpha(self.fg.rx_alpha())
+
+ # Add the qtsnk widgets to the hlayout box
+ self.gui.sinkLayout.addWidget(snkTx)
+ self.gui.sinkLayout.addWidget(snkRx)
+
+
+ # Connect up some signals
+ self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
+ self.pauseFg)
+
+ self.connect(self.gui.sampleRateEdit,
QtCore.SIGNAL("editingFinished()"),
+ self.sampleRateEditText)
+
+ self.connect(self.gui.snrEdit, QtCore.SIGNAL("editingFinished()"),
+ self.snrEditText)
+ self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"),
+ self.freqEditText)
+ self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"),
+ self.timeEditText)
+
+ self.connect(self.gui.gainMuEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainMuEditText)
+ self.connect(self.gui.alphaEdit, QtCore.SIGNAL("editingFinished()"),
+ self.alphaEditText)
+
+ # Build a timer to update the packet number and PER fields
+ self.update_delay = 250 # time between updating packet rate fields
+ self.pkt_timer = QtCore.QTimer(self)
+ self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"),
+ self.updatePacketInfo)
+ self.pkt_timer.start(self.update_delay)
+
+ def pauseFg(self):
+ if(self.gui.pauseButton.text() == "Pause"):
+ self.fg.stop()
+ self.fg.wait()
+ self.gui.pauseButton.setText("Unpause")
+ else:
+ self.fg.start()
+ self.gui.pauseButton.setText("Pause")
+
+ # Accessor functions for Gui to manipulate system parameters
+ def set_sample_rate(self, sr):
+ ssr = eng_notation.num_to_str(sr)
+ self.gui.sampleRateEdit.setText(QtCore.QString("%1").arg(ssr))
+
+ def sampleRateEditText(self):
+ try:
+ rate = self.gui.sampleRateEdit.text().toAscii()
+ srate = eng_notation.str_to_num(rate)
+ #self.fg.set_sample_rate(srate)
+ except RuntimeError:
+ pass
+
+
+ # Accessor functions for Gui to manipulate channel model
+ def set_snr(self, snr):
+ self.gui.snrEdit.setText(QtCore.QString("%1").arg(snr))
+
+ def set_frequency(self, fo):
+ self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo))
+
+ def set_time_offset(self, to):
+ self.gui.timeEdit.setText(QtCore.QString("%1").arg(to))
+
+ def snrEditText(self):
+ try:
+ snr = self.gui.snrEdit.text().toDouble()[0]
+ self.fg.set_snr(snr)
+ except RuntimeError:
+ pass
+
+ def freqEditText(self):
+ try:
+ freq = self.gui.freqEdit.text().toDouble()[0]
+ self.fg.set_frequency_offset(freq)
+ except RuntimeError:
+ pass
+
+ def timeEditText(self):
+ try:
+ to = self.gui.timeEdit.text().toDouble()[0]
+ self.fg.set_timing_offset(to)
+ except RuntimeError:
+ pass
+
+
+ # Accessor functions for Gui to manipulate receiver parameters
+ def set_gain_mu(self, gain):
+ self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain))
+
+ def set_alpha(self, alpha):
+ self.gui.alphaEdit.setText(QtCore.QString("%1").arg(alpha))
+
+ def alphaEditText(self):
+ try:
+ alpha = self.gui.alphaEdit.text().toDouble()[0]
+ self.fg.set_rx_alpha(alpha)
+ except RuntimeError:
+ pass
+
+ def gainMuEditText(self):
+ try:
+ gain = self.gui.gainMuEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_mu(gain)
+ except RuntimeError:
+ pass
+
+ # Accessor functions for packet error reporting
+ def updatePacketInfo(self):
+ # Pull these globals in from the main thread
+ global n_rcvd, n_right, pktno
+
+ per = float(n_rcvd - n_right)/float(pktno)
+ self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd))
+ self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right))
+ self.gui.perEdit.setText(QtCore.QString("%1").arg(per))
+
+
+
+# ////////////////////////////////////////////////////////////////////
+# Define the GNU Radio Top Block
+# ////////////////////////////////////////////////////////////////////
+
+
+
+class my_top_block(gr.top_block):
+ def __init__(self, mod_class, demod_class, rx_callback, options):
+ gr.top_block.__init__(self)
+
+ self._sample_rate = options.sample_rate
+
+ channelon = True;
+
+ self.gui_on = options.gui
+
+ self._frequency_offset = options.frequency_offset
+ self._timing_offset = options.timing_offset
+ self._tx_amplitude = options.tx_amplitude
+ self._snr_dB = options.snr
+
+ self._noise_voltage = self.get_noise_voltage(self._snr_dB)
+
+ self.txpath = transmit_path(mod_class, options)
+ self.throttle = gr.throttle(gr.sizeof_gr_complex, self.sample_rate())
+ self.rxpath = receive_path(demod_class, rx_callback, options)
+
+ # FIXME: do better exposure to lower issues for control
+ self._gain_mu = self.rxpath.packet_receiver._demodulator._mm_gain_mu
+ self._alpha = self.rxpath.packet_receiver._demodulator._costas_alpha
+
+ if channelon:
+ self.channel = gr.channel_model(self._noise_voltage,
+ self.frequency_offset(),
+ self.timing_offset())
+
+ if options.discontinuous:
+ z = 20000*[0,]
+ self.zeros = gr.vector_source_c(z, True)
+ packet_size = 5*((4+8+4+1500+4) * 8)
+ self.mux = gr.stream_mux(gr.sizeof_gr_complex, [packet_size-0,
int(9e5)])
+
+ # Connect components
+ self.connect(self.txpath, self.throttle, (self.mux,0))
+ self.connect(self.zeros, (self.mux,1))
+ self.connect(self.mux, self.channel, self.rxpath)
+
+ else:
+ self.connect(self.txpath, self.throttle, self.channel,
self.rxpath)
+
+ if self.gui_on:
+ self.qapp = QtGui.QApplication(sys.argv)
+ fftsize = 2048
+
+ self.snk_tx = qtgui.sink_c(fftsize,
gr.firdes.WIN_BLACKMAN_hARRIS,
+ -1/2, 1/2,
+ "Tx", True, True, False, True, True)
+ self.snk_rx = qtgui.sink_c(fftsize,
gr.firdes.WIN_BLACKMAN_hARRIS,
+ -1/2, 1/2,
+ "Rx", True, True, False, True, True)
+
+ self.snk_tx.set_frequency_axis(0, 80)
+ self.snk_rx.set_frequency_axis(-60, 20)
+
+ # Connect to the QT sinks
+ # FIXME: make better exposure to receiver from rxpath
+ self.receiver =
self.rxpath.packet_receiver._demodulator.receiver
+ self.connect(self.channel, self.snk_tx)
+ self.connect(self.receiver, self.snk_rx)
+
+ pyTxQt = self.snk_tx.pyqwidget()
+ pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget)
+
+ pyRxQt = self.snk_rx.pyqwidget()
+ pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget)
+
+ self.main_box = dialog_box(pyTx, pyRx, self)
+ self.main_box.show()
+
+ else:
+ # Connect components
+ self.connect(self.txpath, self.throttle, self.rxpath)
+
+
+
+ # System Parameters
+ def sample_rate(self):
+ return self._sample_rate
+
+ def set_sample_rate(self, sr):
+ self._sample_rate = sr
+ #self.throttle.set_samples_per_second(self._sample_rate)
+
+ # Channel Model Parameters
+ def snr(self):
+ return self._snr_dB
+
+ def set_snr(self, snr):
+ self._snr_dB = snr
+ self._noise_voltage = self.get_noise_voltage(self._snr_dB)
+ self.channel.set_noise_voltage(self._noise_voltage)
+
+ def get_noise_voltage(self, SNR):
+ snr = 10.0**(SNR/10.0)
+ power_in_signal = abs(self._tx_amplitude)**2
+ noise_power = power_in_signal/SNR
+ noise_voltage = math.sqrt(noise_power)
+ return noise_voltage
+
+ def frequency_offset(self):
+ return self._frequency_offset * self.sample_rate()
+
+ def set_frequency_offset(self, fo):
+ self._frequency_offset = fo / self.sample_rate()
+ self.channel.set_frequency_offset(self._frequency_offset)
+
+ def timing_offset(self):
+ return self._timing_offset
+
+ def set_timing_offset(self, to):
+ self._timing_offset = to
+ self.channel.set_timing_offset(self._timing_offset)
+
+
+ # Receiver Parameters
+ def rx_gain_mu(self):
+ return self._gain_mu
+
+ def rx_gain_omega(self):
+ return self.gain_omega
+
+ def set_rx_gain_mu(self, gain):
+ self._gain_mu = gain
+ self.gain_omega = .25 * self._gain_mu * self._gain_mu
+ self.receiver.set_gain_mu(self._gain_mu)
+ self.receiver.set_gain_omega(self.gain_omega)
+
+ def rx_alpha(self):
+ return self._alpha
+
+ def rx_beta(self):
+ return self.beta
+
+ def set_rx_alpha(self, alpha):
+ self._alpha = alpha
+ self.beta = .25 * self._alpha * self._alpha
+ self.receiver.set_alpha(self._alpha)
+ self.receiver.set_beta(self.beta)
+
+
+
+# /////////////////////////////////////////////////////////////////////////////
+# Thread to handle the packet sending procedure
+# Operates in parallel with qApp.exec_()
+# /////////////////////////////////////////////////////////////////////////////
+
+
+
+class th_send(Thread):
+ def __init__(self, send_fnc, megs, sz):
+ Thread.__init__(self)
+ self.send = send_fnc
+ self.nbytes = int(1e6 * megs)
+ self.pkt_size = int(sz)
+
+ def run(self):
+ # generate and send packets
+ n = 0
+ pktno = 0
+
+ while n < self.nbytes:
+ self.send(struct.pack('!H', pktno & 0xffff) +
+ (self.pkt_size - 2) * chr(pktno & 0xff))
+ n += self.pkt_size
+ pktno += 1
+
+ self.send(eof=True)
+
+ def stop(self):
+ self.nbytes = 0
+
+
+
+# /////////////////////////////////////////////////////////////////////////////
+# main
+# /////////////////////////////////////////////////////////////////////////////
+
+
+
+def main():
+
+ global n_rcvd, n_right, pktno
+
+ n_rcvd = 0
+ n_right = 0
+ pktno = 0
+
+ def rx_callback(ok, payload):
+ global n_rcvd, n_right, pktno
+ (pktno,) = struct.unpack('!H', payload[0:2])
+ n_rcvd += 1
+ if ok:
+ n_right += 1
+
+ if not options.gui:
+ print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % (
+ ok, pktno, n_rcvd, n_right)
+
+
+ def send_pkt(payload='', eof=False):
+ return tb.txpath.send_pkt(payload, eof)
+
+ mods = modulation_utils.type_1_mods()
+ demods = modulation_utils.type_1_demods()
+
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
+ expert_grp = parser.add_option_group("Expert")
+ channel_grp = parser.add_option_group("Channel")
+
+ parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
+ default='dbpsk',
+ help="Select modulation from: %s [default=%%default]"
+ % (', '.join(mods.keys()),))
+
+ parser.add_option("-s", "--size", type="eng_float", default=1500,
+ help="set packet size [default=%default]")
+ parser.add_option("-M", "--megabytes", type="eng_float", default=1.0,
+ help="set megabytes to transmit [default=%default]")
+ parser.add_option("","--discontinuous", action="store_true", default=False,
+ help="enable discontinous transmission (bursts of 5
packets)")
+ parser.add_option("-G", "--gui", action="store_true", default=False,
+ help="Turn on the GUI [default=%default]")
+
+ channel_grp.add_option("", "--sample-rate", type="eng_float", default=1e5,
+ help="set speed of channel/simulation rate to RATE
[default=%default]")
+ channel_grp.add_option("", "--snr", type="eng_float", default=30,
+ help="set the SNR of the channel in dB
[default=%default]")
+ channel_grp.add_option("", "--frequency-offset", type="eng_float",
default=0,
+ help="set frequency offset introduced by channel
[default=%default]")
+ channel_grp.add_option("", "--timing-offset", type="eng_float",
default=1.0,
+ help="set timing offset introduced by channel
[default=%default]")
+ channel_grp.add_option("", "--seed", action="store_true", default=False,
+ help="use a random seed for AWGN noise
[default=%default]")
+
+ transmit_path.add_options(parser, expert_grp)
+ receive_path.add_options(parser, expert_grp)
+
+ for mod in mods.values():
+ mod.add_options(expert_grp)
+ for demod in demods.values():
+ demod.add_options(expert_grp)
+
+ (options, args) = parser.parse_args ()
+
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ r = gr.enable_realtime_scheduling()
+ if r != gr.RT_OK:
+ print "Warning: failed to enable realtime scheduling"
+
+ # Create an instance of a hierarchical block
+ tb = my_top_block(mods[options.modulation],
+ demods[options.modulation],
+ rx_callback, options)
+ tb.start()
+
+ packet_sender = th_send(send_pkt, options.megabytes, options.size)
+ packet_sender.start()
+
+ if(options.gui):
+ tb.qapp.exec_()
+ packet_sender.stop()
+ else:
+ # Process until done; hack in to the join to stop on an interrupt
+ while(packet_sender.isAlive()):
+ try:
+ packet_sender.join(1)
+ except KeyboardInterrupt:
+ packet_sender.stop()
+
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
Copied: gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_rx.py
(from rev 11215,
gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/benchmark_qt_rx.py)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_rx.py
(rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_rx.py
2009-06-17 04:32:16 UTC (rev 11216)
@@ -0,0 +1,430 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007,2009 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, gru, modulation_utils
+from gnuradio import usrp
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+import random
+import struct
+import sys
+
+# from current dir
+from receive_path import receive_path
+
+try:
+ from gnuradio.qtgui import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Please install gr-qtgui."
+ sys.exit(1)
+
+try:
+ from qt_rx_window import Ui_DigitalWindow
+except ImportError:
+ print "Error: could not find qt_rx_window.py:"
+ print "\t\"pyuic4 qt_rx_window.ui -o qt_rx_window.py\""
+ sys.exit(1)
+
+#import os
+#print os.getpid()
+#raw_input('Attach and press enter: ')
+
+# ////////////////////////////////////////////////////////////////////
+# Define the QT Interface and Control Dialog
+# ////////////////////////////////////////////////////////////////////
+
+
+class dialog_box(QtGui.QMainWindow):
+ def __init__(self, snkRxIn, snkRx, fg, parent=None):
+
+ QtGui.QWidget.__init__(self, parent)
+ self.gui = Ui_DigitalWindow()
+ self.gui.setupUi(self)
+
+ self.fg = fg
+
+ self.set_frequency(self.fg.frequency())
+ self.set_gain(self.fg.gain())
+ self.set_decim(self.fg.decim())
+ self.set_gain_mu(self.fg.rx_gain_mu())
+ self.set_alpha(self.fg.rx_alpha())
+
+ # Add the qtsnk widgets to the hlayout box
+ self.gui.sinkLayout.addWidget(snkRxIn)
+ self.gui.sinkLayout.addWidget(snkRx)
+
+
+ # Connect up some signals
+ self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"),
+ self.freqEditText)
+ self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainEditText)
+ self.connect(self.gui.decimEdit, QtCore.SIGNAL("editingFinished()"),
+ self.decimEditText)
+ self.connect(self.gui.gainMuEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainMuEditText)
+ self.connect(self.gui.alphaEdit, QtCore.SIGNAL("editingFinished()"),
+ self.alphaEditText)
+
+ # Build a timer to update the packet number and PER fields
+ self.update_delay = 250 # time between updating packet rate fields
+ self.pkt_timer = QtCore.QTimer(self)
+ self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"),
+ self.updatePacketInfo)
+ self.pkt_timer.start(self.update_delay)
+
+
+ # Accessor functions for Gui to manipulate receiver parameters
+ def set_frequency(self, fo):
+ self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo))
+
+ def set_gain(self, gain):
+ self.gui.gainEdit.setText(QtCore.QString("%1").arg(gain))
+
+ def set_decim(self, decim):
+ self.gui.decimEdit.setText(QtCore.QString("%1").arg(decim))
+
+ def set_gain_mu(self, gain):
+ self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain))
+
+ def set_alpha(self, alpha):
+ self.gui.alphaEdit.setText(QtCore.QString("%1").arg(alpha))
+
+ def freqEditText(self):
+ try:
+ freq = self.gui.freqEdit.text().toDouble()[0]
+ self.fg.set_freq(freq)
+ except RuntimeError:
+ pass
+
+ def gainEditText(self):
+ try:
+ gain = self.gui.gainEdit.text().toDouble()[0]
+ self.fg.set_gain(gain)
+ except RuntimeError:
+ pass
+
+ def decimEditText(self):
+ try:
+ decim = self.gui.decimEdit.text().toInt()[0]
+ self.fg.set_decim(decim)
+ except RuntimeError:
+ pass
+
+ def alphaEditText(self):
+ try:
+ alpha = self.gui.alphaEdit.text().toDouble()[0]
+ self.fg.set_rx_alpha(alpha)
+ except RuntimeError:
+ pass
+
+ def gainMuEditText(self):
+ try:
+ gain = self.gui.gainMuEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_mu(gain)
+ except RuntimeError:
+ pass
+
+
+ # Accessor function for packet error reporting
+ def updatePacketInfo(self):
+ # Pull these globals in from the main thread
+ global n_rcvd, n_right, pktno
+
+ per = float(n_rcvd - n_right)/float(pktno)
+ self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd))
+ self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right))
+ self.gui.perEdit.setText(QtCore.QString("%1").arg(per))
+
+
+
+# ////////////////////////////////////////////////////////////////////
+# Define the GNU Radio Top Block
+# ////////////////////////////////////////////////////////////////////
+
+
+class my_top_block(gr.top_block):
+ def __init__(self, demodulator, rx_callback, options):
+ gr.top_block.__init__(self)
+
+ self._rx_freq = options.rx_freq # receiver's center
frequency
+ self._rx_gain = options.rx_gain # receiver's gain
+ self._rx_subdev_spec = options.rx_subdev_spec # daughterboard to
use
+ self._decim = options.decim # Decimating rate
for the USRP (prelim)
+ self.gui_on = options.gui
+
+ if self._rx_freq is None:
+ sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be
specified\n")
+ raise SystemExit
+
+ # Set up USRP source
+ self._setup_usrp_source()
+ ok = self.set_freq(self._rx_freq)
+ if not ok:
+ print "Failed to set Rx frequency to %s" %
(eng_notation.num_to_str(self._rx_freq))
+ raise ValueError, eng_notation.num_to_str(self._rx_freq)
+ g = self.subdev.gain_range()
+ if options.show_rx_gain_range:
+ print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g" \
+ % (g[0], g[1], g[2])
+ self.set_gain(options.rx_gain)
+ self.set_auto_tr(True) # enable Auto Transmit/Receive
switching
+
+ # Set up receive path
+ self.rxpath = receive_path(demodulator, rx_callback, options)
+
+ # FIXME: do better exposure to lower issues for control
+ self._gain_mu = self.rxpath.packet_receiver._demodulator._mm_gain_mu
+ self._alpha = self.rxpath.packet_receiver._demodulator._costas_alpha
+
+ self.connect(self.u, self.rxpath)
+
+ if self.gui_on:
+ self.qapp = QtGui.QApplication(sys.argv)
+ fftsize = 2048
+
+ self.snk_rxin = qtgui.sink_c(fftsize,
gr.firdes.WIN_BLACKMAN_hARRIS,
+ -1/2, 1/2,
+ "Received", True, True, False, True,
True)
+ self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ -1/2, 1/2,
+ "Post-Synchronizer", True, True, False,
True, True)
+
+ self.snk_rxin.set_frequency_axis(-60, 20)
+ self.snk_rx.set_frequency_axis(-60, 20)
+
+ # Connect to the QT sinks
+ # FIXME: make better exposure to receiver from rxpath
+ self.receiver = self.rxpath.packet_receiver._demodulator.receiver
+ self.connect(self.u, self.snk_rxin)
+ self.connect(self.receiver, self.snk_rx)
+
+ pyRxInQt = self.snk_rxin.pyqwidget()
+ pyRxIn = sip.wrapinstance(pyRxInQt, QtGui.QWidget)
+
+ pyRxQt = self.snk_rx.pyqwidget()
+ pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget)
+
+ self.main_box = dialog_box(pyRxIn, pyRx, self)
+ self.main_box.show()
+
+ def _setup_usrp_source(self):
+ self.u = usrp.source_c ()
+ adc_rate = self.u.adc_rate()
+
+ self.u.set_decim_rate(self._decim)
+
+ # determine the daughterboard subdevice we're using
+ if self._rx_subdev_spec is None:
+ self._rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
+ self.subdev = usrp.selected_subdev(self.u, self._rx_subdev_spec)
+
+ self.u.set_mux(usrp.determine_rx_mux_value(self.u,
self._rx_subdev_spec))
+
+ def set_freq(self, target_freq):
+ """
+ Set the center frequency we're interested in.
+
+ @param target_freq: frequency in Hz
+ @rypte: bool
+
+ Tuning is a two step process. First we ask the front-end to
+ tune as close to the desired frequency as it can. Then we use
+ the result of that operation and our target_frequency to
+ determine the value for the digital up converter.
+ """
+ r = self.u.tune(0, self.subdev, target_freq)
+ if r:
+ self._rx_freq = target_freq
+ return True
+
+ return False
+
+ def set_gain(self, gain):
+ """
+ Sets the analog gain in the USRP
+ """
+ if gain is None:
+ r = self.subdev.gain_range()
+ gain = (r[0] + r[1])/2 # set gain to midpoint
+ self._rx_gain = gain
+ return self.subdev.set_gain(self._rx_gain)
+
+ def set_auto_tr(self, enable):
+ return self.subdev.set_auto_tr(enable)
+
+ def set_decim(self, decim):
+ self._decim = decim
+ self.u.set_decim_rate(self._decim)
+
+ def frequency(self):
+ return self._rx_freq
+
+ def gain(self):
+ return self._rx_gain
+
+ def decim(self):
+ return self._decim
+
+ def rx_gain_mu(self):
+ return self._gain_mu
+
+ def rx_gain_omega(self):
+ return self.gain_omega
+
+ def set_rx_gain_mu(self, gain):
+ self._gain_mu = gain
+ self.gain_omega = .25 * self._gain_mu * self._gain_mu
+ self.receiver.set_gain_mu(self._gain_mu)
+ self.receiver.set_gain_omega(self.gain_omega)
+
+ def rx_alpha(self):
+ return self._alpha
+
+ def rx_beta(self):
+ return self.beta
+
+ def set_rx_alpha(self, alpha):
+ self._alpha = alpha
+ self.beta = .25 * self._alpha * self._alpha
+ self.receiver.set_alpha(self._alpha)
+ self.receiver.set_beta(self.beta)
+
+ def add_options(normal, expert):
+ """
+ Adds usrp-specific options to the Options Parser
+ """
+ add_freq_option(normal)
+ normal.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
+ help="select USRP Rx side A or B")
+ normal.add_option("", "--rx-gain", type="eng_float", default=None,
metavar="GAIN",
+ help="set receiver gain in dB [default=midpoint].
See also --show-rx-gain-range")
+ normal.add_option("", "--show-rx-gain-range", action="store_true",
default=False,
+ help="print min and max Rx gain available on
selected daughterboard")
+ normal.add_option("-v", "--verbose", action="store_true",
default=False)
+ normal.add_option("-G", "--gui", action="store_true", default=False,
+ help="Turn on the GUI [default=%default]")
+
+ expert.add_option("", "--rx-freq", type="eng_float", default=None,
+ help="set Rx frequency to FREQ [default=%default]",
metavar="FREQ")
+ expert.add_option("-d", "--decim", type="intx", default=128,
+ help="set fpga decimation rate to DECIM
[default=%default]")
+ expert.add_option("", "--snr", type="eng_float", default=30,
+ help="set the SNR of the channel in dB
[default=%default]")
+
+
+ # Make a static method to call before instantiation
+ add_options = staticmethod(add_options)
+
+
+def add_freq_option(parser):
+ """
+ Hackery that has the -f / --freq option set both tx_freq and rx_freq
+ """
+ def freq_callback(option, opt_str, value, parser):
+ parser.values.rx_freq = value
+ parser.values.tx_freq = value
+
+ if not parser.has_option('--freq'):
+ parser.add_option('-f', '--freq', type="eng_float",
+ action="callback", callback=freq_callback,
+ help="set Tx and/or Rx frequency to FREQ
[default=%default]",
+ metavar="FREQ")
+
+
+# /////////////////////////////////////////////////////////////////////////////
+# main
+# /////////////////////////////////////////////////////////////////////////////
+
+global n_rcvd, n_right
+
+def main():
+ global n_rcvd, n_right, pktno
+
+ n_rcvd = 0
+ n_right = 0
+ pktno = 1
+
+ def rx_callback(ok, payload):
+ global n_rcvd, n_right, pktno
+ (pktno,) = struct.unpack('!H', payload[0:2])
+ n_rcvd += 1
+ if ok:
+ n_right += 1
+
+ if not options.gui:
+ print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % (
+ ok, pktno, n_rcvd, n_right)
+
+
+ demods = modulation_utils.type_1_demods()
+
+ # Create Options Parser:
+ parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
+ expert_grp = parser.add_option_group("Expert")
+
+ parser.add_option("-m", "--modulation", type="choice",
choices=demods.keys(),
+ default='dbpsk',
+ help="Select modulation from: %s [default=%%default]"
+ % (', '.join(demods.keys()),))
+
+ my_top_block.add_options(parser, expert_grp)
+ receive_path.add_options(parser, expert_grp)
+
+ for mod in demods.values():
+ mod.add_options(expert_grp)
+
+ (options, args) = parser.parse_args ()
+
+ if len(args) != 0:
+ parser.print_help(sys.stderr)
+ sys.exit(1)
+
+ if options.rx_freq is None:
+ sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
+ parser.print_help(sys.stderr)
+ sys.exit(1)
+
+
+ # build the graph
+ tb = my_top_block(demods[options.modulation], rx_callback, options)
+
+ r = gr.enable_realtime_scheduling()
+ if r != gr.RT_OK:
+ print "Warning: Failed to enable realtime scheduling."
+
+ tb.start() # start flow graph
+
+ if(options.gui):
+ tb.qapp.exec_()
+ else:
+ tb.wait() # wait for it to finish
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
Property changes on:
gnuradio/trunk/gnuradio-examples/python/digital/benchmark_qt_rx.py
___________________________________________________________________
Added: svn:executable
+ *
Copied: gnuradio/trunk/gnuradio-examples/python/digital/qt_digital_window.ui
(from rev 11215,
gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/qt_digital_window.ui)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/qt_digital_window.ui
(rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/digital/qt_digital_window.ui
2009-06-17 04:32:16 UTC (rev 11216)
@@ -0,0 +1,395 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DigitalWindow</class>
+ <widget class="QMainWindow" name="DigitalWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1236</width>
+ <height>739</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <widget class="QPushButton" name="closeButton">
+ <property name="geometry">
+ <rect>
+ <x>1120</x>
+ <y>640</y>
+ <width>101</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ <widget class="QFrame" name="sinkFrame">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>1221</width>
+ <height>501</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <widget class="QWidget" name="horizontalLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>1201</width>
+ <height>481</height>
+ </rect>
+ </property>
+ <layout class="QHBoxLayout" name="sinkLayout"/>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="channelModeBox">
+ <property name="geometry">
+ <rect>
+ <x>290</x>
+ <y>520</y>
+ <width>291</width>
+ <height>161</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Channel Model Parameters</string>
+ </property>
+ <widget class="QLabel" name="timeLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>90</y>
+ <width>101</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Timing Offset</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="timeEdit">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>90</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="snrEdit">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>30</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="snrLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>SNR (dB)</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="freqEdit">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>60</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="freqLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>141</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Frequency Offset (Hz)</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="rxBox">
+ <property name="geometry">
+ <rect>
+ <x>590</x>
+ <y>520</y>
+ <width>251</width>
+ <height>161</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Receiver Parameters</string>
+ </property>
+ <widget class="QLineEdit" name="gainMuEdit">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>30</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="gainMuLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Gain mu</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="alphaEdit">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>60</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="alphaLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Alpha</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="sysBox">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>520</y>
+ <width>261</width>
+ <height>161</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>System Parameters</string>
+ </property>
+ <widget class="QLineEdit" name="sampleRateEdit">
+ <property name="geometry">
+ <rect>
+ <x>140</x>
+ <y>30</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="sampleRateLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>121</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Sample Rate (sps)</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QPushButton" name="pauseButton">
+ <property name="geometry">
+ <rect>
+ <x>1120</x>
+ <y>520</y>
+ <width>101</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Pause</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" name="rxBox_2">
+ <property name="geometry">
+ <rect>
+ <x>850</x>
+ <y>520</y>
+ <width>251</width>
+ <height>161</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Received Packet Info</string>
+ </property>
+ <widget class="QLineEdit" name="pktsRcvdEdit">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>30</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="pktsRcvdLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Packets Rcvd.</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="pktsCorrectEdit">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>60</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="pktsCorrectLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Packets Correct</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="perLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>90</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>PER</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="perEdit">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>90</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1236</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>&File</string>
+ </property>
+ <addaction name="actionExit"/>
+ </widget>
+ <addaction name="menuFile"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionExit">
+ <property name="text">
+ <string>E&xit</string>
+ </property>
+ </action>
+ </widget>
+ <tabstops>
+ <tabstop>closeButton</tabstop>
+ <tabstop>snrEdit</tabstop>
+ <tabstop>freqEdit</tabstop>
+ <tabstop>timeEdit</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>322</x>
+ <y>623</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>66</x>
+ <y>561</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>actionExit</sender>
+ <signal>triggered()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>617</x>
+ <y>327</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
Copied: gnuradio/trunk/gnuradio-examples/python/digital/qt_rx_window.ui (from
rev 11215,
gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/qt_rx_window.ui)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/qt_rx_window.ui
(rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/digital/qt_rx_window.ui
2009-06-17 04:32:16 UTC (rev 11216)
@@ -0,0 +1,329 @@
+<ui version="4.0" >
+ <class>DigitalWindow</class>
+ <widget class="QMainWindow" name="DigitalWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1085</width>
+ <height>766</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <widget class="QPushButton" name="closeButton" >
+ <property name="geometry" >
+ <rect>
+ <x>960</x>
+ <y>670</y>
+ <width>101</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ <widget class="QFrame" name="sinkFrame" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>1061</width>
+ <height>501</height>
+ </rect>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <widget class="QWidget" name="horizontalLayoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>1041</width>
+ <height>481</height>
+ </rect>
+ </property>
+ <layout class="QHBoxLayout" name="sinkLayout" />
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="rxBox" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>520</y>
+ <width>251</width>
+ <height>181</height>
+ </rect>
+ </property>
+ <property name="title" >
+ <string>Receiver Parameters</string>
+ </property>
+ <widget class="QLineEdit" name="gainMuEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>120</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="gainMuLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>120</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>mu's gain</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="alphaEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>150</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="alphaLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>150</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Alpha</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="gainLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>101</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Gain (dB)</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="freqEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>30</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="freqLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>141</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Frequency (Hz)</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="gainEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>60</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="decimLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>90</y>
+ <width>101</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Decimation</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="decimEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>90</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="rxBox_2" >
+ <property name="geometry" >
+ <rect>
+ <x>300</x>
+ <y>520</y>
+ <width>251</width>
+ <height>121</height>
+ </rect>
+ </property>
+ <property name="title" >
+ <string>Received Packet Info</string>
+ </property>
+ <widget class="QLineEdit" name="pktsRcvdEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>30</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="pktsRcvdLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Packets Rcvd.</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="pktsCorrectEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>60</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="pktsCorrectLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Packets Correct</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="perLabel" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>90</y>
+ <width>111</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>PER</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="perEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>90</y>
+ <width>113</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1085</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>&File</string>
+ </property>
+ <addaction name="actionExit" />
+ </widget>
+ <addaction name="menuFile" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="actionExit" >
+ <property name="text" >
+ <string>E&xit</string>
+ </property>
+ </action>
+ </widget>
+ <tabstops>
+ <tabstop>closeButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>322</x>
+ <y>623</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>66</x>
+ <y>561</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>actionExit</sender>
+ <signal>triggered()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>617</x>
+ <y>327</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
Property changes on:
gnuradio/trunk/gnuradio-examples/python/digital/receive_path.py
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/receive_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/receive_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/receive_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/receive_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/receive_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/receive_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/receive_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/receive_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/receive_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/receive_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/receive_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/receive_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/receive_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/receive_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/receive_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/receive_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/receive_path_lb.py:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/receive_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/receive_path_lb.py:10540-10546
+
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/receive_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/receive_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/receive_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/receive_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/receive_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/receive_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/receive_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/receive_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/receive_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/receive_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/receive_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/receive_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/receive_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/receive_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/receive_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/receive_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/receive_path_lb.py:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/receive_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/receive_path_lb.py:10540-10546
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/receive_path.py:11210-11215
Property changes on:
gnuradio/trunk/gnuradio-examples/python/digital/transmit_path.py
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/transmit_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/transmit_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/transmit_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/transmit_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/transmit_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/transmit_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/transmit_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/transmit_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/transmit_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/transmit_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/transmit_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/transmit_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/transmit_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/transmit_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/transmit_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/transmit_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/transmit_path_lb.py:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/transmit_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/transmit_path_lb.py:10540-10546
+
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/transmit_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/transmit_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/transmit_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/transmit_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/transmit_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/transmit_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/transmit_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/transmit_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/transmit_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/transmit_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/transmit_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/transmit_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/transmit_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/transmit_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/transmit_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/transmit_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/transmit_path_lb.py:10876-10880
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/transmit_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/transmit_path_lb.py:10540-10546
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/transmit_path.py:11210-11215
Modified: gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.cc
===================================================================
--- gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.cc 2009-06-17 03:56:20 UTC
(rev 11215)
+++ gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.cc 2009-06-17 04:32:16 UTC
(rev 11216)
@@ -62,7 +62,8 @@
SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
const bool frequency, const bool waterfall,
const bool waterfall3d, const bool time,
- const bool constellation)
+ const bool constellation,
+ const bool use_openGL)
{
//_windowStateLock->Lock();
@@ -81,7 +82,7 @@
}
// Called from the Event Thread
- _spectrumDisplayForm = new SpectrumDisplayForm(parent);
+ _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent);
// Toggle Windows on/off
_spectrumDisplayForm->ToggleTabFrequency(frequency);
Modified: gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.h
===================================================================
--- gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.h 2009-06-17 03:56:20 UTC
(rev 11215)
+++ gnuradio/trunk/gr-qtgui/src/lib/SpectrumGUIClass.h 2009-06-17 04:32:16 UTC
(rev 11216)
@@ -30,7 +30,8 @@
void OpenSpectrumWindow(QWidget*,
const bool frequency=true, const bool waterfall=true,
const bool waterfall3d=true, const bool time=true,
- const bool constellation=true);
+ const bool constellation=true,
+ const bool use_openGL=true);
void SetDisplayTitle(const std::string);
bool GetWindowOpenFlag();
Modified: gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.cc
===================================================================
--- gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.cc 2009-06-17 03:56:20 UTC
(rev 11215)
+++ gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.cc 2009-06-17 04:32:16 UTC
(rev 11216)
@@ -37,6 +37,7 @@
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent)
{
return qtgui_sink_c_sptr (new qtgui_sink_c (fftsize, wintype,
@@ -44,6 +45,7 @@
plotfreq, plotwaterfall,
plotwaterfall3d, plottime,
plotconst,
+ use_openGL,
parent));
}
@@ -53,6 +55,7 @@
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent)
: gr_block ("sink_c",
gr_make_io_signature (1, -1, sizeof(gr_complex)),
@@ -82,7 +85,7 @@
buildwindow();
- initialize();
+ initialize(use_openGL);
}
qtgui_sink_c::~qtgui_sink_c()
@@ -105,7 +108,7 @@
void
-qtgui_sink_c::initialize()
+qtgui_sink_c::initialize(const bool opengl)
{
if(qApp != NULL) {
d_qApplication = qApp;
@@ -127,7 +130,8 @@
d_main_gui->OpenSpectrumWindow(d_parent,
d_plotfreq, d_plotwaterfall,
d_plotwaterfall3d, d_plottime,
- d_plotconst);
+ d_plotconst,
+ opengl);
d_object = new qtgui_obj(d_qApplication);
qApp->postEvent(d_object, new qtgui_event(&d_pmutex));
Modified: gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.h
===================================================================
--- gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.h 2009-06-17 03:56:20 UTC
(rev 11215)
+++ gnuradio/trunk/gr-qtgui/src/lib/qtgui_sink_c.h 2009-06-17 04:32:16 UTC
(rev 11216)
@@ -40,6 +40,7 @@
bool plotfreq=true, bool
plotwaterfall=true,
bool plotwaterfall3d=true, bool
plottime=true,
bool plotconst=true,
+ bool use_openGL=true,
QWidget *parent=NULL);
class qtgui_sink_c : public gr_block
@@ -51,6 +52,7 @@
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool
plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
qtgui_sink_c (int fftsize, int wintype,
float fmin, float fmax,
@@ -58,9 +60,12 @@
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
- void initialize();
+ // use opengl to force OpenGL on or off
+ // this might be necessary for sessions over SSH
+ void initialize(const bool opengl);
int d_fftsize;
gr_firdes::win_type d_wintype;
@@ -79,7 +84,7 @@
gr_complex *d_residbuf;
bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst;
-
+
QWidget *d_parent;
SpectrumGUIClass *d_main_gui;
Modified: gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.cc
===================================================================
--- gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.cc 2009-06-17
03:56:20 UTC (rev 11215)
+++ gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.cc 2009-06-17
04:32:16 UTC (rev 11216)
@@ -5,17 +5,22 @@
int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1;
-SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
+SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent)
: QWidget(parent)
{
setupUi(this);
+ _useOpenGL = useOpenGL;
_systemSpecifiedFlag = false;
_intValidator = new QIntValidator(this);
_intValidator->setBottom(0);
_frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame);
_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame);
- _waterfall3DDisplayPlot = new
Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
+
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ _waterfall3DDisplayPlot = new
Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
+ }
+
_timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame);
_constellationDisplayPlot = new
ConstellationDisplayPlot(ConstellationDisplayFrame);
_numRealDataPoints = 1024;
@@ -34,12 +39,14 @@
WaterfallMinimumIntensityWheel->setTickCnt(50);
WaterfallMinimumIntensityWheel->setValue(-200);
- Waterfall3DMaximumIntensityWheel->setRange(-200, 0);
- Waterfall3DMaximumIntensityWheel->setTickCnt(50);
- Waterfall3DMinimumIntensityWheel->setRange(-200, 0);
- Waterfall3DMinimumIntensityWheel->setTickCnt(50);
- Waterfall3DMinimumIntensityWheel->setValue(-200);
-
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ Waterfall3DMaximumIntensityWheel->setRange(-200, 0);
+ Waterfall3DMaximumIntensityWheel->setTickCnt(50);
+ Waterfall3DMinimumIntensityWheel->setRange(-200, 0);
+ Waterfall3DMinimumIntensityWheel->setTickCnt(50);
+ Waterfall3DMinimumIntensityWheel->setValue(-200);
+ }
+
_peakFrequency = 0;
_peakAmplitude = -HUGE_VAL;
@@ -203,10 +210,12 @@
timePerFFT, dataTimestamp,
spectrumUpdateEvent->getDroppedFFTFrames());
}
- if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) {
- _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints,
numFFTDataPoints,
- timePerFFT, dataTimestamp,
-
spectrumUpdateEvent->getDroppedFFTFrames());
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) {
+ _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints,
numFFTDataPoints,
+ timePerFFT, dataTimestamp,
+
spectrumUpdateEvent->getDroppedFFTFrames());
+ }
}
}
@@ -281,28 +290,30 @@
WaterfallAutoScaleBtn->move(WaterfallAutoScaleBtn->x(),
e->size().height()-115);
- Waterfall3DPlotDisplayFrame->resize(e->size().width()-4,
- e->size().height()-140);
- _waterfall3DDisplayPlot->resize( Waterfall3DPlotDisplayFrame->width()-4,
- e->size().height()-140);
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ Waterfall3DPlotDisplayFrame->resize(e->size().width()-4,
+ e->size().height()-140);
+ _waterfall3DDisplayPlot->resize( Waterfall3DPlotDisplayFrame->width()-4,
+ e->size().height()-140);
+
+ Waterfall3DMaximumIntensityLabel->move(width() - 5 -
+
Waterfall3DMaximumIntensityLabel->width(),
+
Waterfall3DMaximumIntensityLabel->y());
+
Waterfall3DMaximumIntensityWheel->resize(Waterfall3DMaximumIntensityLabel->x()
- 5 -
+
Waterfall3DMaximumIntensityWheel->x(),
+
Waterfall3DMaximumIntensityWheel->height());
+ Waterfall3DMinimumIntensityLabel->move(width() - 5 -
+
Waterfall3DMinimumIntensityLabel->width(),
+ height() - 115);
+
Waterfall3DMinimumIntensityWheel->resize(Waterfall3DMinimumIntensityLabel->x()
- 5 -
+
Waterfall3DMinimumIntensityWheel->x(),
+
Waterfall3DMaximumIntensityWheel->height());
+
Waterfall3DMinimumIntensityWheel->move(Waterfall3DMinimumIntensityWheel->x(),
+ height() - 115);
+ Waterfall3DAutoScaleBtn->move(WaterfallAutoScaleBtn->x(),
+ e->size().height()-115);
+ }
- Waterfall3DMaximumIntensityLabel->move(width() - 5 -
-
Waterfall3DMaximumIntensityLabel->width(),
- Waterfall3DMaximumIntensityLabel->y());
-
Waterfall3DMaximumIntensityWheel->resize(Waterfall3DMaximumIntensityLabel->x()
- 5 -
-
Waterfall3DMaximumIntensityWheel->x(),
-
Waterfall3DMaximumIntensityWheel->height());
- Waterfall3DMinimumIntensityLabel->move(width() - 5 -
-
Waterfall3DMinimumIntensityLabel->width(),
- height() - 115);
-
Waterfall3DMinimumIntensityWheel->resize(Waterfall3DMinimumIntensityLabel->x()
- 5 -
-
Waterfall3DMinimumIntensityWheel->x(),
-
Waterfall3DMaximumIntensityWheel->height());
- Waterfall3DMinimumIntensityWheel->move(Waterfall3DMinimumIntensityWheel->x(),
- height() - 115);
- Waterfall3DAutoScaleBtn->move(WaterfallAutoScaleBtn->x(),
- e->size().height()-115);
-
TimeDomainDisplayFrame->resize(e->size().width()-4,
e->size().height()-140);
_timeDomainDisplayPlot->resize( TimeDomainDisplayFrame->width()-4,
@@ -340,11 +351,11 @@
waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value());
waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value());
-
waterfall3DMinimumIntensityChangedCB(Waterfall3DMinimumIntensityWheel->value());
-
waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value());
-
// If the video card doesn't support OpenGL then don't display the 3D
Waterfall
- if(QGLFormat::hasOpenGL()){
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+
waterfall3DMinimumIntensityChangedCB(Waterfall3DMinimumIntensityWheel->value());
+
waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value());
+
// Check for Hardware Acceleration of the OpenGL
if(!_waterfall3DDisplayPlot->format().directRendering()){
// Only ask this once while the program is running...
@@ -485,11 +496,13 @@
newCenterFrequency,
UseRFFrequenciesCheckBox->isChecked(),
units, strunits[iunit]);
- _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
- newStopFrequency,
- newCenterFrequency,
-
UseRFFrequenciesCheckBox->isChecked(),
- units, strunits[iunit]);
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
+ newStopFrequency,
+ newCenterFrequency,
+
UseRFFrequenciesCheckBox->isChecked(),
+ units, strunits[iunit]);
+ }
}
}
@@ -578,7 +591,9 @@
AverageDataReset();
_waterfallDisplayPlot->Reset();
- _waterfall3DDisplayPlot->Reset();
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ _waterfall3DDisplayPlot->Reset();
+ }
}
@@ -661,30 +676,34 @@
void
SpectrumDisplayForm::waterfall3DMaximumIntensityChangedCB( double newValue )
{
- if(newValue > Waterfall3DMinimumIntensityWheel->value()){
- Waterfall3DMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue,
0, 'f', 0));
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if(newValue > Waterfall3DMinimumIntensityWheel->value()){
+ Waterfall3DMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue,
0, 'f', 0));
+ }
+ else{
+
Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value());
+ }
+
+
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
+
Waterfall3DMaximumIntensityWheel->value());
}
- else{
-
Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value());
- }
-
-
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
-
Waterfall3DMaximumIntensityWheel->value());
}
void
SpectrumDisplayForm::waterfall3DMinimumIntensityChangedCB( double newValue )
{
- if(newValue < Waterfall3DMaximumIntensityWheel->value()){
- Waterfall3DMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue,
0, 'f', 0));
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if(newValue < Waterfall3DMaximumIntensityWheel->value()){
+ Waterfall3DMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue,
0, 'f', 0));
+ }
+ else{
+
Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value());
+ }
+
+
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
+
Waterfall3DMaximumIntensityWheel->value());
}
- else{
-
Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value());
- }
-
-
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
-
Waterfall3DMaximumIntensityWheel->value());
}
@@ -716,17 +735,19 @@
void
SpectrumDisplayForm::Waterfall3DAutoScaleBtnCB()
{
- double minimumIntensity = _noiseFloorAmplitude - 5;
- if(minimumIntensity < Waterfall3DMinimumIntensityWheel->minValue()){
- minimumIntensity = Waterfall3DMinimumIntensityWheel->minValue();
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ double minimumIntensity = _noiseFloorAmplitude - 5;
+ if(minimumIntensity < Waterfall3DMinimumIntensityWheel->minValue()){
+ minimumIntensity = Waterfall3DMinimumIntensityWheel->minValue();
+ }
+ Waterfall3DMinimumIntensityWheel->setValue(minimumIntensity);
+ double maximumIntensity = _peakAmplitude + 10;
+ if(maximumIntensity > Waterfall3DMaximumIntensityWheel->maxValue()){
+ maximumIntensity = Waterfall3DMaximumIntensityWheel->maxValue();
+ }
+ Waterfall3DMaximumIntensityWheel->setValue(maximumIntensity);
+ waterfallMaximumIntensityChangedCB(maximumIntensity);
}
- Waterfall3DMinimumIntensityWheel->setValue(minimumIntensity);
- double maximumIntensity = _peakAmplitude + 10;
- if(maximumIntensity > Waterfall3DMaximumIntensityWheel->maxValue()){
- maximumIntensity = Waterfall3DMaximumIntensityWheel->maxValue();
- }
- Waterfall3DMaximumIntensityWheel->setValue(maximumIntensity);
- waterfallMaximumIntensityChangedCB(maximumIntensity);
}
void
@@ -758,27 +779,29 @@
void
SpectrumDisplayForm::Waterfall3DIntensityColorTypeChanged( int newType )
{
- QColor lowIntensityColor;
- QColor highIntensityColor;
- if(newType == Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
- // Select the Low Intensity Color
- lowIntensityColor =
_waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
- if(!lowIntensityColor.isValid()){
- lowIntensityColor = Qt::black;
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ QColor lowIntensityColor;
+ QColor highIntensityColor;
+ if(newType ==
Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
+ // Select the Low Intensity Color
+ lowIntensityColor =
_waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
+ if(!lowIntensityColor.isValid()){
+ lowIntensityColor = Qt::black;
+ }
+ QMessageBox::information(this, "Low Intensity Color Selection", "In the
next window, select the low intensity color for the waterfall display",
QMessageBox::Ok);
+ lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
+
+ // Select the High Intensity Color
+ highIntensityColor =
_waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
+ if(!highIntensityColor.isValid()){
+ highIntensityColor = Qt::white;
+ }
+ QMessageBox::information(this, "High Intensity Color Selection", "In the
next window, select the high intensity color for the waterfall display",
QMessageBox::Ok);
+ highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
}
- QMessageBox::information(this, "Low Intensity Color Selection", "In the
next window, select the low intensity color for the waterfall display",
QMessageBox::Ok);
- lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
-
- // Select the High Intensity Color
- highIntensityColor =
_waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
- if(!highIntensityColor.isValid()){
- highIntensityColor = Qt::white;
- }
- QMessageBox::information(this, "High Intensity Color Selection", "In the
next window, select the high intensity color for the waterfall display",
QMessageBox::Ok);
- highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
+ _waterfall3DDisplayPlot->SetIntensityColorMapType(newType,
lowIntensityColor,
+ highIntensityColor);
}
- _waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor,
- highIntensityColor);
}
@@ -816,9 +839,11 @@
SpectrumDisplayForm::ToggleTabWaterfall3D(const bool state)
{
if(state == true) {
- if(d_plot_waterfall3d == -1) {
- SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display");
- d_plot_waterfall3d = SpectrumTypeTab->count()-1;
+ if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
+ if(d_plot_waterfall3d == -1) {
+ SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display");
+ d_plot_waterfall3d = SpectrumTypeTab->count()-1;
+ }
}
}
else {
Modified: gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.h
===================================================================
--- gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.h 2009-06-17
03:56:20 UTC (rev 11215)
+++ gnuradio/trunk/gr-qtgui/src/lib/spectrumdisplayform.h 2009-06-17
04:32:16 UTC (rev 11216)
@@ -20,7 +20,7 @@
Q_OBJECT
public:
- SpectrumDisplayForm(QWidget* parent = 0);
+ SpectrumDisplayForm(bool useOpenGL = true, QWidget* parent = 0);
~SpectrumDisplayForm();
void setSystem( SpectrumGUIClass * newSystem, const uint64_t
numFFTDataPoints,
@@ -75,8 +75,9 @@
protected:
private:
- void _AverageHistory( const double * newBuffer );
+ void _AverageHistory( const double * newBuffer );
+ bool _useOpenGL;
int _historyEntryCount;
int _historyEntry;
std::vector<double*>* _historyVector;
Property changes on: gnuradio/trunk/gr-qtgui/src/python/usrp_display.py
___________________________________________________________________
Modified: svn:mergeinfo
-
/gnuradio/branches/developers/eb/t364/gr-qtgui/src/python/usrp_display.py:11016-11017
/gnuradio/branches/developers/eb/t367/gr-qtgui/src/python/usrp_display.py:11021-11025
/gnuradio/branches/developers/eb/t371/gr-qtgui/src/python/usrp_display.py:10958-10971
/gnuradio/branches/developers/jblum/wxgui/gr-qtgui/src/python/usrp_display.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gr-qtgui/src/python/usrp_display.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gr-qtgui/src/python/usrp_display.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/np/gr-qtgui/src/python/usrp_display.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gr-qtgui/src/python/usrp_display.py:10876-10880
+
/gnuradio/branches/developers/eb/t364/gr-qtgui/src/python/usrp_display.py:11016-11017
/gnuradio/branches/developers/eb/t367/gr-qtgui/src/python/usrp_display.py:11021-11025
/gnuradio/branches/developers/eb/t371/gr-qtgui/src/python/usrp_display.py:10958-10971
/gnuradio/branches/developers/jblum/wxgui/gr-qtgui/src/python/usrp_display.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gr-qtgui/src/python/usrp_display.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gr-qtgui/src/python/usrp_display.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/np/gr-qtgui/src/python/usrp_display.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gr-qtgui/src/python/usrp_display.py:10876-10880
/gnuradio/branches/developers/trondeau/qtdigital/gr-qtgui/src/python/usrp_display.py:11210-11215
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11216 - in gnuradio/trunk: gnuradio-examples/python/digital gr-qtgui/src/lib gr-qtgui/src/python,
trondeau <=