1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

SDRPlay: use device sequence number from device API

This commit is contained in:
f4exb
2017-04-14 02:49:41 +02:00
parent d001099f7e
commit 3fa28dab30
2 changed files with 19 additions and 5 deletions
+16 -5
View File
@@ -37,7 +37,8 @@ SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) :
m_dev(0),
m_sdrPlayThread(0),
m_deviceDescription("SDRPlay"),
m_devNumber(0)
m_devNumber(0),
m_running(false)
{
}
@@ -46,11 +47,21 @@ SDRPlayInput::~SDRPlayInput()
stop();
}
bool openDevice()
{
}
void closeDevice()
{
}
bool SDRPlayInput::start(int device)
{
QMutexLocker mutexLocker(&m_mutex);
m_devNumber = device;
m_devNumber = m_deviceAPI->getSampleSourceSequence();
if (m_dev != 0)
{
@@ -69,9 +80,9 @@ bool SDRPlayInput::start(int device)
return false;
}
if ((res = mirisdr_open(&m_dev, MIRISDR_HW_SDRPLAY, device)) < 0)
if ((res = mirisdr_open(&m_dev, MIRISDR_HW_SDRPLAY, m_devNumber)) < 0)
{
qCritical("SDRPlayInput::start: could not open SDRPlay #%d: %s", device, strerror(errno));
qCritical("SDRPlayInput::start: could not open SDRPlay #%d: %s", m_devNumber, strerror(errno));
return false;
}
@@ -79,7 +90,7 @@ bool SDRPlayInput::start(int device)
product[0] = '\0';
serial[0] = '\0';
if ((res = mirisdr_get_device_usb_strings(device, vendor, product, serial)) < 0)
if ((res = mirisdr_get_device_usb_strings(m_devNumber, vendor, product, serial)) < 0)
{
qCritical("SDRPlayInput::start: error accessing USB device");
stop();