rtl_tcp: add direct_samp and offset_tune args like used in rtl= target

gr3.6
Dimitri Stolnikov 10 years ago
parent faa5123186
commit ede9c80455
  1. 2
      grc/gen_osmosdr_blocks.py
  2. 20
      lib/rtl_tcp/rtl_tcp_source_c.cc
  3. 1
      lib/rtl_tcp/rtl_tcp_source_c.h
  4. 12
      lib/rtl_tcp/rtl_tcp_source_f.cc
  5. 2
      lib/rtl_tcp/rtl_tcp_source_f.h

@ -132,7 +132,7 @@ Lines ending with ... mean it's possible to bind devices together by specifying
rtl=0[,rtl_xtal=28.8e6][,tuner_xtal=28.8e6] ...
rtl=1[,buffers=32][,buflen=N*512] ...
rtl=2[,direct_samp=0|1|2][,offset_tune=0|1] ...
rtl_tcp=127.0.0.1:1234[,psize=16384] ...
rtl_tcp=127.0.0.1:1234[,psize=16384][,direct_samp=0|1|2][,offset_tune=0|1] ...
uhd[,serial=...][,lo_offset=0][,mcr=52e6][,nchan=2][,subdev='\\\\'B:0 A:0\\\\''] ...
osmosdr=0[,mcr=64e6][,nchan=5][,buffers=32][,buflen=N*512] ...
file='/path/to/your file',rate=1e6[,freq=100e6][,repeat=true][,throttle=true] ...

@ -60,12 +60,14 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
gr_hier_block2("rtl_tcp_source_c",
gr_make_io_signature (0, 0, 0),
gr_make_io_signature (1, 1, sizeof (gr_complex))),
_no_tuner(false),
_auto_gain(false),
_if_gain(0)
{
std::string host = "127.0.0.1";
unsigned short port = 1234;
int payload_size = 16384;
unsigned int direct_samp = 0, offset_tune = 0;
_freq = 0;
_rate = 0;
@ -88,6 +90,12 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
if (dict.count("psize"))
payload_size = boost::lexical_cast< int >( dict["psize"] );
if (dict.count("direct_samp"))
direct_samp = boost::lexical_cast< unsigned int >( dict["direct_samp"] );
if (dict.count("offset_tune"))
offset_tune = boost::lexical_cast< unsigned int >( dict["offset_tune"] );
if (!host.length())
host = "127.0.0.1";
@ -111,6 +119,13 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
set_gain_mode(false); /* enable manual gain mode by default */
_src->set_direct_sampling(direct_samp);
if (direct_samp) {
_no_tuner = true;
}
_src->set_offset_tuning(offset_tune);
/* rtl tcp source provides a stream of interleaved IQ floats */
gr_deinterleave_sptr deinterleave = gr_make_deinterleave(sizeof(float));
@ -186,6 +201,11 @@ osmosdr::freq_range_t rtl_tcp_source_c::get_freq_range( size_t chan )
{
osmosdr::freq_range_t range;
if (_no_tuner) {
range += osmosdr::range_t( 0, double(28.8e6) ); // as far as we know
return range;
}
enum rtlsdr_tuner tuner = _src->get_tuner_type();
if ( tuner == RTLSDR_TUNER_E4000 ) {

@ -78,6 +78,7 @@ public:
private:
double _freq, _rate, _gain, _corr;
bool _no_tuner;
bool _auto_gain;
double _if_gain;
rtl_tcp_source_f_sptr _src;

@ -314,3 +314,15 @@ void rtl_tcp_source_f::set_agc_mode(int on)
struct command cmd = { 0x08, htonl(on) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_direct_sampling(int on)
{
struct command cmd = { 0x09, htonl(on) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_offset_tuning(int on)
{
struct command cmd = { 0x0a, htonl(on) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}

@ -113,6 +113,8 @@ public:
void set_freq_corr(int ppm);
void set_if_gain(int stage, int gain);
void set_agc_mode(int on);
void set_direct_sampling(int on);
void set_offset_tuning(int on);
};

Loading…
Cancel
Save