1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Compare commits

..

2 Commits

5 changed files with 123 additions and 19 deletions

View File

@ -54,11 +54,17 @@ ChannelAnalyzer::ChannelAnalyzer(DeviceAPI *deviceAPI) :
m_deviceAPI->addChannelSink(this); m_deviceAPI->addChannelSink(this);
m_deviceAPI->addChannelSinkAPI(this); m_deviceAPI->addChannelSinkAPI(this);
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
} }
ChannelAnalyzer::~ChannelAnalyzer() ChannelAnalyzer::~ChannelAnalyzer()
{ {
qDebug("ChannelAnalyzer::~ChannelAnalyzer"); qDebug("ChannelAnalyzer::~ChannelAnalyzer");
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
m_deviceAPI->removeChannelSinkAPI(this); m_deviceAPI->removeChannelSinkAPI(this);
m_deviceAPI->removeChannelSink(this); m_deviceAPI->removeChannelSink(this);
@ -177,12 +183,103 @@ void ChannelAnalyzer::applySettings(const ChannelAnalyzerSettings& settings, boo
<< " m_pllBandwidth: " << settings.m_pllBandwidth << " m_pllBandwidth: " << settings.m_pllBandwidth
<< " m_pllDampingFactor: " << settings.m_pllDampingFactor << " m_pllDampingFactor: " << settings.m_pllDampingFactor
<< " m_pllLoopGain: " << settings.m_pllLoopGain << " m_pllLoopGain: " << settings.m_pllLoopGain
<< " m_inputType: " << (int) settings.m_inputType; << " m_inputType: " << (int) settings.m_inputType
<< " m_useReverseAPI:" << settings.m_useReverseAPI
<< " m_reverseAPIAddress:" << settings.m_reverseAPIAddress
<< " m_reverseAPIPort:" << settings.m_reverseAPIPort
<< " m_reverseAPIDeviceIndex:" << settings.m_reverseAPIDeviceIndex
<< " m_reverseAPIChannelIndex:" << settings.m_reverseAPIChannelIndex;
QList<QString> reverseAPIKeys;
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
reverseAPIKeys.append("inputFrequencyOffset");
}
if ((settings.m_rationalDownSample != m_settings.m_rationalDownSample) || force) {
reverseAPIKeys.append("rationalDownSample");
}
if ((settings.m_rationalDownSamplerRate != m_settings.m_rationalDownSamplerRate) || force) {
reverseAPIKeys.append("rationalDownSamplerRate");
}
if ((settings.m_bandwidth != m_settings.m_bandwidth) || force) {
reverseAPIKeys.append("bandwidth");
}
if ((settings.m_lowCutoff != m_settings.m_lowCutoff) || force) {
reverseAPIKeys.append("lowCutoff");
}
if ((settings.m_log2Decim != m_settings.m_log2Decim) || force) {
reverseAPIKeys.append("log2Decim");
}
if ((settings.m_lowCutoff != m_settings.m_lowCutoff) || force) {
reverseAPIKeys.append("lowCutoff");
}
if ((settings.m_ssb != m_settings.m_ssb) || force) {
reverseAPIKeys.append("ssb");
}
if ((settings.m_pll != m_settings.m_pll) || force) {
reverseAPIKeys.append("pll");
}
if ((settings.m_fll != m_settings.m_fll) || force) {
reverseAPIKeys.append("fll");
}
if ((settings.m_costasLoop != m_settings.m_costasLoop) || force) {
reverseAPIKeys.append("costasLoop");
}
if ((settings.m_rrc != m_settings.m_rrc) || force) {
reverseAPIKeys.append("rrc");
}
if ((settings.m_rrcRolloff != m_settings.m_rrcRolloff) || force) {
reverseAPIKeys.append("rrcRolloff");
}
if ((settings.m_pllPskOrder != m_settings.m_pllPskOrder) || force) {
reverseAPIKeys.append("pllPskOrder");
}
if ((settings.m_pllBandwidth != m_settings.m_pllBandwidth) || force) {
reverseAPIKeys.append("pllBandwidth");
}
if ((settings.m_pllDampingFactor != m_settings.m_pllDampingFactor) || force) {
reverseAPIKeys.append("pllDampingFactor");
}
if ((settings.m_pllLoopGain != m_settings.m_pllLoopGain) || force) {
reverseAPIKeys.append("pllLoopGain");
}
if ((settings.m_inputType != m_settings.m_inputType) || force) {
reverseAPIKeys.append("inputType");
}
if ((settings.m_rgbColor != m_settings.m_rgbColor) || force) {
reverseAPIKeys.append("rgbColor");
}
if ((settings.m_title != m_settings.m_title) || force) {
reverseAPIKeys.append("title");
}
if (m_settings.m_streamIndex != settings.m_streamIndex)
{
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
{
m_deviceAPI->removeChannelSinkAPI(this);
m_deviceAPI->removeChannelSink(this, m_settings.m_streamIndex);
m_deviceAPI->addChannelSink(this, settings.m_streamIndex);
m_deviceAPI->addChannelSinkAPI(this);
}
reverseAPIKeys.append("streamIndex");
}
ChannelAnalyzerBaseband::MsgConfigureChannelAnalyzerBaseband *msg ChannelAnalyzerBaseband::MsgConfigureChannelAnalyzerBaseband *msg
= ChannelAnalyzerBaseband::MsgConfigureChannelAnalyzerBaseband::create(settings, force); = ChannelAnalyzerBaseband::MsgConfigureChannelAnalyzerBaseband::create(settings, force);
m_basebandSink->getInputMessageQueue()->push(msg); m_basebandSink->getInputMessageQueue()->push(msg);
if (settings.m_useReverseAPI)
{
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
}
m_settings = settings; m_settings = settings;
} }
@ -478,7 +575,7 @@ void ChannelAnalyzer::webapiFormatChannelSettings(
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet()); swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex()); swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
swgChannelSettings->setChannelType(new QString(m_channelId)); swgChannelSettings->setChannelType(new QString(m_channelId));
swgChannelSettings->setSsbDemodSettings(new SWGSDRangel::SWGSSBDemodSettings()); swgChannelSettings->setChannelAnalyzerSettings(new SWGSDRangel::SWGChannelAnalyzerSettings());
SWGSDRangel::SWGChannelAnalyzerSettings *swgChannelAnalyzerSettings = swgChannelSettings->getChannelAnalyzerSettings(); SWGSDRangel::SWGChannelAnalyzerSettings *swgChannelAnalyzerSettings = swgChannelSettings->getChannelAnalyzerSettings();
// transfer data that has been modified. When force is on transfer all data except reverse API data // transfer data that has been modified. When force is on transfer all data except reverse API data

