| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2017 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 14:44:23 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef SDRSRV_DEVICE_DEVICESET_H_
 | 
					
						
							|  |  |  | #define SDRSRV_DEVICE_DEVICESET_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QTimer>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-05 21:32:57 +02:00
										 |  |  | #include "export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | class DeviceAPI; | 
					
						
							| 
									
										
										
										
											2019-05-16 18:39:13 +02:00
										 |  |  | class DSPDeviceSourceEngine; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | class DSPDeviceSinkEngine; | 
					
						
							| 
									
										
										
										
											2019-05-16 18:39:13 +02:00
										 |  |  | class DSPDeviceMIMOEngine; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | class PluginAPI; | 
					
						
							| 
									
										
										
										
											2019-05-09 17:27:12 +02:00
										 |  |  | class ChannelAPI; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | class Preset; | 
					
						
							| 
									
										
										
										
											2020-11-12 01:22:48 +01:00
										 |  |  | class SpectrumVis; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace SWGSDRangel { | 
					
						
							|  |  |  |     class SWGGLSpectrum; | 
					
						
							|  |  |  |     class SWGSpectrumServer; | 
					
						
							|  |  |  |     class SWGSuccessResponse; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-05 21:32:57 +02:00
										 |  |  | class SDRBASE_API DeviceSet | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 19:26:52 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  |     DeviceAPI *m_deviceAPI; | 
					
						
							| 
									
										
										
										
											2019-05-16 18:39:13 +02:00
										 |  |  |     DSPDeviceSourceEngine *m_deviceSourceEngine; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  |     DSPDeviceSinkEngine *m_deviceSinkEngine; | 
					
						
							| 
									
										
										
										
											2019-05-16 18:39:13 +02:00
										 |  |  |     DSPDeviceMIMOEngine *m_deviceMIMOEngine; | 
					
						
							| 
									
										
										
										
											2020-11-12 01:22:48 +01:00
										 |  |  |     SpectrumVis *m_spectrumVis; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-11 09:36:27 +02:00
										 |  |  |     DeviceSet(int tabIndex, int deviceType); | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  |     ~DeviceSet(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 00:44:56 +02:00
										 |  |  |     int getNumberOfChannels() const { return m_channelInstanceRegistrations.size(); } | 
					
						
							| 
									
										
										
										
											2020-10-16 08:35:06 +02:00
										 |  |  |     int getIndex() const { return m_deviceTabIndex; } | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     void setIndex(int index) { m_deviceTabIndex = index; } | 
					
						
							| 
									
										
										
										
											2019-09-08 00:44:56 +02:00
										 |  |  |     void freeChannels(); | 
					
						
							| 
									
										
										
										
											2020-10-13 08:15:21 +02:00
										 |  |  |     const ChannelAPI *getChannelAt(int channelIndex) const; | 
					
						
							|  |  |  |     ChannelAPI *getChannelAt(int channelIndex); | 
					
						
							| 
									
										
										
										
											2020-09-20 01:06:34 +02:00
										 |  |  |     void deleteChannel(int channelIndex); | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  |     void loadRxChannelSettings(const Preset* preset, PluginAPI *pluginAPI); | 
					
						
							|  |  |  |     void saveRxChannelSettings(Preset* preset); | 
					
						
							|  |  |  |     void loadTxChannelSettings(const Preset* preset, PluginAPI *pluginAPI); | 
					
						
							|  |  |  |     void saveTxChannelSettings(Preset* preset); | 
					
						
							| 
									
										
										
										
											2019-09-13 13:40:31 +02:00
										 |  |  |     void loadMIMOChannelSettings(const Preset* preset, PluginAPI *pluginAPI); | 
					
						
							|  |  |  |     void saveMIMOChannelSettings(Preset* preset); | 
					
						
							| 
									
										
										
										
											2022-03-23 05:53:12 +01:00
										 |  |  |     ChannelAPI *addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI); | 
					
						
							|  |  |  |     ChannelAPI *addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI); | 
					
						
							|  |  |  |     ChannelAPI *addMIMOChannel(int selectedChannelIndex, PluginAPI *pluginAPI); | 
					
						
							| 
									
										
										
										
											2020-10-11 08:27:58 +02:00
										 |  |  |     // slave mode
 | 
					
						
							| 
									
										
										
										
											2020-10-15 08:52:30 +02:00
										 |  |  |     void addChannelInstance(ChannelAPI *channelAPI); | 
					
						
							| 
									
										
										
										
											2020-10-11 08:27:58 +02:00
										 |  |  |     void removeChannelInstanceAt(int index); | 
					
						
							|  |  |  |     void removeChannelInstance(ChannelAPI *channelAPI); | 
					
						
							|  |  |  |     void clearChannels(); | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-12 01:22:48 +01:00
										 |  |  |     // REST API
 | 
					
						
							|  |  |  |     int webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const; | 
					
						
							|  |  |  |     int webapiSpectrumSettingsPutPatch( | 
					
						
							|  |  |  |             bool force, | 
					
						
							|  |  |  |             const QStringList& spectrumSettingsKeys, | 
					
						
							|  |  |  |             SWGSDRangel::SWGGLSpectrum& response, // query + response
 | 
					
						
							|  |  |  |             QString& errorMessage); | 
					
						
							|  |  |  |     int webapiSpectrumServerGet(SWGSDRangel::SWGSpectrumServer& response, QString& errorMessage) const; | 
					
						
							|  |  |  |     int webapiSpectrumServerPost(SWGSDRangel::SWGSuccessResponse& response, QString& errorMessage); | 
					
						
							|  |  |  |     int webapiSpectrumServerDelete(SWGSDRangel::SWGSuccessResponse& response, QString& errorMessage); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2020-10-15 02:24:29 +02:00
										 |  |  |     typedef QList<ChannelAPI*> ChannelInstanceRegistrations; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 00:44:56 +02:00
										 |  |  |     ChannelInstanceRegistrations m_channelInstanceRegistrations; | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  |     int m_deviceTabIndex; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 00:44:56 +02:00
										 |  |  |     void renameChannelInstances(); | 
					
						
							| 
									
										
										
										
											2020-10-15 02:24:29 +02:00
										 |  |  |     static bool compareChannels(const ChannelAPI *channelA, const ChannelAPI *channelB); | 
					
						
							| 
									
										
										
										
											2017-12-17 23:15:42 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* SDRSRV_DEVICE_DEVICESET_H_ */
 |