mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 13:11:20 -05:00 
			
		
		
		
	MIMO activation in Main Server
This commit is contained in:
		
							parent
							
								
									0f6e157599
								
							
						
					
					
						commit
						25acf953a7
					
				@ -72,8 +72,6 @@ MainServer::MainServer(qtwebapp::LoggerWithFile *logger, const MainParser& parse
 | 
				
			|||||||
    m_apiAdapter = new WebAPIAdapter();
 | 
					    m_apiAdapter = new WebAPIAdapter();
 | 
				
			||||||
    m_requestMapper = new WebAPIRequestMapper(this);
 | 
					    m_requestMapper = new WebAPIRequestMapper(this);
 | 
				
			||||||
    m_requestMapper->setAdapter(m_apiAdapter);
 | 
					    m_requestMapper->setAdapter(m_apiAdapter);
 | 
				
			||||||
    m_apiHost = parser.getServerAddress();
 | 
					 | 
				
			||||||
    m_apiPort = parser.getServerPort();
 | 
					 | 
				
			||||||
    m_apiServer = new WebAPIServer(parser.getServerAddress(), parser.getServerPort(), m_requestMapper);
 | 
					    m_apiServer = new WebAPIServer(parser.getServerAddress(), parser.getServerPort(), m_requestMapper);
 | 
				
			||||||
    m_apiServer->start();
 | 
					    m_apiServer->start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -164,6 +162,8 @@ bool MainServer::handleMessage(const Message& cmd)
 | 
				
			|||||||
            addSinkDevice();
 | 
					            addSinkDevice();
 | 
				
			||||||
        } else if (direction == 0) { // Single stream Rx
 | 
					        } else if (direction == 0) { // Single stream Rx
 | 
				
			||||||
            addSourceDevice();
 | 
					            addSourceDevice();
 | 
				
			||||||
 | 
					        }  else if (direction == 2) { // MIMO
 | 
				
			||||||
 | 
					            addMIMODevice();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
@ -343,6 +343,49 @@ void MainServer::addSourceDevice()
 | 
				
			|||||||
    deviceAPI->setSampleSource(source);
 | 
					    deviceAPI->setSampleSource(source);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MainServer::addMIMODevice()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    DSPDeviceMIMOEngine *dspDeviceMIMOEngine = m_dspEngine->addDeviceMIMOEngine();
 | 
				
			||||||
 | 
					    dspDeviceMIMOEngine->start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    uint dspDeviceMIMOEngineUID =  dspDeviceMIMOEngine->getUID();
 | 
				
			||||||
 | 
					    char uidCStr[16];
 | 
				
			||||||
 | 
					    sprintf(uidCStr, "UID:%d", dspDeviceMIMOEngineUID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int deviceTabIndex = m_mainCore->m_deviceSets.size();
 | 
				
			||||||
 | 
					    m_mainCore->m_deviceSets.push_back(new DeviceSet(deviceTabIndex, 2));
 | 
				
			||||||
 | 
					    m_mainCore->m_deviceSets.back()->m_deviceSourceEngine = nullptr;
 | 
				
			||||||
 | 
					    m_mainCore->m_deviceSets.back()->m_deviceSinkEngine = nullptr;
 | 
				
			||||||
 | 
					    m_mainCore->m_deviceSets.back()->m_deviceMIMOEngine = dspDeviceMIMOEngine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    char tabNameCStr[16];
 | 
				
			||||||
 | 
					    sprintf(tabNameCStr, "M%d", deviceTabIndex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DeviceAPI *deviceAPI = new DeviceAPI(DeviceAPI::StreamMIMO, deviceTabIndex, nullptr, nullptr, dspDeviceMIMOEngine);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // create a test MIMO by default
 | 
				
			||||||
 | 
					    int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
 | 
				
			||||||
 | 
					    const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex);
 | 
				
			||||||
 | 
					    deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
 | 
				
			||||||
 | 
					    deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
 | 
				
			||||||
 | 
					    deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
 | 
				
			||||||
 | 
					    deviceAPI->setHardwareId(samplingDevice->hardwareId);
 | 
				
			||||||
 | 
					    deviceAPI->setSamplingDeviceId(samplingDevice->id);
 | 
				
			||||||
 | 
					    deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
 | 
				
			||||||
 | 
					    deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
 | 
				
			||||||
 | 
					    deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getMIMOPluginInterface(testMIMODeviceIndex));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (userArgs.size() > 0) {
 | 
				
			||||||
 | 
					        deviceAPI->setHardwareUserArguments(userArgs);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DeviceSampleMIMO *mimo = deviceAPI->getPluginInterface()->createSampleMIMOPluginInstance(
 | 
				
			||||||
 | 
					            deviceAPI->getSamplingDeviceId(), deviceAPI);
 | 
				
			||||||
 | 
					    m_mainCore->m_deviceSets.back()->m_deviceAPI->setSampleMIMO(mimo);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainServer::removeLastDevice()
 | 
					void MainServer::removeLastDevice()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (m_mainCore->m_deviceSets.back()->m_deviceSourceEngine) // source set
 | 
					    if (m_mainCore->m_deviceSets.back()->m_deviceSourceEngine) // source set
 | 
				
			||||||
@ -579,6 +622,21 @@ void MainServer::changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex)
 | 
				
			|||||||
        deviceSet->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
 | 
					        deviceSet->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
 | 
				
			||||||
        deviceSet->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getMIMOPluginInterface(selectedDeviceIndex));
 | 
					        deviceSet->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getMIMOPluginInterface(selectedDeviceIndex));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (deviceSet->m_deviceAPI->getSamplingDeviceId().size() == 0) // non existent device => replace by default
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            qDebug("MainServer::changeSampleMIMO: non existent device replaced by Test MIMO");
 | 
				
			||||||
 | 
					            int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
 | 
				
			||||||
 | 
					            const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
 | 
				
			||||||
 | 
					            deviceSet->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getMIMOPluginInterface(testMIMODeviceIndex));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
 | 
					        QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (userArgs.size() > 0) {
 | 
					        if (userArgs.size() > 0) {
 | 
				
			||||||
 | 
				
			|||||||
@ -59,6 +59,7 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    void addSourceDevice();
 | 
					    void addSourceDevice();
 | 
				
			||||||
    void addSinkDevice();
 | 
					    void addSinkDevice();
 | 
				
			||||||
 | 
					    void addMIMODevice();
 | 
				
			||||||
    void removeLastDevice();
 | 
					    void removeLastDevice();
 | 
				
			||||||
    void changeSampleSource(int deviceSetIndex, int selectedDeviceIndex);
 | 
					    void changeSampleSource(int deviceSetIndex, int selectedDeviceIndex);
 | 
				
			||||||
    void changeSampleSink(int deviceSetIndex, int selectedDeviceIndex);
 | 
					    void changeSampleSink(int deviceSetIndex, int selectedDeviceIndex);
 | 
				
			||||||
@ -68,9 +69,6 @@ public:
 | 
				
			|||||||
    void addFeature(int featureSetIndex, int featureIndex);
 | 
					    void addFeature(int featureSetIndex, int featureIndex);
 | 
				
			||||||
    void deleteFeature(int featureSetIndex, int featureIndex);
 | 
					    void deleteFeature(int featureSetIndex, int featureIndex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const QString& getAPIHost() const { return m_apiHost; }
 | 
					 | 
				
			||||||
    int getAPIPort() const { return m_apiPort; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
signals:
 | 
					signals:
 | 
				
			||||||
    void finished();
 | 
					    void finished();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -78,9 +76,6 @@ private:
 | 
				
			|||||||
    static MainServer *m_instance;
 | 
					    static MainServer *m_instance;
 | 
				
			||||||
    MainCore *m_mainCore;
 | 
					    MainCore *m_mainCore;
 | 
				
			||||||
    DSPEngine* m_dspEngine;
 | 
					    DSPEngine* m_dspEngine;
 | 
				
			||||||
    int m_lastEngineState;
 | 
					 | 
				
			||||||
	QString m_apiHost;
 | 
					 | 
				
			||||||
	int m_apiPort;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    MessageQueue m_inputMessageQueue;
 | 
					    MessageQueue m_inputMessageQueue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user