View File

@ -211,7 +211,7 @@ QByteArray ChannelAnalyzerGUI::serialize() const
bool ChannelAnalyzerGUI::deserialize(const QByteArray& data) bool ChannelAnalyzerGUI::deserialize(const QByteArray& data)
{ {
if(m_settings.deserialize(data)) if (m_settings.deserialize(data))
{ {
displaySettings(); displaySettings();
applySettings(true); // will have true applySettings(true); // will have true
@ -459,12 +459,22 @@ void ChannelAnalyzerGUI::onMenuDialogCalled(const QPoint& p)
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
dialog.move(p); dialog.move(p);
dialog.exec(); dialog.exec();
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_title = m_channelMarker.getTitle();
m_settings.m_useReverseAPI = dialog.useReverseAPI();
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
setWindowTitle(m_settings.m_title); setWindowTitle(m_settings.m_title);
setTitleColor(m_settings.m_rgbColor); setTitleColor(m_settings.m_rgbColor);

View File

@ -164,9 +164,9 @@ bool ChannelAnalyzerSettings::deserialize(const QByteArray& data)
m_rollupState->deserialize(bytetmp); m_rollupState->deserialize(bytetmp);
} }
d.readBool(18, &m_useReverseAPI, false); d.readBool(23, &m_useReverseAPI, false);
d.readString(19, &m_reverseAPIAddress, "127.0.0.1"); d.readString(24, &m_reverseAPIAddress, "127.0.0.1");
d.readU32(20, &utmp, 0); d.readU32(25, &utmp, 0);
if ((utmp > 1023) && (utmp < 65535)) { if ((utmp > 1023) && (utmp < 65535)) {
m_reverseAPIPort = utmp; m_reverseAPIPort = utmp;
@ -174,11 +174,11 @@ bool ChannelAnalyzerSettings::deserialize(const QByteArray& data)
m_reverseAPIPort = 8888; m_reverseAPIPort = 8888;
} }
d.readU32(21, &utmp, 0); d.readU32(26, &utmp, 0);
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
d.readU32(22, &utmp, 0); d.readU32(27, &utmp, 0);
m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
d.readS32(23, &m_streamIndex, 0); d.readS32(28, &m_streamIndex, 0);
return true; return true;
} }

View File

@ -312,8 +312,8 @@ bool MetisMISO::applySettings(const MetisMISOSettings& settings, bool force)
<< " m_dcBlock:" << settings.m_dcBlock << " m_dcBlock:" << settings.m_dcBlock
<< " m_iqCorrection:" << settings.m_iqCorrection << " m_iqCorrection:" << settings.m_iqCorrection
<< " m_txDrive:" << settings.m_txDrive << " m_txDrive:" << settings.m_txDrive
<< " m_streamIndex:" << m_settings.m_streamIndex << " m_streamIndex:" << settings.m_streamIndex
<< " m_spectrumStreamIndex:" << m_settings.m_spectrumStreamIndex << " m_spectrumStreamIndex:" << settings.m_spectrumStreamIndex
<< " m_useReverseAPI: " << settings.m_useReverseAPI << " m_useReverseAPI: " << settings.m_useReverseAPI
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress << " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort << " m_reverseAPIPort: " << settings.m_reverseAPIPort
@ -448,15 +448,8 @@ bool MetisMISO::applySettings(const MetisMISOSettings& settings, bool force)
reverseAPIKeys.append("streamIndex"); reverseAPIKeys.append("streamIndex");
} }
if ((m_settings.m_spectrumStreamIndex != settings.m_spectrumStreamIndex) || force) if ((m_settings.m_spectrumStreamIndex != settings.m_spectrumStreamIndex) || force) {
{
reverseAPIKeys.append("spectrumStreamIndex"); reverseAPIKeys.append("spectrumStreamIndex");
if (settings.m_spectrumStreamIndex < MetisMISOSettings::m_maxReceivers) {
m_deviceAPI->setSpectrumSinkInput(true, m_settings.m_spectrumStreamIndex);
} else {
m_deviceAPI->setSpectrumSinkInput(false, 0);
}
} }
if (propagateSettings) { if (propagateSettings) {

View File

@ -138,11 +138,13 @@ void MetisMISOGui::on_streamIndex_currentIndexChanged(int index)
if (m_settings.m_spectrumStreamIndex < MetisMISOSettings::m_maxReceivers) if (m_settings.m_spectrumStreamIndex < MetisMISOSettings::m_maxReceivers)
{ {
m_deviceUISet->m_spectrum->setDisplayedStream(true, index); m_deviceUISet->m_spectrum->setDisplayedStream(true, index);
m_deviceUISet->m_deviceAPI->setSpectrumSinkInput(true, m_settings.m_spectrumStreamIndex);
m_deviceUISet->setSpectrumScalingFactor(SDR_RX_SCALEF); m_deviceUISet->setSpectrumScalingFactor(SDR_RX_SCALEF);
} }
else else
{ {
m_deviceUISet->m_spectrum->setDisplayedStream(false, 0); m_deviceUISet->m_spectrum->setDisplayedStream(false, 0);
m_deviceUISet->m_deviceAPI->setSpectrumSinkInput(false, 0);
m_deviceUISet->setSpectrumScalingFactor(SDR_TX_SCALEF); m_deviceUISet->setSpectrumScalingFactor(SDR_TX_SCALEF);
} }
@ -168,11 +170,13 @@ void MetisMISOGui::on_spectrumSource_currentIndexChanged(int index)
if (m_settings.m_spectrumStreamIndex < MetisMISOSettings::m_maxReceivers) if (m_settings.m_spectrumStreamIndex < MetisMISOSettings::m_maxReceivers)
{ {
m_deviceUISet->m_spectrum->setDisplayedStream(true, index); m_deviceUISet->m_spectrum->setDisplayedStream(true, index);
m_deviceUISet->m_deviceAPI->setSpectrumSinkInput(true, m_settings.m_spectrumStreamIndex);
m_deviceUISet->setSpectrumScalingFactor(SDR_RX_SCALEF); m_deviceUISet->setSpectrumScalingFactor(SDR_RX_SCALEF);
} }
else else
{ {
m_deviceUISet->m_spectrum->setDisplayedStream(false, 0); m_deviceUISet->m_spectrum->setDisplayedStream(false, 0);
m_deviceUISet->m_deviceAPI->setSpectrumSinkInput(false, 0);
m_deviceUISet->setSpectrumScalingFactor(SDR_TX_SCALEF); m_deviceUISet->setSpectrumScalingFactor(SDR_TX_SCALEF);
} }