From 7e88cfcd4800529f75702b5cf3c5ac7a1300a862 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 10 Sep 2015 08:12:49 +0200 Subject: [PATCH] Support for Airspy: make pointer to thread private. Debug messages on enumeration --- plugins/samplesource/airspy/airspyplugin.cpp | 2 ++ plugins/samplesource/airspy/airspythread.cpp | 8 ++++---- plugins/samplesource/airspy/airspythread.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/samplesource/airspy/airspyplugin.cpp b/plugins/samplesource/airspy/airspyplugin.cpp index e5a0eaa6a..b0394e4c2 100644 --- a/plugins/samplesource/airspy/airspyplugin.cpp +++ b/plugins/samplesource/airspy/airspyplugin.cpp @@ -73,6 +73,7 @@ PluginInterface::SampleSourceDevices AirspyPlugin::enumSampleSources() if (rc != AIRSPY_SUCCESS) { + qDebug("AirspyPlugin::enumSampleSources: failed to read serial no: %s", airspy_error_name(rc)); continue; // next } @@ -88,6 +89,7 @@ PluginInterface::SampleSourceDevices AirspyPlugin::enumSampleSources() } else { + qDebug("AirspyPlugin::enumSampleSources: enumerated %d Airspy devices %s", i, airspy_error_name(rc)); break; // finished } } diff --git a/plugins/samplesource/airspy/airspythread.cpp b/plugins/samplesource/airspy/airspythread.cpp index 396ca8be0..e837cce88 100644 --- a/plugins/samplesource/airspy/airspythread.cpp +++ b/plugins/samplesource/airspy/airspythread.cpp @@ -20,7 +20,7 @@ #include "airspythread.h" #include "dsp/samplefifo.h" -AirspyThread *airspyThread = 0; +AirspyThread *AirspyThread::m_this = 0; AirspyThread::AirspyThread(struct airspy_device* dev, SampleFifo* sampleFifo, QObject* parent) : QThread(parent), @@ -32,13 +32,13 @@ AirspyThread::AirspyThread(struct airspy_device* dev, SampleFifo* sampleFifo, QO m_log2Decim(0), m_fcPos(0) { - airspyThread = this; + m_this = this; } AirspyThread::~AirspyThread() { stopWork(); - airspyThread = 0; + m_this = 0; } void AirspyThread::startWork() @@ -185,5 +185,5 @@ void AirspyThread::callback(const qint16* buf, qint32 len) int AirspyThread::rx_callback(airspy_transfer_t* transfer) { qint32 bytes_to_write = transfer->sample_count * sizeof(qint16) * 2; - airspyThread->callback((qint16 *) transfer->samples, bytes_to_write); + m_this->callback((qint16 *) transfer->samples, bytes_to_write); } diff --git a/plugins/samplesource/airspy/airspythread.h b/plugins/samplesource/airspy/airspythread.h index 41db97862..1e9a7b880 100644 --- a/plugins/samplesource/airspy/airspythread.h +++ b/plugins/samplesource/airspy/airspythread.h @@ -52,6 +52,7 @@ private: int m_samplerate; unsigned int m_log2Decim; int m_fcPos; + static AirspyThread *m_this; Decimators m_decimators;