[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4226 - gnuradio/branches/developers/trondeau/digital-
From: |
trondeau |
Subject: |
[Commit-gnuradio] r4226 - gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio |
Date: |
Thu, 4 Jan 2007 15:21:32 -0700 (MST) |
Author: trondeau
Date: 2007-01-04 15:21:32 -0700 (Thu, 04 Jan 2007)
New Revision: 4226
Modified:
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/packet_utils.py
Log:
added flag to toggle data whitening (set default to not disturb legacy behavior)
Modified:
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/packet_utils.py
===================================================================
---
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/packet_utils.py
2007-01-04 22:19:51 UTC (rev 4225)
+++
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/packet_utils.py
2007-01-04 22:21:32 UTC (rev 4226)
@@ -99,7 +99,7 @@
return struct.pack('!HH', payload_len, payload_len)
def make_packet(payload, samples_per_symbol, bits_per_symbol,
- access_code=default_access_code, pad_for_usrp=True):
+ access_code=default_access_code, pad_for_usrp=True,
whitening=True):
"""
Build a packet, given access code and payload.
@@ -127,7 +127,10 @@
if L > MAXLEN:
raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,)
- pkt = ''.join((packed_preamble, packed_access_code, make_header(L),
whiten(payload_with_crc), '\x55'))
+ if whitening:
+ pkt = ''.join((packed_preamble, packed_access_code, make_header(L),
whiten(payload_with_crc), '\x55'))
+ else:
+ pkt = ''.join((packed_preamble, packed_access_code, make_header(L),
(payload_with_crc), '\x55'))
if pad_for_usrp:
pkt = pkt + (_npadding_bytes(len(pkt), samples_per_symbol,
bits_per_symbol) * '\x55')
@@ -156,13 +159,16 @@
return byte_modulus - r
-def unmake_packet(whitened_payload_with_crc):
+def unmake_packet(whitened_payload_with_crc, dewhitening=True):
"""
Return (ok, payload)
@param whitened_payload_with_crc: string
"""
- payload_with_crc = dewhiten(whitened_payload_with_crc)
+ if dewhitening:
+ payload_with_crc = dewhiten(whitened_payload_with_crc)
+ else:
+ payload_with_crc = (whitened_payload_with_crc)
ok, payload = gru.check_crc32(payload_with_crc)
if 0:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4226 - gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio,
trondeau <=