Merged r9433:9527 from features/gr-usrp2 into trunk. Adds usrp2 and gr-usrp2 top...
[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    *
30    * An object derived from this class is passed to usrp2::rx_samples
31    * to process the received frames of samples.
32    */
33   class rx_sample_handler {
34   public:
35     virtual ~rx_sample_handler();
36
37     /*!
38      * \param items points to the first 32-bit word of uninterpreted sample data in the frame.
39      * \param nitems is the number of entries in the frame in units of uint32_t's.
40      * \param metadata is the additional per frame data provided by the USRP2 FPGA.
41      *
42      * \p items points to the raw sample data received off of the ethernet.  The data is
43      * packed into big-endian 32-bit unsigned ints for transport, but the actual format
44      * of the data is dependent on the current configuration of the USRP2.  The most common
45      * format is 16-bit I & Q, with I in the top of the 32-bit word.
46      *
47      * This is the general purpose, low level interface and relies on other functions
48      * to handle all required endian-swapping and format conversion.  \sa FIXME.
49      *
50      * \returns true if the object wants to be called again with new data;
51      * false if no additional data is wanted.
52      */
53     virtual bool operator()(const uint32_t *items, size_t nitems, const rx_metadata *metadata) = 0;
54   };
55
56 };
57
58 #endif /* INCLUDED_RX_SAMPLE_HANDLER_H */