2019-10-23 01:09:47 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Copyright (C) 2019 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 //
|
|
|
|
|
// (at your option) any later version. //
|
|
|
|
|
// //
|
|
|
|
|
// 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/>. //
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2019-10-24 01:23:38 +02:00
|
|
|
#ifndef INCLUDE_BEAMSTEERINGCWMODSOURCE_H
|
|
|
|
|
#define INCLUDE_BEAMSTEERINGCWMODSOURCE_H
|
2019-10-23 01:09:47 +02:00
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QMutex>
|
|
|
|
|
|
|
|
|
|
#include "dsp/samplemofifo.h"
|
|
|
|
|
#include "util/message.h"
|
|
|
|
|
#include "util/messagequeue.h"
|
2019-10-25 08:30:01 +02:00
|
|
|
#include "beamsteeringcwmodstreamsource.h"
|
2019-10-23 01:09:47 +02:00
|
|
|
|
2019-10-24 01:23:38 +02:00
|
|
|
class UpSampleChannelizer;
|
2019-10-23 01:09:47 +02:00
|
|
|
|
2019-10-24 01:23:38 +02:00
|
|
|
class BeamSteeringCWModSource : public QObject
|
2019-10-23 01:09:47 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
class MsgConfigureChannelizer : public Message {
|
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
int getLog2Interp() const { return m_log2Interp; }
|
|
|
|
|
int getFilterChainHash() const { return m_filterChainHash; }
|
|
|
|
|
|
|
|
|
|
static MsgConfigureChannelizer* create(unsigned int log2Interp, unsigned int filterChainHash) {
|
|
|
|
|
return new MsgConfigureChannelizer(log2Interp, filterChainHash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
unsigned int m_log2Interp;
|
|
|
|
|
unsigned int m_filterChainHash;
|
|
|
|
|
|
|
|
|
|
MsgConfigureChannelizer(unsigned int log2Interp, unsigned int filterChainHash) :
|
|
|
|
|
Message(),
|
|
|
|
|
m_log2Interp(log2Interp),
|
|
|
|
|
m_filterChainHash(filterChainHash)
|
|
|
|
|
{ }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MsgSignalNotification : public Message {
|
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
int getOutputSampleRate() const { return m_outputSampleRate; }
|
|
|
|
|
qint64 getCenterFrequency() const { return m_centerFrequency; }
|
|
|
|
|
|
2019-10-25 08:30:01 +02:00
|
|
|
static MsgSignalNotification* create(int outputSampleRate, qint64 centerFrequency) {
|
|
|
|
|
return new MsgSignalNotification(outputSampleRate, centerFrequency);
|
2019-10-23 01:09:47 +02:00
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
int m_outputSampleRate;
|
|
|
|
|
qint64 m_centerFrequency;
|
|
|
|
|
|
2019-10-25 08:30:01 +02:00
|
|
|
MsgSignalNotification(int outputSampleRate, qint64 centerFrequency) :
|
2019-10-23 01:09:47 +02:00
|
|
|
Message(),
|
|
|
|
|
m_outputSampleRate(outputSampleRate),
|
2019-10-25 08:30:01 +02:00
|
|
|
m_centerFrequency(centerFrequency)
|
2019-10-23 01:09:47 +02:00
|
|
|
{ }
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-25 08:30:01 +02:00
|
|
|
class MsgConfigureSteeringAngle : public Message {
|
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
float getSteeringAngle() const { return m_steeringAngle; }
|
|
|
|
|
|
|
|
|
|
static MsgConfigureSteeringAngle* create(float steeringAngle) {
|
|
|
|
|
return new MsgConfigureSteeringAngle(steeringAngle);
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
float m_steeringAngle;
|
|
|
|
|
|
|
|
|
|
MsgConfigureSteeringAngle(float steeringAngle) :
|
|
|
|
|
Message(),
|
|
|
|
|
m_steeringAngle(steeringAngle)
|
|
|
|
|
{}
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-27 18:20:36 +01:00
|
|
|
class MsgConfigureChannelMute : public Message {
|
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
bool getMute0() const { return m_mute0; }
|
|
|
|
|
bool getMute1() const { return m_mute1; }
|
|
|
|
|
|
|
|
|
|
static MsgConfigureChannelMute* create(bool mute0, bool mute1) {
|
|
|
|
|
return new MsgConfigureChannelMute(mute0, mute1);
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
bool m_mute0;
|
|
|
|
|
bool m_mute1;
|
|
|
|
|
|
|
|
|
|
MsgConfigureChannelMute(bool mute0, bool mute1) :
|
|
|
|
|
Message(),
|
|
|
|
|
m_mute0(mute0),
|
|
|
|
|
m_mute1(mute1)
|
|
|
|
|
{}
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-24 01:23:38 +02:00
|
|
|
BeamSteeringCWModSource();
|
|
|
|
|
~BeamSteeringCWModSource();
|
2019-10-23 01:09:47 +02:00
|
|
|
void reset();
|
|
|
|
|
|
|
|
|
|
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
|
|
|
|
|
|
2019-10-25 08:30:01 +02:00
|
|
|
void setSteeringDegrees(int steeringDegrees);
|
2019-10-27 18:20:36 +01:00
|
|
|
void muteChannel(bool mute0, bool mute1);
|
2019-10-25 08:30:01 +02:00
|
|
|
void pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int streamIndex);
|
2019-10-23 01:09:47 +02:00
|
|
|
|
|
|
|
|
private:
|
2019-10-25 08:30:01 +02:00
|
|
|
void processFifo(std::vector<SampleVector>& data, unsigned int ibegin, unsigned int iend);
|
2019-10-23 01:09:47 +02:00
|
|
|
bool handleMessage(const Message& cmd);
|
|
|
|
|
|
|
|
|
|
int m_steeringDegrees;
|
|
|
|
|
SampleMOFifo m_sampleMOFifo;
|
2019-10-25 08:30:01 +02:00
|
|
|
std::vector<SampleVector::iterator> m_vbegin;
|
2019-10-23 01:09:47 +02:00
|
|
|
int m_sizes[2];
|
2019-10-24 01:23:38 +02:00
|
|
|
UpSampleChannelizer *m_channelizers[2];
|
2019-10-25 08:30:01 +02:00
|
|
|
BeamSteeringCWModStreamSource m_streamSources[2];
|
2019-10-23 01:09:47 +02:00
|
|
|
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
|
|
|
|
QMutex m_mutex;
|
|
|
|
|
unsigned int m_lastStream;
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void handleInputMessages();
|
|
|
|
|
void handleData(); //!< Handle data when samples have to be processed
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2019-10-24 01:23:38 +02:00
|
|
|
#endif // INCLUDE_BEAMSTEERINGCWMODSOURCE_H
|