aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2013-02-18 20:43:35 +0100
committerDimitri Stolnikov <horiz0n@gmx.net>2013-02-18 20:43:35 +0100
commitede9c80455d64d0286c68ce9faaaa7da69aeefd1 (patch)
tree874e76b55f184394e1802b4c5d5c4018cf5a5278 /lib
parentfaa5123186064e3bf6b580fdc6aafcf436a47619 (diff)
rtl_tcp: add direct_samp and offset_tune args like used in rtl= target
Diffstat (limited to 'lib')
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_c.cc20
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_c.h1
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_f.cc12
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_f.h2
4 files changed, 35 insertions, 0 deletions
diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc
index eae5a13..dcedda7 100644
--- a/lib/rtl_tcp/rtl_tcp_source_c.cc
+++ b/lib/rtl_tcp/rtl_tcp_source_c.cc
@@ -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 ) {
diff --git a/lib/rtl_tcp/rtl_tcp_source_c.h b/lib/rtl_tcp/rtl_tcp_source_c.h
index c236bf1..b452e68 100644
--- a/lib/rtl_tcp/rtl_tcp_source_c.h
+++ b/lib/rtl_tcp/rtl_tcp_source_c.h
@@ -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;
diff --git a/lib/rtl_tcp/rtl_tcp_source_f.cc b/lib/rtl_tcp/rtl_tcp_source_f.cc
index 0388647..304fb29 100644
--- a/lib/rtl_tcp/rtl_tcp_source_f.cc
+++ b/lib/rtl_tcp/rtl_tcp_source_f.cc
@@ -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);
+}
diff --git a/lib/rtl_tcp/rtl_tcp_source_f.h b/lib/rtl_tcp/rtl_tcp_source_f.h
index e3dc3f6..ceae709 100644
--- a/lib/rtl_tcp/rtl_tcp_source_f.h
+++ b/lib/rtl_tcp/rtl_tcp_source_f.h
@@ -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);
};