2017-09-01 23:39:55 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-09-04 02:39:51 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2017-09-01 23:39:55 -04:00
|
|
|
#include "device/devicesourceapi.h"
|
2017-09-05 08:11:25 -04:00
|
|
|
#include "plutosdr/deviceplutosdr.h"
|
2017-09-05 02:48:09 -04:00
|
|
|
#include "plutosdrinput.h"
|
2017-09-04 02:39:51 -04:00
|
|
|
#include "ui_plutosdrinputgui.h"
|
2017-09-01 23:39:55 -04:00
|
|
|
#include "plutosdrinputgui.h"
|
|
|
|
|
|
|
|
PlutoSDRInputGui::PlutoSDRInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
|
|
|
QWidget(parent),
|
2017-09-04 02:39:51 -04:00
|
|
|
ui(new Ui::PlutoSDRInputGUI),
|
2017-09-01 23:39:55 -04:00
|
|
|
m_deviceAPI(deviceAPI),
|
2017-09-05 02:48:09 -04:00
|
|
|
m_settings(),
|
|
|
|
m_forceSettings(true),
|
|
|
|
m_sampleSource(NULL),
|
|
|
|
m_sampleRate(0),
|
|
|
|
m_deviceCenterFrequency(0),
|
|
|
|
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
|
2017-09-01 23:39:55 -04:00
|
|
|
{
|
2017-09-05 02:48:09 -04:00
|
|
|
m_sampleSource = new PlutoSDRInput(m_deviceAPI);
|
|
|
|
m_deviceAPI->setSource(m_sampleSource);
|
|
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
2017-09-05 08:11:25 -04:00
|
|
|
ui->centerFrequency->setValueRange(7, DevicePlutoSDR::loLowLimitFreq/1000, DevicePlutoSDR::loHighLimitFreq/1000);
|
2017-09-05 02:48:09 -04:00
|
|
|
|
|
|
|
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
|
2017-09-05 08:11:25 -04:00
|
|
|
ui->sampleRate->setValueRange(8, DevicePlutoSDR::srLowLimitFreq, DevicePlutoSDR::srHighLimitFreq);
|
2017-09-05 02:48:09 -04:00
|
|
|
|
|
|
|
ui->lpf->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
|
2017-09-05 08:11:25 -04:00
|
|
|
ui->lpf->setValueRange(5, DevicePlutoSDR::bbLPRxLowLimitFreq/1000, DevicePlutoSDR::bbLPRxHighLimitFreq/1000);
|
2017-09-05 02:48:09 -04:00
|
|
|
|
|
|
|
ui->lpFIR->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
|
2017-09-05 08:11:25 -04:00
|
|
|
ui->lpFIR->setValueRange(5, 1U, 56000U); // will be dynamically recalculated
|
2017-09-05 02:48:09 -04:00
|
|
|
|
2017-09-05 17:51:03 -04:00
|
|
|
ui->hwDecimLabel->setText(QString::fromUtf8("H\u2193"));
|
|
|
|
ui->swDecimLabel->setText(QString::fromUtf8("S\u2193"));
|
|
|
|
|
2017-09-05 02:48:09 -04:00
|
|
|
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
|
|
|
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
|
|
|
m_statusTimer.start(500);
|
|
|
|
|
|
|
|
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
2017-09-01 23:39:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
PlutoSDRInputGui::~PlutoSDRInputGui()
|
|
|
|
{
|
2017-09-04 02:39:51 -04:00
|
|
|
delete ui;
|
2017-09-01 23:39:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void PlutoSDRInputGui::destroy()
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlutoSDRInputGui::setName(const QString& name)
|
|
|
|
{
|
|
|
|
setObjectName(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString PlutoSDRInputGui::getName() const
|
|
|
|
{
|
|
|
|
return objectName();
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlutoSDRInputGui::resetToDefaults()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
qint64 PlutoSDRInputGui::getCenterFrequency() const
|
|
|
|
{
|
|
|
|
return m_settings.m_centerFrequency;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlutoSDRInputGui::setCenterFrequency(qint64 centerFrequency)
|
|
|
|
{
|
|
|
|
m_settings.m_centerFrequency = centerFrequency;
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray PlutoSDRInputGui::serialize() const
|
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PlutoSDRInputGui::deserialize(const QByteArray& data)
|
|
|
|
{
|
|
|
|
if(m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
// displaySettings();
|
|
|
|
// m_forceSettings = true;
|
|
|
|
// sendSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PlutoSDRInputGui::handleMessage(const Message& message)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|