| 
									
										
										
										
											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                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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-12-06 10:30:51 +01:00
										 |  |  | #ifndef INCLUDE_BFMDEMODGUI_H
 | 
					
						
							|  |  |  | #define INCLUDE_BFMDEMODGUI_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-26 00:22:08 +02:00
										 |  |  | #include <plugin/plugininstancegui.h>
 | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | #include "gui/rollupwidget.h"
 | 
					
						
							|  |  |  | #include "dsp/channelmarker.h"
 | 
					
						
							| 
									
										
										
										
											2017-09-16 22:23:31 +02:00
										 |  |  | #include "util/messagequeue.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-01 17:54:48 +02:00
										 |  |  | #include "bfmdemodsettings.h"
 | 
					
						
							| 
									
										
										
										
											2016-10-02 13:18:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | class PluginAPI; | 
					
						
							| 
									
										
										
										
											2017-10-31 08:24:05 +01:00
										 |  |  | class DeviceUISet; | 
					
						
							| 
									
										
										
										
											2017-10-01 11:50:16 +02:00
										 |  |  | class RDSParser; | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-06 19:47:55 +01:00
										 |  |  | class SpectrumVis; | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | class BFMDemod; | 
					
						
							| 
									
										
										
										
											2017-11-09 01:03:05 +01:00
										 |  |  | class BasebandSampleSink; | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Ui { | 
					
						
							|  |  |  | 	class BFMDemodGUI; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-26 00:22:08 +02:00
										 |  |  | class BFMDemodGUI : public RollupWidget, public PluginInstanceGUI { | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2017-11-09 01:03:05 +01:00
										 |  |  | 	static BFMDemodGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceAPI, BasebandSampleSink *rxChannel); | 
					
						
							| 
									
										
										
										
											2017-09-16 10:45:08 +02:00
										 |  |  | 	virtual void destroy(); | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void setName(const QString& name); | 
					
						
							|  |  |  | 	QString getName() const; | 
					
						
							|  |  |  | 	virtual qint64 getCenterFrequency() const; | 
					
						
							|  |  |  | 	virtual void setCenterFrequency(qint64 centerFrequency); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	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-12-06 10:30:51 +01:00
										 |  |  | 	virtual bool handleMessage(const Message& message); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 01:23:01 +01:00
										 |  |  | public slots: | 
					
						
							|  |  |  |     void channelMarkerChangedByCursor(); | 
					
						
							| 
									
										
										
										
											2017-11-14 22:58:35 +01:00
										 |  |  |     void channelMarkerHighlightedByCursor(); | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	Ui::BFMDemodGUI* ui; | 
					
						
							|  |  |  | 	PluginAPI* m_pluginAPI; | 
					
						
							| 
									
										
										
										
											2017-10-31 08:24:05 +01:00
										 |  |  | 	DeviceUISet* m_deviceUISet; | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 	ChannelMarker m_channelMarker; | 
					
						
							| 
									
										
										
										
											2017-10-01 17:54:48 +02:00
										 |  |  | 	BFMDemodSettings m_settings; | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 	bool m_doApplySettings; | 
					
						
							| 
									
										
										
										
											2015-12-14 01:36:13 +01:00
										 |  |  | 	int m_rdsTimerCount; | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-06 19:47:55 +01:00
										 |  |  | 	SpectrumVis* m_spectrumVis; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	BFMDemod* m_bfmDemod; | 
					
						
							| 
									
										
										
										
											2015-12-08 09:25:46 +01:00
										 |  |  | 	int m_rate; | 
					
						
							| 
									
										
										
										
											2015-12-16 03:12:38 +01:00
										 |  |  | 	std::vector<unsigned int> m_g14ComboIndex; | 
					
						
							| 
									
										
										
										
											2017-09-16 22:23:31 +02:00
										 |  |  | 	MessageQueue m_inputMessageQueue; | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 01:03:05 +01:00
										 |  |  | 	explicit BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0); | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 	virtual ~BFMDemodGUI(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void blockApplySettings(bool block); | 
					
						
							| 
									
										
										
										
											2017-08-25 18:56:43 +02:00
										 |  |  | 	void applySettings(bool force = false); | 
					
						
							| 
									
										
										
										
											2017-10-01 19:20:56 +02:00
										 |  |  |     void displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-08-25 18:56:43 +02:00
										 |  |  | 	void displayUDPAddress(); | 
					
						
							| 
									
										
										
										
											2015-12-14 15:15:31 +01:00
										 |  |  | 	void rdsUpdate(bool force); | 
					
						
							|  |  |  | 	void rdsUpdateFixedFields(); | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void leaveEvent(QEvent*); | 
					
						
							|  |  |  | 	void enterEvent(QEvent*); | 
					
						
							| 
									
										
										
										
											2015-12-16 04:12:49 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void changeFrequency(qint64 f); | 
					
						
							| 
									
										
										
										
											2017-01-08 20:11:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     static int requiredBW(int rfBW) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (rfBW <= 48000) { | 
					
						
							|  |  |  |             return 48000; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             return (3*rfBW)/2; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-11-14 01:23:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							|  |  |  | 	void on_deltaFrequency_changed(qint64 value); | 
					
						
							|  |  |  | 	void on_rfBW_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_afBW_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_volume_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_squelch_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_audioStereo_toggled(bool stereo); | 
					
						
							|  |  |  | 	void on_lsbStereo_toggled(bool lsb); | 
					
						
							|  |  |  | 	void on_showPilot_clicked(); | 
					
						
							|  |  |  | 	void on_rds_clicked(); | 
					
						
							|  |  |  | 	void on_copyAudioToUDP_toggled(bool copy); | 
					
						
							|  |  |  | 	void on_g14ProgServiceNames_currentIndexChanged(int index); | 
					
						
							|  |  |  | 	void on_clearData_clicked(bool checked); | 
					
						
							|  |  |  | 	void on_g00AltFrequenciesBox_activated(int index); | 
					
						
							|  |  |  | 	void on_g14MappedFrequencies_activated(int index); | 
					
						
							|  |  |  | 	void on_g14AltFrequencies_activated(int index); | 
					
						
							|  |  |  | 	void onWidgetRolled(QWidget* widget, bool rollDown); | 
					
						
							|  |  |  |     void onMenuDialogCalled(const QPoint& p); | 
					
						
							|  |  |  |     void handleInputMessages(); | 
					
						
							|  |  |  | 	void tick(); | 
					
						
							| 
									
										
										
										
											2015-12-06 10:30:51 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_BFMDEMODGUI_H
 |