GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
async_encoder.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 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 #ifndef INCLUDED_FEC_ASYNC_ENCODER_H
24 #define INCLUDED_FEC_ASYNC_ENCODER_H
25 
26 #include <gnuradio/block.h>
27 #include <gnuradio/fec/api.h>
29 #include <boost/shared_ptr.hpp>
30 
31 namespace gr {
32 namespace fec {
33 
34 /*!
35  * \brief Creates the encoder block for use in GNU Radio
36  * flowgraphs with async message from a given FEC API object
37  * derived from the generic_encoder class.
38  * \ingroup error_coding_blk
39  *
40  * \details
41  *
42  * Encodes frames received as async messages or as a PDU over a
43  * message port. This encoder works off a full message as one
44  * frame or block to encode. The message length is used as the
45  * frame length. To support this, the encoder variable used will
46  * have had its frame_size set. This block treats that initial
47  * frame_size value as the maximum transmission unit (MTU) and
48  * will not process frames larger than that.
49  *
50  * This deployment works off messages and expects them to either
51  * be messages full of unpacked bits or PDU messages, which means
52  * full bytes of a frame from the higher layers, including things
53  * like headers, tails, CRC check bytes, etc. For handling PDUs,
54  * set the \p packed option of this deployment block to True. The
55  * block will then use the FEC API to properly unpack the bits
56  * from the PDU, pass it through the encoder, and repack them to
57  * output the PDUs for the next stage of processing.
58  *
59  * The packed PDU form of this deployment is designed to work well
60  * with other PDU-based blocks to operate within the processing
61  * flow of data packets or frames.
62  *
63  * Due to differences in how data is packed and processed, this
64  * block also offers the ability to change the direction of how
65  * bits are unpacked and packed, where reading or writing from the
66  * LSB or MSB. By default, the \p rev_unpack and \p rev_pack modes
67  * are set to True. Using this setup allows the async block to
68  * behave with PDUs in the same operation and format as the tagged
69  * stream encoders. That is, putting the same data into both the
70  * tagged stream encoder deployment and this with these default
71  * settings should produce the same data.
72  */
73 class FEC_API async_encoder : virtual public block
74 {
75 public:
76  typedef boost::shared_ptr<async_encoder> sptr;
77 
78  /*!
79  * Build the PDU-based FEC encoder block from an FECAPI encoder object.
80  *
81  * \param my_encoder An FECAPI encoder object child of the generic_encoder class.
82  * \param packed True if working on packed bytes (like PDUs).
83  * \param rev_unpack Reverse the unpacking order from input bytes to bits.
84  * \param rev_pack Reverse the packing order from bits to output bytes.
85  * \param mtu The Maximum Transmission Unit (MTU) of the input
86  * frame that the block will be able to
87  * process. Specified in bytes and defaults to 1500.
88  */
89  static sptr make(generic_encoder::sptr my_encoder,
90  bool packed = false,
91  bool rev_unpack = true,
92  bool rev_pack = true,
93  int mtu = 1500);
94 
95  virtual int general_work(int noutput_items,
96  gr_vector_int& ninput_items,
97  gr_vector_const_void_star& input_items,
98  gr_vector_void_star& output_items) = 0;
99 };
100 
101 } /* namespace fec */
102 } /* namespace gr */
103 
104 #endif /* INCLUDED_FEC_ASYNC_ENCODER_H */
std::vector< const void * > gr_vector_const_void_star
Definition: types.h:40
Creates the encoder block for use in GNU Radio flowgraphs with async message from a given FEC API obj...
Definition: async_encoder.h:73
std::vector< void * > gr_vector_void_star
Definition: types.h:39
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
boost::shared_ptr< generic_encoder > sptr
Definition: generic_encoder.h:49
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:30
boost::shared_ptr< async_encoder > sptr
Definition: async_encoder.h:76
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: block.h:71
std::vector< int > gr_vector_int
Definition: types.h:35