GNU Radio Manual and C++ API Reference  3.7.13.4
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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 
24 #ifndef INCLUDED_DIGITAL_PACKET_PARSE_B_H
25 #define INCLUDED_DIGITAL_PACKET_PARSE_B_H
26 
27 #include <gnuradio/digital/api.h>
29 #include <gnuradio/sync_block.h>
30 
31 namespace gr {
32  namespace digital {
33 
34  /*!
35  * \brief Block that synchronizes to a header based on a header
36  * format object class. Designed to accept hard bits and produce
37  * PDUs with packed bytes (pmt::u8vector).
38  *
39  * \ingroup packet_operators_blk
40  *
41  * \details
42  *
43  * A packet synchronizer block. This block takes in hard bits
44  * (unpacked bytes; 1's and 0's as the LSB) and finds the access
45  * code as a sync word to find the start of a frame.
46  *
47  * The block uses a format object derived from a
48  * header_format_base class.
49  *
50  * Once the frame is detected (usually through the use of an
51  * access code), the block uses the format object's parser
52  * function to decode the remaining header. Generally, as in the
53  * default header case, the header will contain the length of the
54  * frame's payload. That and anything else in the header will
55  * generally go into the PDU's meta-data dictionary.
56  *
57  * The block will output a PDU that contains frame's header info
58  * in the meta-data portion of the PDU and the payload itself. The
59  * payload is packed hard bits as taken from the input stream.
60  *
61  * \sa packet_sync_ff for a soft decision version.
62  */
63  class DIGITAL_API protocol_parser_b : virtual public sync_block
64  {
65  public:
66  typedef boost::shared_ptr<protocol_parser_b> sptr;
67 
68  /*!
69  * Make a packet header block using a given \p format.
70  *
71  * \param format The format object to use when reading the
72  * header.
73  */
74  static sptr make(const header_format_base::sptr &format);
75  };
76 
77  } // namespace digital
78 } // namespace gr
79 
80 #endif /* INCLUDED_DIGITAL_PROTOCOL_PARSER_B_H */
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
Include this header to use the message passing features.
Definition: logger.h:695
Block that synchronizes to a header based on a header format object class. Designed to accept hard bi...
Definition: protocol_parser_b.h:63
boost::shared_ptr< protocol_parser_b > sptr
Definition: protocol_parser_b.h:66
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
boost::shared_ptr< header_format_base > sptr
Definition: header_format_base.h:127