3 * Copyright 2008 Free Software Foundation, Inc.
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.
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.
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/>.
18 #ifndef INCLUDED_USRP2_RX_SAMPLE_HANDLER_H
19 #define INCLUDED_USRP2_RX_SAMPLE_HANDLER_H
21 #include <usrp2/metadata.h>
28 * \brief Abstract function object called to handle received data blocks.
31 * An object derived from this class is passed to usrp2::rx_samples
32 * to process the received frames of samples.
34 class rx_sample_handler {
36 virtual ~rx_sample_handler();
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.
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.
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.
51 * \returns true if the object wants to be called again with new data;
52 * false if no additional data is wanted.
54 virtual bool operator()(const uint32_t *items, size_t nitems, const rx_metadata *metadata) = 0;
59 #endif /* INCLUDED_RX_SAMPLE_HANDLER_H */