diff options
author | Michael Berman <michael@gpstoo.com> | 2013-10-03 13:22:21 -0700 |
---|---|---|
committer | Michael Berman <michael@gpstoo.com> | 2013-10-03 13:22:21 -0700 |
commit | 6c8bf9fa34f6fe6b8f02fc2c962f4baaec94e2f1 (patch) | |
tree | a01f247f4444fb44bbf600eabe191e564b3ae2e6 /gr-digital/python/digital/pkt.py | |
parent | e2ae0852c82ae1d15dc09d434e75b1f95e4297a5 (diff) |
Digital/pkt: adding ability to dynamically change preamble for pky.py
Diffstat (limited to 'gr-digital/python/digital/pkt.py')
-rw-r--r-- | gr-digital/python/digital/pkt.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gr-digital/python/digital/pkt.py b/gr-digital/python/digital/pkt.py index 434548906e..fbdcaa3a66 100644 --- a/gr-digital/python/digital/pkt.py +++ b/gr-digital/python/digital/pkt.py @@ -40,8 +40,8 @@ class mod_pkts(gr.hier_block2): Send packets by calling send_pkt """ - def __init__(self, modulator, access_code=None, msgq_limit=2, pad_for_usrp=True, - use_whitener_offset=False, modulate=True): + def __init__(self, modulator, preamble=None, access_code=None, msgq_limit=2, + pad_for_usrp=True, use_whitener_offset=False, modulate=True): """ Hierarchical block for sending packets @@ -72,6 +72,12 @@ class mod_pkts(gr.hier_block2): 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 + + if preamble is None: + preamble = packet_utils.default_preamble + if not packet_utils.is_1_0_string(preamble): + raise ValueError, "Invalid preamble %r. Must be string of 1's and 0's" % (preamble,) + self._preamble = preamble # accepts messages from the outside world self._pkt_input = blocks.message_source(gr.sizeof_char, msgq_limit) @@ -91,6 +97,7 @@ class mod_pkts(gr.hier_block2): pkt = packet_utils.make_packet(payload, self._modulator.samples_per_symbol(), self._modulator.bits_per_symbol(), + self._preamble, self._access_code, self._pad_for_usrp, self._whitener_offset) |