SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
airspyhfthread.h
Go to the documentation of this file.
1 // Copyright (C) 2018 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef INCLUDE_AIRSPYHFTHREAD_H
19 #define INCLUDE_AIRSPYHFTHREAD_H
20 
21 #include <dsp/decimatorsfi.h>
22 #include <QThread>
23 #include <QMutex>
24 #include <QWaitCondition>
25 #include <libairspyhf/airspyhf.h>
26 
27 #include "dsp/samplesinkfifo.h"
28 
29 #define AIRSPYHF_BLOCKSIZE (1<<17)
30 
31 class AirspyHFThread : public QThread {
32  Q_OBJECT
33 
34 public:
35  AirspyHFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0);
37 
38  void startWork();
39  void stopWork();
40  void setSamplerate(uint32_t samplerate);
41  void setLog2Decimation(unsigned int log2_decim);
42 
43 private:
45  QWaitCondition m_startWaiter;
46  bool m_running;
47 
48  airspyhf_device_t* m_dev;
52 
54  unsigned int m_log2Decim;
56 
58 
59  void run();
60  void callback(const float* buf, qint32 len);
61  static int rx_callback(airspyhf_transfer_t* transfer);
62 };
63 
64 #endif // INCLUDE_AIRSPYHFTHREAD_H
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
#define AIRSPYHF_BLOCKSIZE
void setLog2Decimation(unsigned int log2_decim)
QWaitCondition m_startWaiter
qint16 m_buf[2 *AIRSPYHF_BLOCKSIZE]
void setSamplerate(uint32_t samplerate)
QMutex m_startWaitMutex
unsigned int uint32_t
Definition: rtptypes_win.h:46
unsigned int m_log2Decim
void callback(const float *buf, qint32 len)
DecimatorsFI m_decimators
static int rx_callback(airspyhf_transfer_t *transfer)
SampleVector m_convertBuffer
static AirspyHFThread * m_this
SampleSinkFifo * m_sampleFifo
AirspyHFThread(airspyhf_device_t *dev, SampleSinkFifo *sampleFifo, QObject *parent=0)
airspyhf_device_t * m_dev