| 
									
										
										
										
											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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-11 01:17:55 +02:00
										 |  |  | #ifndef SDRBASE_DEVICE_DEVICESOURCEAPI_H_
 | 
					
						
							|  |  |  | #define SDRBASE_DEVICE_DEVICESOURCEAPI_H_
 | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QObject>
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-14 18:47:19 +02:00
										 |  |  | #include "dsp/dspdevicesourceengine.h"
 | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "util/export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class MainWindow; | 
					
						
							|  |  |  | class GLSpectrum; | 
					
						
							| 
									
										
										
										
											2016-05-16 03:21:21 +02:00
										 |  |  | class ChannelWindow; | 
					
						
							| 
									
										
										
										
											2016-10-02 22:29:04 +02:00
										 |  |  | class BasebandSampleSink; | 
					
						
							| 
									
										
										
										
											2016-10-03 15:55:16 +02:00
										 |  |  | class ThreadedBasebandSampleSink; | 
					
						
							| 
									
										
										
										
											2016-10-02 23:16:40 +02:00
										 |  |  | class DeviceSampleSource; | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | class MessageQueue; | 
					
						
							| 
									
										
										
										
											2016-05-16 03:21:21 +02:00
										 |  |  | class ChannelMarker; | 
					
						
							|  |  |  | class QWidget; | 
					
						
							| 
									
										
										
										
											2016-05-16 11:32:22 +02:00
										 |  |  | class PluginGUI; | 
					
						
							| 
									
										
										
										
											2016-05-16 18:53:01 +02:00
										 |  |  | class PluginAPI; | 
					
						
							| 
									
										
										
										
											2016-05-16 17:47:22 +02:00
										 |  |  | class Preset; | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-11 01:17:55 +02:00
										 |  |  | class SDRANGEL_API DeviceSourceAPI : public QObject { | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     // Device engine stuff
 | 
					
						
							| 
									
										
										
										
											2016-10-02 22:29:04 +02:00
										 |  |  |     void addSink(BasebandSampleSink* sink);       //!< Add a sample sink to device engine
 | 
					
						
							|  |  |  |     void removeSink(BasebandSampleSink* sink);    //!< Remove a sample sink from device engine
 | 
					
						
							| 
									
										
										
										
											2016-10-03 15:55:16 +02:00
										 |  |  |     void addThreadedSink(ThreadedBasebandSampleSink* sink);     //!< Add a sample sink that will run on its own thread to device engine
 | 
					
						
							|  |  |  |     void removeThreadedSink(ThreadedBasebandSampleSink* sink);  //!< Remove a sample sink that runs on its own thread from device engine
 | 
					
						
							| 
									
										
										
										
											2016-10-02 23:16:40 +02:00
										 |  |  |     void setSource(DeviceSampleSource* source); //!< Set device engine sample source type
 | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  |     bool initAcquisition();               //!< Initialize device engine acquisition sequence
 | 
					
						
							|  |  |  |     bool startAcquisition();              //!< Start device engine acquisition sequence
 | 
					
						
							|  |  |  |     void stopAcquisition();               //!< Stop device engine acquisition sequence
 | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  |     DSPDeviceSourceEngine::State state() const; //!< device engine state
 | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  |     QString errorMessage();               //!< Return the current device engine error message
 | 
					
						
							|  |  |  |     uint getDeviceUID() const;            //!< Return the current device engine unique ID
 | 
					
						
							|  |  |  |     MessageQueue *getDeviceInputMessageQueue(); | 
					
						
							|  |  |  |     MessageQueue *getDeviceOutputMessageQueue(); | 
					
						
							|  |  |  |     void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections
 | 
					
						
							| 
									
										
										
										
											2016-05-16 16:02:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  |     // device related stuff
 | 
					
						
							| 
									
										
										
										
											2016-05-16 03:21:21 +02:00
										 |  |  |     GLSpectrum *getSpectrum();                           //!< Direct spectrum getter
 | 
					
						
							|  |  |  |     void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
 | 
					
						
							|  |  |  |     ChannelWindow *getChannelWindow();                   //!< Direct channel window getter
 | 
					
						
							| 
									
										
										
										
											2016-05-16 16:02:55 +02:00
										 |  |  |     void addRollupWidget(QWidget *widget);               //!< Add rollup widget to channel window
 | 
					
						
							|  |  |  |     void setInputGUI(QWidget* inputGUI, const QString& sourceDisplayName); | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 16:37:07 +02:00
										 |  |  |     void setSampleSourceId(const QString& id); | 
					
						
							|  |  |  |     void setSampleSourceSerial(const QString& serial); | 
					
						
							|  |  |  |     void setSampleSourceSequence(int sequence); | 
					
						
							|  |  |  |     void setSampleSourcePluginGUI(PluginGUI *gui); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 18:53:01 +02:00
										 |  |  |     void registerChannelInstance(const QString& channelName, PluginGUI* pluginGUI); | 
					
						
							|  |  |  |     void removeChannelInstance(PluginGUI* pluginGUI); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 16:37:07 +02:00
										 |  |  |     void freeAll(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 17:47:22 +02:00
										 |  |  |     void loadSourceSettings(const Preset* preset); | 
					
						
							|  |  |  |     void saveSourceSettings(Preset* preset); | 
					
						
							| 
									
										
										
										
											2016-05-16 18:53:01 +02:00
										 |  |  |     void loadChannelSettings(const Preset* preset, PluginAPI *pluginAPI); | 
					
						
							| 
									
										
										
										
											2016-05-16 18:34:23 +02:00
										 |  |  |     void saveChannelSettings(Preset* preset); | 
					
						
							| 
									
										
										
										
											2016-05-16 17:47:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-17 19:08:04 +02:00
										 |  |  |     MainWindow *getMainWindow() { return m_mainWindow; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2016-05-16 17:47:22 +02:00
										 |  |  |     struct ChannelInstanceRegistration | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QString m_channelName; | 
					
						
							|  |  |  |         PluginGUI* m_gui; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ChannelInstanceRegistration() : | 
					
						
							|  |  |  |             m_channelName(), | 
					
						
							|  |  |  |             m_gui(NULL) | 
					
						
							|  |  |  |         { } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ChannelInstanceRegistration(const QString& channelName, PluginGUI* pluginGUI) : | 
					
						
							|  |  |  |             m_channelName(channelName), | 
					
						
							|  |  |  |             m_gui(pluginGUI) | 
					
						
							|  |  |  |         { } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         bool operator<(const ChannelInstanceRegistration& other) const; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     typedef QList<ChannelInstanceRegistration> ChannelInstanceRegistrations; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-11 01:17:55 +02:00
										 |  |  |     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); | 
					
						
							| 
									
										
										
										
											2016-10-11 01:17:55 +02:00
										 |  |  |     ~DeviceSourceAPI(); | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 18:53:01 +02:00
										 |  |  |     void renameChannelInstances(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 16:02:55 +02:00
										 |  |  |     MainWindow *m_mainWindow; | 
					
						
							|  |  |  |     int m_deviceTabIndex; | 
					
						
							| 
									
										
										
										
											2016-10-18 00:03:51 +02:00
										 |  |  |     DSPDeviceSourceEngine *m_deviceSourceEngine; | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  |     GLSpectrum *m_spectrum; | 
					
						
							| 
									
										
										
										
											2016-05-16 03:21:21 +02:00
										 |  |  |     ChannelWindow *m_channelWindow; | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 16:37:07 +02:00
										 |  |  |     QString m_sampleSourceId; | 
					
						
							|  |  |  |     QString m_sampleSourceSerial; | 
					
						
							|  |  |  |     int m_sampleSourceSequence; | 
					
						
							|  |  |  |     PluginGUI* m_sampleSourcePluginGUI; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 17:47:22 +02:00
										 |  |  |     ChannelInstanceRegistrations m_channelInstanceRegistrations; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 01:12:55 +02:00
										 |  |  |     friend class MainWindow; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-11 01:17:55 +02:00
										 |  |  | #endif /* SDRBASE_DEVICE_DEVICESOURCEAPI_H_ */
 |