[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3617 - gnuradio/branches/developers/eb/digital-wip/gn
From: |
eb |
Subject: |
[Commit-gnuradio] r3617 - gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio |
Date: |
Fri, 22 Sep 2006 12:14:03 -0600 (MDT) |
Author: eb
Date: 2006-09-22 12:14:03 -0600 (Fri, 22 Sep 2006)
New Revision: 3617
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/packet_utils.py
Log:
added preamble to packet header
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/packet_utils.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/packet_utils.py
2006-09-22 18:04:26 UTC (rev 3616)
+++
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/packet_utils.py
2006-09-22 18:14:03 UTC (rev 3617)
@@ -71,8 +71,9 @@
default_access_code = \
conv_packed_binary_string_to_1_0_string('\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC')
+preamble = \
+ conv_packed_binary_string_to_1_0_string('\xAA\xAA\xAA\xAB')
-
def is_1_0_string(s):
if not isinstance(s, str):
return False
@@ -97,7 +98,8 @@
def make_header(payload_len):
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):
+def make_packet(payload, samples_per_symbol, bits_per_symbol,
+ access_code=default_access_code, pad_for_usrp=True):
"""
Build a packet, given access code and payload.
@@ -115,6 +117,7 @@
raise ValueError, "access_code must be a string containing only 0's
and 1's (%r)" % (access_code,)
(packed_access_code, padded) =
conv_1_0_string_to_packed_binary_string(access_code)
+ (packed_preamble, ignore) =
conv_1_0_string_to_packed_binary_string(preamble)
payload_with_crc = gru.gen_and_append_crc32(payload)
#print "outbound crc =", string_to_hex_list(payload_with_crc[-4:])
@@ -124,7 +127,7 @@
if L > MAXLEN:
raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,)
- pkt = ''.join((packed_access_code, make_header(L),
whiten(payload_with_crc), '\x55'))
+ pkt = ''.join((packed_preamble, packed_access_code, make_header(L),
whiten(payload_with_crc), '\x55'))
if pad_for_usrp:
pkt = pkt + (_npadding_bytes(len(pkt), samples_per_symbol,
bits_per_symbol) * '\x55')
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3617 - gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio,
eb <=