Imported Upstream version 3.2.2
[debian/gnuradio] / usrp2 / host / include / usrp2 / rx_sample_handler.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008 Free Software Foundation, Inc.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef INCLUDED_USRP2_RX_SAMPLE_HANDLER_H
19 #define INCLUDED_USRP2_RX_SAMPLE_HANDLER_H
20
21 #include <usrp2/metadata.h>
22 #include <stddef.h>
23
24
25 namespace usrp2 {
26
27   /*!
28    * \brief Abstract function object called to handle received data blocks.
29    * \ingroup usrp2
30    *
31    * An object derived from this class is passed to usrp2::rx_samples
32    * to process the received frames of samples.
33    */
34   class rx_sample_handler {
35   public:
36     virtual ~rx_sample_handler();
37
38     /*!
39      * \param items points to the first 32-bit word of uninterpreted sample data in the frame.
40      * \param nitems is the number of entries in the frame in units of uint32_t's.
41      * \param metadata is the additional per frame data provided by the USRP2 FPGA.
42      *
43      * \p items points to the raw sample data received off of the ethernet.  The data is
44      * packed into big-endian 32-bit unsigned ints for transport, but the actual format
45      * of the data is dependent on the current configuration of the USRP2.  The most common
46      * format is 16-bit I & Q, with I in the top of the 32-bit word.
47      *
48      * This is the general purpose, low level interface and relies on other functions
49      * to handle all required endian-swapping and format conversion.  \sa FIXME.
50      *
51      * \returns true if the object wants to be called again with new data;
52      * false if no additional data is wanted.
53      */
54     virtual bool operator()(const uint32_t *items, size_t nitems, const rx_metadata *metadata) = 0;
55   };
56
57 };
58
59 #endif /* INCLUDED_RX_SAMPLE_HANDLER_H */