GNU Radio Manual and C++ API Reference  3.7.13.4
The Free & Open Software Radio Ecosystem
gr::digital::header_format_ofdm Class Reference

Header formatter that includes the payload length, packet number, and a CRC check on the header. More...

#include <gnuradio/digital/header_format_ofdm.h>

Public Member Functions

 header_format_ofdm (const std::vector< std::vector< int > > &occupied_carriers, int n_syms, const std::string &len_key_name="packet_len", const std::string &frame_key_name="frame_len", const std::string &num_key_name="packet_num", int bits_per_header_sym=1, int bits_per_payload_sym=1, bool scramble_header=false)
 
virtual ~header_format_ofdm ()
 
virtual bool format (int nbytes_in, const unsigned char *input, pmt::pmt_t &output, pmt::pmt_t &info)
 Encodes the header information in the given tags into bits and places them into out. More...
 
virtual bool parse (int nbits_in, const unsigned char *input, std::vector< pmt::pmt_t > &info, int &nbits_processed)
 
virtual size_t header_nbits () const
 
- Public Member Functions inherited from gr::digital::header_format_crc
 header_format_crc (const std::string &len_key_name="packet_len", const std::string &num_key_name="packet_num")
 
virtual ~header_format_crc ()
 
void set_header_num (unsigned header_num)
 
- Public Member Functions inherited from gr::digital::header_format_base
 header_format_base ()
 
virtual ~header_format_base ()
 
sptr base ()
 
sptr formatter ()
 
size_t header_nbytes () const
 

Static Public Member Functions

static sptr make (const std::vector< std::vector< int > > &occupied_carriers, int n_syms, const std::string &len_key_name="packet_len", const std::string &frame_key_name="frame_len", const std::string &num_key_name="packet_num", int bits_per_header_sym=1, int bits_per_payload_sym=1, bool scramble_header=false)
 
- Static Public Member Functions inherited from gr::digital::header_format_crc
static sptr make (const std::string &len_key_name="packet_len", const std::string &num_key_name="packet_num")
 

Protected Member Functions

virtual int header_payload ()
 
- Protected Member Functions inherited from gr::digital::header_format_crc
virtual bool header_ok ()
 Verify that the header is valid. More...
 
- Protected Member Functions inherited from gr::digital::header_format_base
virtual void enter_search ()
 Enter Search state of the state machine to find the access code. More...
 
virtual void enter_have_sync ()
 Access code found, start getting the header. More...
 
virtual void enter_have_header (int payload_len)
 Header found, setup for pulling in the hard decision bits. More...
 

Protected Attributes

pmt::pmt_t d_frame_key_name
 Tag key of the additional frame length tag. More...
 
const std::vector< std::vector< int > > d_occupied_carriers
 Which carriers/symbols carry data. More...
 
int d_syms_per_set
 Helper variable: Total number of elements in d_occupied_carriers. More...
 
int d_bits_per_payload_sym
 
std::vector< uint8_t > d_scramble_mask
 Bits are xor'd with this before tx'ing. More...
 
size_t d_header_len
 
- Protected Attributes inherited from gr::digital::header_format_crc
uint16_t d_header_number
 
pmt::pmt_t d_len_key_name
 
pmt::pmt_t d_num_key_name
 
boost::crc_optimal< 8, 0x07, 0xFF, 0x00, false, false > d_crc_impl
 
- Protected Attributes inherited from gr::digital::header_format_base
state_t d_state
 state of the state machine More...
 
header_buffer d_hdr_reg
 header_buffer object to hold header bits More...
 
pmt::pmt_t d_info
 info captured from the header More...
 
gr::logger_ptr d_logger
 
gr::logger_ptr d_debug_logger
 

Additional Inherited Members

- Public Types inherited from gr::digital::header_format_base
typedef boost::shared_ptr< header_format_basesptr
 
- Protected Types inherited from gr::digital::header_format_base
enum  state_t { STATE_SYNC_SEARCH, STATE_HAVE_SYNC }
 

Detailed Description

