1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-24 11:12:27 -04:00

MIMO: AM demod: implemented stream index (except dialog and apply setting)

This commit is contained in:
f4exb 2019-05-20 16:31:15 +02:00
parent 1e881d0b2f
commit e62e187931
20 changed files with 101 additions and 22 deletions

View File

@ -436,6 +436,7 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
<< " m_audioDeviceName: " << settings.m_audioDeviceName << " m_audioDeviceName: " << settings.m_audioDeviceName
<< " m_pll: " << settings.m_pll << " m_pll: " << settings.m_pll
<< " m_syncAMOperation: " << (int) settings.m_syncAMOperation << " m_syncAMOperation: " << (int) settings.m_syncAMOperation
<< " m_streamIndex: " << settings.m_streamIndex
<< " 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
@ -520,6 +521,10 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
reverseAPIKeys.append("volume"); reverseAPIKeys.append("volume");
} }
if ((m_settings.m_streamIndex != settings.m_streamIndex) || force) {
reverseAPIKeys.append("streamIndex");
}
if (settings.m_useReverseAPI) if (settings.m_useReverseAPI)
{ {
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && 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; AMDemodSettings::SyncAMLSB : (AMDemodSettings::SyncAMOperation) syncAMOperationCode;
} }
if (channelSettingsKeys.contains("streamIndex")) {
settings.m_streamIndex = response.getAmDemodSettings()->getStreamIndex();
}
if (channelSettingsKeys.contains("useReverseAPI")) { if (channelSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getAmDemodSettings()->getUseReverseApi() != 0; 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()->setPll(settings.m_pll ? 1 : 0);
response.getAmDemodSettings()->setSyncAmOperation((int) m_settings.m_syncAMOperation); response.getAmDemodSettings()->setSyncAmOperation((int) m_settings.m_syncAMOperation);
response.getAmDemodSettings()->setStreamIndex(m_settings.m_streamIndex);
response.getAmDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); response.getAmDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getAmDemodSettings()->getReverseApiAddress()) { if (response.getAmDemodSettings()->getReverseApiAddress()) {
@ -760,6 +769,9 @@ void AMDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, con
if (channelSettingsKeys.contains("syncAMOperation") || force) { if (channelSettingsKeys.contains("syncAMOperation") || force) {
swgAMDemodSettings->setSyncAmOperation((int) settings.m_syncAMOperation); 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") QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
.arg(settings.m_reverseAPIAddress) .arg(settings.m_reverseAPIAddress)

View File

@ -230,6 +230,10 @@ void AMDemodGUI::onMenuDialogCalled(const QPoint &p)
applySettings(); applySettings();
} }
else if ((m_contextMenuType == ContextMenuStreamSettings) && (m_deviceUISet->m_deviceMIMOEngine))
{
// TODO: open select MIMO channel dialog
}
resetContextMenuType(); resetContextMenuType();
} }
@ -379,9 +383,20 @@ void AMDemodGUI::displaySettings()
ui->ssb->setIcon(m_iconDSBUSB); ui->ssb->setIcon(m_iconDSBUSB);
} }
displayStreamIndex();
blockApplySettings(false); 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*) void AMDemodGUI::leaveEvent(QEvent*)
{ {
m_channelMarker.setHighlighted(false); m_channelMarker.setHighlighted(false);

View File

@ -65,6 +65,7 @@ private:
void blockApplySettings(bool block); void blockApplySettings(bool block);
void applySettings(bool force = false); void applySettings(bool force = false);
void displaySettings(); void displaySettings();
void displayStreamIndex();
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(QEvent*); void enterEvent(QEvent*);

View File

@ -41,6 +41,7 @@ void AMDemodSettings::resetToDefaults()
m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName;
m_pll = false; m_pll = false;
m_syncAMOperation = SyncAMDSB; m_syncAMOperation = SyncAMDSB;
m_streamIndex = 0;
m_useReverseAPI = false; m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888; m_reverseAPIPort = 8888;
@ -53,6 +54,7 @@ QByteArray AMDemodSettings::serialize() const
SimpleSerializer s(1); SimpleSerializer s(1);
s.writeS32(1, m_inputFrequencyOffset); s.writeS32(1, m_inputFrequencyOffset);
s.writeS32(2, m_rfBandwidth/100); s.writeS32(2, m_rfBandwidth/100);
s.writeS32(3, m_streamIndex);
s.writeS32(4, m_volume*10); s.writeS32(4, m_volume*10);
s.writeS32(5, m_squelch); s.writeS32(5, m_squelch);
@ -95,6 +97,7 @@ bool AMDemodSettings::deserialize(const QByteArray& data)
d.readS32(1, &m_inputFrequencyOffset, 0); d.readS32(1, &m_inputFrequencyOffset, 0);
d.readS32(2, &tmp, 4); d.readS32(2, &tmp, 4);
m_rfBandwidth = 100 * tmp; m_rfBandwidth = 100 * tmp;
d.readS32(3, &m_streamIndex, 0);
d.readS32(4, &tmp, 20); d.readS32(4, &tmp, 20);
m_volume = tmp * 0.1; m_volume = tmp * 0.1;
d.readS32(5, &tmp, -40); d.readS32(5, &tmp, -40);

View File

@ -43,6 +43,7 @@ struct AMDemodSettings
QString m_audioDeviceName; QString m_audioDeviceName;
bool m_pll; bool m_pll;
SyncAMOperation m_syncAMOperation; SyncAMOperation m_syncAMOperation;
int m_streamIndex; //!< MIMO channel. Not relevant when connected to SI (single Rx).
bool m_useReverseAPI; bool m_useReverseAPI;
QString m_reverseAPIAddress; QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort; uint16_t m_reverseAPIPort;

View File

@ -65,7 +65,7 @@ PluginInterface::SamplingDevices TestMIPlugin::enumSampleMIMO()
QString::null, QString::null,
0, 0,
PluginInterface::SamplingDevice::BuiltInDevice, PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamAny, PluginInterface::SamplingDevice::StreamMIMO,
1, 1,
0)); 0));

