GNU Radio Manual and C++ API Reference  3.10.9.1
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 Types

typedef std::shared_ptr< header_format_ofdmsptr
 
- Public Types inherited from gr::digital::header_format_crc
typedef std::shared_ptr< header_format_crcsptr
 
- Public Types inherited from gr::digital::header_format_base
typedef std::shared_ptr< header_format_basesptr
 

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)
 
 ~header_format_ofdm () override
 
bool format (int nbytes_in, const unsigned char *input, pmt::pmt_t &output, pmt::pmt_t &info) override
 Encodes the header information in the given tags into bits and places them into out. More...
 
bool parse (int nbits_in, const unsigned char *input, std::vector< pmt::pmt_t > &info, int &nbits_processed) override
 
size_t header_nbits () const override
 
- 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")
 
 ~header_format_crc () override
 
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

int header_payload () override
 
- Protected Member Functions inherited from gr::digital::header_format_crc
bool header_ok () override
 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
 
crc 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

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

Member Typedef Documentation

◆ sptr

Constructor & Destructor Documentation

◆ header_format_ofdm()

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 
)

◆ ~header_format_ofdm()

gr::digital::header_format_ofdm::~header_format_ofdm ( )
override

Member Function Documentation

◆ format()

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

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 every time this function is called)
  • Bit 24-31: 8-Bit CRC

Reimplemented from gr::digital::header_format_crc.

◆ header_nbits()

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

Returns the length of the formatted header in bits.

Reimplemented from gr::digital::header_format_crc.

◆ header_payload()

int gr::digital::header_format_ofdm::header_payload ( )
overrideprotectedvirtual

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

Reimplemented from gr::digital::header_format_crc.

◆ make()

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.

◆ parse()

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

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

◆ d_bits_per_payload_sym

int gr::digital::header_format_ofdm::d_bits_per_payload_sym
protected

◆ d_frame_key_name

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

Tag key of the additional frame length tag.

◆ d_header_len

size_t gr::digital::header_format_ofdm::d_header_len
protected

◆ d_occupied_carriers

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

Which carriers/symbols carry data.

◆ d_scramble_mask

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

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

◆ d_syms_per_set

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: