2016-05-16 01:12:55 +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                  //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								//                                                                               //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// 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/>.          //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								///////////////////////////////////////////////////////////////////////////////////
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-26 00:22:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <plugin/plugininstancegui.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "device/devicesourceapi.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "device/devicesinkapi.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-17 17:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "dsp/devicesamplesource.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "plugin/pluginapi.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "plugin/plugininterface.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 03:21:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "gui/glspectrum.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "gui/channelwindow.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:02:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "mainwindow.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "settings/preset.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:02:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 13:34:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// TODO: extract GUI dependencies in a separate object
 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DeviceSourceAPI : : DeviceSourceAPI ( MainWindow  * mainWindow , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:02:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        int  deviceTabIndex , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        DSPDeviceSourceEngine  * deviceSourceEngine , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:02:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        GLSpectrum  * glSpectrum , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ChannelWindow  * channelWindow )  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_mainWindow ( mainWindow ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_deviceTabIndex ( deviceTabIndex ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine ( deviceSourceEngine ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 03:21:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_spectrum ( glSpectrum ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_channelWindow ( channelWindow ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sampleSourceSequence ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 01:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_pluginInterface ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 20:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_sampleSourcePluginInstanceUI ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-03 08:59:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_buddySharedPtr ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 13:34:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_isBuddyLeader ( false ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_masterTimer ( mainWindow - > getMasterTimer ( ) )  // TODO: get master timer directly not from main window
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DeviceSourceAPI : : ~ DeviceSourceAPI ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : addSink ( BasebandSampleSink  * sink ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > addSink ( sink ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : removeSink ( BasebandSampleSink *  sink ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > removeSink ( sink ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : addThreadedSink ( ThreadedBasebandSampleSink *  sink ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > addThreadedSink ( sink ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : removeThreadedSink ( ThreadedBasebandSampleSink *  sink ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > removeThreadedSink ( sink ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 08:45:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setSampleSource ( DeviceSampleSource *  source ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > setSource ( source ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 08:45:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DeviceSampleSource  * DeviceSourceAPI : : getSampleSource ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-05 13:57:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  m_deviceSourceEngine - > getSource ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  DeviceSourceAPI : : initAcquisition ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  m_deviceSourceEngine - > initAcquisition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  DeviceSourceAPI : : startAcquisition ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  m_deviceSourceEngine - > startAcquisition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : stopAcquisition ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > stopAcquistion ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DSPDeviceSourceEngine : : State  DeviceSourceAPI : : state ( )  const 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  m_deviceSourceEngine - > state ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QString  DeviceSourceAPI : : errorMessage ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  m_deviceSourceEngine - > errorMessage ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								uint  DeviceSourceAPI : : getDeviceUID ( )  const 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  m_deviceSourceEngine - > getUID ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-13 23:40:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								MessageQueue  * DeviceSourceAPI : : getDeviceEngineInputMessageQueue ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  m_deviceSourceEngine - > getInputMessageQueue ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-17 17:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								MessageQueue  * DeviceSourceAPI : : getSampleSourceInputMessageQueue ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-17 17:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  getSampleSource ( ) - > getInputMessageQueue ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-17 17:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								MessageQueue  * DeviceSourceAPI : : getSampleSourceGUIMessageQueue ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  getSampleSource ( ) - > getMessageQueueToGUI ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : configureCorrections ( bool  dcOffsetCorrection ,  bool  iqImbalanceCorrection ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > configureCorrections ( dcOffsetCorrection ,  iqImbalanceCorrection ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								GLSpectrum  * DeviceSourceAPI : : getSpectrum ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 01:12:55 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  m_spectrum ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 03:21:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : addChannelMarker ( ChannelMarker *  channelMarker ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 03:21:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_spectrum - > addChannelMarker ( channelMarker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								ChannelWindow  * DeviceSourceAPI : : getChannelWindow ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 03:21:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  m_channelWindow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : addRollupWidget ( QWidget  * widget ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 03:21:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_channelWindow - > addRollupWidget ( widget ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setHardwareId ( const  QString &  id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_hardwareId  =  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setSampleSourceId ( const  QString &  id ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sampleSourceId  =  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 08:23:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : resetSampleSourceId ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sampleSourceId . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setSampleSourceSerial ( const  QString &  serial ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sampleSourceSerial  =  serial ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 01:24:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setSampleSourceDisplayName ( const  QString &  name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sampleSourceDisplayName  =  name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setSampleSourceSequence ( int  sequence ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sampleSourceSequence  =  sequence ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_deviceSourceEngine - > setSourceSequence ( sequence ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 18:48:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setSampleSourcePluginInterface ( PluginInterface  * iface ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 01:30:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 18:48:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_pluginInterface  =  iface ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-15 01:30:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-26 00:22:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : setSampleSourcePluginInstanceGUI ( PluginInstanceGUI  * gui ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 20:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_sampleSourcePluginInstanceUI  =  gui ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-26 00:22:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : registerChannelInstance ( const  QString &  channelName ,  PluginInstanceGUI *  pluginGUI ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_channelInstanceRegistrations . append ( ChannelInstanceRegistration ( channelName ,  pluginGUI ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    renameChannelInstances ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-26 00:22:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : removeChannelInstance ( PluginInstanceGUI *  pluginGUI ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    for ( ChannelInstanceRegistrations : : iterator  it  =  m_channelInstanceRegistrations . begin ( ) ;  it  ! =  m_channelInstanceRegistrations . end ( ) ;  + + it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if ( it - > m_gui  = =  pluginGUI ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            m_channelInstanceRegistrations . erase ( it ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    renameChannelInstances ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : renameChannelInstances ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_channelInstanceRegistrations [ i ] . m_gui - > setName ( QString ( " %1:%2 " ) . arg ( m_channelInstanceRegistrations [ i ] . m_channelName ) . arg ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-16 10:45:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : freeChannels ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 21:51:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								//    while(!m_channelInstanceRegistrations.isEmpty())
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								//    {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								//        ChannelInstanceRegistration reg(m_channelInstanceRegistrations.takeLast());
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								//        reg.m_gui->destroy();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								//    }
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 21:51:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::freeAll: destroying channel [%s] " ,  qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelName ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 21:51:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_channelInstanceRegistrations [ i ] . m_gui - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 16:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : loadSourceSettings ( const  Preset *  preset ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( preset - > isSourcePreset ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::loadSourceSettings: Loading preset [%s | %s] " ,  qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 20:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( m_sampleSourcePluginInstanceUI  ! =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            const  QByteArray *  sourceConfig  =  preset - > findBestDeviceConfig ( m_sampleSourceId ,  m_sampleSourceSerial ,  m_sampleSourceSequence ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( sourceConfig  ! =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-10 23:38:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                qDebug ( " DeviceSourceAPI::loadSettings: deserializing source %s[%d]: %s " ,  qPrintable ( m_sampleSourceId ) ,  m_sampleSourceSequence ,  qPrintable ( m_sampleSourceSerial ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 20:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                m_sampleSourcePluginInstanceUI - > deserialize ( * sourceConfig ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-10 23:38:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                qDebug ( " DeviceSourceAPI::loadSettings: source %s[%d]: %s not found " ,  qPrintable ( m_sampleSourceId ) ,  m_sampleSourceSequence ,  qPrintable ( m_sampleSourceSerial ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qint64  centerFrequency  =  preset - > getCenterFrequency ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-10 23:38:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qDebug ( " DeviceSourceAPI::loadSettings: center frequency: %llu Hz " ,  centerFrequency ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 20:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            m_sampleSourcePluginInstanceUI - > setCenterFrequency ( centerFrequency ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::loadSourceSettings: Loading preset [%s | %s] is not a source preset \n " ,  qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : saveSourceSettings ( Preset *  preset ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( preset - > isSourcePreset ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 20:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( m_sampleSourcePluginInstanceUI  ! =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 20:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qDebug ( " DeviceSourceAPI::saveSourceSettings: %s saved " ,  qPrintable ( m_sampleSourcePluginInstanceUI - > getName ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            preset - > addOrUpdateDeviceConfig ( m_sampleSourceId ,  m_sampleSourceSerial ,  m_sampleSourceSequence ,  m_sampleSourcePluginInstanceUI - > serialize ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            preset - > setCenterFrequency ( m_sampleSourcePluginInstanceUI - > getCenterFrequency ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            qDebug ( " DeviceSourceAPI::saveSourceSettings: no source " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::saveSourceSettings: not a source preset " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : loadChannelSettings ( const  Preset  * preset ,  PluginAPI  * pluginAPI ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( preset - > isSourcePreset ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::loadChannelSettings: Loading preset [%s | %s] " ,  qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Available channel plugins
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        PluginAPI : : ChannelRegistrations  * channelRegistrations  =  pluginAPI - > getRxChannelRegistrations ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // copy currently open channels and clear list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ChannelInstanceRegistrations  openChannels  =  m_channelInstanceRegistrations ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_channelInstanceRegistrations . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::loadChannelSettings: %d channel(s) in preset " ,  preset - > getChannelCount ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        for ( int  i  =  0 ;  i  <  preset - > getChannelCount ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            const  Preset : : ChannelConfig &  channelConfig  =  preset - > getChannelConfig ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ChannelInstanceRegistration  reg ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            // if we have one instance available already, use it
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            for ( int  i  =  0 ;  i  <  openChannels . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                qDebug ( " DeviceSourceAPI::loadChannelSettings: channels compare [%s] vs [%s] " ,  qPrintable ( openChannels [ i ] . m_channelName ) ,  qPrintable ( channelConfig . m_channel ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                if ( openChannels [ i ] . m_channelName  = =  channelConfig . m_channel ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    qDebug ( " DeviceSourceAPI::loadChannelSettings: channel [%s] found " ,  qPrintable ( openChannels [ i ] . m_channelName ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    reg  =  openChannels . takeAt ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    m_channelInstanceRegistrations . append ( reg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            // if we haven't one already, create one
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if ( reg . m_gui  = =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                for ( int  i  =  0 ;  i  <  channelRegistrations - > count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    if ( ( * channelRegistrations ) [ i ] . m_channelName  = =  channelConfig . m_channel ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        qDebug ( " DeviceSourceAPI::loadChannelSettings: creating new channel [%s] " ,  qPrintable ( channelConfig . m_channel ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        reg  =  ChannelInstanceRegistration ( channelConfig . m_channel ,  ( * channelRegistrations ) [ i ] . m_plugin - > createRxChannel ( channelConfig . m_channel ,  this ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if ( reg . m_gui  ! =  NULL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                qDebug ( " DeviceSourceAPI::loadChannelSettings: deserializing channel [%s] " ,  qPrintable ( channelConfig . m_channel ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                reg . m_gui - > deserialize ( channelConfig . m_config ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // everything, that is still "available" is not needed anymore
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        for ( int  i  =  0 ;  i  <  openChannels . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qDebug ( " DeviceSourceAPI::loadChannelSettings: destroying spare channel [%s] " ,  qPrintable ( openChannels [ i ] . m_channelName ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            openChannels [ i ] . m_gui - > destroy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        renameChannelInstances ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-25 02:34:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::loadChannelSettings: Loading preset [%s | %s] not a source preset " ,  qPrintable ( preset - > getGroup ( ) ) ,  qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:53:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : saveChannelSettings ( Preset  * preset ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:34:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( preset - > isSourcePreset ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        qSort ( m_channelInstanceRegistrations . begin ( ) ,  m_channelInstanceRegistrations . end ( ) ) ;  // sort by increasing delta frequency and type
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:34:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        for ( int  i  =  0 ;  i  <  m_channelInstanceRegistrations . count ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qDebug ( " DeviceSourceAPI::saveChannelSettings: channel [%s] saved " ,  qPrintable ( m_channelInstanceRegistrations [ i ] . m_channelName ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 00:07:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            preset - > addChannel ( m_channelInstanceRegistrations [ i ] . m_channelName ,  m_channelInstanceRegistrations [ i ] . m_gui - > serialize ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:34:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qDebug ( " DeviceSourceAPI::saveChannelSettings: not a source preset " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 18:34:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// sort by increasing delta frequency and type (i.e. name)
 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  DeviceSourceAPI : : ChannelInstanceRegistration : : operator < ( const  ChannelInstanceRegistration &  other )  const 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 17:47:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( m_gui  & &  other . m_gui ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( m_gui - > getCenterFrequency ( )  = =  other . m_gui - > getCenterFrequency ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            return  m_gui - > getName ( )  <  other . m_gui - > getName ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            return  m_gui - > getCenterFrequency ( )  <  other . m_gui - > getCenterFrequency ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : addSourceBuddy ( DeviceSourceAPI *  buddy ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sourceBuddies . push_back ( buddy ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    buddy - > m_sourceBuddies . push_back ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    qDebug ( " DeviceSourceAPI::addSourceBuddy: added buddy %s(%s) [%lx] <-> [%lx] " , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getHardwareId ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getSampleSourceSerial ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  buddy , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : addSinkBuddy ( DeviceSinkAPI *  buddy ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sinkBuddies . push_back ( buddy ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-02 23:30:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    buddy - > m_sourceBuddies . push_back ( this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    qDebug ( " DeviceSourceAPI::addSinkBuddy: added buddy %s(%s) [%lx] <-> [%lx] " , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getHardwareId ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getSampleSinkSerial ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  buddy , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : removeSourceBuddy ( DeviceSourceAPI *  buddy ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    std : : vector < DeviceSourceAPI * > : : iterator  it  =  m_sourceBuddies . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    for  ( ; it  ! =  m_sourceBuddies . end ( ) ;  + + it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( * it  = =  buddy ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qDebug ( " DeviceSourceAPI::removeSourceBuddy: buddy %s(%s) [%lx] removed from the list of [%lx] " , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    qPrintable ( buddy - > getHardwareId ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    qPrintable ( buddy - > getSampleSourceSerial ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    ( uint64_t )  ( * it ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    ( uint64_t )  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            m_sourceBuddies . erase ( it ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    qDebug ( " DeviceSourceAPI::removeSourceBuddy: buddy %s(%s) [%lx] not found in the list of [%lx] " , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getHardwareId ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getSampleSourceSerial ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  buddy , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : removeSinkBuddy ( DeviceSinkAPI *  buddy ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    std : : vector < DeviceSinkAPI * > : : iterator  it  =  m_sinkBuddies . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    for  ( ; it  ! =  m_sinkBuddies . end ( ) ;  + + it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( * it  = =  buddy ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qDebug ( " DeviceSourceAPI::removeSinkBuddy: buddy %s(%s) [%lx] removed from the list of [%lx] " , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    qPrintable ( buddy - > getHardwareId ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    qPrintable ( buddy - > getSampleSinkSerial ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    ( uint64_t )  ( * it ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    ( uint64_t )  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            m_sinkBuddies . erase ( it ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    qDebug ( " DeviceSourceAPI::removeSinkBuddy: buddy %s(%s) [%lx] not found in the list of [%lx] " , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getHardwareId ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            qPrintable ( buddy - > getSampleSinkSerial ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  buddy , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( uint64_t )  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DeviceSourceAPI : : clearBuddiesLists ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    std : : vector < DeviceSourceAPI * > : : iterator  itSource  =  m_sourceBuddies . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    std : : vector < DeviceSinkAPI * > : : iterator  itSink  =  m_sinkBuddies . begin ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-03 08:59:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    bool  leaderElected  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    for  ( ; itSource  ! =  m_sourceBuddies . end ( ) ;  + + itSource ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-03 08:59:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( isBuddyLeader ( )  & &  ! leaderElected ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( * itSource ) - > setBuddyLeader ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            leaderElected  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ( * itSource ) - > removeSourceBuddy ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    m_sourceBuddies . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    for  ( ; itSink  ! =  m_sinkBuddies . end ( ) ;  + + itSink ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-03 08:59:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( isBuddyLeader ( )  & &  ! leaderElected ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( * itSink ) - > setBuddyLeader ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            leaderElected  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ( * itSink ) - > removeSourceBuddy ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    m_sinkBuddies . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}