forked from sdr/gr-osmosdr
fix copyright notice
Remove FSF line, since we do not have any agreements with them.
This commit is contained in:
parent
755da481d4
commit
31a4356ba5
|
@ -1,10 +1,7 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GNU Radio is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef OSMOSDR_ARG_HELPERS_H
|
||||
#define OSMOSDR_ARG_HELPERS_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <gr_io_signature.h>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
inline std::vector< std::string > args_to_vector( const std::string &args )
|
||||
{
|
||||
std::vector< std::string > result;
|
||||
|
||||
boost::escaped_list_separator<char> separator("\\", " ", "'");
|
||||
typedef boost::tokenizer< boost::escaped_list_separator<char> > tokenizer_t;
|
||||
tokenizer_t tokens(args, separator);
|
||||
|
||||
BOOST_FOREACH(std::string token, tokens)
|
||||
result.push_back(token);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::vector< std::string > params_to_vector( const std::string ¶ms )
|
||||
{
|
||||
std::vector< std::string > result;
|
||||
|
||||
boost::escaped_list_separator<char> separator("\\", ",", "'");
|
||||
typedef boost::tokenizer< boost::escaped_list_separator<char> > tokenizer_t;
|
||||
tokenizer_t tokens(params, separator);
|
||||
|
||||
BOOST_FOREACH(std::string token, tokens)
|
||||
result.push_back(token);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef std::map< std::string, std::string > dict_t;
|
||||
|
||||
inline dict_t params_to_dict( const std::string ¶ms )
|
||||
{
|
||||
dict_t result;
|
||||
|
||||
std::vector< std::string > param_list = params_to_vector( params );
|
||||
BOOST_FOREACH(std::string param, param_list) {
|
||||
std::cout << "D'" << param << "'" << std::endl;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline gr_io_signature_sptr args_to_io_signature( const std::string &args )
|
||||
{
|
||||
std::vector< std::string > arg_list = args_to_vector( args );
|
||||
|
||||
const size_t nchan = std::max<size_t>(arg_list.size(), 1);
|
||||
return gr_make_io_signature(nchan, nchan, sizeof(gr_complex));
|
||||
}
|
||||
|
||||
#endif // OSMOSDR_ARG_HELPERS_H
|
|
@ -1,10 +1,7 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2012 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2012 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2012 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
|
@ -33,6 +30,8 @@
|
|||
#include <osmosdr_source_c_impl.h>
|
||||
#include <gr_io_signature.h>
|
||||
|
||||
#include <osmosdr_arg_helpers.h>
|
||||
|
||||
/*
|
||||
* Create a new instance of osmosdr_source_c_impl and return
|
||||
* a boost shared_ptr. This is effectively the public constructor.
|
||||
|
@ -43,124 +42,134 @@ osmosdr_make_source_c (const std::string &args)
|
|||
return gnuradio::get_initial_sptr(new osmosdr_source_c_impl (args));
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify constraints on number of input and output streams.
|
||||
* This info is used to construct the input and output signatures
|
||||
* (2nd & 3rd args to gr_block's constructor). The input and
|
||||
* output signatures are used by the runtime system to
|
||||
* check that a valid number and type of inputs and outputs
|
||||
* are connected to this block. In this case, we accept
|
||||
* only 1 input and 1 output.
|
||||
*/
|
||||
static const int MIN_IN = 0; // mininum number of input streams
|
||||
static const int MAX_IN = 0; // maximum number of input streams
|
||||
static const int MIN_OUT = 1; // minimum number of output streams
|
||||
static const int MAX_OUT = 1; // maximum number of output streams
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
|
||||
: gr_hier_block2 ("osmosdr_source_c_impl",
|
||||
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)),
|
||||
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex)))
|
||||
gr_make_io_signature (0, 0, 0),
|
||||
args_to_io_signature(args))
|
||||
{
|
||||
_src = make_rtl_source_c( args );
|
||||
std::vector< std::string > arg_list = args_to_vector(args);
|
||||
|
||||
connect(_src, 0, self(), 0);
|
||||
std::cout << "arg_list.size: " << arg_list.size() << std::endl;
|
||||
|
||||
BOOST_FOREACH(std::string arg, arg_list) {
|
||||
dict_t dict = params_to_dict(arg);
|
||||
|
||||
std::cout << "" << std::endl;
|
||||
BOOST_FOREACH( dict_t::value_type &entry, dict )
|
||||
std::cout << "'" << entry.first << "' '" << entry.second << "'" << std::endl;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < 1; i++ ) {
|
||||
std::string arg = boost::lexical_cast<std::string>(i);
|
||||
|
||||
rtl_source_c_sptr src = make_rtl_source_c( arg );
|
||||
|
||||
connect(src, 0, self(), i);
|
||||
|
||||
_srcs.push_back( src );
|
||||
}
|
||||
}
|
||||
|
||||
size_t osmosdr_source_c_impl::get_num_channels()
|
||||
{
|
||||
return _src->get_num_channels();
|
||||
size_t channels = 0;
|
||||
|
||||
channels = _srcs[0]->get_num_channels();
|
||||
|
||||
return channels;
|
||||
}
|
||||
|
||||
osmosdr::meta_range_t osmosdr_source_c_impl::get_sample_rates()
|
||||
{
|
||||
return _src->get_sample_rates();
|
||||
return _srcs[0]->get_sample_rates();
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::set_sample_rate(double rate)
|
||||
{
|
||||
return _src->set_sample_rate(rate);
|
||||
return _srcs[0]->set_sample_rate(rate);
|
||||
// return rate;
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::get_sample_rate()
|
||||
{
|
||||
return _src->get_sample_rate();
|
||||
return _srcs[0]->get_sample_rate();
|
||||
}
|
||||
|
||||
osmosdr::freq_range_t osmosdr_source_c_impl::get_freq_range( size_t chan )
|
||||
{
|
||||
return _src->get_freq_range( chan );
|
||||
return _srcs[chan]->get_freq_range( chan );
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::set_center_freq( double freq, size_t chan )
|
||||
{
|
||||
return _src->set_center_freq( freq, chan );
|
||||
return _srcs[chan]->set_center_freq( freq, chan );
|
||||
// return freq;
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::get_center_freq( size_t chan )
|
||||
{
|
||||
return _src->get_center_freq( chan );
|
||||
return _srcs[chan]->get_center_freq( chan );
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::set_freq_corr( double ppm, size_t chan )
|
||||
{
|
||||
return _src->set_freq_corr( ppm, chan );
|
||||
return _srcs[chan]->set_freq_corr( ppm, chan );
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::get_freq_corr( size_t chan )
|
||||
{
|
||||
return _src->get_freq_corr( chan );
|
||||
return _srcs[chan]->get_freq_corr( chan );
|
||||
}
|
||||
|
||||
std::vector<std::string> osmosdr_source_c_impl::get_gain_names( size_t chan )
|
||||
{
|
||||
return _src->get_gain_names( chan );
|
||||
return _srcs[chan]->get_gain_names( chan );
|
||||
}
|
||||
|
||||
osmosdr::gain_range_t osmosdr_source_c_impl::get_gain_range( size_t chan )
|
||||
{
|
||||
return _src->get_gain_range( chan );
|
||||
return _srcs[chan]->get_gain_range( chan );
|
||||
}
|
||||
|
||||
osmosdr::gain_range_t osmosdr_source_c_impl::get_gain_range( const std::string & name, size_t chan )
|
||||
{
|
||||
return _src->get_gain_range( name, chan );
|
||||
return _srcs[chan]->get_gain_range( name, chan );
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::set_gain( double gain, size_t chan )
|
||||
{
|
||||
return _src->set_gain( gain, chan );
|
||||
return _srcs[chan]->set_gain( gain, chan );
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::set_gain( double gain, const std::string & name, size_t chan)
|
||||
{
|
||||
return _src->set_gain( gain, name, chan );
|
||||
return _srcs[chan]->set_gain( gain, name, chan );
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::get_gain( size_t chan )
|
||||
{
|
||||
return _src->get_gain( chan );
|
||||
return _srcs[chan]->get_gain( chan );
|
||||
}
|
||||
|
||||
double osmosdr_source_c_impl::get_gain( const std::string & name, size_t chan )
|
||||
{
|
||||
return _src->get_gain( name, chan );
|
||||
return _srcs[chan]->get_gain( name, chan );
|
||||
}
|
||||
|
||||
std::vector< std::string > osmosdr_source_c_impl::get_antennas( size_t chan )
|
||||
{
|
||||
return _src->get_antennas( chan );
|
||||
return _srcs[chan]->get_antennas( chan );
|
||||
}
|
||||
|
||||
std::string osmosdr_source_c_impl::set_antenna( const std::string & antenna, size_t chan )
|
||||
{
|
||||
return _src->set_antenna( antenna, chan );
|
||||
return _srcs[chan]->set_antenna( antenna, chan );
|
||||
}
|
||||
|
||||
std::string osmosdr_source_c_impl::get_antenna( size_t chan )
|
||||
{
|
||||
return _src->get_antenna( chan );
|
||||
return _srcs[chan]->get_antenna( chan );
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2012 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
|
@ -62,7 +59,8 @@ private:
|
|||
// access the private constructor.
|
||||
friend OSMOSDR_API osmosdr_source_c_sptr osmosdr_make_source_c (const std::string & args);
|
||||
|
||||
rtl_source_c_sptr _src;
|
||||
size_t _nchan;
|
||||
std::vector< rtl_source_c_sptr > _srcs;
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_OSMOSDR_SOURCE_C_IMPL_H */
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2012 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
|
@ -25,6 +22,11 @@
|
|||
#define OSMOSDR_SRC_IFACE_H
|
||||
|
||||
#include <osmosdr_ranges.h>
|
||||
#include <gr_basic_block.h>
|
||||
|
||||
class osmosdr_src_iface;
|
||||
|
||||
typedef boost::shared_ptr<osmosdr_src_iface> osmosdr_src_iface_sptr;
|
||||
|
||||
/*!
|
||||
* TODO: document
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2012 Free Software Foundation, Inc.
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
|
|
Loading…
Reference in New Issue