discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Reading info from pmt_blob


From: Bastian Bloessl
Subject: Re: [Discuss-gnuradio] Reading info from pmt_blob
Date: Sun, 15 Mar 2015 08:27:38 +0100

Hi,

> On 14 Mar 2015, at 22:29, Nicolas Cuervo Benavides <address@hidden> 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

> 
> 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. 
> 




reply via email to

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