Reading info from pmt_blob

Hello all,

I’m new in GNURadio and right now I am understanding a little bit on how
the pmt work and how can it be read.

For that I’m taking this project as a base:
https://github.com/bastibl/gr-ieee802-15-4, working on the MAC layer
(modifying mac.cc and mac.h so far) and from here I want to extract the
sequence number of a frame that I am receiving from the physical layer.
When simulating, I see how the frame is created for Tx, as it can be
read
clear as an output. Appart from other info, it includes the sequence
number
of the frame and that is my main interest right now. However, in the Rx
part, I dont see it as bytes or as hexadecimal values, as it comes in a
coding that I’m missing where it comes from and how it is encoded. I
tried
something like:

pmt::pmt_t received_frame = pmt::make_blob(pmt::blob_data(pmt::cdr(msg))
,
data_len )

where msg is what I am receiving. However on the output I see my message
in
the payload (not encoded = just as It can be written on the message
strobe)
and a long header which I dont understand so far. I dont see a
similarity
with the same frame from when it was sent and, therefore, I have not
managed how to retreive its sequence number.

Any help on how to decode this blob and also how to access to a certain
part of the frame only (in order to retreive the sequence number) would
be
appreciated.

Thanks in advance!
Nicolás Cuervo

Hi,

On 14 Mar 2015, at 22:29, Nicolas Cuervo B. [email protected]
wrote:

Hello all,

I’m new in GNURadio and right now I am understanding a little bit on how the pmt
work and how can it be read.

For that I’m taking this project as a base:
https://github.com/bastibl/gr-ieee802-15-4, working on the MAC layer (modifying
mac.cc and mac.h so far) and from here I want to extract the sequence number of a
frame that I am receiving from the physical layer. When simulating, I see how the
frame is created for Tx, as it can be read clear as an output. Appart from other
info, it includes the sequence number of the frame and that is my main interest
right now. However, in the Rx part, I dont see it as bytes or as hexadecimal
values, as it comes in a coding that I’m missing where it comes from and how it is
encoded. I tried something like:

pmt::pmt_t received_frame = pmt::make_blob(pmt::blob_data(pmt::cdr(msg)) ,
data_len )

this looks like a complicated way to duplicate the blob (i.e. the char
buffer) in the tuple. Something like this is done in the MAC block to
extract the data payload from the buffer received from the PHY. The
headers (9 byte) and the CRC (2 byte) are removed from the blob on the
data is passed to the app layer.

https://github.com/bastibl/gr-ieee802-15-4/blob/master/lib/mac.cc#L77

size_t data_len = pmt::blob_length(blob);
pmt::pmt_t mac_payload = pmt::make_blob((char*)pmt::blob_data(blob) + 9
, data_len - 9 - 2);

I think what you want to do is interpreting the blob (i.e. casting it to
a struct) with something like

struct mac_header = (struct mac_header)(pmt::blob_data(blob));

cout << “seq number: “ << mac_header-> seq_number << endl;

Best,
Bastian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs