You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
4.2 KiB
98 lines
4.2 KiB
/////////////////////////////////////////////////////////////////////////////////// |
|
// Copyright (C) 2026 Dan Chokola, KD2HSG // |
|
// Based on the packet modulator plugin: // |
|
// Copyright (C) 2020-2023 Jon Beniston, M7RCE <jon@beniston.com> // |
|
// Copyright (C) 2020-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> // |
|
// // |
|
// 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/>. // |
|
/////////////////////////////////////////////////////////////////////////////////// |
|
|
|
#ifndef INCLUDE_CHIRPMODEMMODBASEBAND_H |
|
#define INCLUDE_CHIRPMODEMMODBASEBAND_H |
|
|
|
#include <QObject> |
|
#include <QRecursiveMutex> |
|
#include <QThreadPool> |
|
|
|
#include "dsp/samplesourcefifo.h" |
|
#include "util/message.h" |
|
#include "util/messagequeue.h" |
|
|
|
#include "chirpmodemmodsource.h" |
|
|
|
class UpChannelizer; |
|
|
|
class ChirpModemModBaseband : public QObject |
|
{ |
|
Q_OBJECT |
|
public: |
|
class MsgConfigureChirpModemModBaseband : public Message { |
|
MESSAGE_CLASS_DECLARATION |
|
|
|
public: |
|
const ChirpModemModSettings& getSettings() const { return m_settings; } |
|
const QStringList& getSettingsKeys() const { return m_settingsKeys; } |
|
bool getForce() const { return m_force; } |
|
|
|
static MsgConfigureChirpModemModBaseband *create(const QStringList& settingsKeys, const ChirpModemModSettings& settings, bool force) { |
|
return new MsgConfigureChirpModemModBaseband(settingsKeys, settings, force); |
|
} |
|
|
|
private: |
|
ChirpModemModSettings m_settings; |
|
QStringList m_settingsKeys; |
|
bool m_force; |
|
|
|
MsgConfigureChirpModemModBaseband(const QStringList& settingsKeys, const ChirpModemModSettings& settings, bool force) : |
|
Message(), |
|
m_settings(settings), |
|
m_settingsKeys(settingsKeys), |
|
m_force(force) |
|
{ } |
|
}; |
|
|
|
ChirpModemModBaseband(); |
|
~ChirpModemModBaseband(); |
|
void reset(); |
|
void pull(const SampleVector::iterator& begin, unsigned int nbSamples); |
|
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } |
|
double getMagSq() const { return m_source.getMagSq(); } |
|
int getChannelSampleRate() const; |
|
int getChannelFrequencyOffset() const; |
|
void setSpectrumSampleSink(BasebandSampleSink *sampleSink) { m_source.setSpectrumSink(sampleSink); } |
|
void setMessageQueueToChannel(MessageQueue *queue) { m_source.setMessageQueueToChannel(queue); } |
|
|
|
signals: |
|
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples); |
|
|
|
private: |
|
SampleSourceFifo m_sampleFifo; |
|
UpChannelizer *m_channelizer; |
|
ChirpModemModSource m_source; |
|
MessageQueue m_inputMessageQueue; |
|
ChirpModemModSettings m_settings; |
|
QRecursiveMutex m_mutex; |
|
QThreadPool m_generator; //!< One thread: generates transmissions in order, off the DSP thread |
|
|
|
void generate(const ChirpModemModGen::Job& job); |
|
void processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd); |
|
bool handleMessage(const Message& cmd); |
|
void applySettings(const QStringList& settingsKeys, const ChirpModemModSettings& settings, bool force = false); |
|
|
|
private slots: |
|
void handleInputMessages(); |
|
void handleData(); |
|
}; |
|
|
|
#endif // INCLUDE_CHIRPMODEMMODBASEBAND_H
|
|
|