2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////////////////////////////////////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Copyright (C) 2016 Edouard Griffiths, F4EXB                                   //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//                                                                               //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// This program is free software; you can redistribute it and/or modify          //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// it under the terms of the GNU General Public License as published by          //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// the Free Software Foundation as version 3 of the License, or                  //
  
						 
					
						
							
								
									
										
										
										
											2019-04-11 14:43:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// (at your option) any later version.                                           //
  
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								//                                                                               //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// This program is distributed in the hope that it will be useful,               //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// but WITHOUT ANY WARRANTY; without even the implied warranty of                //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// GNU General Public License V3 for more details.                               //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//                                                                               //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// You should have received a copy of the GNU General Public License             //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// along with this program. If not, see <http://www.gnu.org/licenses/>.          //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////////////////////////////////////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QFont> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-19 06:13:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <algorithm> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "dsp/spectrumvis.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "dsp/dspdevicesourceengine.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "dsp/dspdevicesinkengine.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "gui/glspectrum.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/glspectrumgui.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/channelwindow.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-10-05 19:23:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "device/devicegui.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "device/deviceset.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "plugin/pluginapi.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "plugin/plugininterface.h" 
  
						 
					
						
							
								
									
										
										
										
											2019-08-02 01:58:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "channel/channelutils.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "channel/channelapi.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-10-04 06:16:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "channel/channelgui.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "settings/preset.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "deviceuiset.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-12 00:53:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DeviceUISet : : DeviceUISet ( int  tabIndex ,  DeviceSet  * deviceSet )  
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_spectrum  =  new  GLSpectrum ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-12 10:45:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_spectrumVis  =  deviceSet - > m_spectrumVis ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_spectrumVis - > setGLSpectrum ( m_spectrum ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_spectrumGUI  =  new  GLSpectrumGUI ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-01 02:33:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_spectrumGUI - > setBuddies ( m_spectrumVis ,  m_spectrum ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_channelWindow  =  new  ChannelWindow ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-20 16:31:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceAPI  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 06:58:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceGUI  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-20 16:31:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceSourceEngine  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceSinkEngine  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceMIMOEngine  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-01 20:06:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceTabIndex  =  tabIndex ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceSet  =  deviceSet ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-18 15:40:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_nbAvailableRxChannels  =  0 ;    // updated at enumeration for UI selector
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_nbAvailableTxChannels  =  0 ;    // updated at enumeration for UI selector
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_nbAvailableMIMOChannels  =  0 ;  // updated at enumeration for UI selector
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // m_spectrum needs to have its font to be set since it cannot be inherited from the main window
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QFont  font ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-06 17:51:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    font . setFamily ( QStringLiteral ( " Liberation Sans " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    font . setPointSize ( 9 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_spectrum - > setFont ( font ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DeviceUISet : : ~ DeviceUISet ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    delete  m_channelWindow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    delete  m_spectrumGUI ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    delete  m_spectrum ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-26 22:30:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : setSpectrumScalingFactor ( float  scalef )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2020-04-29 17:41:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_spectrumVis - > setScalef ( scalef ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-26 22:30:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 00:07:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : addChannelMarker ( ChannelMarker *  channelMarker )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_spectrum - > addChannelMarker ( channelMarker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  DeviceUISet : : addRollupWidget ( QWidget  * widget )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_channelWindow - > addRollupWidget ( widget ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : registerRxChannelInstance ( ChannelAPI  * channelAPI ,  ChannelGUI *  channelGUI )  
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_channelInstanceRegistrations . append ( ChannelInstanceRegistration ( channelAPI ,  channelGUI ,  0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceSet - > addChannelInstance ( channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QObject : : connect ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        channelGUI , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        & ChannelGUI : : closing , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [ = ] ( ) {  this - > handleChannelGUIClosing ( channelGUI ) ;  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        Qt : : QueuedConnection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : registerTxChannelInstance ( ChannelAPI  * channelAPI ,  ChannelGUI *  channelGUI )  
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_channelInstanceRegistrations . append ( ChannelInstanceRegistration ( channelAPI ,  channelGUI ,  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceSet - > addChannelInstance ( channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QObject : : connect ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        channelGUI , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        & ChannelGUI : : closing , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [ = ] ( ) {  this - > handleChannelGUIClosing ( channelGUI ) ;  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        Qt : : QueuedConnection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : registerChannelInstance ( ChannelAPI  * channelAPI ,  ChannelGUI *  channelGUI )  
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_channelInstanceRegistrations . append ( ChannelInstanceRegistration (  channelAPI ,  channelGUI ,  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceSet - > addChannelInstance ( channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QObject : : connect ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        channelGUI , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        & ChannelGUI : : closing , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [ = ] ( ) {  this - > handleChannelGUIClosing ( channelGUI ) ;  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        Qt : : QueuedConnection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : freeChannels ( )  
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::freeChannels: destroying channel [%s] " ,  qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations [ i ] . m_channelAPI - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-21 12:28:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations [ i ] . m_gui - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-17 13:45:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_channelInstanceRegistrations . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceSet - > clearChannels ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : deleteChannel ( int  channelIndex )  
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ( channelIndex  > =  0 )  & &  ( channelIndex  <  m_channelInstanceRegistrations . count ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::deleteChannel: delete channel [%s] at %d " , 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                qPrintable ( m_channelInstanceRegistrations [ channelIndex ] . m_channelAPI - > getURI ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                channelIndex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations [ channelIndex ] . m_channelAPI - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-21 12:28:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations [ channelIndex ] . m_gui - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-17 13:45:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations . removeAt ( channelIndex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceSet - > removeChannelInstanceAt ( channelIndex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 23:41:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : loadRxChannelSettings ( const  Preset  * preset ,  PluginAPI  * pluginAPI )  
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( preset - > isSourcePreset ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadRxChannelSettings: Loading preset [%s | %s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Available channel plugins
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        PluginAPI : : ChannelRegistrations  * channelRegistrations  =  pluginAPI - > getRxChannelRegistrations ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // clear list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qDebug ( " DeviceUISet::loadRxChannelSettings: destroying old channel [%s] " , 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-08 22:29:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_channelAPI - > setMessageQueueToGUI ( nullptr ) ;  // have channel stop sending messages to its GUI
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_channelAPI - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-21 12:28:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_gui - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_deviceSet - > clearChannels ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadRxChannelSettings: %d channel(s) in preset " ,  preset - > getChannelCount ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( int  i  =  0 ;  i  <  preset - > getChannelCount ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  Preset : : ChannelConfig &  channelConfig  =  preset - > getChannelConfig ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 06:16:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ChannelGUI  * rxChannelGUI  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            // create channel instance
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            for ( int  i  =  0 ;  i  <  channelRegistrations - > count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-30 11:49:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                //if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-04 20:24:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                if  ( ChannelUtils : : compareChannelURIs ( ( * channelRegistrations ) [ i ] . m_channelIdURI ,  channelConfig . m_channelIdURI ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-30 11:49:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    qDebug ( " DeviceUISet::loadRxChannelSettings: creating new channel [%s] from config [%s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            qPrintable ( ( * channelRegistrations ) [ i ] . m_channelIdURI ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            qPrintable ( channelConfig . m_channelIdURI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 03:09:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ChannelAPI  * channelAPI ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 22:47:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    BasebandSampleSink  * rxChannel ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 03:09:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ( * channelRegistrations ) [ i ] . m_plugin - > createRxChannel ( m_deviceAPI ,  & rxChannel ,  & channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    rxChannelGUI  =  ( * channelRegistrations ) [ i ] . m_plugin - > createRxChannelGUI ( this ,  rxChannel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    registerRxChannelInstance ( channelAPI ,  rxChannelGUI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    QObject : : connect ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        rxChannelGUI , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        & ChannelGUI : : closing , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        [ = ] ( ) {  this - > handleChannelGUIClosing ( rxChannelGUI ) ;  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        Qt : : QueuedConnection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( rxChannelGUI ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                qDebug ( " DeviceUISet::loadRxChannelSettings: deserializing channel [%s] " ,  qPrintable ( channelConfig . m_channelIdURI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                rxChannelGUI - > deserialize ( channelConfig . m_config ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadRxChannelSettings: Loading preset [%s | %s] not a source preset " ,  qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : saveRxChannelSettings ( Preset  * preset )  
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( preset - > isSourcePreset ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-19 06:13:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        std : : sort ( m_channelInstanceRegistrations . begin ( ) ,  m_channelInstanceRegistrations . end ( ) ) ;  // sort by increasing delta frequency and type
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qDebug ( " DeviceUISet::saveRxChannelSettings: saving channel [%s] " ,  qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            preset - > addChannel ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ,  m_channelInstanceRegistrations [ i ] . m_gui - > serialize ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::saveRxChannelSettings: not a source preset " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : loadTxChannelSettings ( const  Preset  * preset ,  PluginAPI  * pluginAPI )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( preset - > isSinkPreset ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadTxChannelSettings: Loading preset [%s | %s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Available channel plugins
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        PluginAPI : : ChannelRegistrations  * channelRegistrations  =  pluginAPI - > getTxChannelRegistrations ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        //  clear list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qDebug ( " DeviceUISet::loadTxChannelSettings: destroying old channel [%s] " , 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-08 22:29:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_channelAPI - > setMessageQueueToGUI ( nullptr ) ;  // have channel stop sending messages to its GUI
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_channelAPI - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-21 12:28:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_gui - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_deviceSet - > clearChannels ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadTxChannelSettings: %d channel(s) in preset " ,  preset - > getChannelCount ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for ( int  i  =  0 ;  i  <  preset - > getChannelCount ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  Preset : : ChannelConfig &  channelConfig  =  preset - > getChannelConfig ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 06:16:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ChannelGUI  * txChannelGUI  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            // create channel instance
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            for ( int  i  =  0 ;  i  <  channelRegistrations - > count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-30 11:49:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                if  ( ( * channelRegistrations ) [ i ] . m_channelIdURI  = =  channelConfig . m_channelIdURI ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-30 11:49:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    qDebug ( " DeviceUISet::loadTxChannelSettings: creating new channel [%s] from config [%s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            qPrintable ( ( * channelRegistrations ) [ i ] . m_channelIdURI ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            qPrintable ( channelConfig . m_channelIdURI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 03:09:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ChannelAPI  * channelAPI ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 22:47:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    BasebandSampleSource  * txChannel ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 03:09:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ( * channelRegistrations ) [ i ] . m_plugin - > createTxChannel ( m_deviceAPI ,  & txChannel ,  & channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    txChannelGUI  =  ( * channelRegistrations ) [ i ] . m_plugin - > createTxChannelGUI ( this ,  txChannel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    registerTxChannelInstance ( channelAPI ,  txChannelGUI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    QObject : : connect ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        txChannelGUI , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        & ChannelGUI : : closing , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        [ = ] ( ) {  this - > handleChannelGUIClosing ( txChannelGUI ) ;  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        Qt : : QueuedConnection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if ( txChannelGUI ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                qDebug ( " DeviceUISet::loadTxChannelSettings: deserializing channel [%s] " ,  qPrintable ( channelConfig . m_channelIdURI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                txChannelGUI - > deserialize ( channelConfig . m_config ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadTxChannelSettings: Loading preset [%s | %s] not a sink preset " ,  qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  DeviceUISet : : saveTxChannelSettings ( Preset  * preset )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( preset - > isSinkPreset ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-19 06:13:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        std : : sort ( m_channelInstanceRegistrations . begin ( ) ,  m_channelInstanceRegistrations . end ( ) ) ;  // sort by increasing delta frequency and type
 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qDebug ( " DeviceUISet::saveTxChannelSettings: saving channel [%s] " ,  qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            preset - > addChannel ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ,  m_channelInstanceRegistrations [ i ] . m_gui - > serialize ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-16 10:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::saveTxChannelSettings: not a sink preset " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  DeviceUISet : : loadMIMOChannelSettings ( const  Preset  * preset ,  PluginAPI  * pluginAPI )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( preset - > isMIMOPreset ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadMIMOChannelSettings: Loading preset [%s | %s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Available channel plugins
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        PluginAPI : : ChannelRegistrations  * channelRegistrations  =  pluginAPI - > getMIMOChannelRegistrations ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // clear list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qDebug ( " DeviceUISet::loadMIMOChannelSettings: destroying old channel [%s] " , 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-21 12:28:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_channelAPI - > destroy ( ) ;  // stop channel before (issue #860)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations [ i ] . m_gui - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_channelInstanceRegistrations . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_deviceSet - > clearChannels ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadMIMOChannelSettings: %d channel(s) in preset " ,  preset - > getChannelCount ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( int  i  =  0 ;  i  <  preset - > getChannelCount ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  Preset : : ChannelConfig &  channelConfig  =  preset - > getChannelConfig ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 06:16:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ChannelGUI  * mimoChannelGUI  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // create channel instance
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for ( int  i  =  0 ;  i  <  channelRegistrations - > count ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                //if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( ChannelUtils : : compareChannelURIs ( ( * channelRegistrations ) [ i ] . m_channelIdURI ,  channelConfig . m_channelIdURI ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    qDebug ( " DeviceUISet::loadMIMOChannelSettings: creating new channel [%s] from config [%s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            qPrintable ( ( * channelRegistrations ) [ i ] . m_channelIdURI ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            qPrintable ( channelConfig . m_channelIdURI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 03:09:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ChannelAPI  * channelAPI ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 22:47:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    MIMOChannel  * mimoChannel ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 03:09:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ( * channelRegistrations ) [ i ] . m_plugin - > createMIMOChannel ( m_deviceAPI ,  & mimoChannel ,  & channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    mimoChannelGUI  =  ( * channelRegistrations ) [ i ] . m_plugin - > createMIMOChannelGUI ( this ,  mimoChannel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 03:09:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ( * channelRegistrations ) [ i ] . m_plugin - > createMIMOChannel ( m_deviceAPI ,  & mimoChannel ,  & channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    registerChannelInstance ( channelAPI ,  mimoChannelGUI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    QObject : : connect ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        mimoChannelGUI , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        & ChannelGUI : : closing , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        [ = ] ( ) {  this - > handleChannelGUIClosing ( mimoChannelGUI ) ;  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        Qt : : QueuedConnection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( mimoChannelGUI ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                qDebug ( " DeviceUISet::loadMIMOChannelSettings: deserializing channel [%s] " ,  qPrintable ( channelConfig . m_channelIdURI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 05:16:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                mimoChannelGUI - > deserialize ( channelConfig . m_config ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::loadMIMOChannelSettings: Loading preset [%s | %s] not a MIMO preset " ,  qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  DeviceUISet : : saveMIMOChannelSettings ( Preset  * preset )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( preset - > isMIMOPreset ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-19 06:13:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        std : : sort ( m_channelInstanceRegistrations . begin ( ) ,  m_channelInstanceRegistrations . end ( ) ) ;  // sort by increasing delta frequency and type
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 08:52:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qDebug ( " DeviceUISet::saveMIMOChannelSettings: saving channel [%s] " ,  qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            preset - > addChannel ( m_channelInstanceRegistrations [ i ] . m_channelAPI - > getURI ( ) ,  m_channelInstanceRegistrations [ i ] . m_gui - > serialize ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 13:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( " DeviceUISet::saveMIMOChannelSettings: not a MIMO preset " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 22:37:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// sort by increasing delta frequency and type (i.e. name)
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  DeviceUISet : : ChannelInstanceRegistration : : operator < ( const  ChannelInstanceRegistration &  other )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2020-10-03 11:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( m_channelAPI  & &  other . m_channelAPI ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 11:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( m_channelAPI - > getCenterFrequency ( )  = =  other . m_channelAPI - > getCenterFrequency ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 11:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  m_channelAPI - > getName ( )  <  other . m_channelAPI - > getName ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-03 11:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  m_channelAPI - > getCenterFrequency ( )  <  other . m_channelAPI - > getCenterFrequency ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-30 22:45:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-10-24 18:29:18 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DeviceUISet : : handleChannelGUIClosing ( ChannelGUI *  channelGUI )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( ChannelInstanceRegistrations : : iterator  it  =  m_channelInstanceRegistrations . begin ( ) ;  it  ! =  m_channelInstanceRegistrations . end ( ) ;  + + it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( it - > m_gui  = =  channelGUI ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-11 08:27:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_deviceSet - > removeChannelInstance ( it - > m_channelAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-04 19:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            it - > m_channelAPI - > destroy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            m_channelInstanceRegistrations . erase ( it ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-05 18:58:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  DeviceUISet : : webapiSpectrumSettingsGet ( SWGSDRangel : : SWGGLSpectrum &  response ,  QString &  errorMessage )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  m_spectrumVis - > webapiSpectrumSettingsGet ( response ,  errorMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 01:38:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  DeviceUISet : : webapiSpectrumSettingsPutPatch (  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  force , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QStringList &  spectrumSettingsKeys , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    SWGSDRangel : : SWGGLSpectrum &  response ,  // query + response
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QString &  errorMessage ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  m_spectrumVis - > webapiSpectrumSettingsPutPatch ( force ,  spectrumSettingsKeys ,  response ,  errorMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 18:58:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  DeviceUISet : : webapiSpectrumServerGet ( SWGSDRangel : : SWGSpectrumServer &  response ,  QString &  errorMessage )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  m_spectrumVis - > webapiSpectrumServerGet ( response ,  errorMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-06 01:38:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  DeviceUISet : : webapiSpectrumServerPost ( SWGSDRangel : : SWGSuccessResponse &  response ,  QString &  errorMessage )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  m_spectrumVis - > webapiSpectrumServerPost ( response ,  errorMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  DeviceUISet : : webapiSpectrumServerDelete ( SWGSDRangel : : SWGSuccessResponse &  response ,  QString &  errorMessage )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  m_spectrumVis - > webapiSpectrumServerDelete ( response ,  errorMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}