mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-04 16:01:14 -05:00
86 lines
3.4 KiB
C++
86 lines
3.4 KiB
C++
|
///////////////////////////////////////////////////////////////////////////////////
|
||
|
// Copyright (C) 2017 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 //
|
||
|
// //
|
||
|
// 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/>. //
|
||
|
///////////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#include "limesdrinputgui.h"
|
||
|
|
||
|
#include <QDebug>
|
||
|
#include <QMessageBox>
|
||
|
|
||
|
#include "ui_limesdrinputgui.h"
|
||
|
#include "gui/colormapper.h"
|
||
|
#include "gui/glspectrum.h"
|
||
|
#include "dsp/dspengine.h"
|
||
|
#include "dsp/dspcommands.h"
|
||
|
#include "device/devicesourceapi.h"
|
||
|
#include "dsp/filerecord.h"
|
||
|
|
||
|
LimeSDRInputGUI::LimeSDRInputGUI(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||
|
QWidget(parent),
|
||
|
ui(new Ui::BladerfInputGui),
|
||
|
m_deviceAPI(deviceAPI),
|
||
|
m_settings(),
|
||
|
m_sampleSource(0),
|
||
|
m_sampleRate(0),
|
||
|
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
|
||
|
{
|
||
|
m_limeSDRInput = new LimeSDRInput(m_deviceAPI);
|
||
|
m_sampleSource = (DeviceSampleSource *) m_limeSDRInput;
|
||
|
m_deviceAPI->setSource(m_sampleSource);
|
||
|
|
||
|
ui->setupUi(this);
|
||
|
|
||
|
float minF, maxF, stepF;
|
||
|
|
||
|
m_limeSDRInput->getLORange(minF, maxF, stepF);
|
||
|
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||
|
ui->centerFrequency->setValueRange(7, ((uint32_t) minF)/1000, ((uint32_t) maxF)/1000); // frequency dial is in kHz
|
||
|
|
||
|
m_limeSDRInput->getSRRange(minF, maxF, stepF);
|
||
|
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::ReverseGreenYellow));
|
||
|
ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF);
|
||
|
|
||
|
m_limeSDRInput->getLPRange(minF, maxF, stepF);
|
||
|
int minLP = (int) (minF / stepF);
|
||
|
int maxLP = (int) (maxF / stepF);
|
||
|
int nbSteps = (int) ((maxF - minF) / stepF);
|
||
|
ui->lpf->setMinimum(minLP);
|
||
|
ui->lpf->setMaximum(maxLP);
|
||
|
|
||
|
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||
|
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||
|
m_statusTimer.start(500);
|
||
|
|
||
|
displaySettings();
|
||
|
|
||
|
char recFileNameCStr[30];
|
||
|
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||
|
m_fileSink = new FileRecord(std::string(recFileNameCStr));
|
||
|
m_deviceAPI->addSink(m_fileSink);
|
||
|
|
||
|
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||
|
}
|
||
|
|
||
|
LimeSDRInputGUI::~LimeSDRInputGUI()
|
||
|
{
|
||
|
m_deviceAPI->removeSink(m_fileSink);
|
||
|
delete m_fileSink;
|
||
|
delete m_sampleSource; // Valgrind memcheck
|
||
|
delete ui;
|
||
|
}
|
||
|
|
||
|
|
||
|
|