summaryrefslogtreecommitdiff
path: root/gr-digital/python
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/python')
-rw-r--r--gr-digital/python/__init__.py3
-rw-r--r--gr-digital/python/generic_mod_demod.py14
-rw-r--r--gr-digital/python/pkt.py33
3 files changed, 16 insertions, 34 deletions
diff --git a/gr-digital/python/__init__.py b/gr-digital/python/__init__.py
index 7173fa09d..0fc48cc79 100644
--- a/gr-digital/python/__init__.py
+++ b/gr-digital/python/__init__.py
@@ -28,5 +28,6 @@ from qpsk import *
from qam import *
from gmsk import *
from pkt import *
-from packet_utils import *
from crc import *
+from packet_utils import *
+from modulation_utils2 import *
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index b1986512f..dc69fc0b5 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -55,12 +55,12 @@ def add_common_options(parser):
"""
parser.add_option("-p", "--constellation-points", type="int", default=_def_constellation_points,
help="set the number of constellation points (must be a power of 2 for psk, power of 4 for QAM) [default=%default]")
- parser.add_option("", "--non-differential", action="store_true",
- dest="differential", default=False,
- help="do not use differential encoding [default=%default]")
- parser.add_option("", "--differential", action="store_false",
- dest="differential",
- help="use differential encoding [default=False]")
+ parser.add_option("", "--non-differential", action="store_false",
+ dest="differential",
+ help="do not use differential encoding [default=False]")
+ parser.add_option("", "--differential", action="store_true",
+ dest="differential", default=True,
+ help="use differential encoding [default=%default]")
parser.add_option("", "--mod-code", type="choice", choices=mod_codes.codes,
default=mod_codes.NO_CODE,
help="Select modulation code from: %s [default=%%default]"
@@ -112,7 +112,7 @@ class generic_mod(gr.hier_block2):
self._differential = differential
if self._samples_per_symbol < 2:
- raise TypeError, ("sbp must be >= 2, is %d" % self._samples_per_symbol)
+ raise TypeError, ("sbp must be >= 2, is %f" % self._samples_per_symbol)
arity = pow(2,self.bits_per_symbol())
diff --git a/gr-digital/python/pkt.py b/gr-digital/python/pkt.py
index c9b29bd51..8650bdbb0 100644
--- a/gr-digital/python/pkt.py
+++ b/gr-digital/python/pkt.py
@@ -52,18 +52,13 @@ class mod_pkts(gr.hier_block2):
@type msgq_limit: int
@param pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
@param use_whitener_offset: If true, start of whitener XOR string is incremented each packet
- @param modulate: If false, no modulation will be performed.
See gmsk_mod for remaining parameters
"""
- if modulate:
- output_size = gr.sizeof_gr_complex
- else:
- output_size = gr.sizeof_char
gr.hier_block2.__init__(self, "mod_pkts",
gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(1, 1, output_size)) # Output signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._modulator = modulator
self._pad_for_usrp = pad_for_usrp
@@ -78,10 +73,7 @@ class mod_pkts(gr.hier_block2):
# accepts messages from the outside world
self._pkt_input = gr.message_source(gr.sizeof_char, msgq_limit)
- if modulate:
- self.connect(self._pkt_input, self._modulator, self)
- else:
- self.connect(self._pkt_input, self)
+ self.connect(self._pkt_input, self._modulator, self)
def send_pkt(self, payload='', eof=False):
"""
@@ -117,15 +109,13 @@ class demod_pkts(gr.hier_block2):
app via the callback.
"""
- def __init__(self, demodulator, access_code=None, callback=None, threshold=-1, demodulate=True):
+ def __init__(self, demodulator, access_code=None, callback=None, threshold=-1):
"""
Hierarchical block for demodulating and deframing packets.
The input is the complex modulated signal at baseband.
Demodulated packets are sent to the handler.
- If demodulator is None it is assumed the input is already demodulated.
-
@param demodulator: instance of demodulator class (gr_block or hier_block2)
@type demodulator: complex baseband in
@param access_code: AKA sync vector
@@ -136,14 +126,9 @@ class demod_pkts(gr.hier_block2):
@type threshold: int
"""
- if demodulator is not None:
- input_size = gr.sizeof_gr_complex
- else:
- input_size = gr.sizeof_char
-
gr.hier_block2.__init__(self, "demod_pkts",
- gr.io_signature(1, 1, input_size), # Input signature
- gr.io_signature(0, 0, 0)) # Output signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
self._demodulator = demodulator
if access_code is None:
@@ -159,13 +144,9 @@ class demod_pkts(gr.hier_block2):
self.correlator = digital_swig.correlate_access_code_bb(access_code, threshold)
self.framer_sink = gr.framer_sink_1(self._rcvd_pktq)
- if self._demodulator is not None:
- self.connect(self, self._demodulator, self.correlator, self.framer_sink)
- else:
- self.connect(self, self.correlator, self.framer_sink)
+ self.connect(self, self._demodulator, self.correlator, self.framer_sink)
- if callback is not None:
- self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
+ self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
class _queue_watcher_thread(_threading.Thread):