2018-01-10 20:21:29 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// 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 00:57:41 -04:00
|
|
|
// (at your option) any later version. //
|
2018-01-10 20:21:29 -05: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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-07-11 20:39:14 -04:00
|
|
|
#ifndef INCLUDE_AIRSPYHFWORKER_H
|
|
|
|
#define INCLUDE_AIRSPYHFWORKER_H
|
2018-01-10 20:21:29 -05:00
|
|
|
|
2018-04-24 19:44:54 -04:00
|
|
|
#include <dsp/decimatorsfi.h>
|
2020-07-11 20:39:14 -04:00
|
|
|
#include <QObject>
|
2018-01-10 20:21:29 -05:00
|
|
|
#include <libairspyhf/airspyhf.h>
|
|
|
|
|
|
|
|
#include "dsp/samplesinkfifo.h"
|
|
|
|
|
|
|
|
#define AIRSPYHF_BLOCKSIZE (1<<17)
|
|
|
|
|
2020-07-11 20:39:14 -04:00
|
|
|
class AirspyHFWorker : public QObject {
|
2018-01-10 20:21:29 -05:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-07-11 20:39:14 -04:00
|
|
|
AirspyHFWorker(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0);
|
|
|
|
~AirspyHFWorker();
|
2018-01-10 20:21:29 -05:00
|
|
|
|
2022-09-21 16:06:35 -04:00
|
|
|
void startWork();
|
2018-01-10 20:21:29 -05:00
|
|
|
void stopWork();
|
|
|
|
void setSamplerate(uint32_t samplerate);
|
|
|
|
void setLog2Decimation(unsigned int log2_decim);
|
2020-06-21 05:46:08 -04:00
|
|
|
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
2018-01-10 20:21:29 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
airspyhf_device_t* m_dev;
|
|
|
|
qint16 m_buf[2*AIRSPYHF_BLOCKSIZE];
|
|
|
|
SampleVector m_convertBuffer;
|
|
|
|
SampleSinkFifo* m_sampleFifo;
|
|
|
|
|
|
|
|
int m_samplerate;
|
|
|
|
unsigned int m_log2Decim;
|
2020-06-21 05:46:08 -04:00
|
|
|
bool m_iqOrder;
|
2018-01-10 20:21:29 -05:00
|
|
|
|
2020-06-21 05:46:08 -04:00
|
|
|
DecimatorsFI<true> m_decimatorsIQ;
|
|
|
|
DecimatorsFI<false> m_decimatorsQI;
|
2018-01-10 20:21:29 -05:00
|
|
|
|
2020-06-21 05:46:08 -04:00
|
|
|
void callbackIQ(const float* buf, qint32 len);
|
|
|
|
void callbackQI(const float* buf, qint32 len);
|
2018-01-10 20:21:29 -05:00
|
|
|
static int rx_callback(airspyhf_transfer_t* transfer);
|
|
|
|
};
|
|
|
|
|
2020-07-11 20:39:14 -04:00
|
|
|
#endif // INCLUDE_AIRSPYHFWORKER_H
|