mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
LibbladeRF2: migrate bladerfoutput to bladerf1output
This commit is contained in:
parent
e130c2213f
commit
0e79f4eccf
@ -4,7 +4,7 @@ find_package(LibUSB)
|
|||||||
|
|
||||||
find_package(LibBLADERF)
|
find_package(LibBLADERF)
|
||||||
if(LIBUSB_FOUND AND LIBBLADERF_FOUND)
|
if(LIBUSB_FOUND AND LIBBLADERF_FOUND)
|
||||||
add_subdirectory(bladerfoutput)
|
add_subdirectory(bladerf1output)
|
||||||
endif(LIBUSB_FOUND AND LIBBLADERF_FOUND)
|
endif(LIBUSB_FOUND AND LIBBLADERF_FOUND)
|
||||||
|
|
||||||
find_package(LibHACKRF)
|
find_package(LibHACKRF)
|
||||||
@ -28,7 +28,7 @@ if(CM256CC_FOUND)
|
|||||||
endif(CM256CC_FOUND)
|
endif(CM256CC_FOUND)
|
||||||
|
|
||||||
if (BUILD_DEBIAN)
|
if (BUILD_DEBIAN)
|
||||||
add_subdirectory(bladerfoutput)
|
add_subdirectory(bladerf1output)
|
||||||
add_subdirectory(hackrfoutput)
|
add_subdirectory(hackrfoutput)
|
||||||
add_subdirectory(limesdroutput)
|
add_subdirectory(limesdroutput)
|
||||||
add_subdirectory(plutosdroutput)
|
add_subdirectory(plutosdroutput)
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
project(bladerfoutput)
|
project(bladerf1output)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
set(bladerfoutput_SOURCES
|
set(bladerf1output_SOURCES
|
||||||
bladerfoutputgui.cpp
|
bladerf1outputgui.cpp
|
||||||
bladerfoutput.cpp
|
bladerf1output.cpp
|
||||||
bladerfoutputplugin.cpp
|
bladerf1outputplugin.cpp
|
||||||
bladerfoutputsettings.cpp
|
bladerf1outputsettings.cpp
|
||||||
bladerfoutputthread.cpp
|
bladerf1outputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerfoutput_HEADERS
|
set(bladerf1output_HEADERS
|
||||||
bladerfoutputgui.h
|
bladerf1outputgui.h
|
||||||
bladerfoutput.h
|
bladerf1output.h
|
||||||
bladerfoutputplugin.h
|
bladerf1soutputplugin.h
|
||||||
bladerfoutputsettings.h
|
bladerf1outputsettings.h
|
||||||
bladerfoutputthread.h
|
bladerf1outputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerfoutput_FORMS
|
set(bladerf1output_FORMS
|
||||||
bladerf1outputgui.ui
|
bladerf1outputgui.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -46,17 +46,17 @@ add_definitions(${QT_DEFINITIONS})
|
|||||||
add_definitions(-DQT_PLUGIN)
|
add_definitions(-DQT_PLUGIN)
|
||||||
add_definitions(-DQT_SHARED)
|
add_definitions(-DQT_SHARED)
|
||||||
|
|
||||||
#qt4_wrap_cpp(bladerfoutput_HEADERS_MOC ${bladerfoutput_HEADERS})
|
#qt4_wrap_cpp(bladerf1output_HEADERS_MOC ${bladerf1output_HEADERS})
|
||||||
qt5_wrap_ui(bladerfoutput_FORMS_HEADERS ${bladerfoutput_FORMS})
|
qt5_wrap_ui(bladerf1output_FORMS_HEADERS ${bladerf1output_FORMS})
|
||||||
|
|
||||||
add_library(outputbladerf SHARED
|
add_library(outputbladerf1 SHARED
|
||||||
${bladerfoutput_SOURCES}
|
${bladerf1output_SOURCES}
|
||||||
${bladerfoutput_HEADERS_MOC}
|
${bladerf1output_HEADERS_MOC}
|
||||||
${bladerfoutput_FORMS_HEADERS}
|
${bladerf1output_FORMS_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_DEBIAN)
|
if (BUILD_DEBIAN)
|
||||||
target_link_libraries(outputbladerf
|
target_link_libraries(outputbladerf1
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
bladerf
|
bladerf
|
||||||
sdrbase
|
sdrbase
|
||||||
@ -65,7 +65,7 @@ target_link_libraries(outputbladerf
|
|||||||
bladerf1device
|
bladerf1device
|
||||||
)
|
)
|
||||||
else (BUILD_DEBIAN)
|
else (BUILD_DEBIAN)
|
||||||
target_link_libraries(outputbladerf
|
target_link_libraries(outputbladerf1
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${LIBBLADERF_LIBRARIES}
|
${LIBBLADERF_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
@ -75,6 +75,6 @@ target_link_libraries(outputbladerf
|
|||||||
)
|
)
|
||||||
endif (BUILD_DEBIAN)
|
endif (BUILD_DEBIAN)
|
||||||
|
|
||||||
target_link_libraries(outputbladerf Qt5::Core Qt5::Widgets)
|
target_link_libraries(outputbladerf1 Qt5::Core Qt5::Widgets)
|
||||||
|
|
||||||
install(TARGETS outputbladerf DESTINATION lib/plugins/samplesink)
|
install(TARGETS outputbladerf1 DESTINATION lib/plugins/samplesink)
|
@ -14,6 +14,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "bladerf1output.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -26,16 +28,14 @@
|
|||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "device/devicesinkapi.h"
|
#include "device/devicesinkapi.h"
|
||||||
#include "device/devicesourceapi.h"
|
#include "device/devicesourceapi.h"
|
||||||
#include "bladerfoutput.h"
|
|
||||||
|
|
||||||
#include "../../../devices/bladerf1/devicebladerf1shared.h"
|
#include "../../../devices/bladerf1/devicebladerf1shared.h"
|
||||||
#include "bladerfoutputthread.h"
|
#include "bladerf1outputthread.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(BladerfOutput::MsgConfigureBladerf, Message)
|
MESSAGE_CLASS_DEFINITION(Bladerf1Output::MsgConfigureBladerf1, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(BladerfOutput::MsgStartStop, Message)
|
MESSAGE_CLASS_DEFINITION(Bladerf1Output::MsgStartStop, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(BladerfOutput::MsgReportBladerf, Message)
|
MESSAGE_CLASS_DEFINITION(Bladerf1Output::MsgReportBladerf1, Message)
|
||||||
|
|
||||||
BladerfOutput::BladerfOutput(DeviceSinkAPI *deviceAPI) :
|
Bladerf1Output::Bladerf1Output(DeviceSinkAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_settings(),
|
m_settings(),
|
||||||
m_dev(0),
|
m_dev(0),
|
||||||
@ -48,19 +48,19 @@ BladerfOutput::BladerfOutput(DeviceSinkAPI *deviceAPI) :
|
|||||||
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
|
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
BladerfOutput::~BladerfOutput()
|
Bladerf1Output::~Bladerf1Output()
|
||||||
{
|
{
|
||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
closeDevice();
|
closeDevice();
|
||||||
m_deviceAPI->setBuddySharedPtr(0);
|
m_deviceAPI->setBuddySharedPtr(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutput::destroy()
|
void Bladerf1Output::destroy()
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfOutput::openDevice()
|
bool Bladerf1Output::openDevice()
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if (m_dev != 0)
|
||||||
{
|
{
|
||||||
@ -118,12 +118,12 @@ bool BladerfOutput::openDevice()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutput::init()
|
void Bladerf1Output::init()
|
||||||
{
|
{
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfOutput::start()
|
bool Bladerf1Output::start()
|
||||||
{
|
{
|
||||||
// QMutexLocker mutexLocker(&m_mutex);
|
// QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ bool BladerfOutput::start()
|
|||||||
|
|
||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
|
|
||||||
m_bladerfThread = new BladerfOutputThread(m_dev, &m_sampleSourceFifo);
|
m_bladerfThread = new Bladerf1OutputThread(m_dev, &m_sampleSourceFifo);
|
||||||
|
|
||||||
// mutexLocker.unlock();
|
// mutexLocker.unlock();
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
@ -148,7 +148,7 @@ bool BladerfOutput::start()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutput::closeDevice()
|
void Bladerf1Output::closeDevice()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ void BladerfOutput::closeDevice()
|
|||||||
m_dev = 0;
|
m_dev = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutput::stop()
|
void Bladerf1Output::stop()
|
||||||
{
|
{
|
||||||
// QMutexLocker mutexLocker(&m_mutex);
|
// QMutexLocker mutexLocker(&m_mutex);
|
||||||
if (m_bladerfThread != 0)
|
if (m_bladerfThread != 0)
|
||||||
@ -188,12 +188,12 @@ void BladerfOutput::stop()
|
|||||||
m_running = false;
|
m_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray BladerfOutput::serialize() const
|
QByteArray Bladerf1Output::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfOutput::deserialize(const QByteArray& data)
|
bool Bladerf1Output::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@ -203,54 +203,54 @@ bool BladerfOutput::deserialize(const QByteArray& data)
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureBladerf* message = MsgConfigureBladerf::create(m_settings, true);
|
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(m_settings, true);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigureBladerf* messageToGUI = MsgConfigureBladerf::create(m_settings, true);
|
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(m_settings, true);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString& BladerfOutput::getDeviceDescription() const
|
const QString& Bladerf1Output::getDeviceDescription() const
|
||||||
{
|
{
|
||||||
return m_deviceDescription;
|
return m_deviceDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BladerfOutput::getSampleRate() const
|
int Bladerf1Output::getSampleRate() const
|
||||||
{
|
{
|
||||||
int rate = m_settings.m_devSampleRate;
|
int rate = m_settings.m_devSampleRate;
|
||||||
return (rate / (1<<m_settings.m_log2Interp));
|
return (rate / (1<<m_settings.m_log2Interp));
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 BladerfOutput::getCenterFrequency() const
|
quint64 Bladerf1Output::getCenterFrequency() const
|
||||||
{
|
{
|
||||||
return m_settings.m_centerFrequency;
|
return m_settings.m_centerFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutput::setCenterFrequency(qint64 centerFrequency)
|
void Bladerf1Output::setCenterFrequency(qint64 centerFrequency)
|
||||||
{
|
{
|
||||||
BladeRFOutputSettings settings = m_settings;
|
BladeRF1OutputSettings settings = m_settings;
|
||||||
settings.m_centerFrequency = centerFrequency;
|
settings.m_centerFrequency = centerFrequency;
|
||||||
|
|
||||||
MsgConfigureBladerf* message = MsgConfigureBladerf::create(settings, false);
|
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(settings, false);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigureBladerf* messageToGUI = MsgConfigureBladerf::create(settings, false);
|
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(settings, false);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfOutput::handleMessage(const Message& message)
|
bool Bladerf1Output::handleMessage(const Message& message)
|
||||||
{
|
{
|
||||||
if (MsgConfigureBladerf::match(message))
|
if (MsgConfigureBladerf1::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureBladerf& conf = (MsgConfigureBladerf&) message;
|
MsgConfigureBladerf1& conf = (MsgConfigureBladerf1&) message;
|
||||||
qDebug() << "BladerfOutput::handleMessage: MsgConfigureBladerf";
|
qDebug() << "BladerfOutput::handleMessage: MsgConfigureBladerf";
|
||||||
|
|
||||||
if (!applySettings(conf.getSettings(), conf.getForce()))
|
if (!applySettings(conf.getSettings(), conf.getForce()))
|
||||||
@ -285,7 +285,7 @@ bool BladerfOutput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfOutput::applySettings(const BladeRFOutputSettings& settings, bool force)
|
bool Bladerf1Output::applySettings(const BladeRF1OutputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
bool forwardChange = false;
|
bool forwardChange = false;
|
||||||
bool suspendOwnThread = false;
|
bool suspendOwnThread = false;
|
||||||
@ -534,7 +534,7 @@ bool BladerfOutput::applySettings(const BladeRFOutputSettings& settings, bool fo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BladerfOutput::webapiSettingsGet(
|
int Bladerf1Output::webapiSettingsGet(
|
||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -544,7 +544,7 @@ int BladerfOutput::webapiSettingsGet(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRFOutputSettings& settings)
|
void Bladerf1Output::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1OutputSettings& settings)
|
||||||
{
|
{
|
||||||
response.getBladeRf1OutputSettings()->setCenterFrequency(settings.m_centerFrequency);
|
response.getBladeRf1OutputSettings()->setCenterFrequency(settings.m_centerFrequency);
|
||||||
response.getBladeRf1OutputSettings()->setDevSampleRate(settings.m_devSampleRate);
|
response.getBladeRf1OutputSettings()->setDevSampleRate(settings.m_devSampleRate);
|
||||||
@ -557,13 +557,13 @@ void BladerfOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
|
|||||||
response.getBladeRf1OutputSettings()->setXb200Filter((int) settings.m_xb200Filter);
|
response.getBladeRf1OutputSettings()->setXb200Filter((int) settings.m_xb200Filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BladerfOutput::webapiSettingsPutPatch(
|
int Bladerf1Output::webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& deviceSettingsKeys,
|
const QStringList& deviceSettingsKeys,
|
||||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
||||||
{
|
{
|
||||||
BladeRFOutputSettings settings = m_settings;
|
BladeRF1OutputSettings settings = m_settings;
|
||||||
|
|
||||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||||
settings.m_centerFrequency = response.getBladeRf1OutputSettings()->getCenterFrequency();
|
settings.m_centerFrequency = response.getBladeRf1OutputSettings()->getCenterFrequency();
|
||||||
@ -593,12 +593,12 @@ int BladerfOutput::webapiSettingsPutPatch(
|
|||||||
settings.m_xb200Filter = static_cast<bladerf_xb200_filter>(response.getBladeRf1OutputSettings()->getXb200Filter());
|
settings.m_xb200Filter = static_cast<bladerf_xb200_filter>(response.getBladeRf1OutputSettings()->getXb200Filter());
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureBladerf *msg = MsgConfigureBladerf::create(settings, force);
|
MsgConfigureBladerf1 *msg = MsgConfigureBladerf1::create(settings, force);
|
||||||
m_inputMessageQueue.push(msg);
|
m_inputMessageQueue.push(msg);
|
||||||
|
|
||||||
if (m_guiMessageQueue) // forward to GUI if any
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
{
|
{
|
||||||
MsgConfigureBladerf *msgToGUI = MsgConfigureBladerf::create(settings, force);
|
MsgConfigureBladerf1 *msgToGUI = MsgConfigureBladerf1::create(settings, force);
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ int BladerfOutput::webapiSettingsPutPatch(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BladerfOutput::webapiRunGet(
|
int Bladerf1Output::webapiRunGet(
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -614,7 +614,7 @@ int BladerfOutput::webapiRunGet(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BladerfOutput::webapiRun(
|
int Bladerf1Output::webapiRun(
|
||||||
bool run,
|
bool run,
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
@ -23,30 +23,30 @@
|
|||||||
|
|
||||||
#include "../../../devices/bladerf1/devicebladerf1.h"
|
#include "../../../devices/bladerf1/devicebladerf1.h"
|
||||||
#include "../../../devices/bladerf1/devicebladerf1param.h"
|
#include "../../../devices/bladerf1/devicebladerf1param.h"
|
||||||
#include "bladerfoutputsettings.h"
|
#include "bladerf1outputsettings.h"
|
||||||
|
|
||||||
class DeviceSinkAPI;
|
class DeviceSinkAPI;
|
||||||
class BladerfOutputThread;
|
class Bladerf1OutputThread;
|
||||||
|
|
||||||
class BladerfOutput : public DeviceSampleSink {
|
class Bladerf1Output : public DeviceSampleSink {
|
||||||
public:
|
public:
|
||||||
class MsgConfigureBladerf : public Message {
|
class MsgConfigureBladerf1 : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const BladeRFOutputSettings& getSettings() const { return m_settings; }
|
const BladeRF1OutputSettings& getSettings() const { return m_settings; }
|
||||||
bool getForce() const { return m_force; }
|
bool getForce() const { return m_force; }
|
||||||
|
|
||||||
static MsgConfigureBladerf* create(const BladeRFOutputSettings& settings, bool force)
|
static MsgConfigureBladerf1* create(const BladeRF1OutputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
return new MsgConfigureBladerf(settings, force);
|
return new MsgConfigureBladerf1(settings, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BladeRFOutputSettings m_settings;
|
BladeRF1OutputSettings m_settings;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigureBladerf(const BladeRFOutputSettings& settings, bool force) :
|
MsgConfigureBladerf1(const BladeRF1OutputSettings& settings, bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
@ -72,25 +72,25 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
class MsgReportBladerf : public Message {
|
class MsgReportBladerf1 : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static MsgReportBladerf* create()
|
static MsgReportBladerf1* create()
|
||||||
{
|
{
|
||||||
return new MsgReportBladerf();
|
return new MsgReportBladerf1();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
MsgReportBladerf() :
|
MsgReportBladerf1() :
|
||||||
Message()
|
Message()
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
BladerfOutput(DeviceSinkAPI *deviceAPI);
|
Bladerf1Output(DeviceSinkAPI *deviceAPI);
|
||||||
virtual ~BladerfOutput();
|
virtual ~Bladerf1Output();
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
@ -130,14 +130,14 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
bool applySettings(const BladeRFOutputSettings& settings, bool force);
|
bool applySettings(const BladeRF1OutputSettings& settings, bool force);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRFOutputSettings& settings);
|
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1OutputSettings& settings);
|
||||||
|
|
||||||
DeviceSinkAPI *m_deviceAPI;
|
DeviceSinkAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
BladeRFOutputSettings m_settings;
|
BladeRF1OutputSettings m_settings;
|
||||||
struct bladerf* m_dev;
|
struct bladerf* m_dev;
|
||||||
BladerfOutputThread* m_bladerfThread;
|
Bladerf1OutputThread* m_bladerfThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
DeviceBladeRF1Params m_sharedParams;
|
DeviceBladeRF1Params m_sharedParams;
|
||||||
bool m_running;
|
bool m_running;
|
@ -26,9 +26,9 @@
|
|||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "device/devicesinkapi.h"
|
#include "device/devicesinkapi.h"
|
||||||
#include "device/deviceuiset.h"
|
#include "device/deviceuiset.h"
|
||||||
#include "bladerfoutputgui.h"
|
#include "bladerf1outputgui.h"
|
||||||
|
|
||||||
BladerfOutputGui::BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
Bladerf1OutputGui::Bladerf1OutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::Bladerf1OutputGui),
|
ui(new Ui::Bladerf1OutputGui),
|
||||||
m_deviceUISet(deviceUISet),
|
m_deviceUISet(deviceUISet),
|
||||||
@ -39,7 +39,7 @@ BladerfOutputGui::BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
m_sampleRate(0),
|
m_sampleRate(0),
|
||||||
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
|
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
|
||||||
{
|
{
|
||||||
m_deviceSampleSink = (BladerfOutput*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
|
m_deviceSampleSink = (Bladerf1Output*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||||
@ -67,51 +67,51 @@ BladerfOutputGui::BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
BladerfOutputGui::~BladerfOutputGui()
|
Bladerf1OutputGui::~Bladerf1OutputGui()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::destroy()
|
void Bladerf1OutputGui::destroy()
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::setName(const QString& name)
|
void Bladerf1OutputGui::setName(const QString& name)
|
||||||
{
|
{
|
||||||
setObjectName(name);
|
setObjectName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BladerfOutputGui::getName() const
|
QString Bladerf1OutputGui::getName() const
|
||||||
{
|
{
|
||||||
return objectName();
|
return objectName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::resetToDefaults()
|
void Bladerf1OutputGui::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_settings.resetToDefaults();
|
m_settings.resetToDefaults();
|
||||||
displaySettings();
|
displaySettings();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 BladerfOutputGui::getCenterFrequency() const
|
qint64 Bladerf1OutputGui::getCenterFrequency() const
|
||||||
{
|
{
|
||||||
return m_settings.m_centerFrequency;
|
return m_settings.m_centerFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::setCenterFrequency(qint64 centerFrequency)
|
void Bladerf1OutputGui::setCenterFrequency(qint64 centerFrequency)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = centerFrequency;
|
m_settings.m_centerFrequency = centerFrequency;
|
||||||
displaySettings();
|
displaySettings();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray BladerfOutputGui::serialize() const
|
QByteArray Bladerf1OutputGui::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfOutputGui::deserialize(const QByteArray& data)
|
bool Bladerf1OutputGui::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
if(m_settings.deserialize(data)) {
|
if(m_settings.deserialize(data)) {
|
||||||
displaySettings();
|
displaySettings();
|
||||||
@ -124,25 +124,25 @@ bool BladerfOutputGui::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfOutputGui::handleMessage(const Message& message)
|
bool Bladerf1OutputGui::handleMessage(const Message& message)
|
||||||
{
|
{
|
||||||
if (BladerfOutput::MsgConfigureBladerf::match(message))
|
if (Bladerf1Output::MsgConfigureBladerf1::match(message))
|
||||||
{
|
{
|
||||||
const BladerfOutput::MsgConfigureBladerf& cfg = (BladerfOutput::MsgConfigureBladerf&) message;
|
const Bladerf1Output::MsgConfigureBladerf1& cfg = (Bladerf1Output::MsgConfigureBladerf1&) message;
|
||||||
m_settings = cfg.getSettings();
|
m_settings = cfg.getSettings();
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (BladerfOutput::MsgReportBladerf::match(message))
|
else if (Bladerf1Output::MsgReportBladerf1::match(message))
|
||||||
{
|
{
|
||||||
displaySettings();
|
displaySettings();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (BladerfOutput::MsgStartStop::match(message))
|
else if (Bladerf1Output::MsgStartStop::match(message))
|
||||||
{
|
{
|
||||||
BladerfOutput::MsgStartStop& notif = (BladerfOutput::MsgStartStop&) message;
|
Bladerf1Output::MsgStartStop& notif = (Bladerf1Output::MsgStartStop&) message;
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
ui->startStop->setChecked(notif.getStartStop());
|
ui->startStop->setChecked(notif.getStartStop());
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
@ -154,7 +154,7 @@ bool BladerfOutputGui::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::handleInputMessages()
|
void Bladerf1OutputGui::handleInputMessages()
|
||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
@ -182,14 +182,14 @@ void BladerfOutputGui::handleInputMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::updateSampleRateAndFrequency()
|
void Bladerf1OutputGui::updateSampleRateAndFrequency()
|
||||||
{
|
{
|
||||||
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
||||||
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||||
ui->deviceRateLabel->setText(QString("%1k").arg(QString::number(m_sampleRate/1000.0, 'g', 5)));
|
ui->deviceRateLabel->setText(QString("%1k").arg(QString::number(m_sampleRate/1000.0, 'g', 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::displaySettings()
|
void Bladerf1OutputGui::displaySettings()
|
||||||
{
|
{
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||||
@ -208,32 +208,32 @@ void BladerfOutputGui::displaySettings()
|
|||||||
ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter));
|
ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::sendSettings()
|
void Bladerf1OutputGui::sendSettings()
|
||||||
{
|
{
|
||||||
if(!m_updateTimer.isActive())
|
if(!m_updateTimer.isActive())
|
||||||
m_updateTimer.start(100);
|
m_updateTimer.start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_centerFrequency_changed(quint64 value)
|
void Bladerf1OutputGui::on_centerFrequency_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = value * 1000;
|
m_settings.m_centerFrequency = value * 1000;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_sampleRate_changed(quint64 value)
|
void Bladerf1OutputGui::on_sampleRate_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_devSampleRate = value;
|
m_settings.m_devSampleRate = value;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_bandwidth_currentIndexChanged(int index)
|
void Bladerf1OutputGui::on_bandwidth_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
int newbw = BladerfBandwidths::getBandwidth(index);
|
int newbw = BladerfBandwidths::getBandwidth(index);
|
||||||
m_settings.m_bandwidth = newbw * 1000;
|
m_settings.m_bandwidth = newbw * 1000;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_interp_currentIndexChanged(int index)
|
void Bladerf1OutputGui::on_interp_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if ((index <0) || (index > 6))
|
if ((index <0) || (index > 6))
|
||||||
return;
|
return;
|
||||||
@ -241,7 +241,7 @@ void BladerfOutputGui::on_interp_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_vga1_valueChanged(int value)
|
void Bladerf1OutputGui::on_vga1_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if ((value < BLADERF_TXVGA1_GAIN_MIN) || (value > BLADERF_TXVGA1_GAIN_MAX))
|
if ((value < BLADERF_TXVGA1_GAIN_MIN) || (value > BLADERF_TXVGA1_GAIN_MAX))
|
||||||
return;
|
return;
|
||||||
@ -251,7 +251,7 @@ void BladerfOutputGui::on_vga1_valueChanged(int value)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_vga2_valueChanged(int value)
|
void Bladerf1OutputGui::on_vga2_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if ((value < BLADERF_TXVGA2_GAIN_MIN) || (value > BLADERF_TXVGA2_GAIN_MAX))
|
if ((value < BLADERF_TXVGA2_GAIN_MIN) || (value > BLADERF_TXVGA2_GAIN_MAX))
|
||||||
return;
|
return;
|
||||||
@ -261,7 +261,7 @@ void BladerfOutputGui::on_vga2_valueChanged(int value)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_xb200_currentIndexChanged(int index)
|
void Bladerf1OutputGui::on_xb200_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (index == 1) // bypass
|
if (index == 1) // bypass
|
||||||
{
|
{
|
||||||
@ -321,25 +321,25 @@ void BladerfOutputGui::on_xb200_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_startStop_toggled(bool checked)
|
void Bladerf1OutputGui::on_startStop_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (m_doApplySettings)
|
if (m_doApplySettings)
|
||||||
{
|
{
|
||||||
BladerfOutput::MsgStartStop *message = BladerfOutput::MsgStartStop::create(checked);
|
Bladerf1Output::MsgStartStop *message = Bladerf1Output::MsgStartStop::create(checked);
|
||||||
m_deviceSampleSink->getInputMessageQueue()->push(message);
|
m_deviceSampleSink->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::updateHardware()
|
void Bladerf1OutputGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "BladerfGui::updateHardware";
|
qDebug() << "BladerfGui::updateHardware";
|
||||||
BladerfOutput::MsgConfigureBladerf* message = BladerfOutput::MsgConfigureBladerf::create( m_settings, m_forceSettings);
|
Bladerf1Output::MsgConfigureBladerf1* message = Bladerf1Output::MsgConfigureBladerf1::create( m_settings, m_forceSettings);
|
||||||
m_deviceSampleSink->getInputMessageQueue()->push(message);
|
m_deviceSampleSink->getInputMessageQueue()->push(message);
|
||||||
m_forceSettings = false;
|
m_forceSettings = false;
|
||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::updateStatus()
|
void Bladerf1OutputGui::updateStatus()
|
||||||
{
|
{
|
||||||
int state = m_deviceUISet->m_deviceSinkAPI->state();
|
int state = m_deviceUISet->m_deviceSinkAPI->state();
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ void BladerfOutputGui::updateStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BladerfOutputGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
|
unsigned int Bladerf1OutputGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
|
||||||
{
|
{
|
||||||
if (xb_200)
|
if (xb_200)
|
||||||
{
|
{
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
|
|
||||||
#include "bladerfoutput.h"
|
#include "bladerf1output.h"
|
||||||
|
|
||||||
class DeviceSampleSink;
|
class DeviceSampleSink;
|
||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
@ -32,12 +32,12 @@ namespace Ui {
|
|||||||
class Bladerf1OutputGui;
|
class Bladerf1OutputGui;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BladerfOutputGui : public QWidget, public PluginInstanceGUI {
|
class Bladerf1OutputGui : public QWidget, public PluginInstanceGUI {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
|
explicit Bladerf1OutputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
|
||||||
virtual ~BladerfOutputGui();
|
virtual ~Bladerf1OutputGui();
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
@ -57,7 +57,7 @@ private:
|
|||||||
DeviceUISet* m_deviceUISet;
|
DeviceUISet* m_deviceUISet;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
bool m_forceSettings;
|
bool m_forceSettings;
|
||||||
BladeRFOutputSettings m_settings;
|
BladeRF1OutputSettings m_settings;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
DeviceSampleSink* m_deviceSampleSink;
|
DeviceSampleSink* m_deviceSampleSink;
|
@ -20,15 +20,15 @@
|
|||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
|
|
||||||
#include "bladerfoutputplugin.h"
|
#include "bladerf1outputplugin.h"
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
#include "bladerfoutput.h"
|
#include "bladerf1output.h"
|
||||||
#else
|
#else
|
||||||
#include "bladerfoutputgui.h"
|
#include "bladerf1outputgui.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const PluginDescriptor BladerfOutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor Bladerf1OutputPlugin::m_pluginDescriptor = {
|
||||||
QString("BladeRF1 Output"),
|
QString("BladeRF1 Output"),
|
||||||
QString("4.2.0"),
|
QString("4.2.0"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
@ -37,25 +37,25 @@ const PluginDescriptor BladerfOutputPlugin::m_pluginDescriptor = {
|
|||||||
QString("https://github.com/f4exb/sdrangel")
|
QString("https://github.com/f4exb/sdrangel")
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString BladerfOutputPlugin::m_hardwareID = "BladeRF1";
|
const QString Bladerf1OutputPlugin::m_hardwareID = "BladeRF1";
|
||||||
const QString BladerfOutputPlugin::m_deviceTypeID = BLADERF1OUTPUT_DEVICE_TYPE_ID;
|
const QString Bladerf1OutputPlugin::m_deviceTypeID = BLADERF1OUTPUT_DEVICE_TYPE_ID;
|
||||||
|
|
||||||
BladerfOutputPlugin::BladerfOutputPlugin(QObject* parent) :
|
Bladerf1OutputPlugin::Bladerf1OutputPlugin(QObject* parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const PluginDescriptor& BladerfOutputPlugin::getPluginDescriptor() const
|
const PluginDescriptor& Bladerf1OutputPlugin::getPluginDescriptor() const
|
||||||
{
|
{
|
||||||
return m_pluginDescriptor;
|
return m_pluginDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputPlugin::initPlugin(PluginAPI* pluginAPI)
|
void Bladerf1OutputPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||||
{
|
{
|
||||||
pluginAPI->registerSampleSink(m_deviceTypeID, this);
|
pluginAPI->registerSampleSink(m_deviceTypeID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInterface::SamplingDevices BladerfOutputPlugin::enumSampleSinks()
|
PluginInterface::SamplingDevices Bladerf1OutputPlugin::enumSampleSinks()
|
||||||
{
|
{
|
||||||
SamplingDevices result;
|
SamplingDevices result;
|
||||||
struct bladerf_devinfo *devinfo = 0;
|
struct bladerf_devinfo *devinfo = 0;
|
||||||
@ -109,7 +109,7 @@ PluginInterface::SamplingDevices BladerfOutputPlugin::enumSampleSinks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
|
PluginInstanceGUI* Bladerf1OutputPlugin::createSampleSinkPluginInstanceGUI(
|
||||||
const QString& sinkId __attribute__((unused)),
|
const QString& sinkId __attribute__((unused)),
|
||||||
QWidget **widget __attribute__((unused)),
|
QWidget **widget __attribute__((unused)),
|
||||||
DeviceUISet *deviceUISet __attribute__((unused)))
|
DeviceUISet *deviceUISet __attribute__((unused)))
|
||||||
@ -117,14 +117,14 @@ PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
|
PluginInstanceGUI* Bladerf1OutputPlugin::createSampleSinkPluginInstanceGUI(
|
||||||
const QString& sinkId,
|
const QString& sinkId,
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet)
|
DeviceUISet *deviceUISet)
|
||||||
{
|
{
|
||||||
if(sinkId == m_deviceTypeID)
|
if(sinkId == m_deviceTypeID)
|
||||||
{
|
{
|
||||||
BladerfOutputGui* gui = new BladerfOutputGui(deviceUISet);
|
Bladerf1OutputGui* gui = new Bladerf1OutputGui(deviceUISet);
|
||||||
*widget = gui;
|
*widget = gui;
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
@ -135,16 +135,15 @@ PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DeviceSampleSink* BladerfOutputPlugin::createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceSinkAPI *deviceAPI)
|
DeviceSampleSink* Bladerf1OutputPlugin::createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceSinkAPI *deviceAPI)
|
||||||
{
|
{
|
||||||
if(sinkId == m_deviceTypeID)
|
if(sinkId == m_deviceTypeID)
|
||||||
{
|
{
|
||||||
BladerfOutput* output = new BladerfOutput(deviceAPI);
|
Bladerf1Output* output = new Bladerf1Output(deviceAPI);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -24,13 +24,13 @@ class PluginAPI;
|
|||||||
|
|
||||||
#define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1output"
|
#define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1output"
|
||||||
|
|
||||||
class BladerfOutputPlugin : public QObject, public PluginInterface {
|
class Bladerf1OutputPlugin : public QObject, public PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(PluginInterface)
|
Q_INTERFACES(PluginInterface)
|
||||||
Q_PLUGIN_METADATA(IID BLADERF1OUTPUT_DEVICE_TYPE_ID)
|
Q_PLUGIN_METADATA(IID BLADERF1OUTPUT_DEVICE_TYPE_ID)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BladerfOutputPlugin(QObject* parent = NULL);
|
explicit Bladerf1OutputPlugin(QObject* parent = NULL);
|
||||||
|
|
||||||
const PluginDescriptor& getPluginDescriptor() const;
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
void initPlugin(PluginAPI* pluginAPI);
|
void initPlugin(PluginAPI* pluginAPI);
|
@ -14,17 +14,18 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "bladerf1outputsettings.h"
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "bladerfoutputsettings.h"
|
|
||||||
|
|
||||||
|
|
||||||
BladeRFOutputSettings::BladeRFOutputSettings()
|
BladeRF1OutputSettings::BladeRF1OutputSettings()
|
||||||
{
|
{
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladeRFOutputSettings::resetToDefaults()
|
void BladeRF1OutputSettings::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_centerFrequency = 435000*1000;
|
m_centerFrequency = 435000*1000;
|
||||||
m_devSampleRate = 3072000;
|
m_devSampleRate = 3072000;
|
||||||
@ -37,7 +38,7 @@ void BladeRFOutputSettings::resetToDefaults()
|
|||||||
m_xb200Filter = BLADERF_XB200_AUTO_1DB;
|
m_xb200Filter = BLADERF_XB200_AUTO_1DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray BladeRFOutputSettings::serialize() const
|
QByteArray BladeRF1OutputSettings::serialize() const
|
||||||
{
|
{
|
||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ QByteArray BladeRFOutputSettings::serialize() const
|
|||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladeRFOutputSettings::deserialize(const QByteArray& data)
|
bool BladeRF1OutputSettings::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
SimpleDeserializer d(data);
|
SimpleDeserializer d(data);
|
||||||
|
|
@ -20,7 +20,7 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
|
|
||||||
struct BladeRFOutputSettings {
|
struct BladeRF1OutputSettings {
|
||||||
quint64 m_centerFrequency;
|
quint64 m_centerFrequency;
|
||||||
qint32 m_devSampleRate;
|
qint32 m_devSampleRate;
|
||||||
qint32 m_vga1;
|
qint32 m_vga1;
|
||||||
@ -31,7 +31,7 @@ struct BladeRFOutputSettings {
|
|||||||
bladerf_xb200_path m_xb200Path;
|
bladerf_xb200_path m_xb200Path;
|
||||||
bladerf_xb200_filter m_xb200Filter;
|
bladerf_xb200_filter m_xb200Filter;
|
||||||
|
|
||||||
BladeRFOutputSettings();
|
BladeRF1OutputSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
@ -14,14 +14,15 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "bladerf1outputthread.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "bladerfoutputthread.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BladerfOutputThread::BladerfOutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent) :
|
Bladerf1OutputThread::Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent) :
|
||||||
QThread(parent),
|
QThread(parent),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
m_dev(dev),
|
m_dev(dev),
|
||||||
@ -31,12 +32,12 @@ BladerfOutputThread::BladerfOutputThread(struct bladerf* dev, SampleSourceFifo*
|
|||||||
std::fill(m_buf, m_buf + 2*BLADERFOUTPUT_BLOCKSIZE, 0);
|
std::fill(m_buf, m_buf + 2*BLADERFOUTPUT_BLOCKSIZE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BladerfOutputThread::~BladerfOutputThread()
|
Bladerf1OutputThread::~Bladerf1OutputThread()
|
||||||
{
|
{
|
||||||
stopWork();
|
stopWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputThread::startWork()
|
void Bladerf1OutputThread::startWork()
|
||||||
{
|
{
|
||||||
m_startWaitMutex.lock();
|
m_startWaitMutex.lock();
|
||||||
start();
|
start();
|
||||||
@ -45,18 +46,18 @@ void BladerfOutputThread::startWork()
|
|||||||
m_startWaitMutex.unlock();
|
m_startWaitMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputThread::stopWork()
|
void Bladerf1OutputThread::stopWork()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputThread::setLog2Interpolation(unsigned int log2_interp)
|
void Bladerf1OutputThread::setLog2Interpolation(unsigned int log2_interp)
|
||||||
{
|
{
|
||||||
m_log2Interp = log2_interp;
|
m_log2Interp = log2_interp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputThread::run()
|
void Bladerf1OutputThread::run()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ void BladerfOutputThread::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Interpolate according to specified log2 (ex: log2=4 => decim=16)
|
// Interpolate according to specified log2 (ex: log2=4 => decim=16)
|
||||||
void BladerfOutputThread::callback(qint16* buf, qint32 len)
|
void Bladerf1OutputThread::callback(qint16* buf, qint32 len)
|
||||||
{
|
{
|
||||||
SampleVector::iterator beginRead;
|
SampleVector::iterator beginRead;
|
||||||
m_sampleFifo->readAdvance(beginRead, len/(1<<m_log2Interp));
|
m_sampleFifo->readAdvance(beginRead, len/(1<<m_log2Interp));
|
@ -26,12 +26,12 @@
|
|||||||
|
|
||||||
#define BLADERFOUTPUT_BLOCKSIZE (1<<16)
|
#define BLADERFOUTPUT_BLOCKSIZE (1<<16)
|
||||||
|
|
||||||
class BladerfOutputThread : public QThread {
|
class Bladerf1OutputThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BladerfOutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent = NULL);
|
Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent = NULL);
|
||||||
~BladerfOutputThread();
|
~Bladerf1OutputThread();
|
||||||
|
|
||||||
void startWork();
|
void startWork();
|
||||||
void stopWork();
|
void stopWork();
|
@ -9,7 +9,7 @@ CONFIG += plugin
|
|||||||
|
|
||||||
QT += core gui widgets multimedia opengl
|
QT += core gui widgets multimedia opengl
|
||||||
|
|
||||||
TARGET = outputbladerf
|
TARGET = outputbladerf1
|
||||||
|
|
||||||
DEFINES += USE_SSE2=1
|
DEFINES += USE_SSE2=1
|
||||||
QMAKE_CXXFLAGS += -msse2
|
QMAKE_CXXFLAGS += -msse2
|
||||||
@ -30,19 +30,19 @@ INCLUDEPATH += $$LIBBLADERFSRC
|
|||||||
CONFIG(Release):build_subdir = release
|
CONFIG(Release):build_subdir = release
|
||||||
CONFIG(Debug):build_subdir = debug
|
CONFIG(Debug):build_subdir = debug
|
||||||
|
|
||||||
SOURCES += bladerfoutputgui.cpp\
|
SOURCES += bladerf1outputgui.cpp\
|
||||||
bladerfoutput.cpp\
|
bladerf1output.cpp\
|
||||||
bladerfoutputplugin.cpp\
|
bladerf1outputplugin.cpp\
|
||||||
bladerfoutputsettings.cpp\
|
bladerf1outputsettings.cpp\
|
||||||
bladerfoutputthread.cpp
|
bladerf1outputthread.cpp
|
||||||
|
|
||||||
HEADERS += bladerfoutputgui.h\
|
HEADERS += bladerf1outputgui.h\
|
||||||
bladerfoutput.h\
|
bladerf1output.h\
|
||||||
bladerfoutputplugin.h\
|
bladerf1outputplugin.h\
|
||||||
bladerfoutputsettings.h\
|
bladerf1outputsettings.h\
|
||||||
bladerfoutputthread.h
|
bladerf1outputthread.h
|
||||||
|
|
||||||
FORMS += bladerfoutputgui.ui
|
FORMS += bladerf1outputgui.ui
|
||||||
|
|
||||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
@ -1,20 +1,20 @@
|
|||||||
project(bladerfoutput)
|
project(bladerf1output)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
set(PLUGIN_PREFIX "../../../plugins/samplesink/bladerfoutput")
|
set(PLUGIN_PREFIX "../../../plugins/samplesink/bladerf1output")
|
||||||
|
|
||||||
set(bladerfoutput_SOURCES
|
set(bladerf1output_SOURCES
|
||||||
${PLUGIN_PREFIX}/bladerfoutput.cpp
|
${PLUGIN_PREFIX}/bladerf1output.cpp
|
||||||
${PLUGIN_PREFIX}/bladerfoutputplugin.cpp
|
${PLUGIN_PREFIX}/bladerf1outputplugin.cpp
|
||||||
${PLUGIN_PREFIX}/bladerfoutputsettings.cpp
|
${PLUGIN_PREFIX}/bladerf1outputsettings.cpp
|
||||||
${PLUGIN_PREFIX}/bladerfoutputthread.cpp
|
${PLUGIN_PREFIX}/bladerf1outputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerfoutput_HEADERS
|
set(bladerf1output_HEADERS
|
||||||
${PLUGIN_PREFIX}/bladerfoutput.h
|
${PLUGIN_PREFIX}/bladerf1output.h
|
||||||
${PLUGIN_PREFIX}/bladerfoutputplugin.h
|
${PLUGIN_PREFIX}/bladerf1outputplugin.h
|
||||||
${PLUGIN_PREFIX}/bladerfoutputsettings.h
|
${PLUGIN_PREFIX}/bladerf1outputsettings.h
|
||||||
${PLUGIN_PREFIX}/bladerfoutputthread.h
|
${PLUGIN_PREFIX}/bladerf1outputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_DEBIAN)
|
if (BUILD_DEBIAN)
|
||||||
@ -40,13 +40,13 @@ add_definitions(${QT_DEFINITIONS})
|
|||||||
add_definitions(-DQT_PLUGIN)
|
add_definitions(-DQT_PLUGIN)
|
||||||
add_definitions(-DQT_SHARED)
|
add_definitions(-DQT_SHARED)
|
||||||
|
|
||||||
add_library(outputbladerfsrv SHARED
|
add_library(outputbladerf1srv SHARED
|
||||||
${bladerfoutput_SOURCES}
|
${bladerf1output_SOURCES}
|
||||||
${bladerfoutput_HEADERS_MOC}
|
${bladerf1output_HEADERS_MOC}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_DEBIAN)
|
if (BUILD_DEBIAN)
|
||||||
target_link_libraries(outputbladerfsrv
|
target_link_libraries(outputbladerf1srv
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
bladerf
|
bladerf
|
||||||
sdrbase
|
sdrbase
|
||||||
@ -54,7 +54,7 @@ target_link_libraries(outputbladerfsrv
|
|||||||
bladerf1device
|
bladerf1device
|
||||||
)
|
)
|
||||||
else (BUILD_DEBIAN)
|
else (BUILD_DEBIAN)
|
||||||
target_link_libraries(outputbladerfsrv
|
target_link_libraries(outputbladerf1srv
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${LIBBLADERF_LIBRARIES}
|
${LIBBLADERF_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
@ -63,6 +63,6 @@ target_link_libraries(outputbladerfsrv
|
|||||||
)
|
)
|
||||||
endif (BUILD_DEBIAN)
|
endif (BUILD_DEBIAN)
|
||||||
|
|
||||||
target_link_libraries(outputbladerfsrv Qt5::Core)
|
target_link_libraries(outputbladerf1srv Qt5::Core)
|
||||||
|
|
||||||
install(TARGETS outputbladerfsrv DESTINATION lib/pluginssrv/samplesink)
|
install(TARGETS outputbladerf1srv DESTINATION lib/pluginssrv/samplesink)
|
||||||
|
@ -40,7 +40,7 @@ SUBDIRS += plugins/samplesource/plutosdrinput
|
|||||||
SUBDIRS += plugins/samplesource/rtlsdr
|
SUBDIRS += plugins/samplesource/rtlsdr
|
||||||
SUBDIRS += plugins/samplesource/testsource
|
SUBDIRS += plugins/samplesource/testsource
|
||||||
SUBDIRS += plugins/samplesink/filesink
|
SUBDIRS += plugins/samplesink/filesink
|
||||||
SUBDIRS += plugins/samplesink/bladerfoutput
|
SUBDIRS += plugins/samplesink/bladerf1output
|
||||||
SUBDIRS += plugins/samplesink/hackrfoutput
|
SUBDIRS += plugins/samplesink/hackrfoutput
|
||||||
SUBDIRS += plugins/samplesink/limesdroutput
|
SUBDIRS += plugins/samplesink/limesdroutput
|
||||||
SUBDIRS += plugins/samplesink/plutosdroutput
|
SUBDIRS += plugins/samplesink/plutosdroutput
|
||||||
|
@ -119,7 +119,7 @@ def setupDevice(options):
|
|||||||
lpFIRBW = options.sample_rate / (1 << options.log2_interp)
|
lpFIRBW = options.sample_rate / (1 << options.log2_interp)
|
||||||
lpfBW = lpFIRBW * 1.2
|
lpfBW = lpFIRBW * 1.2
|
||||||
|
|
||||||
if options.device_hwid == "BladeRF":
|
if options.device_hwid == "BladeRF1":
|
||||||
settings['bladeRFOutputSettings']['centerFrequency'] = options.device_freq * 1000
|
settings['bladeRFOutputSettings']['centerFrequency'] = options.device_freq * 1000
|
||||||
settings['bladeRFOutputSettings']['devSampleRate'] = options.sample_rate
|
settings['bladeRFOutputSettings']['devSampleRate'] = options.sample_rate
|
||||||
settings['bladeRFOutputSettings']['vga1'] = -20
|
settings['bladeRFOutputSettings']['vga1'] = -20
|
||||||
|
@ -65,7 +65,7 @@ copy plugins\samplesource\limesdrinput\%1\inputlimesdr.dll %2\plugins\samplesour
|
|||||||
copy plugins\samplesource\plutosdrinput\%1\inputplutosdr.dll %2\plugins\samplesource
|
copy plugins\samplesource\plutosdrinput\%1\inputplutosdr.dll %2\plugins\samplesource
|
||||||
REM copy plugins\samplesource\sdrdaemonsource\%1\inputsdrdaemonsource.dll %2\plugins\samplesource
|
REM copy plugins\samplesource\sdrdaemonsource\%1\inputsdrdaemonsource.dll %2\plugins\samplesource
|
||||||
copy plugins\samplesink\filesink\%1\outputfilesink.dll %2\plugins\samplesink
|
copy plugins\samplesink\filesink\%1\outputfilesink.dll %2\plugins\samplesink
|
||||||
copy plugins\samplesink\bladerfoutput\%1\outputbladerf.dll %2\plugins\samplesink
|
copy plugins\samplesink\bladerf1output\%1\outputbladerf1.dll %2\plugins\samplesink
|
||||||
copy plugins\samplesink\hackrfoutput\%1\outputhackrf.dll %2\plugins\samplesink
|
copy plugins\samplesink\hackrfoutput\%1\outputhackrf.dll %2\plugins\samplesink
|
||||||
copy plugins\samplesink\limesdroutput\%1\outputlimesdr.dll %2\plugins\samplesink
|
copy plugins\samplesink\limesdroutput\%1\outputlimesdr.dll %2\plugins\samplesink
|
||||||
copy plugins\samplesink\plutosdroutput\%1\outputplutosdr.dll %2\plugins\samplesink
|
copy plugins\samplesink\plutosdroutput\%1\outputplutosdr.dll %2\plugins\samplesink
|
||||||
|
Loading…
Reference in New Issue
Block a user