| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2023-11-18 12:02:48 +01:00
										 |  |  | // Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
 | 
					
						
							|  |  |  | // written by Christian Daniel                                                   //
 | 
					
						
							|  |  |  | // Copyright (C) 2015-2016, 2018-2019, 2023 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
 | 
					
						
							| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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                  //
 | 
					
						
							|  |  |  | // (at your option) any later version.                                           //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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 INCLUDE_FT8DEMODWORKER_H
 | 
					
						
							|  |  |  | #define INCLUDE_FT8DEMODWORKER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QObject>
 | 
					
						
							| 
									
										
										
										
											2023-01-29 19:27:45 +01:00
										 |  |  | #include <QSet>
 | 
					
						
							| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  | #include "ft8.h"
 | 
					
						
							| 
									
										
										
										
											2024-03-28 15:15:48 +01:00
										 |  |  | #include "packing.h"
 | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  | class QDateTime; | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  | class MessageQueue; | 
					
						
							|  |  |  | class MsgReportFT8Messages; | 
					
						
							| 
									
										
										
										
											2023-01-20 23:16:57 +01:00
										 |  |  | class ChannelAPI; | 
					
						
							| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class FT8DemodWorker : public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     FT8DemodWorker(); | 
					
						
							|  |  |  |     ~FT8DemodWorker(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void processBuffer(int16_t *buffer, QDateTime periodTS); | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     void setRecordSamples(bool recordSamples) { m_recordSamples = recordSamples; } | 
					
						
							|  |  |  |     void setLogMessages(bool logMessages) { m_logMessages = logMessages; } | 
					
						
							|  |  |  |     void setNbDecoderThreads(int nbDecoderThreads) { m_nbDecoderThreads = nbDecoderThreads; } | 
					
						
							|  |  |  |     void setDecoderTimeBudget(float decoderTimeBudget) { m_decoderTimeBudget = decoderTimeBudget; } | 
					
						
							| 
									
										
										
										
											2023-01-28 08:58:50 +01:00
										 |  |  |     void setUseOSD(bool useOSD) { m_useOSD = useOSD; } | 
					
						
							|  |  |  |     void setOSDDepth(int osdDepth) { m_osdDepth = osdDepth; } | 
					
						
							|  |  |  |     void setOSDLDPCThreshold(int osdLDPCThreshold) { m_osdLDPCThreshold = osdLDPCThreshold; } | 
					
						
							| 
									
										
										
										
											2023-01-29 19:27:45 +01:00
										 |  |  |     void setVerifyOSD(bool verifyOSD) { m_verifyOSD = verifyOSD; } | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     void setLowFrequency(int lowFreq) { m_lowFreq = lowFreq; } | 
					
						
							|  |  |  |     void setHighFrequency(int highFreq) { m_highFreq = highFreq; } | 
					
						
							|  |  |  |     void setReportingMessageQueue(MessageQueue *messageQueue) { m_reportingMessageQueue = messageQueue; } | 
					
						
							| 
									
										
										
										
											2023-01-20 06:42:11 +01:00
										 |  |  |     void invalidateSequence() { m_invalidSequence = true; } | 
					
						
							| 
									
										
										
										
											2023-01-20 23:16:57 +01:00
										 |  |  |     void setBaseFrequency(qint64 baseFrequency) { m_baseFrequency = baseFrequency; } | 
					
						
							|  |  |  |     void setChannel(ChannelAPI *channel) { m_channel = channel; } | 
					
						
							| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     class FT8Callback : public FT8::CallbackInterface | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							| 
									
										
										
										
											2023-01-21 12:22:05 +01:00
										 |  |  |         FT8Callback | 
					
						
							|  |  |  |             (const QDateTime& periodTS, | 
					
						
							|  |  |  |             qint64 baseFrequency, | 
					
						
							|  |  |  |             FT8::Packing& packing, | 
					
						
							|  |  |  |             const QString& name | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |         virtual int hcb( | 
					
						
							|  |  |  |             int *a91, | 
					
						
							|  |  |  |             float hz0, | 
					
						
							|  |  |  |             float off, | 
					
						
							|  |  |  |             const char *comment, | 
					
						
							|  |  |  |             float snr, | 
					
						
							|  |  |  |             int pass, | 
					
						
							|  |  |  |             int correct_bits | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2023-01-21 12:22:05 +01:00
										 |  |  |         virtual QString get_name(); | 
					
						
							| 
									
										
										
										
											2023-01-20 23:16:57 +01:00
										 |  |  |         const std::map<std::string, bool>& getMsgMap() { return cycle_already; } | 
					
						
							|  |  |  |         MsgReportFT8Messages *getReportMessage() { return m_msgReportFT8Messages; } | 
					
						
							| 
									
										
										
										
											2023-01-29 19:27:45 +01:00
										 |  |  |         void setValidCallsigns(const QSet<QString> *validCallsigns) { m_validCallsigns = validCallsigns; } | 
					
						
							| 
									
										
										
										
											2023-01-20 23:16:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     private: | 
					
						
							|  |  |  |         QMutex cycle_mu; | 
					
						
							|  |  |  |         std::map<std::string, bool> cycle_already; | 
					
						
							|  |  |  |         FT8::Packing& m_packing; | 
					
						
							|  |  |  |         MsgReportFT8Messages *m_msgReportFT8Messages; | 
					
						
							|  |  |  |         const QDateTime& m_periodTS; | 
					
						
							| 
									
										
										
										
											2023-01-21 12:22:05 +01:00
										 |  |  |         QString m_name; | 
					
						
							| 
									
										
										
										
											2023-01-29 19:27:45 +01:00
										 |  |  |         const QSet<QString> *m_validCallsigns; | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  |     QString m_samplesPath; | 
					
						
							| 
									
										
										
										
											2023-01-20 23:16:57 +01:00
										 |  |  |     QString m_logsPath; | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     bool m_recordSamples; | 
					
						
							|  |  |  |     bool m_logMessages; | 
					
						
							|  |  |  |     int m_nbDecoderThreads; | 
					
						
							|  |  |  |     float m_decoderTimeBudget; | 
					
						
							| 
									
										
										
										
											2023-01-28 08:58:50 +01:00
										 |  |  |     bool m_useOSD; | 
					
						
							|  |  |  |     int m_osdDepth; | 
					
						
							|  |  |  |     int m_osdLDPCThreshold; | 
					
						
							| 
									
										
										
										
											2023-01-29 19:27:45 +01:00
										 |  |  |     bool m_verifyOSD; | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     int m_lowFreq; | 
					
						
							|  |  |  |     int m_highFreq; | 
					
						
							| 
									
										
										
										
											2023-01-20 06:42:11 +01:00
										 |  |  |     bool m_invalidSequence; | 
					
						
							| 
									
										
										
										
											2023-01-20 23:16:57 +01:00
										 |  |  |     qint64 m_baseFrequency; | 
					
						
							| 
									
										
										
										
											2023-01-19 23:51:43 +01:00
										 |  |  |     FT8::FT8Decoder m_ft8Decoder; | 
					
						
							|  |  |  |     FT8::Packing m_packing; | 
					
						
							|  |  |  |     MessageQueue *m_reportingMessageQueue; | 
					
						
							| 
									
										
										
										
											2023-01-20 23:16:57 +01:00
										 |  |  |     ChannelAPI *m_channel; | 
					
						
							| 
									
										
										
										
											2023-01-29 19:27:45 +01:00
										 |  |  |     QSet<QString> m_validCallsigns; | 
					
						
							| 
									
										
										
										
											2023-01-18 23:00:59 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_FT8DEMODWORKER_H
 |