summaryrefslogtreecommitdiff
path: root/grc/src/grc_gnuradio
diff options
context:
space:
mode:
Diffstat (limited to 'grc/src/grc_gnuradio')
-rw-r--r--grc/src/grc_gnuradio/Makefile.am31
-rw-r--r--grc/src/grc_gnuradio/__init__.py1
-rw-r--r--grc/src/grc_gnuradio/blks2/Makefile.am33
-rw-r--r--grc/src/grc_gnuradio/blks2/__init__.py28
-rw-r--r--grc/src/grc_gnuradio/blks2/error_rate.py137
-rw-r--r--grc/src/grc_gnuradio/blks2/packet.py241
-rw-r--r--grc/src/grc_gnuradio/blks2/probe.py123
-rw-r--r--grc/src/grc_gnuradio/blks2/selector.py128
-rw-r--r--grc/src/grc_gnuradio/blks2/tcp.py66
-rw-r--r--grc/src/grc_gnuradio/blks2/variable_sink.py64
-rw-r--r--grc/src/grc_gnuradio/usrp/Makefile.am30
-rw-r--r--grc/src/grc_gnuradio/usrp/__init__.py26
-rw-r--r--grc/src/grc_gnuradio/usrp/common.py75
-rw-r--r--grc/src/grc_gnuradio/usrp/dual_usrp.py132
-rw-r--r--grc/src/grc_gnuradio/usrp/simple_usrp.py113
-rw-r--r--grc/src/grc_gnuradio/wxgui/Makefile.am27
-rw-r--r--grc/src/grc_gnuradio/wxgui/__init__.py21
-rw-r--r--grc/src/grc_gnuradio/wxgui/top_block_gui.py100
18 files changed, 0 insertions, 1376 deletions
diff --git a/grc/src/grc_gnuradio/Makefile.am b/grc/src/grc_gnuradio/Makefile.am
deleted file mode 100644
index 767e8f670..000000000
--- a/grc/src/grc_gnuradio/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright 2008 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 $(top_srcdir)/grc/Makefile.inc
-
-SUBDIRS = \
- blks2 \
- usrp \
- wxgui
-
-ourpythondir = $(grc_gnuradio_prefix)
-
-ourpython_PYTHON = __init__.py
diff --git a/grc/src/grc_gnuradio/__init__.py b/grc/src/grc_gnuradio/__init__.py
deleted file mode 100644
index 8b1378917..000000000
--- a/grc/src/grc_gnuradio/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/grc/src/grc_gnuradio/blks2/Makefile.am b/grc/src/grc_gnuradio/blks2/Makefile.am
deleted file mode 100644
index 89889605b..000000000
--- a/grc/src/grc_gnuradio/blks2/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright 2008, 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.
-#
-
-include $(top_srcdir)/grc/Makefile.inc
-
-ourpythondir = $(grc_gnuradio_prefix)/blks2
-
-ourpython_PYTHON = \
- __init__.py \
- error_rate.py \
- packet.py \
- probe.py \
- selector.py \
- tcp.py \
- variable_sink.py
diff --git a/grc/src/grc_gnuradio/blks2/__init__.py b/grc/src/grc_gnuradio/blks2/__init__.py
deleted file mode 100644
index cb1196f25..000000000
--- a/grc/src/grc_gnuradio/blks2/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2008, 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 selector import selector, valve
-from packet import options, packet_encoder, packet_decoder, \
- packet_mod_b, packet_mod_s, packet_mod_i, packet_mod_f, packet_mod_c, \
- packet_demod_b, packet_demod_s, packet_demod_i, packet_demod_f, packet_demod_c
-from error_rate import error_rate
-from probe import probe_function, probe_avg_mag_sqrd_c, probe_avg_mag_sqrd_f, probe_density_b, probe_mpsk_snr_c
-from variable_sink import variable_sink_b, variable_sink_s, variable_sink_i, variable_sink_f, variable_sink_c
-from tcp import tcp_source, tcp_sink
diff --git a/grc/src/grc_gnuradio/blks2/error_rate.py b/grc/src/grc_gnuradio/blks2/error_rate.py
deleted file mode 100644
index 9b2df58ef..000000000
--- a/grc/src/grc_gnuradio/blks2/error_rate.py
+++ /dev/null
@@ -1,137 +0,0 @@
-# Copyright 2008 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.
-#
-
-default_win_size = 1000
-
-from gnuradio import gr
-import gnuradio.gr.gr_threading as _threading
-import numpy
-
-#generate 1s counts array
-_1s_counts = [sum([1&(i>>j) for j in range(8)]) for i in range(2**8)]
-
-class input_watcher(_threading.Thread):
- """
- Read samples from the message queue and hand them to the callback.
- """
-
- def __init__(self, msgq, callback):
- self._msgq = msgq
- self._callback = callback
- _threading.Thread.__init__(self)
- self.setDaemon(1)
- self.keep_running = True
- self.start()
-
- def run(self):
- r = ''
- while True:
- msg = self._msgq.delete_head()
- itemsize = int(msg.arg1())
- nitems = int(msg.arg2())
- s = r + msg.to_string()
- i = (nitems-nitems%2)*itemsize
- r = s[i:]
- s = s[:i]
- samples = numpy.fromstring(s, numpy.int8)
- self._callback(samples)
-
-class error_rate(gr.hier_block2):
- """
- Sample the incoming data streams (byte) and calculate the bit or symbol error rate.
- Write the running rate to the output data stream (float).
- """
-
- def __init__(self, type='BER', win_size=default_win_size, bits_per_symbol=2):
- """
- Error rate constructor.
- @param type a string 'BER' or 'SER'
- @param win_size the number of samples to calculate over
- @param bits_per_symbol the number of information bits per symbol (BER only)
- """
- #init
- gr.hier_block2.__init__(
- self, 'error_rate',
- gr.io_signature(2, 2, gr.sizeof_char),
- gr.io_signature(1, 1, gr.sizeof_float),
- )
- assert type in ('BER', 'SER')
- self._max_samples = win_size
- self._bits_per_symbol = bits_per_symbol
- #setup message queue
- msg_source = gr.message_source(gr.sizeof_float, 1)
- self._msgq_source = msg_source.msgq()
- msgq_sink = gr.msg_queue(2)
- msg_sink = gr.message_sink(gr.sizeof_char, msgq_sink, False) #False -> blocking
- inter = gr.interleave(gr.sizeof_char)
- #start thread
- self._num_errs = 0
- self._err_index = 0
- self._num_samps = 0
- self._err_array = numpy.zeros(self._max_samples, numpy.int8)
- if type == 'BER':
- input_watcher(msgq_sink, self._handler_ber)
- elif type == 'SER':
- input_watcher(msgq_sink, self._handler_ser)
- #connect
- self.connect(msg_source, self)
- self.connect((self, 0), (inter, 0))
- self.connect((self, 1), (inter, 1))
- self.connect(inter, msg_sink)
-
- def _handler_ber(self, samples):
- num = len(samples)/2
- arr = numpy.zeros(num, numpy.float32)
- for i in range(num):
- old_err = self._err_array[self._err_index]
- #record error
- self._err_array[self._err_index] = _1s_counts[samples[i*2] ^ samples[i*2 + 1]]
- self._num_errs = self._num_errs + self._err_array[self._err_index] - old_err
- #increment index
- self._err_index = (self._err_index + 1)%self._max_samples
- self._num_samps = min(self._num_samps + 1, self._max_samples)
- #write sample
- arr[i] = float(self._num_errs)/float(self._num_samps*self._bits_per_symbol)
- #write message
- msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num)
- self._msgq_source.insert_tail(msg)
-
- def _handler_ser(self, samples):
- num = len(samples)/2
- arr = numpy.zeros(num, numpy.float32)
- for i in range(num):
- old_err = self._err_array[self._err_index]
- #record error
- ref = samples[i*2]
- res = samples[i*2 + 1]
- if ref == res:
- self._err_array[self._err_index] = 0
- else:
- self._err_array[self._err_index] = 1
- #update number of errors
- self._num_errs = self._num_errs + self._err_array[self._err_index] - old_err
- #increment index
- self._err_index = (self._err_index + 1)%self._max_samples
- self._num_samps = min(self._num_samps + 1, self._max_samples)
- #write sample
- arr[i] = float(self._num_errs)/float(self._num_samps)
- #write message
- msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num)
- self._msgq_source.insert_tail(msg)
diff --git a/grc/src/grc_gnuradio/blks2/packet.py b/grc/src/grc_gnuradio/blks2/packet.py
deleted file mode 100644
index 50de99ac9..000000000
--- a/grc/src/grc_gnuradio/blks2/packet.py
+++ /dev/null
@@ -1,241 +0,0 @@
-# Copyright 2008, 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, packet_utils
-import gnuradio.gr.gr_threading as _threading
-
-##payload length in bytes
-DEFAULT_PAYLOAD_LEN = 512
-
-##how many messages in a queue
-DEFAULT_MSGQ_LIMIT = 2
-
-##threshold for unmaking packets
-DEFAULT_THRESHOLD = 12
-
-##################################################
-## Options Class for OFDM
-##################################################
-class options(object):
- def __init__(self, **kwargs):
- for key, value in kwargs.iteritems(): setattr(self, key, value)
-
-##################################################
-## Packet Encoder
-##################################################
-class _packet_encoder_thread(_threading.Thread):
-
- def __init__(self, msgq, payload_length, send):
- self._msgq = msgq
- self._payload_length = payload_length
- self._send = send
- _threading.Thread.__init__(self)
- self.setDaemon(1)
- self.keep_running = True
- self.start()
-
- def run(self):
- sample = '' #residual sample
- while self.keep_running:
- msg = self._msgq.delete_head() #blocking read of message queue
- sample = sample + msg.to_string() #get the body of the msg as a string
- while len(sample) >= self._payload_length:
- payload = sample[:self._payload_length]
- sample = sample[self._payload_length:]
- self._send(payload)
-
-class packet_encoder(gr.hier_block2):
- """
- Hierarchical block for wrapping packet-based modulators.
- """
-
- def __init__(self, samples_per_symbol, bits_per_symbol, access_code='', pad_for_usrp=True):
- """
- packet_mod constructor.
- @param samples_per_symbol number of samples per symbol
- @param bits_per_symbol number of bits per symbol
- @param access_code AKA sync vector
- @param pad_for_usrp If true, packets are padded such that they end up a multiple of 128 samples
- @param payload_length number of bytes in a data-stream slice
- """
- #setup parameters
- self._samples_per_symbol = samples_per_symbol
- self._bits_per_symbol = bits_per_symbol
- self._pad_for_usrp = pad_for_usrp
- if not access_code: #get access code
- access_code = packet_utils.default_access_code
- if not packet_utils.is_1_0_string(access_code):
- raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,)
- self._access_code = access_code
- self._pad_for_usrp = pad_for_usrp
- #create blocks
- msg_source = gr.message_source(gr.sizeof_char, DEFAULT_MSGQ_LIMIT)
- self._msgq_out = msg_source.msgq()
- #initialize hier2
- gr.hier_block2.__init__(
- self,
- "packet_encoder",
- gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(1, 1, gr.sizeof_char) # Output signature
- )
- #connect
- self.connect(msg_source, self)
-
- def send_pkt(self, payload):
- """
- Wrap the payload in a packet and push onto the message queue.
- @param payload string, data to send
- """
- packet = packet_utils.make_packet(
- payload,
- self._samples_per_symbol,
- self._bits_per_symbol,
- self._access_code,
- self._pad_for_usrp
- )
- msg = gr.message_from_string(packet)
- self._msgq_out.insert_tail(msg)
-
-##################################################
-## Packet Decoder
-##################################################
-class _packet_decoder_thread(_threading.Thread):
-
- def __init__(self, msgq, callback):
- _threading.Thread.__init__(self)
- self.setDaemon(1)
- self._msgq = msgq
- self.callback = callback
- self.keep_running = True
- self.start()
-
- def run(self):
- while self.keep_running:
- msg = self._msgq.delete_head()
- ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1()))
- if self.callback:
- self.callback(ok, payload)
-
-class packet_decoder(gr.hier_block2):
- """
- Hierarchical block for wrapping packet-based demodulators.
- """
-
- def __init__(self, access_code='', threshold=-1, callback=None):
- """
- packet_demod constructor.
- @param access_code AKA sync vector
- @param threshold detect access_code with up to threshold bits wrong (0 -> use default)
- @param callback a function of args: ok, payload
- """
- #access code
- if not access_code: #get access code
- access_code = packet_utils.default_access_code
- if not packet_utils.is_1_0_string(access_code):
- raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,)
- self._access_code = access_code
- #threshold
- if threshold < 0: threshold = DEFAULT_THRESHOLD
- self._threshold = threshold
- #blocks
- msgq = gr.msg_queue(DEFAULT_MSGQ_LIMIT) #holds packets from the PHY
- correlator = gr.correlate_access_code_bb(self._access_code, self._threshold)
- framer_sink = gr.framer_sink_1(msgq)
- #initialize hier2
- gr.hier_block2.__init__(
- self,
- "packet_decoder",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(0, 0, 0) # Output signature
- )
- #connect
- self.connect(self, correlator, framer_sink)
- #start thread
- _packet_decoder_thread(msgq, callback)
-
-##################################################
-## Packet Mod for OFDM Mod and Packet Encoder
-##################################################
-class packet_mod_base(gr.hier_block2):
- """
- Hierarchical block for wrapping packet source block.
- """
-
- def __init__(self, packet_source=None, payload_length=0):
- if not payload_length: #get payload length
- payload_length = DEFAULT_PAYLOAD_LEN
- if payload_length%self._item_size_in != 0: #verify that packet length is a multiple of the stream size
- raise ValueError, 'The payload length: "%d" is not a mutiple of the stream size: "%d".'%(payload_length, self._item_size_in)
- #initialize hier2
- gr.hier_block2.__init__(
- self,
- "ofdm_mod",
- gr.io_signature(1, 1, self._item_size_in), # Input signature
- gr.io_signature(1, 1, packet_source._hb.output_signature().sizeof_stream_item(0)) # Output signature
- )
- #create blocks
- msgq = gr.msg_queue(DEFAULT_MSGQ_LIMIT)
- msg_sink = gr.message_sink(self._item_size_in, msgq, False) #False -> blocking
- #connect
- self.connect(self, msg_sink)
- self.connect(packet_source, self)
- #start thread
- _packet_encoder_thread(msgq, payload_length, packet_source.send_pkt)
-
-class packet_mod_b(packet_mod_base): _item_size_in = gr.sizeof_char
-class packet_mod_s(packet_mod_base): _item_size_in = gr.sizeof_short
-class packet_mod_i(packet_mod_base): _item_size_in = gr.sizeof_int
-class packet_mod_f(packet_mod_base): _item_size_in = gr.sizeof_float
-class packet_mod_c(packet_mod_base): _item_size_in = gr.sizeof_gr_complex
-
-##################################################
-## Packet Demod for OFDM Demod and Packet Decoder
-##################################################
-class packet_demod_base(gr.hier_block2):
- """
- Hierarchical block for wrapping packet sink block.
- """
-
- def __init__(self, packet_sink=None):
- #initialize hier2
- gr.hier_block2.__init__(
- self,
- "ofdm_mod",
- gr.io_signature(1, 1, packet_sink._hb.input_signature().sizeof_stream_item(0)), # Input signature
- gr.io_signature(1, 1, self._item_size_out) # Output signature
- )
- #create blocks
- msg_source = gr.message_source(self._item_size_out, DEFAULT_MSGQ_LIMIT)
- self._msgq_out = msg_source.msgq()
- #connect
- self.connect(self, packet_sink)
- self.connect(msg_source, self)
- if packet_sink._hb.output_signature().sizeof_stream_item(0):
- self.connect(packet_sink, gr.null_sink(packet_sink._hb.output_signature().sizeof_stream_item(0)))
-
- def recv_pkt(self, ok, payload):
- msg = gr.message_from_string(payload, 0, self._item_size_out, len(payload)/self._item_size_out)
- if ok: self._msgq_out.insert_tail(msg)
-
-class packet_demod_b(packet_demod_base): _item_size_out = gr.sizeof_char
-class packet_demod_s(packet_demod_base): _item_size_out = gr.sizeof_short
-class packet_demod_i(packet_demod_base): _item_size_out = gr.sizeof_int
-class packet_demod_f(packet_demod_base): _item_size_out = gr.sizeof_float
-class packet_demod_c(packet_demod_base): _item_size_out = gr.sizeof_gr_complex
diff --git a/grc/src/grc_gnuradio/blks2/probe.py b/grc/src/grc_gnuradio/blks2/probe.py
deleted file mode 100644
index 8db81f057..000000000
--- a/grc/src/grc_gnuradio/blks2/probe.py
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# Copyright 2008 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 threading
-import numpy
-import time
-
-#######################################################################################
-## Probe: Function
-#######################################################################################
-class probe_function(gr.hier_block2, threading.Thread):
- """
- The thread polls the function for values and writes to a message source.
- """
-
- def __init__(self, probe_callback, probe_rate):
- #init hier block
- gr.hier_block2.__init__(
- self, 'probe_function',
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, gr.sizeof_float),
- )
- self._probe_callback = probe_callback
- self.set_probe_rate(probe_rate)
- #create message source
- message_source = gr.message_source(gr.sizeof_float, 1)
- self._msgq = message_source.msgq()
- #connect
- self.connect(message_source, self)
- #setup thread
- threading.Thread.__init__(self)
- self.setDaemon(True)
- self.start()
-
- def run(self):
- """
- Infinite polling loop.
- """
- while True:
- time.sleep(1.0/self._probe_rate)
- arr = numpy.array(self._probe_callback(), numpy.float32)
- msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, 1)
- self._msgq.insert_tail(msg)
-
- def set_probe_rate(self, probe_rate):
- self._probe_rate = probe_rate
-
-class _probe_base(gr.hier_block2):
- def __init__(self, probe_block, probe_callback, probe_rate):
- #init hier block
- gr.hier_block2.__init__(
- self, 'probe',
- gr.io_signature(1, 1, probe_block.input_signature().sizeof_stream_items()[0]),
- gr.io_signature(1, 1, gr.sizeof_float),
- )
- probe_function_block = probe_function(probe_callback, probe_rate)
- #forward callbacks
- self.set_probe_rate = probe_function_block.set_probe_rate
- #connect
- self.connect(self, probe_block)
- self.connect(probe_function_block, self)
-
-#######################################################################################
-## Probe: Average Magnitude Squared
-#######################################################################################
-class _probe_avg_mag_sqrd_base(_probe_base):
- def __init__(self, threshold, alpha, probe_rate):
- #create block
- probe_block = self._probe_block_contructor[0](threshold, alpha)
- #forward callbacks
- self.set_alpha = probe_block.set_alpha
- self.set_threshold = probe_block.set_threshold
- #init
- _probe_base.__init__(self, probe_block, probe_block.level, probe_rate)
-
-class probe_avg_mag_sqrd_c(_probe_avg_mag_sqrd_base): _probe_block_contructor = (gr.probe_avg_mag_sqrd_c,)
-class probe_avg_mag_sqrd_f(_probe_avg_mag_sqrd_base): _probe_block_contructor = (gr.probe_avg_mag_sqrd_f,)
-
-#######################################################################################
-## Probe: Density
-#######################################################################################
-class probe_density_b(_probe_base):
- def __init__(self, alpha, probe_rate):
- #create block
- probe_block = gr.probe_density_b(alpha)
- #forward callbacks
- self.set_alpha = probe_block.set_alpha
- #init
- _probe_base.__init__(self, probe_block, probe_block.density, probe_rate)
-
-#######################################################################################
-## Probe: MPSK SNR
-#######################################################################################
-class probe_mpsk_snr_c(_probe_base):
- def __init__(self, type, alpha, probe_rate):
- """
- Type can be "snr", "signal_mean", or "noise_variance"
- """
- #create block
- probe_block = gr.probe_mpsk_snr_c(alpha)
- #forward callbacks
- self.set_alpha = probe_block.set_alpha
- #init
- _probe_base.__init__(self, probe_block, getattr(probe_block, type), probe_rate)
diff --git a/grc/src/grc_gnuradio/blks2/selector.py b/grc/src/grc_gnuradio/blks2/selector.py
deleted file mode 100644
index f0f6d5dd7..000000000
--- a/grc/src/grc_gnuradio/blks2/selector.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#
-# Copyright 2008 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
-
-class selector(gr.hier_block2):
- """A hier2 block with N inputs and M outputs, where data is only forwarded through input n to output m."""
- def __init__(self, item_size, num_inputs, num_outputs, input_index, output_index):
- """
- Selector constructor.
- @param item_size the size of the gr data stream in bytes
- @param num_inputs the number of inputs (integer)
- @param num_outputs the number of outputs (integer)
- @param input_index the index for the source data
- @param output_index the index for the destination data
- """
- gr.hier_block2.__init__(
- self, 'selector',
- gr.io_signature(num_inputs, num_inputs, item_size),
- gr.io_signature(num_outputs, num_outputs, item_size),
- )
- #terminator blocks for unused inputs and outputs
- self.input_terminators = [gr.null_sink(item_size) for i in range(num_inputs)]
- self.output_terminators = [gr.head(item_size, 0) for i in range(num_outputs)]
- self.copy = gr.kludge_copy(item_size)
- #connections
- for i in range(num_inputs): self.connect((self, i), self.input_terminators[i])
- for i in range(num_outputs): self.connect(gr.null_source(item_size), self.output_terminators[i], (self, i))
- self.item_size = item_size
- self.input_index = input_index
- self.output_index = output_index
- self.num_inputs = num_inputs
- self.num_outputs = num_outputs
- self._connect_current()
-
- def _indexes_valid(self):
- """
- Are the input and output indexes within range of the number of inputs and outputs?
- @return true if input index and output index are in range
- """
- return self.input_index in range(self.num_inputs) and self.output_index in range(self.num_outputs)
-
- def _connect_current(self):
- """If the input and output indexes are valid:
- disconnect the blocks at the input and output index from their terminators,
- and connect them to one another. Then connect the terminators to one another."""
- if self._indexes_valid():
- self.disconnect((self, self.input_index), self.input_terminators[self.input_index])
- self.disconnect(self.output_terminators[self.output_index], (self, self.output_index))
- self.connect((self, self.input_index), self.copy)
- self.connect(self.copy, (self, self.output_index))
- self.connect(self.output_terminators[self.output_index], self.input_terminators[self.input_index])
-
- def _disconnect_current(self):
- """If the input and output indexes are valid:
- disconnect the blocks at the input and output index from one another,
- and the terminators at the input and output index from one another.
- Reconnect the blocks to the terminators."""
- if self._indexes_valid():
- self.disconnect((self, self.input_index), self.copy)
- self.disconnect(self.copy, (self, self.output_index))
- self.disconnect(self.output_terminators[self.output_index], self.input_terminators[self.input_index])
- self.connect((self, self.input_index), self.input_terminators[self.input_index])
- self.connect(self.output_terminators[self.output_index], (self, self.output_index))
-
- def set_input_index(self, input_index):
- """
- Change the block to the new input index if the index changed.
- @param input_index the new input index
- """
- if self.input_index != input_index:
- self.lock()
- self._disconnect_current()
- self.input_index = input_index
- self._connect_current()
- self.unlock()
-
- def set_output_index(self, output_index):
- """
- Change the block to the new output index if the index changed.
- @param output_index the new output index
- """
- if self.output_index != output_index:
- self.lock()
- self._disconnect_current()
- self.output_index = output_index
- self._connect_current()
- self.unlock()
-
-class valve(selector):
- """Wrapper for selector with 1 input and 1 output."""
-
- def __init__(self, item_size, open):
- """
- Constructor for valve.
- @param item_size the size of the gr data stream in bytes
- @param open true if initial valve state is open
- """
- if open: output_index = -1
- else: output_index = 0
- selector.__init__(self, item_size, 1, 1, 0, output_index)
-
- def set_open(self, open):
- """
- Callback to set open state.
- @param open true to set valve state to open
- """
- if open: output_index = -1
- else: output_index = 0
- self.set_output_index(output_index)
diff --git a/grc/src/grc_gnuradio/blks2/tcp.py b/grc/src/grc_gnuradio/blks2/tcp.py
deleted file mode 100644
index c6739b711..000000000
--- a/grc/src/grc_gnuradio/blks2/tcp.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Copyright 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
-import socket
-import os
-
-def _get_sock_fd(addr, port, server):
- """
- Get the file descriptor for the socket.
- As a client, block on connect, dup the socket descriptor.
- As a server, block on accept, dup the client descriptor.
- @param addr the ip address string
- @param port the tcp port number
- @param server true for server mode, false for client mode
- @return the file descriptor number
- """
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- if server:
- sock.bind((addr, port))
- sock.listen(1)
- clientsock, address = sock.accept()
- return os.dup(clientsock.fileno())
- else:
- sock.connect((addr, port))
- return os.dup(sock.fileno())
-
-class tcp_source(gr.hier_block2):
- def __init__(self, itemsize, addr, port, server=True):
- #init hier block
- gr.hier_block2.__init__(
- self, 'tcp_source',
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, itemsize),
- )
- fd = _get_sock_fd(addr, port, server)
- self.connect(gr.file_descriptor_source(itemsize, fd), self)
-
-class tcp_sink(gr.hier_block2):
- def __init__(self, itemsize, addr, port, server=False):
- #init hier block
- gr.hier_block2.__init__(
- self, 'tcp_sink',
- gr.io_signature(1, 1, itemsize),
- gr.io_signature(0, 0, 0),
- )
- fd = _get_sock_fd(addr, port, server)
- self.connect(self, gr.file_descriptor_sink(itemsize, fd))
diff --git a/grc/src/grc_gnuradio/blks2/variable_sink.py b/grc/src/grc_gnuradio/blks2/variable_sink.py
deleted file mode 100644
index cad3b8b04..000000000
--- a/grc/src/grc_gnuradio/blks2/variable_sink.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Copyright 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
-import threading
-import numpy
-
-class _variable_sink_base(gr.hier_block2, threading.Thread):
- """
- The thread polls the message queue for values and writes to a callback.
- """
-
- def __init__(self, vlen, decim, callback):
- self._vlen = vlen
- self._callback = callback
- self._item_size = self._size*self._vlen
- #init hier block
- gr.hier_block2.__init__(
- self, 'variable_sink',
- gr.io_signature(1, 1, self._item_size),
- gr.io_signature(0, 0, 0),
- )
- #create blocks
- self._decimator = gr.keep_one_in_n(self._item_size, decim)
- self._msgq = gr.msg_queue(2)
- message_sink = gr.message_sink(self._item_size, self._msgq, False)
- #connect
- self.connect(self, self._decimator, message_sink)
- #setup thread
- threading.Thread.__init__(self)
- self.setDaemon(True)
- self.start()
-
- def set_decim(self, decim): self._decimator.set_n(decim)
-
- def run(self):
- while True: #truncate to item size, convert to array, callback
- msg = self._msgq.delete_head().to_string()[-self._item_size:]
- arr = map(self._cast, numpy.fromstring(msg, self._numpy))
- self._callback(self._vlen > 1 and arr or arr[0])
-
-class variable_sink_b(_variable_sink_base): _numpy, _size, _cast = numpy.int8, gr.sizeof_char, int
-class variable_sink_s(_variable_sink_base): _numpy, _size, _cast = numpy.int16, gr.sizeof_short, int
-class variable_sink_i(_variable_sink_base): _numpy, _size, _cast = numpy.int32, gr.sizeof_int, int
-class variable_sink_f(_variable_sink_base): _numpy, _size, _cast = numpy.float32, gr.sizeof_float, float
-class variable_sink_c(_variable_sink_base): _numpy, _size, _cast = numpy.complex64, gr.sizeof_gr_complex, complex
diff --git a/grc/src/grc_gnuradio/usrp/Makefile.am b/grc/src/grc_gnuradio/usrp/Makefile.am
deleted file mode 100644
index 136a5dacd..000000000
--- a/grc/src/grc_gnuradio/usrp/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright 2008 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 $(top_srcdir)/grc/Makefile.inc
-
-ourpythondir = $(grc_gnuradio_prefix)/usrp
-
-ourpython_PYTHON = \
- __init__.py \
- common.py \
- dual_usrp.py \
- simple_usrp.py
diff --git a/grc/src/grc_gnuradio/usrp/__init__.py b/grc/src/grc_gnuradio/usrp/__init__.py
deleted file mode 100644
index 1956bbd5b..000000000
--- a/grc/src/grc_gnuradio/usrp/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2008 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 simple_usrp import \
- simple_source_c, simple_source_s, \
- simple_sink_c, simple_sink_s
-from dual_usrp import \
- dual_source_c, dual_source_s, \
- dual_sink_c, dual_sink_s
diff --git a/grc/src/grc_gnuradio/usrp/common.py b/grc/src/grc_gnuradio/usrp/common.py
deleted file mode 100644
index 65c1e7e29..000000000
--- a/grc/src/grc_gnuradio/usrp/common.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 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.
-#
-
-import sys
-from gnuradio import usrp, gr
-
-##################################################
-# USRP base class with common methods
-##################################################
-class usrp_helper(object):
- def _make_usrp(self, *args, **kwargs): self._u = self._usrp_args[0](*args, **kwargs)
- def _get_u(self): return self._u
- def _get_io_size(self): return self._usrp_args[1]
- def _set_frequency(self, chan, subdev, frequency, verbose=False):
- """
- Set the carrier frequency for the given subdevice.
- @param chan specifies the DDC/DUC number
- @param frequency the carrier frequency in Hz
- @param verbose if true, print usrp tuning information
- """
- r = self._get_u().tune(chan, subdev, frequency)
- if not verbose: return
- print subdev.side_and_name()
- if r:
- print "\tr.baseband_frequency =", r.baseband_freq
- print "\tr.dxc_frequency =", r.dxc_freq
- print "\tr.residual_frequency =", r.residual_freq
- print "\tr.inverted =", r.inverted, "\n"
- else: print >> sys.stderr, 'Error calling tune on subdevice.'
- def set_format(self, width, shift): self._get_u().set_format(self._get_u().make_format(width, shift))
-
-##################################################
-# Classes to associate usrp constructor w/ io size
-##################################################
-class usrp_source_c(usrp_helper): _usrp_args = (usrp.source_c, gr.sizeof_gr_complex)
-class usrp_source_s(usrp_helper): _usrp_args = (usrp.source_s, gr.sizeof_short)
-class usrp_sink_c(usrp_helper): _usrp_args = (usrp.sink_c, gr.sizeof_gr_complex)
-class usrp_sink_s(usrp_helper): _usrp_args = (usrp.sink_s, gr.sizeof_short)
-
-##################################################
-# Side spec and antenna spec functions
-##################################################
-def is_flex(rx_ant): return rx_ant.upper() in ('TX/RX', 'RX2')
-def to_spec(side, rx_ant='RXA'):
- """
- Convert the side to a spec number.
- @param side A or B
- @param rx_ant antenna type
- @return the spec (0/1, 0/1/2)
- """
- #determine the side spec
- try: side_spec = {'A': 0, 'B': 1}[side.upper()]
- except: raise ValueError, 'Side A or B expected.'
- #determine the subdevice spec
- if rx_ant.upper() == 'RXB': subdev_spec = 1
- elif rx_ant.upper() == 'RXAB': subdev_spec = 2
- else: subdev_spec = 0
- return (side_spec, subdev_spec)
diff --git a/grc/src/grc_gnuradio/usrp/dual_usrp.py b/grc/src/grc_gnuradio/usrp/dual_usrp.py
deleted file mode 100644
index 1ecf7c47f..000000000
--- a/grc/src/grc_gnuradio/usrp/dual_usrp.py
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright 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.
-#
-
-import common
-from gnuradio import gr, usrp
-
-####################################################################
-# Dual USRP Source
-####################################################################
-class _dual_source(gr.hier_block2):
- """A dual usrp source of IO type short or complex."""
-
- def __init__(self, which, rx_ant_a='RXA', rx_ant_b='RXA'):
- """
- USRP dual source contructor.
- @param which the unit number
- @param rx_ant_a the antenna choice
- @param rx_ant_b the antenna choice
- """
- #initialize hier2 block
- gr.hier_block2.__init__(
- self, 'usrp_dual_source',
- gr.io_signature(0, 0, 0),
- gr.io_signature(2, 2, self._get_io_size()),
- )
- #create usrp object
- self._make_usrp(which=which, nchan=2)
- subdev_spec_a = common.to_spec('A', rx_ant_a)
- subdev_spec_b = common.to_spec('B', rx_ant_b)
- self._get_u().set_mux(self._get_u().determine_rx_mux_value(subdev_spec_a, subdev_spec_b))
- self._subdev_a = self._get_u().selected_subdev(subdev_spec_a)
- self._subdev_b = self._get_u().selected_subdev(subdev_spec_b)
- #connect
- deinter = gr.deinterleave(self._get_io_size())
- self.connect(self._get_u(), deinter)
- for i in range(2): self.connect((deinter, i), (self, i))
-
- def set_decim_rate(self, decim): self._get_u().set_decim_rate(int(decim))
- def set_frequency_a(self, frequency, verbose=False):
- self._set_frequency(
- chan=0, #ddc0
- subdev=self._subdev_a,
- frequency=frequency,
- verbose=verbose,
- )
- def set_frequency_b(self, frequency, verbose=False):
- self._set_frequency(
- chan=1, #ddc1
- subdev=self._subdev_b,
- frequency=frequency,
- verbose=verbose,
- )
- def set_lo_offset_a(self, lo_offset): self._subdev_a.set_lo_offset(lo_offset)
- def set_lo_offset_b(self, lo_offset): self._subdev_b.set_lo_offset(lo_offset)
- def set_gain_a(self, gain): self._subdev_a.set_gain(gain)
- def set_gain_b(self, gain): self._subdev_b.set_gain(gain)
-
-class dual_source_c(_dual_source, common.usrp_source_c): pass
-class dual_source_s(_dual_source, common.usrp_source_s): pass
-
-####################################################################
-# Dual USRP Sink
-####################################################################
-class _dual_sink(gr.hier_block2):
- """A dual usrp sink of IO type short or complex."""
-
- def __init__(self, which):
- """
- USRP simple sink contructor.
- @param which the unit number
- """
- #initialize hier2 block
- gr.hier_block2.__init__(
- self, 'usrp_dual_sink',
- gr.io_signature(2, 2, self._get_io_size()),
- gr.io_signature(0, 0, 0),
- )
- #create usrp object
- self._make_usrp(which=which, nchan=2)
- subdev_spec_a = common.to_spec('A')
- subdev_spec_b = common.to_spec('B')
- self._get_u().set_mux(self._get_u().determine_tx_mux_value(subdev_spec_a, subdev_spec_b))
- self._subdev_a = self._get_u().selected_subdev(subdev_spec_a)
- self._subdev_b = self._get_u().selected_subdev(subdev_spec_b)
- #connect
- inter = gr.interleave(self._get_io_size())
- self.connect(inter, self._get_u())
- for i in range(2): self.connect((self, i), (inter, i))
-
- def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp))
- def set_frequency_a(self, frequency, verbose=False):
- self._set_frequency(
- chan=self._subdev_a.which(),
- subdev=self._subdev_a,
- frequency=frequency,
- verbose=verbose,
- )
- def set_frequency_b(self, frequency, verbose=False):
- self._set_frequency(
- chan=self._subdev_b.which(),
- subdev=self._subdev_b,
- frequency=frequency,
- verbose=verbose,
- )
- def set_lo_offset_a(self, lo_offset): self._subdev_a.set_lo_offset(lo_offset)
- def set_lo_offset_b(self, lo_offset): self._subdev_b.set_lo_offset(lo_offset)
- def set_gain_a(self, gain): self._subdev_a.set_gain(gain)
- def set_gain_b(self, gain): self._subdev_b.set_gain(gain)
- def set_enable_a(self, enable): self._subdev_a.set_enable(enable)
- def set_enable_b(self, enable): self._subdev_b.set_enable(enable)
- def set_auto_tr_a(self, auto_tr): self._subdev_a.set_auto_tr(auto_tr)
- def set_auto_tr_b(self, auto_tr): self._subdev_b.set_auto_tr(auto_tr)
-
-class dual_sink_c(_dual_sink, common.usrp_sink_c): pass
-class dual_sink_s(_dual_sink, common.usrp_sink_s): pass
diff --git a/grc/src/grc_gnuradio/usrp/simple_usrp.py b/grc/src/grc_gnuradio/usrp/simple_usrp.py
deleted file mode 100644
index 9065c7fe9..000000000
--- a/grc/src/grc_gnuradio/usrp/simple_usrp.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright 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.
-#
-
-import common
-from gnuradio import gr, usrp
-
-####################################################################
-# Simple USRP Source
-####################################################################
-class _simple_source(gr.hier_block2):
- """A single usrp source of IO type short or complex."""
-
- def __init__(self, which, side='A', rx_ant='RXA', no_hb=False):
- """
- USRP simple source contructor.
- @param which the unit number
- @param side the usrp side A or B
- @param rx_ant the antenna choice
- @param no_hb disable half band filters
- """
- self._no_hb = no_hb
- #initialize hier2 block
- gr.hier_block2.__init__(
- self, 'usrp_simple_source',
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, self._get_io_size()),
- )
- #create usrp object
- if self._no_hb: self._make_usrp(which=which, nchan=1, fpga_filename="std_4rx_0tx.rbf")
- else: self._make_usrp(which=which, nchan=1)
- subdev_spec = common.to_spec(side, rx_ant)
- self._get_u().set_mux(self._get_u().determine_rx_mux_value(subdev_spec))
- self._subdev = self._get_u().selected_subdev(subdev_spec)
- if common.is_flex(rx_ant): self._subdev.select_rx_antenna(rx_ant)
- #connect
- self.connect(self._get_u(), self)
-
- def set_decim_rate(self, decim):
- self._get_u().set_decim_rate(int(decim))
- if self._no_hb: #set the BW to half the sample rate
- self._subdev.set_bw(self._get_u().converter_rate()/decim/2)
- def set_lo_offset(self, lo_offset): self._subdev.set_lo_offset(lo_offset)
- def set_frequency(self, frequency, verbose=False):
- self._set_frequency(
- chan=0, #ddc0
- subdev=self._subdev,
- frequency=frequency,
- verbose=verbose,
- )
- def set_gain(self, gain): self._subdev.set_gain(gain)
-
-class simple_source_c(_simple_source, common.usrp_source_c): pass
-class simple_source_s(_simple_source, common.usrp_source_s): pass
-
-####################################################################
-# Simple USRP Sink
-####################################################################
-class _simple_sink(gr.hier_block2):
- """A single usrp sink of IO type short or complex."""
-
- def __init__(self, which, side='A'):
- """
- USRP simple sink contructor.
- @param which the unit number
- @param side the usrp side A or B
- """
- #initialize hier2 block
- gr.hier_block2.__init__(
- self, 'usrp_simple_sink',
- gr.io_signature(1, 1, self._get_io_size()),
- gr.io_signature(0, 0, 0),
- )
- #create usrp object
- self._make_usrp(which=which, nchan=1)
- subdev_spec = common.to_spec(side)
- self._get_u().set_mux(self._get_u().determine_tx_mux_value(subdev_spec))
- self._subdev = self._get_u().selected_subdev(subdev_spec)
- #connect
- self.connect(self, self._get_u())
-
- def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp))
- def set_frequency(self, frequency, verbose=False):
- self._set_frequency(
- chan=self._subdev.which(),
- subdev=self._subdev,
- frequency=frequency,
- verbose=verbose,
- )
- def set_lo_offset(self, lo_offset): self._subdev.set_lo_offset(lo_offset)
- def set_gain(self, gain): self._subdev.set_gain(gain)
- def set_enable(self, enable): self._subdev.set_enable(enable)
- def set_auto_tr(self, auto_tr): self._subdev.set_auto_tr(auto_tr)
-
-class simple_sink_c(_simple_sink, common.usrp_sink_c): pass
-class simple_sink_s(_simple_sink, common.usrp_sink_s): pass
-
diff --git a/grc/src/grc_gnuradio/wxgui/Makefile.am b/grc/src/grc_gnuradio/wxgui/Makefile.am
deleted file mode 100644
index 2e5e7ebd0..000000000
--- a/grc/src/grc_gnuradio/wxgui/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright 2008 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 $(top_srcdir)/grc/Makefile.inc
-
-ourpythondir = $(grc_gnuradio_prefix)/wxgui
-ourpython_PYTHON = \
- __init__.py \
- top_block_gui.py
diff --git a/grc/src/grc_gnuradio/wxgui/__init__.py b/grc/src/grc_gnuradio/wxgui/__init__.py
deleted file mode 100644
index 94a0adb8a..000000000
--- a/grc/src/grc_gnuradio/wxgui/__init__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2008 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 top_block_gui import top_block_gui
diff --git a/grc/src/grc_gnuradio/wxgui/top_block_gui.py b/grc/src/grc_gnuradio/wxgui/top_block_gui.py
deleted file mode 100644
index f3305d7c5..000000000
--- a/grc/src/grc_gnuradio/wxgui/top_block_gui.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# Copyright 2008 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.
-#
-
-import wx
-import sys, os
-from gnuradio import gr
-from gnuradio.gr.pubsub import pubsub
-
-default_gui_size = (200, 100)
-
-class top_block_gui(gr.top_block, pubsub):
- """gr top block with wx gui app and grid sizer."""
-
- def __init__(self, title='', size=default_gui_size, icon=None):
- """
- Initialize the gr top block.
- Create the wx gui elements.
- @param title the main window title
- @param size the main window size tuple in pixels
- @param icon the file path to an icon or None
- """
- #initialize
- gr.top_block.__init__(self)
- pubsub.__init__(self)
- self._size = size
- #set the icon
- if icon and os.path.isfile(icon): self._icon = icon
- else: self._icon = None
- #create gui elements
- self._wx_app = wx.App()
- self._wx_frame = wx.Frame(None , -1, title)
- self._wx_grid = wx.GridBagSizer(5, 5)
- self._wx_vbox = wx.BoxSizer(wx.VERTICAL)
-
- def GetWin(self):
- """
- Get the window for wx elements to fit within.
- @return the wx frame
- """
- return self._wx_frame
-
- def Add(self, win):
- """
- Add a window to the wx vbox.
- @param win the wx window
- """
- self._wx_vbox.Add(win, 0, wx.EXPAND)
-
- def GridAdd(self, win, row, col, row_span=1, col_span=1):
- """
- Add a window to the wx grid at the given position.
- @param win the wx window
- @param row the row specification (integer >= 0)
- @param col the column specification (integer >= 0)
- @param row_span the row span specification (integer >= 1)
- @param col_span the column span specification (integer >= 1)
- """
- self._wx_grid.Add(win, wx.GBPosition(row, col), wx.GBSpan(row_span, col_span), wx.EXPAND)
-
- def Run(self):
- """
- Setup the wx gui elements.
- Start the gr top block.
- Block with the wx main loop.
- """
- #set wx app icon
- if self._icon: self._wx_frame.SetIcon(wx.Icon(self._icon, wx.BITMAP_TYPE_ANY))
- #set minimal window size
- self._wx_frame.SetSizeHints(*self._size)
- #create callback for quit
- def _quit(event):
- gr.top_block.stop(self)
- self._wx_frame.Destroy()
- #setup app
- self._wx_vbox.Add(self._wx_grid, 0, wx.EXPAND)
- self._wx_frame.Bind(wx.EVT_CLOSE, _quit)
- self._wx_frame.SetSizerAndFit(self._wx_vbox)
- self._wx_frame.Show()
- self._wx_app.SetTopWindow(self._wx_frame)
- #start flow graph
- gr.top_block.start(self)
- #blocking main loop
- self._wx_app.MainLoop()