summaryrefslogtreecommitdiff
path: root/gr-digital/python/pkt.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/python/pkt.py')
-rw-r--r--gr-digital/python/pkt.py33
1 files changed, 7 insertions, 26 deletions
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):