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.
airspythread.h
Go to the documentation of this file.
1 // Copyright (C) 2015 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_AIRSPYTHREAD_H
19 #define INCLUDE_AIRSPYTHREAD_H
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 #include <libairspy/airspy.h>
25 
26 #include "dsp/samplesinkfifo.h"
27 #include "dsp/decimators.h"
28 
29 #define AIRSPY_BLOCKSIZE (1<<17)
30 
31 class AirspyThread : public QThread {
32  Q_OBJECT
33 
34 public:
35  AirspyThread(struct airspy_device* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
36  ~AirspyThread();
37 
38  void startWork();
39  void stopWork();
40  void setSamplerate(uint32_t samplerate);
41  void setLog2Decimation(unsigned int log2_decim);
42  void setFcPos(int fcPos);
43 
44 private:
46  QWaitCondition m_startWaiter;
47  bool m_running;
48 
49  struct airspy_device* m_dev;
53 
55  unsigned int m_log2Decim;
56  int m_fcPos;
58 
60 
61  void run();
62  void callback(const qint16* buf, qint32 len);
63  static int rx_callback(airspy_transfer_t* transfer);
64 };
65 
66 #endif // INCLUDE_AIRSPYTHREAD_H
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
#define AIRSPY_BLOCKSIZE
Definition: airspythread.h:29
qint16 m_buf[2 *AIRSPY_BLOCKSIZE]
Definition: airspythread.h:50
unsigned int m_log2Decim
Definition: airspythread.h:55
static int rx_callback(airspy_transfer_t *transfer)
static AirspyThread * m_this
Definition: airspythread.h:57
AirspyThread(struct airspy_device *dev, SampleSinkFifo *sampleFifo, QObject *parent=NULL)
struct airspy_device * m_dev
Definition: airspythread.h:49
void callback(const qint16 *buf, qint32 len)
unsigned int uint32_t
Definition: rtptypes_win.h:46
QMutex m_startWaitMutex
Definition: airspythread.h:45
void setLog2Decimation(unsigned int log2_decim)
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 12 > m_decimators
Definition: airspythread.h:59
SampleSinkFifo * m_sampleFifo
Definition: airspythread.h:52
SampleVector m_convertBuffer
Definition: airspythread.h:51
void setSamplerate(uint32_t samplerate)
void setFcPos(int fcPos)
QWaitCondition m_startWaiter
Definition: airspythread.h:46
void startWork()