GNU Radio 3.4.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2008 Free Software Foundation, Inc. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 #ifndef INCLUDED_USRP2_RX_SAMPLE_HANDLER_H 00019 #define INCLUDED_USRP2_RX_SAMPLE_HANDLER_H 00020 00021 #include <usrp2/metadata.h> 00022 #include <stddef.h> 00023 00024 00025 namespace usrp2 { 00026 00027 /*! 00028 * \brief Abstract function object called to handle received data blocks. 00029 * \ingroup usrp2 00030 * 00031 * An object derived from this class is passed to usrp2::rx_samples 00032 * to process the received frames of samples. 00033 */ 00034 class rx_sample_handler { 00035 public: 00036 virtual ~rx_sample_handler(); 00037 00038 /*! 00039 * \param items points to the first 32-bit word of uninterpreted sample data in the frame. 00040 * \param nitems is the number of entries in the frame in units of uint32_t's. 00041 * \param metadata is the additional per frame data provided by the USRP2 FPGA. 00042 * 00043 * \p items points to the raw sample data received off of the ethernet. The data is 00044 * packed into big-endian 32-bit unsigned ints for transport, but the actual format 00045 * of the data is dependent on the current configuration of the USRP2. The most common 00046 * format is 16-bit I & Q, with I in the top of the 32-bit word. 00047 * 00048 * This is the general purpose, low level interface and relies on other functions 00049 * to handle all required endian-swapping and format conversion. \sa FIXME. 00050 * 00051 * \returns true if the object wants to be called again with new data; 00052 * false if no additional data is wanted. 00053 */ 00054 virtual bool operator()(const uint32_t *items, size_t nitems, const rx_metadata *metadata) = 0; 00055 }; 00056 00057 }; 00058 00059 #endif /* INCLUDED_RX_SAMPLE_HANDLER_H */