GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
async_decoder.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_DECODER_H
24#define INCLUDED_FEC_ASYNC_DECODER_H
25
26#include <gnuradio/block.h>
27#include <gnuradio/fec/api.h>
29#include <boost/shared_ptr.hpp>
30
31namespace gr {
32namespace fec {
33
34/*!
35 * \brief Creates the decoder block for use in GNU Radio
36 * flowgraphs from a given FEC API object derived from the
37 * generic_decoder class.
38 * \ingroup error_coding_blk
39 *
40 * \details
41 *
42 * Decodes frames received as async messages over a message
43 * port. This decoder deployment expects messages of soft decision
44 * symbols in and can produce either packed, PDU messages (\p
45 * packed = True) or messages full of unpacked bits (\p packed =
46 * False).
47 *
48 * This decoder works off a full message as one frame or block to
49 * decode. The message length is used to calculate the frame
50 * length. To support this, the decoder variable used will have
51 * had its frame_size set. This block treats that initial
52 * frame_size value as the maximum transmission unit (MTU) and
53 * will not process frames larger than that after being decoded.
54 *
55 * The packed PDU form of this deployment is designed to work well
56 * with other PDU-based blocks to operate within the processing
57 * flow of data packets or frames.
58 *
59 * Due to differences in how data is packed and processed, this
60 * block also offers the ability to change the direction of how
61 * bits are packed. All inputs messages are one soft decision per
62 * item. By default, the \p rev_pack mode is set to True. Using
63 * this setup allows the async block to behave with PDUs in the
64 * same operation and format as the tagged stream decoders. That
65 * is, putting the same data into both the tagged stream decoder
66 * deployment and this with the default setting should produce the
67 * same data.
68 *
69 * Because the block handles data as a full frame per message,
70 * this decoder deployment cannot work with any decoders that
71 * require history. For example, the gr::fec::code::cc_decoder
72 * decoder in streaming mode requires an extra rate*(K-1) bits to
73 * complete the decoding, so it would have to wait for the next
74 * message to come in and finish processing. Therefore, the
75 * streaming mode of the CC decoder is not allowed. The other
76 * three modes will work with this deployment since the frame is
77 * self-contained for decoding.
78 */
79class FEC_API async_decoder : virtual public block
80{
81public:
82 typedef boost::shared_ptr<async_decoder> sptr;
83
84 /*!
85 * Build the PDU-based FEC decoder block from an FECAPI decoder object.
86 *
87 * \param my_decoder An FECAPI decoder object child of the generic_decoder class.
88 * \param packed Sets output to packed bytes if true; otherwise, 1 bit per byte.
89 * \param rev_pack If packing bits, should they be reversed?
90 * \param mtu The Maximum Transmission Unit (MTU) of the output
91 * frame that the block will be able to
92 * process. Specified in bytes and defaults to 1500.
93 */
94 static sptr make(generic_decoder::sptr my_decoder,
95 bool packed = false,
96 bool rev_pack = true,
97 int mtu = 1500);
98
99 virtual int general_work(int noutput_items,
100 gr_vector_int& ninput_items,
101 gr_vector_const_void_star& input_items,
102 gr_vector_void_star& output_items) = 0;
103};
104
105} /* namespace fec */
106} /* namespace gr */
107
108#endif /* INCLUDED_FEC_ASYNC_DECODER_H */
The abstract base class for all 'terminal' processing blocks.
Definition block.h:72
Creates the decoder block for use in GNU Radio flowgraphs from a given FEC API object derived from th...
Definition async_decoder.h:80
virtual int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)=0
compute output items from input items
boost::shared_ptr< async_decoder > sptr
Definition async_decoder.h:82
static sptr make(generic_decoder::sptr my_decoder, bool packed=false, bool rev_pack=true, int mtu=1500)
boost::shared_ptr< generic_decoder > sptr
Definition generic_decoder.h:75
#define FEC_API
Definition gr-fec/include/gnuradio/fec/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46
std::vector< const void * > gr_vector_const_void_star
Definition types.h:40
std::vector< void * > gr_vector_void_star
Definition types.h:39
std::vector< int > gr_vector_int
Definition types.h:35