| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2018 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 14:43:33 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +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 SDRGUI_DSP_SCOPEVISXY_H_
 | 
					
						
							|  |  |  | #define SDRGUI_DSP_SCOPEVISXY_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "dsp/basebandsamplesink.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-20 13:49:21 +01:00
										 |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2022-02-13 00:57:33 +01:00
										 |  |  | #include "util/messagequeue.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-13 00:57:33 +01:00
										 |  |  | #include <QObject>
 | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | #include <QColor>
 | 
					
						
							|  |  |  | #include <vector>
 | 
					
						
							|  |  |  | #include <complex>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TVScreen; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-13 00:57:33 +01:00
										 |  |  | class SDRGUI_API ScopeVisXY : public QObject, public BasebandSampleSink { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | public: | 
					
						
							|  |  |  | 	ScopeVisXY(TVScreen *tvScreen); | 
					
						
							|  |  |  | 	virtual ~ScopeVisXY(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-15 08:31:49 +01:00
										 |  |  | 	using BasebandSampleSink::feed; | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | 	virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly); | 
					
						
							|  |  |  | 	virtual void start(); | 
					
						
							|  |  |  | 	virtual void stop(); | 
					
						
							| 
									
										
										
										
											2022-02-13 00:57:33 +01:00
										 |  |  |     virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); } | 
					
						
							|  |  |  |     virtual QString getSinkName() { return objectName(); } | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void setScale(float scale) { m_scale = scale; } | 
					
						
							| 
									
										
										
										
											2018-03-13 01:39:43 +01:00
										 |  |  | 	void setStroke(int stroke) { m_alphaTrace = stroke; } | 
					
						
							|  |  |  |     void setDecay(int decay) { m_alphaReset = 255 - decay; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void setPixelsPerFrame(int pixelsPerFrame); | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | 	void setPlotRGB(const QRgb& plotRGB) { m_plotRGB = plotRGB; } | 
					
						
							|  |  |  | 	void setGridRGB(const QRgb& gridRGB) { m_gridRGB = gridRGB; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void addGraticulePoint(const std::complex<float>& z); | 
					
						
							| 
									
										
										
										
											2018-03-15 00:16:50 +01:00
										 |  |  | 	void calculateGraticule(int rows, int cols); | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | 	void clearGraticule(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-02-13 00:57:33 +01:00
										 |  |  | 	virtual bool handleMessage(const Message& message); | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | 	void drawGraticule(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	TVScreen *m_tvScreen; | 
					
						
							|  |  |  | 	float m_scale; | 
					
						
							|  |  |  | 	int m_cols; | 
					
						
							|  |  |  | 	int m_rows; | 
					
						
							|  |  |  | 	int m_pixelsPerFrame; | 
					
						
							|  |  |  | 	int m_pixelCount; | 
					
						
							| 
									
										
										
										
											2018-03-13 01:39:43 +01:00
										 |  |  | 	int m_alphaTrace;  //!< this is the stroke value [0:255]
 | 
					
						
							|  |  |  | 	int m_alphaReset;  //!< alpha channel of screen blanking (blackening) is 255 minus decay value [0:255]
 | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | 	QRgb m_plotRGB; | 
					
						
							|  |  |  | 	QRgb m_gridRGB; | 
					
						
							|  |  |  | 	std::vector<std::complex<float> > m_graticule; | 
					
						
							| 
									
										
										
										
											2018-03-15 00:16:50 +01:00
										 |  |  | 	std::vector<int> m_graticuleRows; | 
					
						
							|  |  |  | 	std::vector<int> m_graticuleCols; | 
					
						
							| 
									
										
										
										
											2022-02-13 00:57:33 +01:00
										 |  |  | 	MessageQueue m_inputMessageQueue; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							|  |  |  | 	void handleInputMessages(); | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* SDRGUI_DSP_SCOPEVISXY_H_ */
 |