mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-03 06:24:48 -04:00
Plugins device enumeration optimization: factorization of common code for Rx/Tx devices
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "xtrx_api.h"
|
||||
#include "devicextrxparam.h"
|
||||
#include "devicextrx.h"
|
||||
|
||||
const uint32_t DeviceXTRX::m_lnaTbl[m_nbGains] = {
|
||||
@@ -76,6 +77,28 @@ void DeviceXTRX::close()
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceXTRX::enumOriginDevices(const QString& hardwareId, PluginInterface::OriginDevices& originDevices)
|
||||
{
|
||||
xtrx_device_info_t devs[32];
|
||||
int res = xtrx_discovery(devs, 32);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < res; i++)
|
||||
{
|
||||
DeviceXTRXParams XTRXParams;
|
||||
QString displayableName(QString("XTRX[%1:%2] %3").arg(i).arg("%1").arg(devs[i].uniqname));
|
||||
|
||||
originDevices.append(PluginInterface::OriginDevice(
|
||||
displayableName,
|
||||
hardwareId,
|
||||
QString(devs[i].uniqname),
|
||||
i,
|
||||
XTRXParams.m_nbRxChannels,
|
||||
XTRXParams.m_nbTxChannels
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceXTRX::getAutoGains(uint32_t autoGain, uint32_t& lnaGain, uint32_t& tiaGain, uint32_t& pgaGain)
|
||||
{
|
||||
uint32_t value = autoGain + 12 > 73 ? 73 : autoGain + 12;
|
||||
|
||||
Reference in New Issue
Block a user