⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemevaldlg.cpp

📁 Dream.exe soft source (Visual C++)
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		QDateTime DateTime;
		DateTime.setDate(QDate(pDRMRec->GetParameters()->iYear,
			pDRMRec->GetParameters()->iMonth,
			pDRMRec->GetParameters()->iDay));
		DateTime.setTime(QTime(pDRMRec->GetParameters()->iUTCHour,
			pDRMRec->GetParameters()->iUTCMin));

		strFACInfo = DateTime.toString();
#else
		/* Set time and date */
		QString strMin;
		const int iMin = pDRMRec->GetParameters()->iUTCMin;

		/* Add leading zero to number smaller than 10 */
		if (iMin < 10)
			strMin = "0";
		else
			strMin = "";

		strMin += QString().setNum(iMin);

		strFACInfo =
			/* Time */
			QString().setNum(pDRMRec->GetParameters()->iUTCHour) + ":" +
			strMin + "  -  " +
			/* Date */
			QString().setNum(pDRMRec->GetParameters()->iMonth) + "/" +
			QString().setNum(pDRMRec->GetParameters()->iDay) + "/" +
			QString().setNum(pDRMRec->GetParameters()->iYear);
#endif
	}

	FACTimeDateL->setText(tr("Received time - date:")); /* Label */
	FACTimeDateV->setText(strFACInfo); /* Value */


	/* Update controls */
	UpdateControls();
}

void systemevalDlg::OnRadioTimeLinear() 
{
	if (pDRMRec->GetChanEst()->GetTimeInt() != CChannelEstimation::TLINEAR)
		pDRMRec->GetChanEst()->SetTimeInt(CChannelEstimation::TLINEAR);
}

void systemevalDlg::OnRadioTimeWiener() 
{
	if (pDRMRec->GetChanEst()->GetTimeInt() != CChannelEstimation::TWIENER)
		pDRMRec->GetChanEst()->SetTimeInt(CChannelEstimation::TWIENER);
}

void systemevalDlg::OnRadioFrequencyLinear() 
{
	if (pDRMRec->GetChanEst()->GetFreqInt() != CChannelEstimation::FLINEAR)
		pDRMRec->GetChanEst()->SetFreqInt(CChannelEstimation::FLINEAR);
}

void systemevalDlg::OnRadioFrequencyDft() 
{
	if (pDRMRec->GetChanEst()->GetFreqInt() != CChannelEstimation::FDFTFILTER)
		pDRMRec->GetChanEst()->SetFreqInt(CChannelEstimation::FDFTFILTER);
}

void systemevalDlg::OnRadioFrequencyWiener() 
{
	if (pDRMRec->GetChanEst()->GetFreqInt() != CChannelEstimation::FWIENER)
		pDRMRec->GetChanEst()->SetFreqInt(CChannelEstimation::FWIENER);
}

void systemevalDlg::OnRadioTiSyncFirstPeak() 
{
	if (pDRMRec->GetChanEst()->GetTimeSyncTrack()->GetTiSyncTracType() != 
		CTimeSyncTrack::TSFIRSTPEAK)
	{
		pDRMRec->GetChanEst()->GetTimeSyncTrack()->
			SetTiSyncTracType(CTimeSyncTrack::TSFIRSTPEAK);
	}
}

void systemevalDlg::OnRadioTiSyncEnergy() 
{
	if (pDRMRec->GetChanEst()->GetTimeSyncTrack()->GetTiSyncTracType() != 
		CTimeSyncTrack::TSENERGY)
	{
		pDRMRec->GetChanEst()->GetTimeSyncTrack()->
			SetTiSyncTracType(CTimeSyncTrack::TSENERGY);
	}
}

void systemevalDlg::OnSliderIterChange(int value)
{
	/* Set new value in working thread module */
	pDRMRec->GetMSCMLC()->SetNumIterations(value);

	/* Show the new value in the label control */
	TextNumOfIterations->setText(tr("MLC: Number of Iterations: ") +
		QString().setNum(value));
}

void systemevalDlg::OnListSelChanged(QListViewItem* NewSelIt)
{
	/* Get char type from selected item and setup chart */
	MainPlot->SetupChart(((CCharSelItem*) NewSelIt)->GetCharType());
}

void systemevalDlg::OnListRightButClicked(QListViewItem* NewSelIt,
										  const QPoint& iPnt, int iCol)
{
	/* Make sure that list item is valid */
	if (NewSelIt != NULL)
	{
		/* Show menu at mouse position only if selectable item was chosen */
		if (NewSelIt->isSelectable())
			pListViewContextMenu->exec(QCursor::pos());
	}
}