View File

@ -40,7 +40,7 @@ public:
{ {
StreamSingleSink, //!< Exposes a single sink stream (input, Rx) StreamSingleSink, //!< Exposes a single sink stream (input, Rx)
StreamSingleSource, //!< Exposes a single source stream (output, Tx) 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); ChannelAPI(const QString& name, StreamType streamType);

View File

@ -46,7 +46,7 @@ public:
{ {
StreamSingleRx, //!< Exposes a single input stream that can be one of the streams of a physical device 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 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 { enum EngineState {

View File

@ -42,7 +42,7 @@ public:
{ {
StreamSingleRx, //!< Exposes a single input stream that can be one of the streams of a physical device 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 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 QString displayedName; //!< The human readable name

View File

@ -761,6 +761,10 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "Synchronous AM sidebands mode (DSB, USB, LSB)" "description" : "Synchronous AM sidebands mode (DSB, USB, LSB)"
}, },
"streamIndex" : {
"type" : "integer",
"description" : "MIMO channel. Not relevant when connected to SI (single Rx)."
},
"useReverseAPI" : { "useReverseAPI" : {
"type" : "integer", "type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)" "description" : "Synchronize with reverse API (1 for yes, 0 for no)"
@ -25080,7 +25084,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2019-05-18T10:36:57.027+02:00 Generated 2019-05-20T16:12:41.467+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@ AMDemodSettings:
description: AMDemod description: AMDemod
properties: properties:
inputFrequencyOffset: inputFrequencyOffset:
description: channel center frequency shift from baseband center in Hz description: channel center frequency shift from baseband center in Hz
type: integer type: integer
format: int64 format: int64
rfBandwidth: rfBandwidth:
@ -33,6 +33,9 @@ AMDemodSettings:
syncAMOperation: syncAMOperation:
description: Synchronous AM sidebands mode (DSB, USB, LSB) description: Synchronous AM sidebands mode (DSB, USB, LSB)
type: integer type: integer
streamIndex:
description: MIMO channel. Not relevant when connected to SI (single Rx).
type: integer
useReverseAPI: useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no) description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer type: integer
@ -41,9 +44,9 @@ AMDemodSettings:
reverseAPIPort: reverseAPIPort:
type: integer type: integer
reverseAPIDeviceIndex: reverseAPIDeviceIndex:
type: integer type: integer
reverseAPIChannelIndex: reverseAPIChannelIndex:
type: integer type: integer
AMDemodReport: AMDemodReport:
description: AMDemod description: AMDemod
@ -59,4 +62,3 @@ AMDemodReport:
type: integer type: integer
channelSampleRate: channelSampleRate:
type: integer type: integer

View File

@ -44,9 +44,10 @@ DeviceUISet::DeviceUISet(int tabIndex, int deviceType, QTimer& timer)
m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum); m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow; m_channelWindow = new ChannelWindow;
m_samplingDeviceControl = new SamplingDeviceControl(tabIndex, deviceType); m_samplingDeviceControl = new SamplingDeviceControl(tabIndex, deviceType);
m_deviceSourceEngine = 0; m_deviceAPI = nullptr;
m_deviceAPI = 0; m_deviceSourceEngine = nullptr;
m_deviceSinkEngine = 0; m_deviceSinkEngine = nullptr;
m_deviceMIMOEngine = nullptr;
m_deviceTabIndex = tabIndex; m_deviceTabIndex = tabIndex;
m_nbAvailableRxChannels = 0; // updated at enumeration for UI selector m_nbAvailableRxChannels = 0; // updated at enumeration for UI selector
m_nbAvailableTxChannels = 0; // updated at enumeration for UI selector m_nbAvailableTxChannels = 0; // updated at enumeration for UI selector

View File

@ -384,3 +384,9 @@ bool RollupWidget::eventFilter(QObject* object, QEvent* event)
} }
return QWidget::eventFilter(object, event); return QWidget::eventFilter(object, event);
} }
void RollupWidget::setStreamIndicator(const QString& indicator)
{
m_streamIndicator = indicator;
update();
}

