|
From: | masond |
Subject: | Re: [Discuss-gnuradio] bbn_80211b_rx.py: how is the received packet handled please? |
Date: | Tue, 29 Jul 2008 17:46:43 -0500 |
User-agent: | Internet Messaging Program (IMP) H3 (4.1.3) |
Quoting "Y. Zhuang" <address@hidden>:
Thanks very much for help. So "@qHBB" and "@qHbB" actually mean the format that we should unpack this string, right? What is the differences between "@qHBB" and "@qHbB" then? and "@BBBBBB"? Thank you
Yes. Basically, to summarize the python doc I linked, if you have binary data stored in a string you want to decode, each character in the python format string corresponds to one or more of the bytes in it (with the exception of the @ at the beginning. @ tells the byte order and alignment to use -- the system default in this case). Then q would be a long long, H an unsigned short, and B being an unsigned char. Also, @BBBBBB can be written as @6B, and you can construct the formatting strings dynamically if needed (if transmitting a variable length packet).
The difference between qHbB and qHBB is that the lowercase b in the middle is signed and the capital B is unsigned. (i.e. is the number stored in two's-complement.) Of course, what that means for the code is up to the coder.
--Mason
[Prev in Thread] | Current Thread | [Next in Thread] |