22 #ifndef INCLUDED_SOAPY_SINK_IMPL_H 23 #define INCLUDED_SOAPY_SINK_IMPL_H 26 #include <boost/bind.hpp> 27 #include <boost/thread/mutex.hpp> 29 #include <SoapySDR/Version.hpp> 30 #include <SoapySDR/Modules.hpp> 31 #include <SoapySDR/Registry.hpp> 32 #include <SoapySDR/Device.hpp> 45 SoapySDR::Device *d_device;
46 SoapySDR::Stream *d_stream;
49 pmt::pmt_t d_message_port;
53 double d_sampling_rate;
55 std::string d_antenna;
57 gr_complex d_dc_offset;
58 bool d_dc_offset_auto_mode;
59 bool d_gain_auto_mode;
60 double d_frequency_correction;
61 gr_complex d_iq_balance;
63 std::string d_clock_source;
64 std::string d_frontend_mapping;
68 const pmt::pmt_t d_length_tag_key;
69 long d_burst_remaining;
71 virtual bool is_gain_valid(
size_t channel, std::string gainType);
73 void register_msg_cmd_handler(
const pmt::pmt_t &cmd,
cmd_handler_t handler);
74 std::map<pmt::pmt_t, cmd_handler_t> d_cmd_handlers;
76 inline io_signature::sptr
77 args_to_io_sig(
const std::string type,
size_t nchan)
86 return io_signature::make(nchan, nchan, size);
89 void tag_work(
int noutput_items);
92 sink_impl(
size_t nchan,
const std::string &device,
93 const std::string &args,
double sampling_rate,
94 const std::string &type,
95 const std::string &length_tag_name);
102 int work(
int noutput_items,
103 gr_vector_const_void_star &input_items,
104 gr_vector_void_star &output_items);
106 virtual std::vector<std::string>
listAntennas(
int channel);
127 void set_frequency(
size_t channel,
const std::string &name,
double frequency);
140 void set_gain(
size_t channel,
float gain);
148 void set_gain(
size_t channel,
const std::string name,
float gain);
177 void set_antenna(
size_t channel,
const std::string &name);
189 bool dc_offset_auto_mode);
virtual bool DC_offset_support(int channel)
sink_impl(size_t nchan, const std::string &device, const std::string &args, double sampling_rate, const std::string &type, const std::string &length_tag_name)
std::complex< double > get_dc_offset(size_t channel)
double get_sampling_rate(size_t channel)
void cmd_handler_samp_rate(pmt::pmt_t val, size_t chann)
void set_dc_offset_mode(size_t channel, bool dc_offset_auto_mode)
double get_frequency(size_t channel)
void msg_handler_command(pmt::pmt_t msg)
virtual bool freq_correction_support(int channel)
void set_frequency(size_t channel, double frequency)
void set_clock_source(const std::string &clock_source)
std::complex< double > get_iq_balance(size_t channel)
virtual bool IQ_balance_support(int channel)
void set_antenna(size_t channel, const std::string &name)
double get_master_clock_rate()
void set_bandwidth(size_t channel, double bandwidth)
void set_dc_offset(size_t channel, gr_complexd dc_offset, bool dc_offset_auto_mode)
bool get_gain_mode(size_t channel)
double get_gain(size_t channel)
void set_gain(size_t channel, float gain)
std::string get_antenna(size_t channel)
bool get_dc_offset_mode(size_t channel)
void set_gain_mode(size_t channel, bool gain_auto_mode)
void set_master_clock_rate(double clock_rate)
double get_bandwidth(size_t channel)
void cmd_handler_antenna(pmt::pmt_t val, size_t chann)
void set_sample_rate(size_t channel, double sample_rate)
void set_frequency_correction(size_t channel, double freq_correction)
void set_iq_balance(size_t channel, gr_complexd iq_balance)
void cmd_handler_bw(pmt::pmt_t val, size_t chann)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
double get_frequency_correction(size_t channel)
std::string get_clock_source()
void set_frontend_mapping(const std::string &frontend_mapping)
boost::function< void(pmt::pmt_t, size_t)> cmd_handler_t
Definition: sink_impl.h:34
Sink block implementation for SDR devices.
Definition: sink_impl.h:43
virtual std::vector< std::string > listAntennas(int channel)
void cmd_handler_frequency(pmt::pmt_t val, size_t chann)
void cmd_handler_gain(pmt::pmt_t val, size_t chann)