View File

@ -48,6 +48,7 @@ protected:
bool eventFilter(QObject* object, QEvent* event); bool eventFilter(QObject* object, QEvent* event);
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; } void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
void setStreamIndicator(const QString& indicator);
}; };
#endif // INCLUDE_ROLLUPWIDGET_H #endif // INCLUDE_ROLLUPWIDGET_H

View File

@ -421,7 +421,7 @@ void MainWindow::addMIMODevice()
char tabNameCStr[16]; char tabNameCStr[16];
sprintf(tabNameCStr, "M%d", deviceTabIndex); 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_deviceAPI = deviceAPI;
m_deviceUIs.back()->m_samplingDeviceControl->setPluginManager(m_pluginManager); m_deviceUIs.back()->m_samplingDeviceControl->setPluginManager(m_pluginManager);

View File

@ -50,10 +50,10 @@ DeviceSet::ChannelInstanceRegistration::ChannelInstanceRegistration(const QStrin
DeviceSet::DeviceSet(int tabIndex) DeviceSet::DeviceSet(int tabIndex)
{ {
m_deviceAPI = 0; m_deviceAPI = nullptr;
m_deviceSourceEngine = 0; m_deviceSourceEngine = nullptr;
m_deviceSinkEngine = 0; m_deviceSinkEngine = nullptr;
m_deviceMIMOEngine = 0; m_deviceMIMOEngine = nullptr;
m_deviceTabIndex = tabIndex; m_deviceTabIndex = tabIndex;
} }

View File

@ -2,7 +2,7 @@ AMDemodSettings:
description: AMDemod description: AMDemod
properties: properties:
inputFrequencyOffset: inputFrequencyOffset:
description: channel center frequency shift from baseband center in Hz description: channel center frequency shift from baseband center in Hz
type: integer type: integer
format: int64 format: int64
rfBandwidth: rfBandwidth:
@ -33,6 +33,9 @@ AMDemodSettings:
syncAMOperation: syncAMOperation:
description: Synchronous AM sidebands mode (DSB, USB, LSB) description: Synchronous AM sidebands mode (DSB, USB, LSB)
type: integer type: integer
streamIndex:
description: MIMO channel. Not relevant when connected to SI (single Rx).
type: integer
useReverseAPI: useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no) description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer type: integer
@ -41,9 +44,9 @@ AMDemodSettings:
reverseAPIPort: reverseAPIPort:
type: integer type: integer
reverseAPIDeviceIndex: reverseAPIDeviceIndex:
type: integer type: integer
reverseAPIChannelIndex: reverseAPIChannelIndex:
type: integer type: integer
AMDemodReport: AMDemodReport:
description: AMDemod description: AMDemod
@ -59,4 +62,3 @@ AMDemodReport:
type: integer type: integer
channelSampleRate: channelSampleRate:
type: integer type: integer

