diff options
author | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-05-07 23:02:36 +0200 |
---|---|---|
committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-05-07 23:02:36 +0200 |
commit | 9b9c5bfcf48eb44bd38888fb62aa7bd4067cc82f (patch) | |
tree | e689106ebd2aa94ebb6db27488b1b0281bf2b908 /lib/rtl_tcp | |
parent | e38dc2f42738ab3068bb03b7c44cb203e135675f (diff) |
rtl_tcp: implement frequency correction control
Diffstat (limited to 'lib/rtl_tcp')
-rw-r--r-- | lib/rtl_tcp/rtl_tcp_source_c.cc | 7 | ||||
-rw-r--r-- | lib/rtl_tcp/rtl_tcp_source_c.h | 2 | ||||
-rw-r--r-- | lib/rtl_tcp/rtl_tcp_source_f.cc | 6 | ||||
-rw-r--r-- | lib/rtl_tcp/rtl_tcp_source_f.h | 1 |
4 files changed, 14 insertions, 2 deletions
diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc index c1f2869..059e99f 100644 --- a/lib/rtl_tcp/rtl_tcp_source_c.cc +++ b/lib/rtl_tcp/rtl_tcp_source_c.cc @@ -51,6 +51,7 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) : _freq = 0; _rate = 0; _gain = 0; + _corr = 0; _auto_gain = false; dict_t dict = params_to_dict(args); @@ -162,12 +163,16 @@ double rtl_tcp_source_c::get_center_freq( size_t chan ) double rtl_tcp_source_c::set_freq_corr( double ppm, size_t chan ) { + _src->set_freq_corr( int(ppm) ); + + _corr = ppm; + return get_freq_corr( chan ); } double rtl_tcp_source_c::get_freq_corr( size_t chan ) { - return 0; + return _corr; } std::vector<std::string> rtl_tcp_source_c::get_gain_names( size_t chan ) diff --git a/lib/rtl_tcp/rtl_tcp_source_c.h b/lib/rtl_tcp/rtl_tcp_source_c.h index f5431c7..bb67027 100644 --- a/lib/rtl_tcp/rtl_tcp_source_c.h +++ b/lib/rtl_tcp/rtl_tcp_source_c.h @@ -75,7 +75,7 @@ public: std::string get_antenna( size_t chan = 0 ); private: - double _freq, _rate, _gain; + double _freq, _rate, _gain, _corr; bool _auto_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 4d962a9..6dfa6ab 100644 --- a/lib/rtl_tcp/rtl_tcp_source_f.cc +++ b/lib/rtl_tcp/rtl_tcp_source_f.cc @@ -267,3 +267,9 @@ void rtl_tcp_source_f::set_gain(int gain) struct command cmd = { 0x04, gain };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
+
+void rtl_tcp_source_f::set_freq_corr(int ppm)
+{
+ struct command cmd = { 0x05, ppm };
+ 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 1c2d265..dd994cb 100644 --- a/lib/rtl_tcp/rtl_tcp_source_f.h +++ b/lib/rtl_tcp/rtl_tcp_source_f.h @@ -94,6 +94,7 @@ private: void set_sample_rate(int sample_rate);
void set_gain_mode(int manual);
void set_gain(int gain);
+ void set_freq_corr(int ppm);
};
|