18 #include <QMessageBox> 38 #include "ui_soapysdrinputgui.h" 44 m_deviceUISet(deviceUISet),
45 m_forceSettings(true),
46 m_doApplySettings(true),
49 m_deviceCenterFrequency(0),
50 m_lastEngineState(
DeviceAPI::StNotStarted),
58 m_autoDCCorrection(0),
67 ui->centerFrequency->setValueRange(7, f_min/1000, f_max/1000);
95 connect(startStopRightClickEnabler, SIGNAL(rightClick(
const QPoint &)),
this, SLOT(
openDeviceSettingsDialog(
const QPoint &)));
117 const SoapySDR::RangeList& rangeList,
121 if (rangeList.size() == 0) {
125 bool rangeDiscrete =
true;
126 bool rangeInterval =
true;
128 for (
const auto &it : rangeList)
130 if (it.minimum() != it.maximum()) {
131 rangeDiscrete =
false;
133 rangeInterval =
false;
143 for (
const auto &it : rangeList) {
144 rangeGUI->
addItem(QString(
"%1").
arg(QString::number(it.minimum()/1000.0,
'f', 0)), it.minimum());
147 *settingGUI = rangeGUI;
148 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
149 layout->addWidget(rangeGUI);
151 else if (rangeInterval)
157 for (
const auto &it : rangeList) {
163 *settingGUI = rangeGUI;
164 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
165 layout->addWidget(rangeGUI);
171 if (antennaList.size() == 0) {
179 for (
const auto &it : antennaList) {
183 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
191 if (tunableElementsList.size() <= 1) {
195 std::vector<DeviceSoapySDRParams::FrequencySetting>::const_iterator it = tunableElementsList.begin() + 1;
197 for (
int i = 0; it != tunableElementsList.end(); ++it,
i++)
199 if (it->m_ranges.size() == 0) {
207 QString(
"%1 freq").
arg(it->m_name.c_str()),
208 QString((it->m_name ==
"CORR") ?
"ppm" :
"Hz"));
224 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
226 QFrame *line =
new QFrame(
this);
227 line->setFrameShape(QFrame::HLine);
228 line->setFrameShadow(QFrame::Sunken);
229 layout->addWidget(line);
235 m_autoGain->setStyleSheet(
"QCheckBox::indicator::unchecked {background: rgb(79,79,79);} QCheckBox::indicator::checked {background: rgb(255, 157, 38);}");
248 if (individualGainsList.size() == 0) {
252 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
253 std::vector<DeviceSoapySDRParams::GainSetting>::const_iterator it = individualGainsList.begin();
255 for (
int i = 0; it != individualGainsList.end(); ++it,
i++)
258 gainGUI->
setInterval(it->m_range.minimum(), it->m_range.maximum());
259 gainGUI->
setLabel(QString(
"%1 gain").
arg(it->m_name.c_str()));
262 layout->addWidget(gainGUI);
270 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
292 m_autoDCCorrection->setStyleSheet(
"QCheckBox::indicator::unchecked {background: rgb(79,79,79);} QCheckBox::indicator::checked {background: rgb(255, 157, 38);}");
317 m_autoIQCorrection->setToolTip(QString(
"Automatic hardware IQ imbalance correction"));
318 m_autoIQCorrection->setStyleSheet(
"QCheckBox::indicator::unchecked {background: rgb(79,79,79);} QCheckBox::indicator::checked {background: rgb(255, 157, 38);}");
327 if (argInfoList.size() == 0) {
331 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
333 QFrame *line =
new QFrame(
this);
334 line->setFrameShape(QFrame::HLine);
335 line->setFrameShadow(QFrame::Sunken);
336 layout->addWidget(line);
338 std::vector<SoapySDR::ArgInfo>::const_iterator it = argInfoList.begin();
340 for (; it != argInfoList.end(); ++it)
347 }
else if (it->type == SoapySDR::ArgInfo::INT) {
349 }
else if (it->type == SoapySDR::ArgInfo::FLOAT) {
351 }
else if (it->type == SoapySDR::ArgInfo::STRING) {
361 else if (it->options.size() == 0)
368 std::vector<std::string>::const_iterator optionIt = it->options.begin();
369 std::vector<std::string>::const_iterator optionNameIt = it->optionNames.begin();
371 for (
int i = 0; optionIt != it->options.end(); ++optionIt,
i++)
373 QString name(optionNameIt == it->optionNames.end() ? optionIt->c_str() : optionNameIt->c_str());
375 if (optionNameIt != it->optionNames.end()) {
380 argGUI->
addIntValue(name, atoi(optionIt->c_str()));
389 if ((it->range.minimum() != 0) || (it->range.maximum() != 0)) {
390 argGUI->
setRange(it->range.minimum(), it->range.maximum());
393 argGUI->
setLabel(QString(it->name.size() == 0 ? it->key.c_str() : it->name.c_str()));
394 argGUI->
setUnits(QString(it->units.c_str()));
396 if (it->description.size() != 0) {
397 argGUI->
setToolTip(QString(it->description.c_str()));
400 layout->addWidget(argGUI);
408 connect(gui, SIGNAL(valueChanged(QString, QVariant)),
this, SLOT(
deviceArgChanged(QString, QVariant)));
413 connect(gui, SIGNAL(valueChanged(QString, QVariant)),
this, SLOT(
streamArgChanged(QString, QVariant)));
527 qDebug(
"SoapySDRInputGui::handleInputMessages: message: %s", message->
getIdentifier());
534 qDebug(
"SoapySDRInputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->
getSampleRate(), notif->
getCenterFrequency());
614 double angleInRadians = (value / 180.0) *
M_PI;
629 double angleInRadians = (value / 180.0) *
M_PI;
667 if ((index <0) || (index > 6))
678 }
else if (index == 1) {
681 }
else if (index == 2) {
699 ui->LOppmText->setText(QString(
"%1").
arg(QString::number(value/10.0,
'f', 1)));
716 ui->record->setStyleSheet(
"QToolButton { background-color : red; }");
718 ui->record->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
792 *elIt = it->getValue();
830 it->setValue(elIt.value());
831 *elIt = it->getValue();
844 it->setValue(elIt.value());
845 *elIt = it->getValue();
861 ui->deviceRateText->setText(tr(
"%1k").
arg(QString::number(
m_sampleRate / 1000.0f,
'g', 5)));
870 qint64 minLimit = f_min/1000 + deltaFrequency;
871 qint64 maxLimit = f_max/1000 + deltaFrequency;
873 minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
874 maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
876 qDebug(
"SoapySDRInputGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
878 ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
883 int64_t centerFrequency = kHzValue*1000;
886 ui->centerFrequency->setToolTip(QString(
"Main center frequency in kHz (LO: %1 kHz)").
arg(centerFrequency/1000));
898 qDebug() <<
"SoapySDRInputGui::updateHardware";
915 ui->startStop->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
918 ui->startStop->setStyleSheet(
"QToolButton { background-color : blue; }");
921 ui->startStop->setStyleSheet(
"QToolButton { background-color : green; }");
924 ui->startStop->setStyleSheet(
"QToolButton { background-color : red; }");
Message * pop()
Pop message from queue.
const QString & getReverseAPIAddress() const
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void setSampleRate(qint32 sampleRate)
const std::string & getCurrentValue()
void setUnits(const QString &units)
void setValue(const std::string &value)
void setLabel(const QString &text)
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
void setUseReverseAPI(bool useReverseAPI)
virtual void setValue(double value)=0
MessageQueue * getInputMessageQueue()
void setUnits(const QString &units)
const QMap< QString, QVariant > & getDeviceArgSettings() const
void setRange(double min, double max)
uint16_t getReverseAPIDeviceIndex() const
Fixed< IntType, IntBits > abs(Fixed< IntType, IntBits > const &x)
QString errorMessage()
Last error message from the device engine.
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
GLSpectrum * getSpectrum()
Direct spectrum getter.
engine is before initialization
qint64 getCenterFrequency() const
EngineState state() const
Return the state of the device engine corresponding to the stream type.
void setArgument(double value)
void setAutomatic(bool automatic)
void setLabel(const QString &text)
void setInterval(double minimum, double maximum)
uint16_t getReverseAPIPort() const
void setLabel(const QString &text)
void setAutomaticEnable(bool enable)
void addItem(const QString &itemStr, double itemValue)
static bool match(const Message *message)
void setLabel(const QString &text)
virtual double getCurrentValue()
void addItem(const QString &itemStr, const std::string &itemValue)
virtual double getCurrentValue()=0
void addIntValue(const QString &text, int value)
void setUnits(const QString &units)
void setUnits(const QString &units)
void addInterval(double minimum, double maximum)
void addFloatValue(const QString &text, double value)
void setModule(double value)
int getSampleRate() const
void setToolTip(const QString &text)
void setToolTip(const QString &text)
void setCenterFrequency(qint64 frequency)
virtual const char * getIdentifier() const
void setReverseAPIAddress(const QString &address)
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
void setLabel(const QString &text)
void setReverseAPIPort(uint16_t port)
void setUnits(const QString &units)
bool useReverseAPI() const
virtual void setValue(double value)
void setLabel(const QString &text)
T max(const T &x, const T &y)
void addStringValue(const QString &text, const QString &value)
T min(const T &x, const T &y)
unsigned __int64 uint64_t