GNU Radio's TEST Package

sink_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2013 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 INCLUDED_OSMOSDR_SINK_IMPL_H
21#define INCLUDED_OSMOSDR_SINK_IMPL_H
22
23#include "osmosdr/sink.h"
24
25#include "sink_iface.h"
26
27#include <map>
28
29 class sink_impl : public osmosdr::sink
30{
31 public:
32 sink_impl(const std::string & args);
33
34 size_t get_num_channels( void );
35
36 osmosdr::meta_range_t get_sample_rates( void );
37 double set_sample_rate( double rate );
38 double get_sample_rate( void );
39
40 osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
41 double set_center_freq( double freq, size_t chan = 0 );
42 double get_center_freq( size_t chan = 0 );
43 double set_freq_corr( double ppm, size_t chan = 0 );
44 double get_freq_corr( size_t chan = 0 );
45
46 std::vector<std::string> get_gain_names( size_t chan = 0 );
47 osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
48 osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
49 bool set_gain_mode( bool automatic, size_t chan = 0 );
50 bool get_gain_mode( size_t chan = 0 );
51 double set_gain( double gain, size_t chan = 0 );
52 double set_gain( double gain, const std::string & name, size_t chan = 0 );
53 double get_gain( size_t chan = 0 );
54 double get_gain( const std::string & name, size_t chan = 0 );
55
56 double set_if_gain( double gain, size_t chan = 0 );
57 double set_bb_gain( double gain, size_t chan = 0 );
58
59 std::vector< std::string > get_antennas( size_t chan = 0 );
60 std::string set_antenna( const std::string & antenna, size_t chan = 0 );
61 std::string get_antenna( size_t chan = 0 );
62
63 void set_dc_offset( const std::complex<double> &offset, size_t chan = 0 );
64
65 void set_iq_balance( const std::complex<double> &balance, size_t chan = 0 );
66
67 double set_bandwidth( double bandwidth, size_t chan = 0 );
68 double get_bandwidth( size_t chan = 0 );
69 osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 );
70
71 void set_time_source(const std::string &source, const size_t mboard = 0);
72 std::string get_time_source(const size_t mboard);
73 std::vector<std::string> get_time_sources(const size_t mboard);
74 void set_clock_source(const std::string &source, const size_t mboard = 0);
75 std::string get_clock_source(const size_t mboard);
76 std::vector<std::string> get_clock_sources(const size_t mboard);
77 double get_clock_rate(size_t mboard = 0);
78 void set_clock_rate(double rate, size_t mboard = 0);
79 ::osmosdr::time_spec_t get_time_now(size_t mboard = 0);
80 ::osmosdr::time_spec_t get_time_last_pps(size_t mboard = 0);
81 void set_time_now(const ::osmosdr::time_spec_t &time_spec, size_t mboard = 0);
82 void set_time_next_pps(const ::osmosdr::time_spec_t &time_spec);
83 void set_time_unknown_pps(const ::osmosdr::time_spec_t &time_spec);
84
85 private:
86 std::vector< sink_iface * > _devs;
87
88 /* cache to prevent multiple device calls with the same value coming from grc */
89 double _sample_rate;
90 std::map< size_t, double > _center_freq;
91 std::map< size_t, double > _freq_corr;
92 std::map< size_t, bool > _gain_mode;
93 std::map< size_t, double > _gain;
94 std::map< size_t, double > _if_gain;
95 std::map< size_t, double > _bb_gain;
96 std::map< size_t, std::string > _antenna;
97 std::map< size_t, double > _bandwidth;
98};
99
100#endif /* INCLUDED_OSMOSDR_SINK_IMPL_H */
osmosdr::sink
Takes a stream of complex samples.
Definition: sink.h:39
osmosdr::time_spec_t
Definition: time_spec.h:39
sink_impl
Definition: sink_impl.h:30
sink_impl::get_clock_sources
std::vector< std::string > get_clock_sources(const size_t mboard)
sink_impl::set_bandwidth
double set_bandwidth(double bandwidth, size_t chan=0)
sink_impl::get_bandwidth_range
osmosdr::freq_range_t get_bandwidth_range(size_t chan=0)
sink_impl::get_gain_mode
bool get_gain_mode(size_t chan=0)
sink_impl::get_gain
double get_gain(size_t chan=0)
sink_impl::set_time_now
void set_time_now(const ::osmosdr::time_spec_t &time_spec, size_t mboard=0)
sink_impl::get_gain
double get_gain(const std::string &name, size_t chan=0)
sink_impl::set_antenna
std::string set_antenna(const std::string &antenna, size_t chan=0)
sink_impl::get_time_now
::osmosdr::time_spec_t get_time_now(size_t mboard=0)
sink_impl::get_freq_range
osmosdr::freq_range_t get_freq_range(size_t chan=0)
sink_impl::set_time_next_pps
void set_time_next_pps(const ::osmosdr::time_spec_t &time_spec)
sink_impl::set_dc_offset
void set_dc_offset(const std::complex< double > &offset, size_t chan=0)
sink_impl::get_clock_source
std::string get_clock_source(const size_t mboard)
sink_impl::set_if_gain
double set_if_gain(double gain, size_t chan=0)
sink_impl::set_center_freq
double set_center_freq(double freq, size_t chan=0)
sink_impl::get_clock_rate
double get_clock_rate(size_t mboard=0)
sink_impl::get_time_last_pps
::osmosdr::time_spec_t get_time_last_pps(size_t mboard=0)
sink_impl::get_gain_names
std::vector< std::string > get_gain_names(size_t chan=0)
sink_impl::get_freq_corr
double get_freq_corr(size_t chan=0)
sink_impl::set_gain
double set_gain(double gain, size_t chan=0)
sink_impl::set_gain_mode
bool set_gain_mode(bool automatic, size_t chan=0)
sink_impl::get_time_source
std::string get_time_source(const size_t mboard)
sink_impl::get_antenna
std::string get_antenna(size_t chan=0)
sink_impl::get_sample_rates
osmosdr::meta_range_t get_sample_rates(void)
sink_impl::set_sample_rate
double set_sample_rate(double rate)
sink_impl::set_clock_source
void set_clock_source(const std::string &source, const size_t mboard=0)
sink_impl::get_bandwidth
double get_bandwidth(size_t chan=0)
sink_impl::get_num_channels
size_t get_num_channels(void)
sink_impl::set_time_unknown_pps
void set_time_unknown_pps(const ::osmosdr::time_spec_t &time_spec)
sink_impl::set_freq_corr
double set_freq_corr(double ppm, size_t chan=0)
sink_impl::get_time_sources
std::vector< std::string > get_time_sources(const size_t mboard)
sink_impl::set_gain
double set_gain(double gain, const std::string &name, size_t chan=0)
sink_impl::get_antennas
std::vector< std::string > get_antennas(size_t chan=0)
sink_impl::get_center_freq
double get_center_freq(size_t chan=0)
sink_impl::get_gain_range
osmosdr::gain_range_t get_gain_range(const std::string &name, size_t chan=0)
sink_impl::set_iq_balance
void set_iq_balance(const std::complex< double > &balance, size_t chan=0)
sink_impl::get_sample_rate
double get_sample_rate(void)
sink_impl::set_clock_rate
void set_clock_rate(double rate, size_t mboard=0)
sink_impl::sink_impl
sink_impl(const std::string &args)
sink_impl::get_gain_range
osmosdr::gain_range_t get_gain_range(size_t chan=0)
sink_impl::set_time_source
void set_time_source(const std::string &source, const size_t mboard=0)
sink_impl::set_bb_gain
double set_bb_gain(double gain, size_t chan=0)
sink.h
sink_iface.h
osmosdr::meta_range_t
Definition: ranges.h:75