void systemevalDlg::OnListViContMenu()
{
	/* Get chart type from current selected list view item */
	QListViewItem* pCurSelLVItem = ListViewCharSel->selectedItem();

	if (pCurSelLVItem != NULL)
	{
		/* Open new chart window and add window pointer in vector
		   (needed for closing the windows) */
		vecpDRMPlots.Add(
			OpenChartWin(((CCharSelItem*) pCurSelLVItem)->GetCharType()));
	}
}

void systemevalDlg::OnCheckFlipSpectrum()
{
	/* Set parameter in working thread module */
	pDRMRec->GetReceiver()->
		SetFlippedSpectrum(CheckBoxFlipSpec->isChecked());
}

void systemevalDlg::OnCheckRecFilter()
{
	/* Set parameter in working thread module */
	pDRMRec->GetFreqSyncAcq()->
		SetRecFilter(CheckBoxRecFilter->isChecked());

	/* If filter status is changed, a new aquisition is necessary */
	pDRMRec->SetReceiverMode(CDRMReceiver::RM_DRM);
}

void systemevalDlg::OnCheckModiMetric()
{
	/* Set parameter in working thread module */
	pDRMRec->GetChanEst()->SetIntCons(CheckBoxModiMetric->isChecked());
}

void systemevalDlg::OnCheckBoxMuteAudio()
{
	/* Set parameter in working thread module */
	pDRMRec->GetWriteData()->MuteAudio(CheckBoxMuteAudio->isChecked());
}

void systemevalDlg::OnCheckBoxReverb()
{
	/* Set parameter in working thread module */
	pDRMRec->GetAudSorceDec()->SetReverbEffect(CheckBoxReverb->isChecked());
}

void systemevalDlg::OnCheckSaveAudioWAV()
{
/*
	This code is copied in AnalogDemDlg.cpp. If you do changes here, you should
	apply the changes in the other file, too
*/
	if (CheckBoxSaveAudioWave->isChecked() == TRUE)
	{
		/* Show "save file" dialog */
		QString strFileName =
			QFileDialog::getSaveFileName(tr("DreamOut.wav"), "*.wav", this);

		/* Check if user not hit the cancel button */
		if (!strFileName.isNull())
		{
			pDRMRec->GetWriteData()->
				StartWriteWaveFile(strFileName.latin1());
		}
		else
		{
			/* User hit the cancel button, uncheck the button */
			CheckBoxSaveAudioWave->setChecked(FALSE);
		}
	}
	else
		pDRMRec->GetWriteData()->StopWriteWaveFile();
}

void systemevalDlg::OnTimerLogFileStart()
{
	/* Start logging (if not already done) */
	if (!CheckBoxWriteLog->isChecked())
	{
		CheckBoxWriteLog->setChecked(TRUE);
		OnCheckWriteLog();
	}
}

void systemevalDlg::OnCheckWriteLog()
{
	if (CheckBoxWriteLog->isChecked())
	{
		/* Activte log file timer for long and short log file */
		TimerLogFileShort.start(60000); /* Every minute (i.e. 60000 ms) */
		TimerLogFileLong.start(1000); /* Every second */

		/* Get frequency from front-end edit control */
		QString strFreq = EdtFrequency->text();
		iCurFrequency = strFreq.toUInt();
		pDRMRec->GetParameters()->ReceptLog.SetFrequency(iCurFrequency);

		/* Set some other information obout this receiption */
		QString strAddText = "";

		/* Check if receiver does receive a DRM signal */
		if ((pDRMRec->GetReceiverState() == CDRMReceiver::AS_WITH_SIGNAL) &&
			(pDRMRec->GetReceiverMode() == CDRMReceiver::RM_DRM))
		{
			/* First get current selected audio service */
			int iCurSelServ =
				pDRMRec->GetParameters()->GetCurSelAudioService();

			/* Check whether service parameters were not transmitted yet */
			if (pDRMRec->GetParameters()->Service[iCurSelServ].IsActive())
			{
				strAddText = tr("Label            ");

				/* Service label (UTF-8 encoded string -> convert) */
				strAddText += QString().fromUtf8(QCString(
					pDRMRec->GetParameters()->Service[iCurSelServ].
					strLabel.c_str()));

				strAddText += tr("\nBitrate          ");

				strAddText += QString().setNum(pDRMRec->GetParameters()->
					GetBitRateKbps(iCurSelServ, FALSE), 'f', 2) + " kbps";

				strAddText += tr("\nMode             ") + GetRobModeStr();
				strAddText += tr("\nBandwidth        ") + GetSpecOccStr();
			}
		}

		/* Set additional text for log file. Conversion from QString to STL
		   string is needed (done with .latin1() function of QT string) */
		string strTemp = strAddText.latin1();
		pDRMRec->GetParameters()->ReceptLog.SetAdditText(strTemp);

		/* Set current transmission parameters. TDOD: better solution */
		pDRMRec->GetParameters()->ReceptLog.
			SetRobMode(pDRMRec->GetParameters()->GetWaveMode());
		pDRMRec->GetParameters()->ReceptLog.
			SetMSCScheme(pDRMRec->GetParameters()->eMSCCodingScheme);
		pDRMRec->GetParameters()->ReceptLog.
			SetProtLev(pDRMRec->GetParameters()->MSCPrLe);

		/* Activate log file */
		pDRMRec->GetParameters()->ReceptLog.SetLog(TRUE);
	}
	else
	{
		/* Deactivate log file timer */
		TimerLogFileShort.stop();
		TimerLogFileLong.stop();

		pDRMRec->GetParameters()->ReceptLog.SetLog(FALSE);
	}
}