View File

@ -761,6 +761,10 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "Synchronous AM sidebands mode (DSB, USB, LSB)" "description" : "Synchronous AM sidebands mode (DSB, USB, LSB)"
}, },
"streamIndex" : {
"type" : "integer",
"description" : "MIMO channel. Not relevant when connected to SI (single Rx)."
},
"useReverseAPI" : { "useReverseAPI" : {
"type" : "integer", "type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)" "description" : "Synchronize with reverse API (1 for yes, 0 for no)"
@ -25080,7 +25084,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2019-05-18T10:36:57.027+02:00 Generated 2019-05-20T16:12:41.467+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -50,6 +50,8 @@ SWGAMDemodSettings::SWGAMDemodSettings() {
m_pll_isSet = false; m_pll_isSet = false;
sync_am_operation = 0; sync_am_operation = 0;
m_sync_am_operation_isSet = false; m_sync_am_operation_isSet = false;
stream_index = 0;
m_stream_index_isSet = false;
use_reverse_api = 0; use_reverse_api = 0;
m_use_reverse_api_isSet = false; m_use_reverse_api_isSet = false;
reverse_api_address = nullptr; reverse_api_address = nullptr;
@ -90,6 +92,8 @@ SWGAMDemodSettings::init() {
m_pll_isSet = false; m_pll_isSet = false;
sync_am_operation = 0; sync_am_operation = 0;
m_sync_am_operation_isSet = false; m_sync_am_operation_isSet = false;
stream_index = 0;
m_stream_index_isSet = false;
use_reverse_api = 0; use_reverse_api = 0;
m_use_reverse_api_isSet = false; m_use_reverse_api_isSet = false;
reverse_api_address = new QString(""); reverse_api_address = new QString("");
@ -120,6 +124,7 @@ SWGAMDemodSettings::cleanup() {
if(reverse_api_address != nullptr) { if(reverse_api_address != nullptr) {
delete reverse_api_address; delete reverse_api_address;
} }
@ -161,6 +166,8 @@ SWGAMDemodSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sync_am_operation, pJson["syncAMOperation"], "qint32", ""); ::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(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString"); ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
@ -220,6 +227,9 @@ SWGAMDemodSettings::asJsonObject() {
if(m_sync_am_operation_isSet){ if(m_sync_am_operation_isSet){
obj->insert("syncAMOperation", QJsonValue(sync_am_operation)); obj->insert("syncAMOperation", QJsonValue(sync_am_operation));
} }
if(m_stream_index_isSet){
obj->insert("streamIndex", QJsonValue(stream_index));
}
if(m_use_reverse_api_isSet){ if(m_use_reverse_api_isSet){
obj->insert("useReverseAPI", QJsonValue(use_reverse_api)); obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
} }
@ -349,6 +359,16 @@ SWGAMDemodSettings::setSyncAmOperation(qint32 sync_am_operation) {
this->m_sync_am_operation_isSet = true; 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 qint32
SWGAMDemodSettings::getUseReverseApi() { SWGAMDemodSettings::getUseReverseApi() {
return use_reverse_api; return use_reverse_api;
@ -415,6 +435,7 @@ SWGAMDemodSettings::isSet(){
if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;} if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
if(m_pll_isSet){ isObjectUpdated = true; break;} if(m_pll_isSet){ isObjectUpdated = true; break;}
if(m_sync_am_operation_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(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;} if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;} if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}

View File

@ -75,6 +75,9 @@ public:
qint32 getSyncAmOperation(); qint32 getSyncAmOperation();
void setSyncAmOperation(qint32 sync_am_operation); void setSyncAmOperation(qint32 sync_am_operation);
qint32 getStreamIndex();
void setStreamIndex(qint32 stream_index);
qint32 getUseReverseApi(); qint32 getUseReverseApi();
void setUseReverseApi(qint32 use_reverse_api); void setUseReverseApi(qint32 use_reverse_api);
@ -127,6 +130,9 @@ private:
qint32 sync_am_operation; qint32 sync_am_operation;
bool m_sync_am_operation_isSet; bool m_sync_am_operation_isSet;
qint32 stream_index;
bool m_stream_index_isSet;
qint32 use_reverse_api; qint32 use_reverse_api;
bool m_use_reverse_api_isSet; bool m_use_reverse_api_isSet;