27 #include <libconfig.h++>
28 #include "srsran/srsran.h"
44 explicit SdrReader(
const libconfig::Config &
cfg,
size_t rx_channels)
60 bool init(
const std::string &device_args,
const char *sample_file,
const char *write_sample_file);
90 int get_samples(cf_t *data[SRSRAN_MAX_CHANNELS], uint32_t nsamples, srsran_timestamp_t *rx_time);
161 std::unique_ptr<MultichannelRingbuffer>
_buffer;
Interface to the SDR stick.
double get_frequency()
Get current center frequency.
void stop()
Stop reading samples from the SDR.
const libconfig::Config & _cfg
void start()
Start reading samples from the SDR.
double get_buffer_level()
Get current ringbuffer level (0 = empty .
bool _high_watermark_reached
std::string _temp_sensor_key
bool init(const std::string &device_args, const char *sample_file, const char *write_sample_file)
Initializes the SDR interface and creates a ring buffer according to the params from Cfg.
void disableSampleFileWriting()
If sample file creation is enabled, writing samples stops after this call.
SdrReader(const libconfig::Config &cfg, size_t rx_channels)
Default constructor.
void enumerateDevices()
Prints a list of all available SDR devices.
std::thread _readerThread
int get_samples(cf_t *data[SRSRAN_MAX_CHANNELS], uint32_t nsamples, srsran_timestamp_t *rx_time)
Store nsamples count samples into the buffer at data.
unsigned get_filter_bw()
Get current filter bandwidth.
std::string get_antenna()
Get current antenna port.
srsran_filesource_t file_source
bool set_gain(bool use_agc, double gain, uint8_t idx)
uint32_t rssi()
Get RSSI estimate (disabled at the moment)
srsran_filesink_t file_sink
void clear_buffer()
Clear all samples from the rx buffers.
std::map< std::string, std::string > _device_args
bool set_sample_rate(uint32_t rate, uint8_t idx)
bool set_antenna(const std::string &antenna, uint8_t idx)
bool tune(uint32_t frequency, uint32_t sample_rate, uint32_t bandwidth, double gain, const std::string &antenna, bool use_agc)
Tune the SDR to the desired frequency, and set gain, filter and antenna parameters.
std::unique_ptr< MultichannelRingbuffer > _buffer
bool set_filter_bw(uint32_t bandwidth, uint8_t idx)
virtual ~SdrReader()
Default destructor.
std::chrono::steady_clock::time_point _last_read
void enableSampleFileWriting()
If sample file creation is enabled, writing samples starts after this call.
double get_gain()
Get current gain.
bool _temp_sensor_available
bool set_frequency(uint32_t frequency, uint8_t idx)
double get_sample_rate()
Get current sample rate.
static Config cfg
Global configuration object.
static std::string antenna
Antenna input to be used.
static unsigned sample_rate
Sample rate of the SDR.
static uint32_t bandwidth
Low pass filter bandwidth for the SDR.
static unsigned frequency
Center freqeuncy the SDR is tuned to.
static double gain
Overall system gain for the SDR.