Header formatter that includes the payload length, packet number, and a CRC check on the header.

Child class of header_format_base. This version's header format looks like:

  • length (12 bits): length of the payload
  • number (12 bits): packet number
  • CRC8 (8 bits): A CRC8 check on the header contents

Instead of duplicating the payload length, we only add it once and use the CRC8 to make sure it's correctly received.

  |  0 -- 11 | 12 -- 23 | 24 -- 31 |
  |    len   | pkt len  |   CRC8   |

Reimplements packet_header_default in the style of the header_format_base.

Constructor & Destructor Documentation

gr::digital::header_format_ofdm::header_format_ofdm ( const std::vector< std::vector< int > > &  occupied_carriers,
int  n_syms,
const std::string &  len_key_name = "packet_len",
const std::string &  frame_key_name = "frame_len",
const std::string &  num_key_name = "packet_num",
int  bits_per_header_sym = 1,
int  bits_per_payload_sym = 1,
bool  scramble_header = false 
)
virtual gr::digital::header_format_ofdm::~header_format_ofdm ( )
virtual

Member Function Documentation

virtual bool gr::digital::header_format_ofdm::format ( int  nbytes_in,
const unsigned char *  input,
pmt::pmt_t output,
pmt::pmt_t info 
)
virtual

Encodes the header information in the given tags into bits and places them into out.

Uses the following header format:

  • Bits 0-11: The packet length (what was stored in the tag with key len_tag_key)
  • Bits 12-23: The header number (counts up everytime this function is called)
  • Bit 24-31: 8-Bit CRC

Reimplemented from gr::digital::header_format_crc.

virtual size_t gr::digital::header_format_ofdm::header_nbits ( ) const
virtual

Returns the length of the formatted header in bits.

Reimplemented from gr::digital::header_format_crc.

virtual int gr::digital::header_format_ofdm::header_payload ( )
protectedvirtual

Get info from the header; return payload length and package rest of data in d_info dictionary.

Reimplemented from gr::digital::header_format_crc.

static sptr gr::digital::header_format_ofdm::make ( const std::vector< std::vector< int > > &  occupied_carriers,
int  n_syms,
const std::string &  len_key_name = "packet_len",
const std::string &  frame_key_name = "frame_len",
const std::string &  num_key_name = "packet_num",
int  bits_per_header_sym = 1,
int  bits_per_payload_sym = 1,
bool  scramble_header = false 
)
static

Factory to create an async packet header formatter; returns an sptr to the object.

virtual bool gr::digital::header_format_ofdm::parse ( int  nbits_in,
const unsigned char *  input,
std::vector< pmt::pmt_t > &  info,
int &  nbits_processed 
)
virtual

Parses a header. This function is overloaded in the child class, which knows how to convert the incoming hard bits (0's and 1's) back into a packet header.

Parameters
nbits_inThe number of bits in the input array.
inputThe input as hard decision bits.
infoA vector of pmt::dicts to hold any meta data or info about the PDU. When parsing the header, the formatter can add info from the header into this dict. Each packet has a single PMT dictionary of info, so the vector length is the number of packets received extracted during one call to this parser function.
nbits_processedNumber of input bits actually processed; If all goes well, this is nbits_in. A premature return after a bad header could be less than this.

MUST be overloaded.

Reimplemented from gr::digital::header_format_crc.

Member Data Documentation

int gr::digital::header_format_ofdm::d_bits_per_payload_sym
protected
pmt::pmt_t gr::digital::header_format_ofdm::d_frame_key_name
protected

Tag key of the additional frame length tag.

size_t gr::digital::header_format_ofdm::d_header_len
protected
const std::vector<std::vector<int> > gr::digital::header_format_ofdm::d_occupied_carriers
protected

Which carriers/symbols carry data.

std::vector<uint8_t> gr::digital::header_format_ofdm::d_scramble_mask
protected

Bits are xor'd with this before tx'ing.

int gr::digital::header_format_ofdm::d_syms_per_set
protected

Helper variable: Total number of elements in d_occupied_carriers.


The documentation for this class was generated from the following file: