Exemplo n.º 1
0
/////////////////////////////////////////////////////////////////////
// Setup Demod parameters and clamp to limits
/////////////////////////////////////////////////////////////////////
void MainWindow::SetupDemod(int index)
{
	m_DemodMode = index;
	ui->framePlot->SetDemodRanges(
			m_DemodSettings[m_DemodMode].LowCutmin,
			m_DemodSettings[m_DemodMode].LowCutmax,
			m_DemodSettings[m_DemodMode].HiCutmin,
			m_DemodSettings[m_DemodMode].HiCutmax,
			m_DemodSettings[m_DemodMode].Symetric);
	//Clamp cutoff freqs to range of particular demod
	if(m_DemodSettings[index].LowCut < m_DemodSettings[index].LowCutmin)
		m_DemodSettings[index].LowCut = m_DemodSettings[index].LowCutmin;
	if(m_DemodSettings[index].LowCut > m_DemodSettings[index].LowCutmax)
		m_DemodSettings[index].LowCut = m_DemodSettings[index].LowCutmax;

	if(m_DemodSettings[index].HiCut < m_DemodSettings[index].HiCutmin)
		m_DemodSettings[index].HiCut = m_DemodSettings[index].HiCutmin;
	if(m_DemodSettings[index].HiCut > m_DemodSettings[index].HiCutmax)
		m_DemodSettings[index].HiCut = m_DemodSettings[index].HiCutmax;

	ui->framePlot->SetHiLowCutFrequencies(m_DemodSettings[m_DemodMode].LowCut,
										  m_DemodSettings[m_DemodMode].HiCut);
	ui->framePlot->SetFilterClickResolution(m_DemodSettings[m_DemodMode].FilterClickResolution);
	ui->framePlot->UpdateOverlay();
	m_pSdrInterface->SetDemod(m_DemodMode, m_DemodSettings[m_DemodMode]);
	m_pSdrInterface->SetDemodFreq(m_CenterFrequency - m_DemodFrequency);
	UpdateInfoBox();
}
Exemplo n.º 2
0
// This is called just after the constructor when your object has been created.  Construct has set
// up your object here so it is safe to make runtime calls.
void ExtObject::OnCreate()
{
	// Load the edittime data that was serialized.
	bin ar;
	ar.attach(info.editObject->eData, info.editObject->eSize);

	// Read the data.  Same format as you exported in EditExt::Serialize.
	// Your runtime loader must be able to load all versions!
	int Version = 0;
	ar >> Version;

	// Finished reading data
	ar.detach();

	// Height is line width
	float angle = cr::to_radians(info.editObject->eAngle);
	float length = info.editObject->eWidth;
	line_width = info.editObject->eHeight;

	start.x = info.editObject->eX;
	start.y = info.editObject->eY;
	start.z = 0;

	end.x = start.x + cos(angle) * length;
	end.y = start.y + sin(angle) * length;
	end.z = 0;

	UpdateInfoBox();

	// Box collisions
	info.collMode = COLLISIONMODE_ANGLED_BOX;

	info.angle = info.editObject->eAngle;
	info.pInfo->filter = info.editObject->eColor;

	SetupPrivateVariableVector(pRuntime, this, privateVars);

	// Update bounding box
	pRuntime->UpdateBoundingBox(this);
}
Exemplo n.º 3
0
void MainWindow::OnNewHighCutFreq(int freq)
{
	m_DemodSettings[m_DemodMode].HiCut = freq;
	UpdateInfoBox();
	m_pSdrInterface->SetDemod(m_DemodMode, m_DemodSettings[m_DemodMode]);
}
Exemplo n.º 4
0
/////////////////////////////////////////////////////////////////////
// Constructor/Destructor
/////////////////////////////////////////////////////////////////////
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
	ui->setupUi(this);
	setWindowTitle(PROGRAM_TITLE_VERSION);

	//create SDR interface class
	m_pSdrInterface = new CSdrInterface;
	//give GUI plotter access to the sdr interface object
	ui->framePlot->SetSdrInterface(m_pSdrInterface);

	//create the global Testbench object
	if(!g_pTestBench)
		g_pTestBench = new CTestBench(this);

	readSettings();		//read persistent settings

	ui->actionAlwaysOnTop->setChecked(m_AlwaysOnTop);
	AlwaysOnTop();

	//create Demod setup menu for non-modal use(can leave up and still access rest of program)
	m_pDemodSetupDlg = new CDemodSetupDlg(this);

	m_pTimer = new QTimer(this);

	//connect a bunch of signals to the GUI objects
	connect(m_pTimer, SIGNAL(timeout()), this, SLOT(OnTimer()));

	connect(ui->frameFreqCtrl, SIGNAL(NewFrequency(qint64)), this, SLOT(OnNewCenterFrequency(qint64)));
	connect(ui->frameDemodFreqCtrl, SIGNAL(NewFrequency(qint64)), this, SLOT(OnNewDemodFrequency(qint64)));

	connect(m_pSdrInterface, SIGNAL(NewStatus(int)), this,  SLOT( OnStatus(int) ) );
	connect(m_pSdrInterface, SIGNAL(NewInfoData()), this,  SLOT( OnNewInfoData() ) );
	connect(m_pSdrInterface, SIGNAL(NewFftData()), this,  SLOT( OnNewFftData() ) );

	connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(OnExit()));
	connect(ui->actionNetwork, SIGNAL(triggered()), this, SLOT(OnNetworkDlg()));
	connect(ui->actionSoundCard, SIGNAL(triggered()), this, SLOT(OnSoundCardDlg()));
	connect(ui->actionSDR, SIGNAL(triggered()), this, SLOT(OnSdrDlg()));
	connect(ui->actionDisplay, SIGNAL(triggered()), this, SLOT(OnDisplayDlg()));
	connect(ui->actionAlwaysOnTop, SIGNAL(triggered()), this, SLOT(AlwaysOnTop()));
	connect(ui->actionDemod_Setup, SIGNAL(triggered()), this, SLOT(OnDemodDlg()));
	connect(ui->actionNoise_Processing, SIGNAL(triggered()), this, SLOT(OnNoiseProcDlg()));

	connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(OnAbout()));

	connect(ui->framePlot, SIGNAL(NewDemodFreq(qint64)), this,  SLOT( OnNewScreenDemodFreq(qint64) ) );
	connect(ui->framePlot, SIGNAL(NewCenterFreq(qint64)), this,  SLOT( OnNewScreenCenterFreq(qint64) ) );
    connect(ui->framePlot, SIGNAL(NewLowCutFreq(int)), this,  SLOT( OnNewLowCutFreq(int) ) );
    connect(ui->framePlot, SIGNAL(NewHighCutFreq(int)), this,  SLOT( OnNewHighCutFreq(int) ) );

	m_pTimer->start(200);		//start up status timer

	m_pSdrInterface->SetRadioType(m_RadioType);
		quint32 maxspan = m_pSdrInterface->GetMaxBWFromIndex(m_BandwidthIndex);

	ui->framePlot->SetPercent2DScreen(m_Percent2DScreen);

	//initialize controls and limits
	qint32 tmpspan = m_SpanFrequency;	//save since setting range triggers control to update
	ui->SpanspinBox->setMaximum(maxspan/1000);
	m_SpanFrequency = tmpspan;
	if(m_SpanFrequency>maxspan)
		m_SpanFrequency = maxspan;
	ui->SpanspinBox->setValue(m_SpanFrequency/1000);
	m_LastSpanKhz = m_SpanFrequency/1000;

	//tmp save demod freq since gets set to center freq by center freq control inititalization
	qint64 tmpdemod = m_DemodFrequency;

	ui->frameFreqCtrl->Setup(9, 100U, 500000000U, 1, UNITS_KHZ );
	ui->frameFreqCtrl->SetBkColor(Qt::darkBlue);
	ui->frameFreqCtrl->SetDigitColor(Qt::cyan);
	ui->frameFreqCtrl->SetUnitsColor(Qt::lightGray);
	ui->frameFreqCtrl->SetHighlightColor(Qt::darkGray);
	ui->frameFreqCtrl->SetFrequency(m_CenterFrequency);

	m_DemodFrequency = tmpdemod;
	ui->frameDemodFreqCtrl->Setup(9, 100U, 500000000U, 1, UNITS_KHZ );
	ui->frameDemodFreqCtrl->SetBkColor(Qt::darkBlue);
	ui->frameDemodFreqCtrl->SetDigitColor(Qt::white);
	ui->frameDemodFreqCtrl->SetUnitsColor(Qt::lightGray);
	ui->frameDemodFreqCtrl->SetHighlightColor(Qt::darkGray);
	//limit demod frequency to Center Frequency +/-span frequency
	ui->frameDemodFreqCtrl->Setup(9, m_CenterFrequency-m_SpanFrequency/2,
								  m_CenterFrequency+m_SpanFrequency/2,
								  1,
								  UNITS_KHZ );
	ui->frameDemodFreqCtrl->SetFrequency(m_DemodFrequency);

	ui->framePlot->SetSpanFreq( m_SpanFrequency );
	ui->framePlot->SetCenterFreq( m_CenterFrequency );
	ui->framePlot->SetClickResolution(m_ClickResolution);
	m_FreqChanged = false;

	ui->horizontalSliderVol->setValue(m_Volume);
	m_pSdrInterface->SetVolume(m_Volume);

	ui->ScalecomboBox->addItem("10 dB/Div", 10);
	ui->ScalecomboBox->addItem("5 dB/Div", 5);
	ui->ScalecomboBox->addItem("3 dB/Div", 3);
	ui->ScalecomboBox->addItem("1 dB/Div", 1);
	m_dBStepSize = (int)ui->ScalecomboBox->itemData(m_VertScaleIndex).toInt();
	ui->ScalecomboBox->setCurrentIndex(m_VertScaleIndex);
	ui->framePlot->SetdBStepSize(m_dBStepSize);

	ui->MaxdBspinBox->setValue(m_MaxdB);
	ui->MaxdBspinBox->setSingleStep(m_dBStepSize);
	ui->MaxdBspinBox->setMinimum(MIN_FFTDB+VERT_DIVS*m_dBStepSize);
	ui->MaxdBspinBox->setMaximum(MAX_FFTDB);
	ui->framePlot->SetMaxdB(m_MaxdB);


	m_pSdrInterface->SetFftSize( m_FftSize);
	m_pSdrInterface->SetFftAve( m_FftAve);
	m_pSdrInterface->SetMaxDisplayRate(m_MaxDisplayRate);
	m_pSdrInterface->SetSdrBandwidthIndex(m_BandwidthIndex);
	m_pSdrInterface->SetSdrRfGain( m_RfGain );
	m_pSdrInterface->ManageNCOSpurOffsets(CSdrInterface::NCOSPUR_CMD_SET,
										  &m_NCOSpurOffsetI,
										  &m_NCOSpurOffsetQ);

	m_pSdrInterface->SetSoundCardSelection(m_SoundInIndex, m_SoundOutIndex, m_StereoOut);
	m_pSdrInterface->SetSpectrumInversion(m_InvertSpectrum);
	m_pSdrInterface->SetUSFmVersion(m_USFm);

	InitDemodSettings();
	ui->framePlot->SetDemodCenterFreq( m_DemodFrequency );
	SetupDemod(m_DemodMode);
	m_RdsDecode.DecodeReset(m_USFm);

	SetupNoiseProc();

	UpdateInfoBox();

	m_ActiveDevice = "";
	m_pSdrInterface->SetupNetwork(m_IPAdr,m_Port);
	m_Status = CSdrInterface::NOT_CONNECTED;
	m_LastStatus = m_Status;
	m_pSdrInterface->StartIO();

	m_KeepAliveTimer = 0;


	if(m_UseTestBench)
	{
		//make sure top of dialog is visable(0,0 doesn't include menu bar.Qt bug?)
		if(m_TestBenchRect.top()<30)
			m_TestBenchRect.setTop(30);
		g_pTestBench->setGeometry(m_TestBenchRect);
		g_pTestBench->show();
		g_pTestBench->Init();
	}
}