32 #include <uhd/utils/safe_main.hpp> 33 #include <uhd/utils/thread_priority.hpp> 34 #include <uhd/usrp/multi_usrp.hpp> 36 #include <sys/types.h> 56 uhd::stream_args_t stream_args(
"fc32",
"sc16");
57 std::vector<size_t> channel_nums;
58 channel_nums.push_back(0);
59 stream_args.channels = channel_nums;
62 usrp->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
85 rf_dumpfile.open(
"RFDump.dat", std::ios::out | std::ios::binary);
86 if_dumpfile.open(
"IFDump.dat", std::ios::out | std::ios::binary);
90 static void doFFTandDump(
int fd, std::complex<float> * in,
int len) __attribute__ ((unused));
92 static void doFFTandDump(
int fd, std::complex<float> * in,
int len)
94 std::complex<float> out[len];
96 fftwf_plan tplan = fftwf_plan_dft_1d(len, (fftwf_complex*) in, (fftwf_complex*) out,
97 FFTW_FORWARD, FFTW_ESTIMATE | FFTW_UNALIGNED);
100 write(fd, out,
sizeof(std::complex<float>) * len);
101 fftwf_destroy_plan(tplan);
106 uhd::set_thread_priority_safe();
111 bool exitflag =
false;
130 if(buf == NULL)
throw(
new SoDa::SoDaException(
"USRPRX couldn't allocate SoDaBuf object",
this));
134 unsigned int coll_so_far = 0;
135 uhd::rx_metadata_t md;
138 unsigned int got =
rx_bits->recv(&(dbuf[coll_so_far]), left, md);
140 debugMsg(
"****************************************");
141 debugMsg(boost::format(
"RECV got error -- md = [%s]\n") % md.to_pp_string());
142 debugMsg(
"****************************************");
160 if(if_buf->
copy(buf)) {
164 throw new SoDaException(
"SoDaBuf Copy for IF stream failed",
this);
190 std::complex<float> o;
203 debugMsg(boost::format(
"Changed 3rdLO to freq = %g\n") % IF_tuning);
228 usrp->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS, 0);
236 usrp->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS, 0);
257 debugMsg(
"In TX ON -- stream continues");
262 debugMsg(
"In TX ON -- stopped stream");
270 debugMsg(
"In TX OFF -- restart stream");
void execCommand(Command *cmd)
void setPhaseIncr(double _pi)
set the phase increment per step for the oscillator (1/freq)
The Thread baseclass for all SoDa thread objects.
void doMixer(SoDaBuf *inout)
implement a complex down converter with complex multiplication
void debugMsg(const std::string &msg, unsigned int threshold=1)
USRPRX(Params *params, uhd::usrp::multi_usrp::sptr usrp, DatMBox *_rx_stream, DatMBox *_if_stream, CmdMBox *_cmd_stream)
The constructor.
turn transmitter on and off.
T * get(unsigned int subscriber_id)
QuadratureOscillator IF_osc
Set the modulation mode for the receive chain.
int iparms[4]
integer parameters
std::ofstream if_dumpfile
This class handles command line parameters and built-ins.
The SoDa Exception class.
void execGetCommand(Command *cmd)
optional method to handle "GET" commands – commands that request a response
uhd::rx_streamer::sptr rx_bits
unsigned int rx_buffer_size
CmdTarget target
the thing we're touching
SoDa::Command::ModulationType rx_modulation
std::complex< float > stepOscCF()
step the oscillator and produce a complex float result
bool audio_rx_stream_enabled
unsigned int getComplexMaxLen()
Return the maximum number of complex float values that this buffer can hold.
double getRXRate() const
Sample rates and all that other stuff are fixed.
void run()
USRPRX is a thread – this is its run loop.
uhd::usrp::multi_usrp::sptr usrp
unsigned int getRFBufferSize() const
On receipt of a STOP command, all threads should exit their run loop.
std::complex< float > * getComplexBuf()
Return a pointer to the storage buffer of complex floats.
This is a list of all the commands that can "do something" to one or more components in the SoDa radi...
bool enable_spectrum_report
ModulationType
modulation selector targets take one of these values
void execRepCommand(Command *cmd)
optional method that reports status or the result of some action.
std::ofstream rf_dumpfile
CmdType cmd
the command type (SET, GET, REP)
double dparms[4]
double float parameters
Tune the 3rd LO (in SoDa::USRPRX).
void set3rdLOFreq(double IF_tuning)
void execSetCommand(Command *cmd)
optional method to handle "SET" commands – commands that set internal state in the object...
static void doFFTandDump(int fd, std::complex< float > *in, int len) __attribute__((unused))