discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] bbn_80211b_rx.py: how is the received packet handled


From: yyzhuang
Subject: [Discuss-gnuradio] bbn_80211b_rx.py: how is the received packet handled please?
Date: Tue, 29 Jul 2008 13:33:07 -0700 (PDT)

Hello,

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])
        mac_str = "%02x:%02x:%02x:%02x:%02X:%02X" % \
                  (data_hdr[0], data_hdr[1], data_hdr[2],
                   data_hdr[3], data_hdr[4], data_hdr[5],)
    else:
        mac_str = "UNKNOWN"

    print "PKT: len=%d, rssi=%d, src=%s, time=%ld, rate=%d Mbps" \
          % (hdr[1], hdr[2], mac_str, hdr[0], hdr[3]/ 10.0)
=======================================================

What does the struct.unpack do? Is it for formatting the packet for display?
coz when I tried to do this:  print "payload: %s" % payload, what got
displayed on the screen is like this:
payload: �,Q
�������F(�F(�p��j{Yd!
                            䀹����
                                 0H
                                      *2$`l�
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? 
-- 
View this message in context: 
http://www.nabble.com/bbn_80211b_rx.py%3A-how-is-the-received-packet-handled-please--tp18720769p18720769.html
Sent from the GnuRadio mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]