| 
									
										
										
										
											2015-12-06 19:47:55 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2015 F4EXB                                                      //
 | 
					
						
							|  |  |  | // written by Edouard Griffiths                                                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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 06:39:30 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2015-12-06 19:47:55 +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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-19 08:55:58 +01:00
										 |  |  | #ifndef INCLUDE_UDPSRCGUI_H
 | 
					
						
							|  |  |  | #define INCLUDE_UDPSRCGUI_H
 | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QHostAddress>
 | 
					
						
							| 
									
										
										
										
											2020-10-04 06:16:15 +02:00
										 |  |  | #include "channel/channelgui.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | #include "dsp/channelmarker.h"
 | 
					
						
							|  |  |  | #include "dsp/movingaverage.h"
 | 
					
						
							| 
									
										
										
										
											2017-09-16 22:23:31 +02:00
										 |  |  | #include "util/messagequeue.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | #include "udpsink.h"
 | 
					
						
							|  |  |  | #include "udpsinksettings.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class PluginAPI; | 
					
						
							| 
									
										
										
										
											2017-10-31 08:24:05 +01:00
										 |  |  | class DeviceUISet; | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | class UDPSink; | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | class SpectrumVis; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Ui { | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | 	class UDPSinkGUI; | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-04 06:16:15 +02:00
										 |  |  | class UDPSinkGUI : public ChannelGUI { | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | 	static UDPSinkGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); | 
					
						
							| 
									
										
										
										
											2017-09-16 10:45:08 +02:00
										 |  |  | 	virtual void destroy(); | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void resetToDefaults(); | 
					
						
							|  |  |  | 	QByteArray serialize() const; | 
					
						
							|  |  |  | 	bool deserialize(const QByteArray& data); | 
					
						
							| 
									
										
										
										
											2017-09-16 22:23:31 +02:00
										 |  |  | 	virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 08:35:18 +01:00
										 |  |  | public slots: | 
					
						
							|  |  |  | 	void channelMarkerChangedByCursor(); | 
					
						
							| 
									
										
										
										
											2017-11-14 22:58:35 +01:00
										 |  |  |     void channelMarkerHighlightedByCursor(); | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | 	Ui::UDPSinkGUI* ui; | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 	PluginAPI* m_pluginAPI; | 
					
						
							| 
									
										
										
										
											2017-10-31 08:24:05 +01:00
										 |  |  | 	DeviceUISet* m_deviceUISet; | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | 	UDPSink* m_udpSink; | 
					
						
							|  |  |  | 	UDPSinkSettings m_settings; | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 	ChannelMarker m_channelMarker; | 
					
						
							| 
									
										
										
										
											2017-08-17 12:57:45 +02:00
										 |  |  | 	MovingAverage<double> m_channelPowerAvg; | 
					
						
							| 
									
										
										
										
											2017-08-17 20:23:17 +02:00
										 |  |  |     MovingAverage<double> m_inPowerAvg; | 
					
						
							| 
									
										
										
										
											2017-08-17 12:57:45 +02:00
										 |  |  | 	uint32_t m_tickCount; | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// settings
 | 
					
						
							|  |  |  | 	bool m_doApplySettings; | 
					
						
							| 
									
										
										
										
											2017-10-07 05:44:43 +02:00
										 |  |  | 	bool m_rfBandwidthChanged; | 
					
						
							| 
									
										
										
										
											2017-09-16 22:23:31 +02:00
										 |  |  | 	MessageQueue m_inputMessageQueue; | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// RF path
 | 
					
						
							|  |  |  | 	SpectrumVis* m_spectrumVis; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | 	explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0); | 
					
						
							|  |  |  | 	virtual ~UDPSinkGUI(); | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void blockApplySettings(bool block); | 
					
						
							| 
									
										
										
										
											2017-08-19 00:12:56 +02:00
										 |  |  | 	void applySettings(bool force = false); | 
					
						
							|  |  |  | 	void applySettingsImmediate(bool force = false); | 
					
						
							| 
									
										
										
										
											2017-08-17 12:57:45 +02:00
										 |  |  | 	void displaySettings(); | 
					
						
							| 
									
										
										
										
											2019-09-23 01:25:17 +02:00
										 |  |  |     void displayStreamIndex(); | 
					
						
							| 
									
										
										
										
											2017-10-07 05:44:43 +02:00
										 |  |  | 	void setSampleFormat(int index); | 
					
						
							| 
									
										
										
										
											2018-09-12 00:08:47 +02:00
										 |  |  | 	void setSampleFormatIndex(const UDPSinkSettings::SampleFormat& sampleFormat); | 
					
						
							| 
									
										
										
										
											2020-10-03 19:51:14 +02:00
										 |  |  | 	bool handleMessage(const Message& message); | 
					
						
							| 
									
										
										
										
											2016-04-03 18:14:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void leaveEvent(QEvent*); | 
					
						
							|  |  |  | 	void enterEvent(QEvent*); | 
					
						
							| 
									
										
										
										
											2017-11-14 08:35:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							| 
									
										
										
										
											2018-05-25 18:44:24 +02:00
										 |  |  |     void handleSourceMessages(); | 
					
						
							| 
									
										
										
										
											2017-11-14 08:35:18 +01:00
										 |  |  | 	void on_deltaFrequency_changed(qint64 value); | 
					
						
							|  |  |  | 	void on_sampleFormat_currentIndexChanged(int index); | 
					
						
							| 
									
										
										
										
											2018-04-19 23:03:21 +02:00
										 |  |  | 	void on_outputUDPAddress_editingFinished(); | 
					
						
							|  |  |  | 	void on_outputUDPPort_editingFinished(); | 
					
						
							|  |  |  | 	void on_inputUDPAudioPort_editingFinished(); | 
					
						
							| 
									
										
										
										
											2017-11-14 08:35:18 +01:00
										 |  |  | 	void on_sampleRate_textEdited(const QString& arg1); | 
					
						
							|  |  |  | 	void on_rfBandwidth_textEdited(const QString& arg1); | 
					
						
							|  |  |  | 	void on_fmDeviation_textEdited(const QString& arg1); | 
					
						
							|  |  |  | 	void on_audioActive_toggled(bool active); | 
					
						
							|  |  |  | 	void on_audioStereo_toggled(bool stereo); | 
					
						
							|  |  |  | 	void on_applyBtn_clicked(); | 
					
						
							|  |  |  | 	void onWidgetRolled(QWidget* widget, bool rollDown); | 
					
						
							|  |  |  | 	void onMenuDialogCalled(const QPoint& p); | 
					
						
							|  |  |  | 	void on_gain_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_volume_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_squelch_valueChanged(int value); | 
					
						
							|  |  |  |     void on_squelchGate_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_agc_toggled(bool agc); | 
					
						
							|  |  |  | 	void tick(); | 
					
						
							| 
									
										
										
										
											2015-11-19 03:27:37 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-19 08:55:58 +01:00
										 |  |  | #endif // INCLUDE_UDPSRCGUI_H
 |