GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
packet_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2005,2012 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_GR_PACKET_SINK_H
24 #define INCLUDED_GR_PACKET_SINK_H
25 
26 #include <gnuradio/digital/api.h>
27 #include <gnuradio/sync_block.h>
28 #include <gnuradio/msg_queue.h>
29 
30 namespace gr {
31  namespace digital {
32 
33  /*!
34  * \brief process received bits looking for packet sync, header,
35  * and process bits into packet
36  * \ingroup packet_operators_blk
37  *
38  * \details
39  * input: stream of symbols to be sliced.
40  *
41  * output: none. Pushes assembled packet into target queue
42  *
43  * The packet sink takes in a stream of binary symbols that are
44  * sliced around 0. The bits are then checked for the \p
45  * sync_vector to determine find and decode the packet. It then
46  * expects a fixed length header of 2 16-bit shorts containing the
47  * payload length, followed by the payload. If the 2 16-bit shorts
48  * are not identical, this packet is ignored. Better algs are
49  * welcome.
50  *
51  * This block is not very useful anymore as it only works with
52  * 2-level modulations such as BPSK or GMSK. The block can
53  * generally be replaced with a correlate access code and frame
54  * sink blocks.
55  */
56  class DIGITAL_API packet_sink : virtual public sync_block
57  {
58  public:
59  // gr::digital::packet_sink::sptr
61 
62  /*!
63  * Make a packet_sink block.
64  *
65  * \param sync_vector The synchronization vector as a vector of 1's and 0's.
66  * \param target_queue The message queue that packets are sent to.
67  * \param threshold Number of bits that can be incorrect in the \p sync_vector.
68  */
69  static sptr make(const std::vector<unsigned char>& sync_vector,
70  msg_queue::sptr target_queue,
71  int threshold=-1);
72 
73  //! return true if we detect carrier
74  virtual bool carrier_sensed() const = 0;
75  };
76 
77  } /* namespace digital */
78 } /* namespace gr */
79 
80 #endif /* INCLUDED_GR_PACKET_SINK_H */
process received bits looking for packet sync, header, and process bits into packet ...
Definition: packet_sink.h:56
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
boost::shared_ptr< packet_sink > sptr
Definition: packet_sink.h:60