GNU Radio's TEST Package

rtl_tcp_source_c.h
Go to the documentation of this file.
1/* -*- mode: c++; c-basic-offset: 2 -*- */
2/*
3 * Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
4 *
5 * GNU Radio is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * GNU Radio is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Radio; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20#ifndef RTL_TCP_SOURCE_C_H
21#define RTL_TCP_SOURCE_C_H
22
23#include <gnuradio/sync_block.h>
24
25#include "source_iface.h"
26
27 class rtl_tcp_source_c;
28
29 typedef std::shared_ptr< rtl_tcp_source_c > rtl_tcp_source_c_sptr;
30
31rtl_tcp_source_c_sptr make_rtl_tcp_source_c( const std::string & args = "" );
32
33 class rtl_tcp_source_c :
34 public gr::sync_block,
35 public source_iface
36{
37 private:
38 /* copied from rtl sdr */
39 enum rtlsdr_tuner {
40 RTLSDR_TUNER_UNKNOWN = 0,
41 RTLSDR_TUNER_E4000,
42 RTLSDR_TUNER_FC0012,
43 RTLSDR_TUNER_FC0013,
44 RTLSDR_TUNER_FC2580,
45 RTLSDR_TUNER_R820T,
46 RTLSDR_TUNER_R828D
47 };
48
49 friend rtl_tcp_source_c_sptr make_rtl_tcp_source_c(const std::string &args);
50
51 rtl_tcp_source_c(const std::string &args);
52 const char * get_tuner_name(void);
53
54 public:
55 ~rtl_tcp_source_c();
56
57 int work(int noutput_items,
58 gr_vector_const_void_star &input_items,
59 gr_vector_void_star &output_items);
60
61 std::string name();
62
63 static std::vector< std::string > get_devices( bool fake = false );
64
65 size_t get_num_channels( void );
66
67 osmosdr::meta_range_t get_sample_rates( void );
68 double set_sample_rate( double rate );
69 double get_sample_rate( void );
70
71 osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
72 double set_center_freq( double freq, size_t chan = 0 );
73 double get_center_freq( size_t chan = 0 );
74 double set_freq_corr( double ppm, size_t chan = 0 );
75 double get_freq_corr( size_t chan = 0 );
76
77 std::vector<std::string> get_gain_names( size_t chan = 0 );
78 osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
79 osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
80 bool set_gain_mode( bool automatic, size_t chan = 0 );
81 bool get_gain_mode( size_t chan = 0 );
82 double set_gain( double gain, size_t chan = 0 );
83 double set_gain( double gain, const std::string & name, size_t chan = 0 );
84 double get_gain( size_t chan = 0 );
85 double get_gain( const std::string & name, size_t chan = 0 );
86
87 double set_if_gain( double gain, size_t chan = 0 );
88
89 std::vector< std::string > get_antennas( size_t chan = 0 );
90 std::string set_antenna( const std::string & antenna, size_t chan = 0 );
91 std::string get_antenna( size_t chan = 0 );
92
93 private:
94 int d_socket; // handle to socket
95 double _freq, _rate, _gain, _corr;
96 bool _no_tuner;
97 bool _auto_gain;
98 double _if_gain;
99
100 enum rtlsdr_tuner d_tuner_type;
101 unsigned int d_tuner_gain_count;
102 unsigned int d_tuner_if_gain_count;
103 unsigned char *d_temp_buff; // hold buffer between calls
104 float *d_LUT;
105};
106
107#endif // RTL_TCP_SOURCE_C_H
rtl_tcp_source_c
Definition: rtl_tcp_source_c.h:36
rtl_tcp_source_c::get_gain
double get_gain(const std::string &name, size_t chan=0)
rtl_tcp_source_c::set_gain
double set_gain(double gain, const std::string &name, size_t chan=0)
rtl_tcp_source_c::name
std::string name()
rtl_tcp_source_c::get_freq_range
osmosdr::freq_range_t get_freq_range(size_t chan=0)
rtl_tcp_source_c::get_gain_range
osmosdr::gain_range_t get_gain_range(size_t chan=0)
rtl_tcp_source_c::get_gain_mode
bool get_gain_mode(size_t chan=0)
rtl_tcp_source_c::get_devices
static std::vector< std::string > get_devices(bool fake=false)
rtl_tcp_source_c::set_if_gain
double set_if_gain(double gain, size_t chan=0)
rtl_tcp_source_c::get_sample_rate
double get_sample_rate(void)
rtl_tcp_source_c::get_num_channels
size_t get_num_channels(void)
rtl_tcp_source_c::set_center_freq
double set_center_freq(double freq, size_t chan=0)
rtl_tcp_source_c::make_rtl_tcp_source_c
friend rtl_tcp_source_c_sptr make_rtl_tcp_source_c(const std::string &args)
rtl_tcp_source_c::~rtl_tcp_source_c
~rtl_tcp_source_c()
rtl_tcp_source_c::set_gain
double set_gain(double gain, size_t chan=0)
rtl_tcp_source_c::work
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
rtl_tcp_source_c::set_sample_rate
double set_sample_rate(double rate)
rtl_tcp_source_c::get_antenna
std::string get_antenna(size_t chan=0)
rtl_tcp_source_c::get_antennas
std::vector< std::string > get_antennas(size_t chan=0)
rtl_tcp_source_c::get_gain_range
osmosdr::gain_range_t get_gain_range(const std::string &name, size_t chan=0)
rtl_tcp_source_c::get_freq_corr
double get_freq_corr(size_t chan=0)
rtl_tcp_source_c::set_gain_mode
bool set_gain_mode(bool automatic, size_t chan=0)
rtl_tcp_source_c::get_center_freq
double get_center_freq(size_t chan=0)
rtl_tcp_source_c::set_freq_corr
double set_freq_corr(double ppm, size_t chan=0)
rtl_tcp_source_c::set_antenna
std::string set_antenna(const std::string &antenna, size_t chan=0)
rtl_tcp_source_c::get_gain_names
std::vector< std::string > get_gain_names(size_t chan=0)
rtl_tcp_source_c::get_sample_rates
osmosdr::meta_range_t get_sample_rates(void)
rtl_tcp_source_c::get_gain
double get_gain(size_t chan=0)
source_iface
Definition: source_iface.h:33
make_rtl_tcp_source_c
rtl_tcp_source_c_sptr make_rtl_tcp_source_c(const std::string &args="")
source_iface.h
osmosdr::meta_range_t
Definition: ranges.h:75