diff --git a/plugins/channelrx/demodam/amdemod.cpp b/plugins/channelrx/demodam/amdemod.cpp index 18ab637e1..29f03e81a 100644 --- a/plugins/channelrx/demodam/amdemod.cpp +++ b/plugins/channelrx/demodam/amdemod.cpp @@ -436,6 +436,7 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force) << " m_audioDeviceName: " << settings.m_audioDeviceName << " m_pll: " << settings.m_pll << " m_syncAMOperation: " << (int) settings.m_syncAMOperation + << " m_streamIndex: " << settings.m_streamIndex << " m_useReverseAPI: " << settings.m_useReverseAPI << " m_reverseAPIAddress: " << settings.m_reverseAPIAddress << " m_reverseAPIPort: " << settings.m_reverseAPIPort @@ -520,6 +521,10 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force) reverseAPIKeys.append("volume"); } + if ((m_settings.m_streamIndex != settings.m_streamIndex) || force) { + reverseAPIKeys.append("streamIndex"); + } + if (settings.m_useReverseAPI) { bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) || @@ -617,6 +622,9 @@ int AMDemod::webapiSettingsPutPatch( AMDemodSettings::SyncAMLSB : (AMDemodSettings::SyncAMOperation) syncAMOperationCode; } + if (channelSettingsKeys.contains("streamIndex")) { + settings.m_streamIndex = response.getAmDemodSettings()->getStreamIndex(); + } if (channelSettingsKeys.contains("useReverseAPI")) { settings.m_useReverseAPI = response.getAmDemodSettings()->getUseReverseApi() != 0; } @@ -690,6 +698,7 @@ void AMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo response.getAmDemodSettings()->setPll(settings.m_pll ? 1 : 0); response.getAmDemodSettings()->setSyncAmOperation((int) m_settings.m_syncAMOperation); + response.getAmDemodSettings()->setStreamIndex(m_settings.m_streamIndex); response.getAmDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); if (response.getAmDemodSettings()->getReverseApiAddress()) { @@ -760,6 +769,9 @@ void AMDemod::webapiReverseSendSettings(QList& channelSettingsKeys, con if (channelSettingsKeys.contains("syncAMOperation") || force) { swgAMDemodSettings->setSyncAmOperation((int) settings.m_syncAMOperation); } + if (channelSettingsKeys.contains("streamIndex") || force) { + swgAMDemodSettings->setStreamIndex(settings.m_streamIndex); + } QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") .arg(settings.m_reverseAPIAddress) diff --git a/plugins/channelrx/demodam/amdemodgui.cpp b/plugins/channelrx/demodam/amdemodgui.cpp index 5e68d7cf6..34ecc7eb7 100644 --- a/plugins/channelrx/demodam/amdemodgui.cpp +++ b/plugins/channelrx/demodam/amdemodgui.cpp @@ -230,6 +230,10 @@ void AMDemodGUI::onMenuDialogCalled(const QPoint &p) applySettings(); } + else if ((m_contextMenuType == ContextMenuStreamSettings) && (m_deviceUISet->m_deviceMIMOEngine)) + { + // TODO: open select MIMO channel dialog + } resetContextMenuType(); } @@ -379,9 +383,20 @@ void AMDemodGUI::displaySettings() ui->ssb->setIcon(m_iconDSBUSB); } + displayStreamIndex(); + blockApplySettings(false); } +void AMDemodGUI::displayStreamIndex() +{ + if (m_deviceUISet->m_deviceMIMOEngine) { + setStreamIndicator(tr("%1").arg(m_settings.m_streamIndex)); + } else { + setStreamIndicator("S"); // single channel indicator + } +} + void AMDemodGUI::leaveEvent(QEvent*) { m_channelMarker.setHighlighted(false); diff --git a/plugins/channelrx/demodam/amdemodgui.h b/plugins/channelrx/demodam/amdemodgui.h index 4849f1196..eb91cb141 100644 --- a/plugins/channelrx/demodam/amdemodgui.h +++ b/plugins/channelrx/demodam/amdemodgui.h @@ -65,6 +65,7 @@ private: void blockApplySettings(bool block); void applySettings(bool force = false); void displaySettings(); + void displayStreamIndex(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodam/amdemodsettings.cpp b/plugins/channelrx/demodam/amdemodsettings.cpp index 615754c0a..55aaf0c36 100644 --- a/plugins/channelrx/demodam/amdemodsettings.cpp +++ b/plugins/channelrx/demodam/amdemodsettings.cpp @@ -41,6 +41,7 @@ void AMDemodSettings::resetToDefaults() m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; m_pll = false; m_syncAMOperation = SyncAMDSB; + m_streamIndex = 0; m_useReverseAPI = false; m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIPort = 8888; @@ -53,6 +54,7 @@ QByteArray AMDemodSettings::serialize() const SimpleSerializer s(1); s.writeS32(1, m_inputFrequencyOffset); s.writeS32(2, m_rfBandwidth/100); + s.writeS32(3, m_streamIndex); s.writeS32(4, m_volume*10); s.writeS32(5, m_squelch); @@ -95,6 +97,7 @@ bool AMDemodSettings::deserialize(const QByteArray& data) d.readS32(1, &m_inputFrequencyOffset, 0); d.readS32(2, &tmp, 4); m_rfBandwidth = 100 * tmp; + d.readS32(3, &m_streamIndex, 0); d.readS32(4, &tmp, 20); m_volume = tmp * 0.1; d.readS32(5, &tmp, -40); diff --git a/plugins/channelrx/demodam/amdemodsettings.h b/plugins/channelrx/demodam/amdemodsettings.h index a3b443ec5..8701e78cd 100644 --- a/plugins/channelrx/demodam/amdemodsettings.h +++ b/plugins/channelrx/demodam/amdemodsettings.h @@ -43,6 +43,7 @@ struct AMDemodSettings QString m_audioDeviceName; bool m_pll; SyncAMOperation m_syncAMOperation; + int m_streamIndex; //!< MIMO channel. Not relevant when connected to SI (single Rx). bool m_useReverseAPI; QString m_reverseAPIAddress; uint16_t m_reverseAPIPort; diff --git a/plugins/samplemimo/testmi/testmiplugin.cpp b/plugins/samplemimo/testmi/testmiplugin.cpp index a7fd98ccc..edb6628bd 100644 --- a/plugins/samplemimo/testmi/testmiplugin.cpp +++ b/plugins/samplemimo/testmi/testmiplugin.cpp @@ -65,7 +65,7 @@ PluginInterface::SamplingDevices TestMIPlugin::enumSampleMIMO() QString::null, 0, PluginInterface::SamplingDevice::BuiltInDevice, - PluginInterface::SamplingDevice::StreamAny, + PluginInterface::SamplingDevice::StreamMIMO, 1, 0)); diff --git a/sdrbase/channel/channelapi.h b/sdrbase/channel/channelapi.h index e776b75b2..db469e96f 100644 --- a/sdrbase/channel/channelapi.h +++ b/sdrbase/channel/channelapi.h @@ -40,7 +40,7 @@ public: { StreamSingleSink, //!< Exposes a single sink stream (input, Rx) StreamSingleSource, //!< Exposes a single source stream (output, Tx) - StreamAny //!< May expose any number of sink and/or source streams + StreamMIMO //!< May expose any number of sink and/or source streams }; ChannelAPI(const QString& name, StreamType streamType); diff --git a/sdrbase/device/deviceapi.h b/sdrbase/device/deviceapi.h index 1bd70cb1e..fe4a75337 100644 --- a/sdrbase/device/deviceapi.h +++ b/sdrbase/device/deviceapi.h @@ -46,7 +46,7 @@ public: { StreamSingleRx, //!< Exposes a single input stream that can be one of the streams of a physical device StreamSingleTx, //!< Exposes a single output stream that can be one of the streams of a physical device - StreamAny //!< May expose any number of input and/or output streams + StreamMIMO //!< May expose any number of input and/or output streams }; enum EngineState { diff --git a/sdrbase/plugin/plugininterface.h b/sdrbase/plugin/plugininterface.h index 7431662df..436b4a53b 100644 --- a/sdrbase/plugin/plugininterface.h +++ b/sdrbase/plugin/plugininterface.h @@ -42,7 +42,7 @@ public: { StreamSingleRx, //!< Exposes a single input stream that can be one of the streams of a physical device StreamSingleTx, //!< Exposes a single output stream that can be one of the streams of a physical device - StreamAny //!< May expose any number of input and/or output streams + StreamMIMO //!< May expose any number of input and/or output streams }; QString displayedName; //!< The human readable name diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 7c5e8ca37..b840b4e26 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -761,6 +761,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "Synchronous AM sidebands mode (DSB, USB, LSB)" }, + "streamIndex" : { + "type" : "integer", + "description" : "MIMO channel. Not relevant when connected to SI (single Rx)." + }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -25080,7 +25084,7 @@ except ApiException as e:
- Generated 2019-05-18T10:36:57.027+02:00 + Generated 2019-05-20T16:12:41.467+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml index 22aaa5aa4..506b9a28f 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml @@ -2,7 +2,7 @@ AMDemodSettings: description: AMDemod properties: inputFrequencyOffset: - description: channel center frequency shift from baseband center in Hz + description: channel center frequency shift from baseband center in Hz type: integer format: int64 rfBandwidth: @@ -33,6 +33,9 @@ AMDemodSettings: syncAMOperation: description: Synchronous AM sidebands mode (DSB, USB, LSB) type: integer + streamIndex: + description: MIMO channel. Not relevant when connected to SI (single Rx). + type: integer useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer @@ -41,9 +44,9 @@ AMDemodSettings: reverseAPIPort: type: integer reverseAPIDeviceIndex: - type: integer + type: integer reverseAPIChannelIndex: - type: integer + type: integer AMDemodReport: description: AMDemod @@ -59,4 +62,3 @@ AMDemodReport: type: integer channelSampleRate: type: integer - \ No newline at end of file diff --git a/sdrgui/device/deviceuiset.cpp b/sdrgui/device/deviceuiset.cpp index 6c16446e5..ac1084235 100644 --- a/sdrgui/device/deviceuiset.cpp +++ b/sdrgui/device/deviceuiset.cpp @@ -44,9 +44,10 @@ DeviceUISet::DeviceUISet(int tabIndex, int deviceType, QTimer& timer) m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum); m_channelWindow = new ChannelWindow; m_samplingDeviceControl = new SamplingDeviceControl(tabIndex, deviceType); - m_deviceSourceEngine = 0; - m_deviceAPI = 0; - m_deviceSinkEngine = 0; + m_deviceAPI = nullptr; + m_deviceSourceEngine = nullptr; + m_deviceSinkEngine = nullptr; + m_deviceMIMOEngine = nullptr; m_deviceTabIndex = tabIndex; m_nbAvailableRxChannels = 0; // updated at enumeration for UI selector m_nbAvailableTxChannels = 0; // updated at enumeration for UI selector diff --git a/sdrgui/gui/rollupwidget.cpp b/sdrgui/gui/rollupwidget.cpp index db65407fe..caa7a01c7 100644 --- a/sdrgui/gui/rollupwidget.cpp +++ b/sdrgui/gui/rollupwidget.cpp @@ -384,3 +384,9 @@ bool RollupWidget::eventFilter(QObject* object, QEvent* event) } return QWidget::eventFilter(object, event); } + +void RollupWidget::setStreamIndicator(const QString& indicator) +{ + m_streamIndicator = indicator; + update(); +} \ No newline at end of file diff --git a/sdrgui/gui/rollupwidget.h b/sdrgui/gui/rollupwidget.h index 01d1def56..6bfd96c07 100644 --- a/sdrgui/gui/rollupwidget.h +++ b/sdrgui/gui/rollupwidget.h @@ -48,6 +48,7 @@ protected: bool eventFilter(QObject* object, QEvent* event); void resetContextMenuType() { m_contextMenuType = ContextMenuNone; } + void setStreamIndicator(const QString& indicator); }; #endif // INCLUDE_ROLLUPWIDGET_H diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index f2f6a1c99..a53f2a2c0 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -421,7 +421,7 @@ void MainWindow::addMIMODevice() char tabNameCStr[16]; sprintf(tabNameCStr, "M%d", deviceTabIndex); - DeviceAPI *deviceAPI = new DeviceAPI(DeviceAPI::StreamSingleTx, deviceTabIndex, nullptr, nullptr, dspDeviceMIMOEngine); + DeviceAPI *deviceAPI = new DeviceAPI(DeviceAPI::StreamMIMO, deviceTabIndex, nullptr, nullptr, dspDeviceMIMOEngine); m_deviceUIs.back()->m_deviceAPI = deviceAPI; m_deviceUIs.back()->m_samplingDeviceControl->setPluginManager(m_pluginManager); diff --git a/sdrsrv/device/deviceset.cpp b/sdrsrv/device/deviceset.cpp index 62885bd63..d4c58a52b 100644 --- a/sdrsrv/device/deviceset.cpp +++ b/sdrsrv/device/deviceset.cpp @@ -50,10 +50,10 @@ DeviceSet::ChannelInstanceRegistration::ChannelInstanceRegistration(const QStrin DeviceSet::DeviceSet(int tabIndex) { - m_deviceAPI = 0; - m_deviceSourceEngine = 0; - m_deviceSinkEngine = 0; - m_deviceMIMOEngine = 0; + m_deviceAPI = nullptr; + m_deviceSourceEngine = nullptr; + m_deviceSinkEngine = nullptr; + m_deviceMIMOEngine = nullptr; m_deviceTabIndex = tabIndex; } diff --git a/swagger/sdrangel/api/swagger/include/AMDemod.yaml b/swagger/sdrangel/api/swagger/include/AMDemod.yaml index 22aaa5aa4..506b9a28f 100644 --- a/swagger/sdrangel/api/swagger/include/AMDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/AMDemod.yaml @@ -2,7 +2,7 @@ AMDemodSettings: description: AMDemod properties: inputFrequencyOffset: - description: channel center frequency shift from baseband center in Hz + description: channel center frequency shift from baseband center in Hz type: integer format: int64 rfBandwidth: @@ -33,6 +33,9 @@ AMDemodSettings: syncAMOperation: description: Synchronous AM sidebands mode (DSB, USB, LSB) type: integer + streamIndex: + description: MIMO channel. Not relevant when connected to SI (single Rx). + type: integer useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer @@ -41,9 +44,9 @@ AMDemodSettings: reverseAPIPort: type: integer reverseAPIDeviceIndex: - type: integer + type: integer reverseAPIChannelIndex: - type: integer + type: integer AMDemodReport: description: AMDemod @@ -59,4 +62,3 @@ AMDemodReport: type: integer channelSampleRate: type: integer - \ No newline at end of file diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 7c5e8ca37..b840b4e26 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -761,6 +761,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "Synchronous AM sidebands mode (DSB, USB, LSB)" }, + "streamIndex" : { + "type" : "integer", + "description" : "MIMO channel. Not relevant when connected to SI (single Rx)." + }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -25080,7 +25084,7 @@ except ApiException as e:
- Generated 2019-05-18T10:36:57.027+02:00 + Generated 2019-05-20T16:12:41.467+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp index 2a64d5271..7f5a12ffa 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp @@ -50,6 +50,8 @@ SWGAMDemodSettings::SWGAMDemodSettings() { m_pll_isSet = false; sync_am_operation = 0; m_sync_am_operation_isSet = false; + stream_index = 0; + m_stream_index_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = nullptr; @@ -90,6 +92,8 @@ SWGAMDemodSettings::init() { m_pll_isSet = false; sync_am_operation = 0; m_sync_am_operation_isSet = false; + stream_index = 0; + m_stream_index_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = new QString(""); @@ -120,6 +124,7 @@ SWGAMDemodSettings::cleanup() { + if(reverse_api_address != nullptr) { delete reverse_api_address; } @@ -161,6 +166,8 @@ SWGAMDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&sync_am_operation, pJson["syncAMOperation"], "qint32", ""); + ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", ""); ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString"); @@ -220,6 +227,9 @@ SWGAMDemodSettings::asJsonObject() { if(m_sync_am_operation_isSet){ obj->insert("syncAMOperation", QJsonValue(sync_am_operation)); } + if(m_stream_index_isSet){ + obj->insert("streamIndex", QJsonValue(stream_index)); + } if(m_use_reverse_api_isSet){ obj->insert("useReverseAPI", QJsonValue(use_reverse_api)); } @@ -349,6 +359,16 @@ SWGAMDemodSettings::setSyncAmOperation(qint32 sync_am_operation) { this->m_sync_am_operation_isSet = true; } +qint32 +SWGAMDemodSettings::getStreamIndex() { + return stream_index; +} +void +SWGAMDemodSettings::setStreamIndex(qint32 stream_index) { + this->stream_index = stream_index; + this->m_stream_index_isSet = true; +} + qint32 SWGAMDemodSettings::getUseReverseApi() { return use_reverse_api; @@ -415,6 +435,7 @@ SWGAMDemodSettings::isSet(){ if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;} if(m_pll_isSet){ isObjectUpdated = true; break;} if(m_sync_am_operation_isSet){ isObjectUpdated = true; break;} + if(m_stream_index_isSet){ isObjectUpdated = true; break;} if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;} if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;} if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;} diff --git a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h index b238eb1d2..8d194bbf3 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h @@ -75,6 +75,9 @@ public: qint32 getSyncAmOperation(); void setSyncAmOperation(qint32 sync_am_operation); + qint32 getStreamIndex(); + void setStreamIndex(qint32 stream_index); + qint32 getUseReverseApi(); void setUseReverseApi(qint32 use_reverse_api); @@ -127,6 +130,9 @@ private: qint32 sync_am_operation; bool m_sync_am_operation_isSet; + qint32 stream_index; + bool m_stream_index_isSet; + qint32 use_reverse_api; bool m_use_reverse_api_isSet;