Пример #1
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;
}
Пример #2
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;
}
Пример #3
0
bool	fileReader::createPluginWindow	(int32_t rate,
	                                 QFrame  *myFrame,
	                                 QSettings *s) {
	(void)rate;
	this	-> myFrame	= myFrame;
	this	-> rate		= 96000;	// default
	(void)s;
	setupUi		(myFrame);
	myReader	= NULL;
	nameofFile	-> setText (QString ("no file"));
	this	-> rate	= setup_Device	();
	rateDisplay	-> display (this -> rate);
	this	-> lastFrequency	= Khz (14070);
	connect (resetButton, SIGNAL (clicked (void)),
	         this, SLOT (reset (void)));
	connect (progressBar, SIGNAL (sliderMoved (int)),
	         this, SLOT (handle_progressBar (int)));
	return true;
}
Пример #4
0
int32_t	virtualInput::defaultFrequency	(void) {
	return Khz (94700);
}
Пример #5
0
//
//	vfoOffset is in Hz, we have two spinboxes influencing the
//	settings
void	dabStick::setKhzOffset	(int k) {
	vfoOffset	= (vfoOffset / 1000) + Khz (k);
}
Пример #6
0
void	dabStick::set_KhzOffset	(int32_t o) {
	vfoOffset	= Khz (o);
	(void)(this -> rtlsdr_set_center_freq (device, lastFrequency + vfoOffset));
}
Пример #7
0
void	airspyHandler::set_rateSelector (const QString &s) {
int32_t v	= s. toInt ();

	setExternalRate (Khz (v));
	set_changeRate (Khz (v));
}
Пример #8
0
int32_t	airspyHandler::defaultFrequency (void) {
	return Khz (94700);
}
Пример #9
0
bool	airspyHandler::legalFrequency (int32_t f) {
	return Khz (24000) <= f && f <= Khz (1750000);
}
Пример #10
0
//	Currently, we do not have lots of settings,
//	it just might change suddenly, but not today
	eladHandler::eladHandler (QSettings *s, bool full, bool *success) {
int16_t	retValue;

	this	-> eladSettings	= s;
	*success		= false;
	deviceOK		= false;
	myFrame			= new QFrame (NULL);
	setupUi (myFrame);
	this	-> myFrame	-> show ();
	_I_Buffer		= NULL;
	theLoader		= NULL;
	theWorker		= NULL;
	conversionNumber	= 2;
	eladSettings -> beginGroup ("sw-elad-s1");
	theRate			=
	             eladSettings -> value ("elad-rate", 384000). toInt ();
	vfoOffset			=
	             eladSettings -> value ("elad-offset", 0). toInt ();
	theRate			= validRate (theRate);
	rateDisplay	-> display (theRate);
	attenuation		=
	             eladSettings -> value ("elad-attenuation", 100). toInt ();
	eladSettings	-> endGroup ();
	attenuationDisplay	-> display (attenuation);
	conversionNumber	= theRate == 192000 ? 1:
	                          theRate <= 3072000 ? 2 : 3;
	iqSize			= conversionNumber == 3 ? 4 : 8;

//
//	sometimes problems with dynamic linkage of libusb, it is
//	loaded indirectly through the dll
	if (libusb_init (NULL) < 0) {
	   fprintf (stderr, "libusb problem\n");	// should not happen
	   return;
	}
	libusb_exit (NULL);

	theLoader	= new eladLoader (theRate, &retValue);
	if (retValue != 0) {
	   if (retValue == -1)
	   QMessageBox::warning (myFrame, tr ("sdr"),
	                         tr ("No success in loading libs\n"));
	   else
	   if (retValue == -2)
	   QMessageBox::warning (myFrame, tr ("sdr"),
	                         tr ("No success in setting up USB\n"));
	   else
	   if (retValue == -3)
	   QMessageBox::warning (myFrame, tr ("sdr"),
	                         tr ("No success in FPGA init\n"));
	   else
	   if (retValue == -4)
	   QMessageBox::warning (myFrame, tr ("sdr"),
	                         tr ("No success in hardware init\n"));
	
	   statusLabel -> setText ("not functioning");
	   delete theLoader;
	   theLoader	= NULL;
	   return;
	}
//
//	Note (10.10.2014: 
//	It turns out that the elad provides for 32 bit samples
//	packed as bytes
	statusLabel	-> setText ("Loaded");
	deviceOK	= true;
	_I_Buffer	= new RingBuffer<uint8_t>(2 * IQ_SIZE * 32768);
	vfoFrequency	= Khz (94700);
//
//	since localFilter and gainReduced are also used as
//	parameter for the API functions, they are int's rather
//	than bool.
	localFilter	= 0;
	filterText	-> setText ("no filter");
	gainReduced	= 0;
	gainLabel	-> setText ("0");
	connect (MHzOffset, SIGNAL (valueChanged (int)),
	         this, SLOT (setMHzOffset (int)));
	connect (gainReduction, SIGNAL (clicked (void)),
	         this, SLOT (setGainReduction (void)));
	connect (filter, SIGNAL (clicked (void)),
	         this, SLOT (setFilter (void)));
	connect (attenuationSlider, SIGNAL (valueChanged (int)),
	         this, SLOT (set_attenuation (int)));
	*success	= true;
}
Пример #11
0
int32_t	eladHandler::defaultFrequency	(void) {
	return Khz (14070);
}
Пример #12
0
bool	eladHandler::legalFrequency (int32_t f) {
	return Khz (100) < f && f < Mhz (30);
}
Пример #13
0
int32_t	cardReader::defaultFrequency	(void) {
	return Khz (14070);
}
Пример #14
0
void	sdrplay::set_KhzOffset		(int o) {
	vfoOffset	= Khz (o);
}
Пример #15
0
int32_t	sdrplay::defaultFrequency	(void) {
	return Khz (94700);
}