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.
xtrxinputthread.h
Go to the documentation of this file.
1 // Copyright (C) 2017, 2018 Edouard Griffiths, F4EXB //
3 // Copyright (C) 2017 Sergey Kostanbaev, Fairwaves Inc. //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef PLUGINS_SAMPLESOURCE_XTRXINPUT_XTRXINPUTTHREAD_H_
20 #define PLUGINS_SAMPLESOURCE_XTRXINPUT_XTRXINPUTTHREAD_H_
21 
22 #include <QThread>
23 #include <QMutex>
24 #include <QWaitCondition>
25 
26 #include "xtrx_api.h"
27 
28 #include "dsp/samplesinkfifo.h"
29 #include "dsp/decimators.h"
30 #include "xtrx/devicextrxshared.h"
31 
32 struct xtrx_dev;
33 
34 class XTRXInputThread : public QThread, public DeviceXTRXShared::ThreadInterface
35 {
36  Q_OBJECT
37 
38 public:
39  XTRXInputThread(struct xtrx_dev *dev, unsigned int nbChannels, unsigned int uniqueChannelIndex = 0, QObject* parent = 0);
41 
42  virtual void startWork();
43  virtual void stopWork();
44  virtual bool isRunning() { return m_running; }
45  unsigned int getNbChannels() const { return m_nbChannels; }
46  void setLog2Decimation(unsigned int channel, unsigned int log2_decim);
47  unsigned int getLog2Decimation(unsigned int channel) const;
48  void setFifo(unsigned int channel, SampleSinkFifo *sampleFifo);
49  SampleSinkFifo *getFifo(unsigned int channel);
50 
51 private:
52  struct Channel
53  {
56  unsigned int m_log2Decim;
58 
59  Channel() :
60  m_sampleFifo(0),
61  m_log2Decim(0)
62  {}
63 
65  {}
66  };
67 
69  QWaitCondition m_startWaiter;
70  bool m_running;
71  struct xtrx_dev *m_dev;
72 
74  unsigned int m_nbChannels;
75  unsigned int m_uniqueChannelIndex;
76 
77  void run();
78  unsigned int getNbFifos();
79  void callbackSI(const qint16* buf, qint32 len);
80  void callbackMI(const qint16* buf0, const qint16* buf1, qint32 len);
81 };
82 
83 
84 
85 #endif /* PLUGINS_SAMPLESOURCE_XTRXINPUT_XTRXINPUTTHREAD_H_ */
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
QWaitCondition m_startWaiter
unsigned int getNbFifos()
Channel * m_channels
Array of channels dynamically allocated for the given number of Rx channels.
XTRXInputThread(struct xtrx_dev *dev, unsigned int nbChannels, unsigned int uniqueChannelIndex=0, QObject *parent=0)
unsigned int m_uniqueChannelIndex
virtual void stopWork()
SampleSinkFifo * m_sampleFifo
unsigned int getNbChannels() const
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 12 > m_decimators
void setFifo(unsigned int channel, SampleSinkFifo *sampleFifo)
void setLog2Decimation(unsigned int channel, unsigned int log2_decim)
virtual bool isRunning()
unsigned int getLog2Decimation(unsigned int channel) const
SampleSinkFifo * getFifo(unsigned int channel)
struct xtrx_dev * m_dev
virtual void startWork()
unsigned int m_nbChannels
void callbackMI(const qint16 *buf0, const qint16 *buf1, qint32 len)
void callbackSI(const qint16 *buf, qint32 len)