Inlined responses:

Quoting yyzhuang <[EMAIL PROTECTED]>:

Hello,

Hi,

In the BBN 802.11 package, I see the scripts for receiver, and some lines of
code for packet handling as well.

======================================================
def rx_callback(ok, payload):
    size = struct.calcsize("@qHBB");
    packet_data = payload[size:];
    hdr = struct.unpack("@qHbB", payload[0:size]);
    if len(packet_data) > 16:
        data_hdr = struct.unpack("@BBBBBB", packet_data[10:16])


What does the struct.unpack do? Is it for formatting the packet for display?

Pretty much -- though it does more than that as well.
http://docs.python.org/lib/module-struct.html
struct.unpack() is also used by the mainline gnuradio code (see gnuradio-examples/python/(digital|ofdm)/benchmark_* for instance).

coz when I tried to do this:  print "payload: %s" % payload, what got
displayed on the screen is like this:
payload: <binary garbage snipped>

That's because the 'payload' string isn't ascii- or unicode-formatted; it's raw binary data packed into a string because that's how python handles things that would be stored in a c struct. If you unpack it with an appropriate format string, you can display the actual data received. (something close to but less ugly than
    struct.unpack('!' + `len(payload)` + 'B',payload)
depending on what you want to see.)


And what exactly the "time" is? As I see in the script, is it in ticks?
means the time instance, or the inter-arrival time?

I'll defer to someone who's familiar with the BBN code.

--Mason





_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to