18 #include <QMessageBox> 26 #include "ui_soapysdroutputgui.h" 44 m_deviceUISet(deviceUISet),
45 m_forceSettings(true),
46 m_doApplySettings(true),
49 m_lastEngineState(
DeviceAPI::StNotStarted),
57 m_autoDCCorrection(0),
66 ui->centerFrequency->setValueRange(7, f_min/1000, f_max/1000);
94 connect(startStopRightClickEnabler, SIGNAL(rightClick(
const QPoint &)),
this, SLOT(
openDeviceSettingsDialog(
const QPoint &)));
116 const SoapySDR::RangeList& rangeList,
120 if (rangeList.size() == 0) {
124 bool rangeDiscrete =
true;
125 bool rangeInterval =
true;
127 for (
const auto &it : rangeList)
129 if (it.minimum() != it.maximum()) {
130 rangeDiscrete =
false;
132 rangeInterval =
false;
142 for (
const auto &it : rangeList) {
143 rangeGUI->
addItem(QString(
"%1").
arg(QString::number(it.minimum()/1000.0,
'f', 0)), it.minimum());
146 *settingGUI = rangeGUI;
147 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
148 layout->addWidget(rangeGUI);
150 else if (rangeInterval)
156 for (
const auto &it : rangeList) {
162 *settingGUI = rangeGUI;
163 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
164 layout->addWidget(rangeGUI);
170 if (antennaList.size() == 0) {
178 for (
const auto &it : antennaList) {
182 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
190 if (tunableElementsList.size() <= 1) {
194 std::vector<DeviceSoapySDRParams::FrequencySetting>::const_iterator it = tunableElementsList.begin() + 1;
196 for (
int i = 0; it != tunableElementsList.end(); ++it,
i++)
198 if (it->m_ranges.size() == 0) {
206 QString(
"%1 freq").
arg(it->m_name.c_str()),
207 QString((it->m_name ==
"CORR") ?
"ppm" :
"Hz"));
223 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
225 QFrame *line =
new QFrame(
this);
226 line->setFrameShape(QFrame::HLine);
227 line->setFrameShadow(QFrame::Sunken);
228 layout->addWidget(line);
234 m_autoGain->setStyleSheet(
"QCheckBox::indicator::unchecked {background: rgb(79,79,79);} QCheckBox::indicator::checked {background: rgb(255, 157, 38);}");
247 if (individualGainsList.size() == 0) {
251 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
252 std::vector<DeviceSoapySDRParams::GainSetting>::const_iterator it = individualGainsList.begin();
254 for (
int i = 0; it != individualGainsList.end(); ++it,
i++)
257 gainGUI->
setInterval(it->m_range.minimum(), it->m_range.maximum());
258 gainGUI->
setLabel(QString(
"%1 gain").
arg(it->m_name.c_str()));
261 layout->addWidget(gainGUI);
269 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
290 m_autoDCCorrection->setStyleSheet(
"QCheckBox::indicator::unchecked {background: rgb(79,79,79);} QCheckBox::indicator::checked {background: rgb(255, 157, 38);}");
314 m_autoIQCorrection->setToolTip(QString(
"Automatic hardware IQ imbalance correction"));
315 m_autoIQCorrection->setStyleSheet(
"QCheckBox::indicator::unchecked {background: rgb(79,79,79);} QCheckBox::indicator::checked {background: rgb(255, 157, 38);}");
324 if (argInfoList.size() == 0) {
328 QVBoxLayout *layout = (QVBoxLayout *)
ui->scrollAreaWidgetContents->layout();
330 QFrame *line =
new QFrame(
this);
331 line->setFrameShape(QFrame::HLine);
332 line->setFrameShadow(QFrame::Sunken);
333 layout->addWidget(line);
335 std::vector<SoapySDR::ArgInfo>::const_iterator it = argInfoList.begin();
337 for (; it != argInfoList.end(); ++it)
344 }
else if (it->type == SoapySDR::ArgInfo::INT) {
346 }
else if (it->type == SoapySDR::ArgInfo::FLOAT) {
348 }
else if (it->type == SoapySDR::ArgInfo::STRING) {
358 else if (it->options.size() == 0)
365 std::vector<std::string>::const_iterator optionIt = it->options.begin();
366 std::vector<std::string>::const_iterator optionNameIt = it->optionNames.begin();
368 for (
int i = 0; optionIt != it->options.end(); ++optionIt,
i++)
370 QString name(optionNameIt == it->optionNames.end() ? optionIt->c_str() : optionNameIt->c_str());
372 if (optionNameIt != it->optionNames.end()) {
377 argGUI->
addIntValue(name, atoi(optionIt->c_str()));
386 if ((it->range.minimum() != 0) || (it->range.maximum() != 0)) {
387 argGUI->
setRange(it->range.minimum(), it->range.maximum());
390 argGUI->
setLabel(QString(it->name.size() == 0 ? it->key.c_str() : it->name.c_str()));
391 argGUI->
setUnits(QString(it->units.c_str()));
393 if (it->description.size() != 0) {
394 argGUI->
setToolTip(QString(it->description.c_str()));
397 layout->addWidget(argGUI);
405 connect(gui, SIGNAL(valueChanged(QString, QVariant)),
this, SLOT(
deviceArgChanged(QString, QVariant)));
410 connect(gui, SIGNAL(valueChanged(QString, QVariant)),
this, SLOT(
streamArgChanged(QString, QVariant)));
525 qDebug(
"SoapySDROutputGui::handleInputMessages: message: %s", message->
getIdentifier());
532 qDebug(
"SoapySDROutputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->
getSampleRate(), notif->
getCenterFrequency());
611 double angleInRadians = (value / 180.0) *
M_PI;
626 double angleInRadians = (value / 180.0) *
M_PI;
652 if ((index <0) || (index > 6))
670 ui->LOppmText->setText(QString(
"%1").
arg(QString::number(value/10.0,
'f', 1)));
747 *elIt = it->getValue();
785 it->setValue(elIt.value());
786 *elIt = it->getValue();
799 it->setValue(elIt.value());
800 *elIt = it->getValue();
816 ui->deviceRateText->setText(tr(
"%1k").
arg(QString::number(
m_sampleRate / 1000.0f,
'g', 5)));
825 qint64 minLimit = f_min/1000 + deltaFrequency;
826 qint64 maxLimit = f_max/1000 + deltaFrequency;
828 minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
829 maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
831 qDebug(
"SoapySDRInputGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
833 ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
838 int64_t centerFrequency = kHzValue*1000;
841 ui->centerFrequency->setToolTip(QString(
"Main center frequency in kHz (LO: %1 kHz)").
arg(centerFrequency/1000));
848 qDebug() <<
"SoapySDROutputGui::updateHardware";
865 ui->startStop->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
868 ui->startStop->setStyleSheet(
"QToolButton { background-color : blue; }");
871 ui->startStop->setStyleSheet(
"QToolButton { background-color : green; }");
874 ui->startStop->setStyleSheet(
"QToolButton { background-color : red; }");
void setCenterFrequencySetting(uint64_t kHzValue)
MessageQueue m_inputMessageQueue
void streamArgChanged(QString itemName, QVariant value)
std::vector< DynamicArgSettingGUI * > m_deviceArgsGUIs
void autoDCCorrectionChanged(bool set)
Message * pop()
Pop message from queue.
const QString & getReverseAPIAddress() const
void createCorrectionsControl()
void sampleRateChanged(double sampleRate)
QMap< QString, double > m_tunableElements
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)
SoapySDROutput * m_sampleSink
std::vector< DynamicItemSettingGUI * > m_tunableElementsGUIs
virtual qint64 getCenterFrequency() const
void setLabel(const QString &text)
void setUseReverseAPI(bool useReverseAPI)
virtual void setValue(double value)=0
virtual void setMessageQueueToGUI(MessageQueue *queue)
void setUnits(const QString &units)
void individualGainChanged(QString name, double value)
std::vector< DynamicItemSettingGUI * > m_individualGainsGUIs
void initStreamArgSettings(SoapySDROutputSettings &settings)
DeviceUISet * m_deviceUISet
void bandwidthChanged(double bandwidth)
bool hasIQAutoCorrection()
void displayTunableElementsControlSettings()
const QMap< QString, QVariant > & getDeviceArgSettings() const
bool getIndividualGains() const
bool hasIQCorrectionValue()
void getGlobalGainRange(int &min, int &max)
SoapySDROutputSettings m_settings
const SoapySDR::RangeList & getBandwidthRanges()
void setRange(double min, double max)
QByteArray serialize() const
void autoIQCorrectionChanged(bool set)
uint16_t getReverseAPIDeviceIndex() const
void displayCorrectionsSettings()
Fixed< IntType, IntBits > abs(Fixed< IntType, IntBits > const &x)
void createIndividualGainsControl(const std::vector< DeviceSoapySDRParams::GainSetting > &individualGainsList)
void initDeviceArgSettings(SoapySDROutputSettings &settings)
void displayDeviceArgsSettings()
virtual bool deserialize(const QByteArray &data)
QString errorMessage()
Last error message from the device engine.
void on_transverter_clicked()
const std::vector< DeviceSoapySDRParams::FrequencySetting > & getTunableElements()
bool hasDCAutoCorrection()
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Ui::SoapySDROutputGui * ui
void dcCorrectionModuleChanged(double value)
const SoapySDR::RangeList & getRateRanges()
void createTunableElementsControl(const std::vector< DeviceSoapySDRParams::FrequencySetting > &tunableElementsList)
QMap< QString, QVariant > m_streamArgSettings
void handleInputMessages()
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
void openDeviceSettingsDialog(const QPoint &p)
GLSpectrum * getSpectrum()
Direct spectrum getter.
engine is before initialization
const SoapySDROutputSettings & getSettings() const
void createGlobalGainControl()
qint64 getCenterFrequency() const
EngineState state() const
Return the state of the device engine corresponding to the stream type.
virtual bool handleMessage(const Message &message)
void setArgument(double value)
void createRangesControl(ItemSettingGUI **settingGUI, const SoapySDR::RangeList &rangeList, const QString &text, const QString &unit)
StringRangeGUI * m_antennas
void setAutomatic(bool automatic)
void globalGainChanged(double gain)
MessageQueue * getInputMessageQueue()
void setLabel(const QString &text)
void displayIndividualGainsControlSettings()
void setInterval(double minimum, double maximum)
uint16_t getReverseAPIPort() const
void setLabel(const QString &text)
uint16_t m_reverseAPIDeviceIndex
void setAutomaticEnable(bool enable)
QMap< QString, double > m_individualGains
void addItem(const QString &itemStr, double itemValue)
void iqCorrectionModuleChanged(double value)
ItemSettingGUI * m_sampleRateGUI
const SoapySDR::ArgInfoList & getDeviceArgInfoList()
void getFrequencyRange(uint64_t &min, uint64_t &max)
static bool match(const Message *message)
void setLabel(const QString &text)
bool getGlobalGain() const
virtual ~SoapySDROutputGui()
void initGainSettings(SoapySDROutputSettings &settings)
bool getStartStop() const
std::complex< double > m_iqCorrection
virtual double getCurrentValue()
void addItem(const QString &itemStr, const std::string &itemValue)
quint64 m_deviceCenterFrequency
Center frequency in device.
qint64 m_transverterDeltaFrequency
void on_centerFrequency_changed(quint64 value)
uint16_t m_reverseAPIPort
virtual double getCurrentValue()=0
const std::vector< DeviceSoapySDRParams::GainSetting > & getIndividualGainsRanges()
QCheckBox * m_autoDCCorrection
void on_startStop_toggled(bool checked)
void addIntValue(const QString &text, int value)
void setUnits(const QString &units)
virtual void setCenterFrequency(qint64 centerFrequency)
void blockApplySettings(bool block)
const std::vector< std::string > & getAntennas()
void dcCorrectionArgumentChanged(double value)
quint64 m_centerFrequency
void setUnits(const QString &units)
void addInterval(double minimum, double maximum)
virtual QByteArray serialize() const
void addFloatValue(const QString &text, double value)
void autoGainChanged(bool set)
void setModule(double value)
QString m_reverseAPIAddress
std::complex< double > m_dcCorrection
void on_LOppm_valueChanged(int value)
int getSampleRate() const
void setToolTip(const QString &text)
SoapySDROutputGui(DeviceUISet *deviceUISet, QWidget *parent=0)
std::vector< DynamicArgSettingGUI * > m_streamArgsGUIs
void setCenterFrequency(qint64 frequency)
virtual const char * getIdentifier() const
void displayStreamArgsSettings()
void setReverseAPIAddress(const QString &address)
void initTunableElementsSettings(SoapySDROutputSettings &settings)
ComplexFactorGUI * m_iqCorrectionGUI
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
void setName(const QString &name)
void setLabel(const QString &text)
const SoapySDR::ArgInfoList & getStreamArgInfoList()
static MsgStartStop * create(bool startStop)
void setReverseAPIPort(uint16_t port)
void on_interp_currentIndexChanged(int index)
ItemSettingGUI * m_bandwidthGUI
void setUnits(const QString &units)
QCheckBox * m_autoIQCorrection
void tunableElementChanged(QString name, double value)
bool useReverseAPI() const
IntervalSliderGUI * m_gainSliderGUI
ComplexFactorGUI * m_dcCorrectionGUI
bool deserialize(const QByteArray &data)
void createArgumentsControl(const SoapySDR::ArgInfoList &argInfoList, bool deviceArguments)
bool hasDCCorrectionValue()
void createAntennasControl(const std::vector< std::string > &antennaList)
void updateSampleRateAndFrequency()
virtual void setValue(double value)
void deviceArgChanged(QString itemName, QVariant value)
QMap< QString, QVariant > m_deviceArgSettings
void setLabel(const QString &text)
T max(const T &x, const T &y)
void addStringValue(const QString &text, const QString &value)
void updateFrequencyLimits()
void iqCorrectionArgumentChanged(double value)
T min(const T &x, const T &y)
unsigned __int64 uint64_t