void systemevalDlg::OnTimerLogFileShort()
{
	/* Write new parameters in log file (short version) */
	pDRMRec->GetParameters()->ReceptLog.WriteParameters(FALSE);
}

void systemevalDlg::OnTimerLogFileLong()
{
	/* Write new parameters in log file (long version) */
	pDRMRec->GetParameters()->ReceptLog.WriteParameters(TRUE);
}

QString	systemevalDlg::GetRobModeStr()
{
	switch (pDRMRec->GetParameters()->GetWaveMode())
	{
	case RM_ROBUSTNESS_MODE_A:
		return "A";
		break;

	case RM_ROBUSTNESS_MODE_B:
		return "B";
		break;

	case RM_ROBUSTNESS_MODE_C:
		return "C";
		break;

	case RM_ROBUSTNESS_MODE_D:
		return "D";
		break;

	default:
		return "A";
	}
}

QString	systemevalDlg::GetSpecOccStr()
{
	switch (pDRMRec->GetParameters()->GetSpectrumOccup())
	{
	case SO_0:
		return "4,5 kHz";
		break;

	case SO_1:
		return "5 kHz";
		break;

	case SO_2:
		return "9 kHz";
		break;

	case SO_3:
		return "10 kHz";
		break;

	case SO_4:
		return "18 kHz";
		break;

	case SO_5:
		return "20 kHz";
		break;

	default:
		return "10 kHz";
	}
}

void systemevalDlg::AddWhatsThisHelp()
{
/*
	This text was taken from the only documentation of Dream software
*/
	/* DC Frequency Offset */
	const QString strDCFreqOffs =
		tr("<b>DC Frequency Offset:</b> This is the "
		"estimation of the DC frequency offset. This offset corresponds "
		"to the resulting sound card intermedia frequency of the front-end. "
		"This frequency is not restricted to a certain value. The only "
		"restriction is that the DRM spectrum must be completely inside the "
		"bandwidth of the sound card.");

	QWhatsThis::add(TextFreqOffset, strDCFreqOffs);
	QWhatsThis::add(ValueFreqOffset, strDCFreqOffs);

	/* Sample Frequency Offset */
	const QString strFreqOffset =
		tr("<b>Sample Frequency Offset:</b> This is the "
		"estimation of the sample rate offset between the sound card sample "
		"rate of the local computer and the sample rate of the D / A (digital "
		"to analog) converter in the transmitter. Usually the sample rate "
		"offset is very constant for a given sound card. Therefore it is "
		"useful to inform the Dream software about this value at application "
		"startup to increase the acquisition speed and reliability.");

	QWhatsThis::add(TextSampFreqOffset, strFreqOffset);
	QWhatsThis::add(ValueSampFreqOffset, strFreqOffset);

	/* Doppler / Delay */
	const QString strDopplerDelay =
		tr("<b>Doppler / Delay:</b> The Doppler frequency "
		"of the channel is estimated for the Wiener filter design of channel "
		"estimation in time direction. If linear interpolation is set for "
		"channel estimation in time direction, this estimation is not updated. "
		"The Doppler frequency is an indication of how fast the channel varies "
		"with time. The higher the frequency, the faster the channel changes "
		"are.<br>The total delay of the Power Delay Spectrum "
		"(PDS) is estimated from the impulse response estimation derived from "
		"the channel estimation. This delay corresponds to the range between "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -