Header formatter that includes the payload length, packet number, and a CRC check on the header. More...
#include <gnuradio/digital/header_format_crc.h>
Public Types | |
typedef std::shared_ptr< header_format_crc > | sptr |
Public Types inherited from gr::digital::header_format_base | |
typedef std::shared_ptr< header_format_base > | sptr |
Public Member Functions | |
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) |
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_base | |
header_format_base () | |
virtual | ~header_format_base () |
sptr | base () |
sptr | formatter () |
virtual bool | format (int nbytes_in, const unsigned char *input, pmt::pmt_t &output, pmt::pmt_t &info)=0 |
virtual bool | parse (int nbits_in, const unsigned char *input, std::vector< pmt::pmt_t > &info, int &nbits_processed)=0 |
virtual size_t | header_nbits () const =0 |
size_t | header_nbytes () const |
Static Public Member Functions | |
static sptr | make (const std::string &len_key_name="packet_len", const std::string &num_key_name="packet_num") |
Protected Member Functions | |
bool | header_ok () override |
Verify that the header is valid. More... | |
int | header_payload () override |
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... | |
virtual bool | header_ok ()=0 |
Verify that the header is valid. More... | |
virtual int | header_payload ()=0 |
Protected Attributes | |
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 } |
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:
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.
typedef std::shared_ptr<header_format_crc> gr::digital::header_format_crc::sptr |
gr::digital::header_format_crc::header_format_crc | ( | const std::string & | len_key_name = "packet_len" , |
const std::string & | num_key_name = "packet_num" |
||
) |
|
override |
|
overridevirtual |
Encodes the header information in the given tags into bits and places them into out
.
Uses the following header format:
len_tag_key
)Implements gr::digital::header_format_base.
Reimplemented in gr::digital::header_format_ofdm.
|
overridevirtual |
Returns the length of the formatted header in bits.
Implements gr::digital::header_format_base.
Reimplemented in gr::digital::header_format_ofdm.
|
overrideprotectedvirtual |
Verify that the header is valid.
Implements gr::digital::header_format_base.
|
overrideprotectedvirtual |
Get info from the header; return payload length and package rest of data in d_info dictionary.
Implements gr::digital::header_format_base.
Reimplemented in gr::digital::header_format_ofdm.
|
static |
Factory to create an async packet header formatter; returns an sptr to the object.
|
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.
nbits_in | The number of bits in the input array. |
input | The input as hard decision bits. |
info | A 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_processed | Number 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.
Implements gr::digital::header_format_base.
Reimplemented in gr::digital::header_format_ofdm.
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |