2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
|
2014-11-29 13:58:20 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
2015-09-13 22:18:29 -04:00
|
|
|
#include "SoapySDRThread.h"
|
2014-12-10 21:22:13 -05:00
|
|
|
#include <algorithm>
|
2014-11-29 13:58:20 -05:00
|
|
|
|
2015-07-29 20:57:02 -04:00
|
|
|
class SDRPostThread : public IOThread {
|
2014-11-29 13:58:20 -05:00
|
|
|
public:
|
|
|
|
|
SDRPostThread();
|
|
|
|
|
~SDRPostThread();
|
|
|
|
|
|
2014-12-11 19:07:21 -05:00
|
|
|
void bindDemodulator(DemodulatorInstance *demod);
|
2016-05-31 19:58:37 -04:00
|
|
|
void bindDemodulators(std::vector<DemodulatorInstance *> *demods);
|
2014-12-11 19:07:21 -05:00
|
|
|
void removeDemodulator(DemodulatorInstance *demod);
|
2015-05-31 22:13:14 -04:00
|
|
|
|
2016-06-28 21:04:52 +02:00
|
|
|
virtual void run();
|
|
|
|
|
virtual void terminate();
|
2014-11-29 13:58:20 -05:00
|
|
|
|
2015-12-29 20:52:49 -05:00
|
|
|
void runSingleCH(SDRThreadIQData *data_in);
|
|
|
|
|
void runPFBCH(SDRThreadIQData *data_in);
|
2015-10-18 12:26:07 -04:00
|
|
|
void setIQVisualRange(long long frequency, int bandwidth);
|
|
|
|
|
|
2014-12-11 19:07:21 -05:00
|
|
|
protected:
|
2017-08-13 18:49:47 +02:00
|
|
|
SDRThreadIQDataQueuePtr iqDataInQueue;
|
|
|
|
|
DemodulatorThreadInputQueuePtr iqDataOutQueue;
|
|
|
|
|
DemodulatorThreadInputQueuePtr iqVisualQueue;
|
|
|
|
|
DemodulatorThreadInputQueuePtr iqActiveDemodVisualQueue;
|
2015-10-17 16:17:12 -04:00
|
|
|
|
2016-06-02 23:56:31 +02:00
|
|
|
//protects access to demodulators lists and such
|
2015-05-31 12:05:45 -04:00
|
|
|
std::mutex busy_demod;
|
2014-11-29 13:58:20 -05:00
|
|
|
std::vector<DemodulatorInstance *> demodulators;
|
2015-08-11 21:49:42 -04:00
|
|
|
|
2016-06-02 23:56:31 +02:00
|
|
|
|
|
|
|
|
|
2015-10-14 18:09:29 -04:00
|
|
|
private:
|
2016-06-02 23:56:31 +02:00
|
|
|
|
2015-10-14 18:09:29 -04:00
|
|
|
void initPFBChannelizer();
|
|
|
|
|
void updateActiveDemodulators();
|
|
|
|
|
void updateChannels();
|
2015-10-18 12:26:07 -04:00
|
|
|
int getChannelAt(long long frequency);
|
2015-10-14 18:09:29 -04:00
|
|
|
|
|
|
|
|
ReBuffer<DemodulatorThreadIQData> buffers;
|
|
|
|
|
std::vector<liquid_float_complex> fpData;
|
|
|
|
|
std::vector<liquid_float_complex> dataOut;
|
|
|
|
|
std::vector<long long> chanCenters;
|
2017-01-28 14:57:27 +01:00
|
|
|
long long chanBw = 0;
|
2015-10-14 18:09:29 -04:00
|
|
|
|
2016-01-29 07:49:31 +11:00
|
|
|
size_t nRunDemods;
|
2015-10-14 18:09:29 -04:00
|
|
|
std::vector<DemodulatorInstance *> runDemods;
|
|
|
|
|
std::vector<int> demodChannel;
|
|
|
|
|
std::vector<int> demodChannelActive;
|
|
|
|
|
|
2015-10-14 00:54:48 -04:00
|
|
|
ReBuffer<DemodulatorThreadIQData> visualDataBuffers;
|
2015-10-14 18:09:29 -04:00
|
|
|
atomic_bool doRefresh;
|
2015-10-18 12:26:07 -04:00
|
|
|
atomic_llong visFrequency;
|
|
|
|
|
atomic_int visBandwidth;
|
2015-10-14 00:54:48 -04:00
|
|
|
int numChannels, sampleRate;
|
2015-10-14 18:09:29 -04:00
|
|
|
long long frequency;
|
2015-10-16 18:40:40 -04:00
|
|
|
firpfbch_crcf channelizer;
|
2015-10-17 16:17:12 -04:00
|
|
|
iirfilt_crcf dcFilter;
|
2015-12-29 20:52:49 -05:00
|
|
|
std::vector<liquid_float_complex> dcBuf;
|
2014-11-29 13:58:20 -05:00
|
|
|
};
|