GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
protocol_parser_b.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015-2016 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 
12 #ifndef INCLUDED_DIGITAL_PACKET_PARSE_B_H
13 #define INCLUDED_DIGITAL_PACKET_PARSE_B_H
14 
15 #include <gnuradio/digital/api.h>
17 #include <gnuradio/sync_block.h>
18 
19 namespace gr {
20 namespace digital {
21 
22 /*!
23  * \brief Block that synchronizes to a header based on a header
24  * format object class. Designed to accept hard bits and produce
25  * PDUs with packed bytes (pmt::u8vector).
26  *
27  * \ingroup packet_operators_blk
28  *
29  * \details
30  *
31  * A packet synchronizer block. This block takes in hard bits
32  * (unpacked bytes; 1's and 0's as the LSB) and finds the access
33  * code as a sync word to find the start of a frame.
34  *
35  * The block uses a format object derived from a
36  * header_format_base class.
37  *
38  * Once the frame is detected (usually through the use of an
39  * access code), the block uses the format object's parser
40  * function to decode the remaining header. Generally, as in the
41  * default header case, the header will contain the length of the
42  * frame's payload. That and anything else in the header will
43  * generally go into the PDU's meta-data dictionary.
44  *
45  * The block will output a PDU that contains frame's header info
46  * in the meta-data portion of the PDU and the payload itself. The
47  * payload is packed hard bits as taken from the input stream.
48  *
49  * \sa packet_sync_ff for a soft decision version.
50  */
52 {
53 public:
54  typedef std::shared_ptr<protocol_parser_b> sptr;
55 
56  /*!
57  * Make a packet header block using a given \p format.
58  *
59  * \param format The format object to use when reading the
60  * header.
61  */
62  static sptr make(const header_format_base::sptr& format);
63 };
64 
65 } // namespace digital
66 } // namespace gr
67 
68 #endif /* INCLUDED_DIGITAL_PROTOCOL_PARSER_B_H */
std::shared_ptr< header_format_base > sptr
Definition: header_format_base.h:114
Block that synchronizes to a header based on a header format object class. Designed to accept hard bi...
Definition: protocol_parser_b.h:52
std::shared_ptr< protocol_parser_b > sptr
Definition: protocol_parser_b.h:54
static sptr make(const header_format_base::sptr &format)
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29