Exemple #1
0
	uhdInput::uhdInput (QSettings *s, bool *success ) {
	this	-> uhdSettings	= s;
	this	-> myFrame	= new QFrame (NULL);
	setupUi (this	-> myFrame);
	this	-> myFrame	-> show ();
	this	-> inputRate	= Khz (2048);
	this	-> ringbufferSize	= 1024;	// blocks of 1024 complexes
	this	-> theBuffer	= NULL;	// also indicates good init or not
	*success		= false;
	lastFrequency		= 100000;
	m_workerHandle		= 0;
//	create a usrp device.
	std::string args;
	std::cout << std::endl;
	std::cout << boost::format("Creating the usrp device with: %s...") % args << std::endl;
	try {
	   m_usrp = uhd::usrp::multi_usrp::make (args);
//	Lock mboard clocks

	   std::string ref("internal");
	   m_usrp -> set_clock_source (ref);

	   std::cout << boost::format("Using Device: %s") % m_usrp->get_pp_string() << std::endl;
//	set sample rate
	   m_usrp -> set_rx_rate (inputRate);
	   inputRate = m_usrp -> get_rx_rate ();
	   std::cout << boost::format("Actual RX Rate: %f Msps...") % (inputRate/1e6) << std::endl << std::endl;

//	allocate the rx buffer
	   theBuffer	= new RingBuffer<std::complex<float> >(ringbufferSize * 1024);
	}
	catch (...) {
	   fprintf (stderr, "No luck with uhd\n");
	   return;
	}
//	some housekeeping for the local frame
	externalGain		-> setMaximum (maxGain ());
	uhdSettings		-> beginGroup ("uhdSettings");
	externalGain 		-> setValue (
	            uhdSettings -> value ("externalGain", 40). toInt ());
	f_correction		-> setValue (
	            uhdSettings -> value ("f_correction", 0). toInt ());
	KhzOffset		-> setValue (
	            uhdSettings -> value ("KhzOffset", 0). toInt ());
	uhdSettings	-> endGroup ();

	setExternalGain	(externalGain	-> value ());
	set_KhzOffset	(KhzOffset	-> value ());
	connect (externalGain, SIGNAL (valueChanged (int)),
	         this, SLOT (setExternalGain (int)));
	connect (KhzOffset, SIGNAL (valueChanged (int)),
	         this, SLOT (set_KhzOffset (int)));
	*success 		= true;
}
Exemple #2
0
	sdrplay::sdrplay  (QSettings *s, bool *success) {
int	err;
float	ver;

	sdrplaySettings		= s;
	this	-> myFrame	= new QFrame (NULL);
	setupUi (this -> myFrame);
	this	-> myFrame	-> show ();
	this	-> inputRate	= Khz (2048);
	this	-> bandWidth	= Khz (1536);

	*success		= false;
	_I_Buffer	= NULL;
	theLoader	= NULL;

	theLoader	= new sdrplayLoader (success);
	if (!(*success)) {
	   fprintf (stderr, " No success in loading sdrplay lib\n");
	   delete theLoader;
	   theLoader = NULL;
	   return;
	}

	err			= theLoader -> my_mir_sdr_ApiVersion (&ver);
//	if (ver != MIR_SDR_API_VERSION) {
//	   fprintf (stderr, "Foute API: %f, %d\n", ver, err);
//	   statusLabel	-> setText ("mirics error");
//	   return NULL;
//	}

	_I_Buffer	= new RingBuffer<int16_t>(2 * 1024 * 1024);
	vfoFrequency	= Khz (94700);
	currentGain	= DEFAULT_GAIN;
	vfoOffset	= 0;
	theWorker	= NULL;

	sdrplaySettings		-> beginGroup ("sdrplaySettings");
	externalGain 		-> setValue (
	            sdrplaySettings -> value ("externalGain", 10). toInt ());
	f_correction		-> setValue (
	            sdrplaySettings -> value ("f_correction", 0). toInt ());
	KhzOffset		-> setValue (
	            sdrplaySettings -> value ("KhzOffset", 0). toInt ());
	sdrplaySettings	-> endGroup ();

	setExternalGain	(externalGain	-> value ());
	set_KhzOffset	(KhzOffset	-> value ());
	connect (externalGain, SIGNAL (valueChanged (int)),
	         this, SLOT (setExternalGain (int)));
	connect (KhzOffset, SIGNAL (valueChanged (int)),
	         this, SLOT (set_KhzOffset (int)));
	*success	= true;
}