mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-08 17:04:46 -04:00
USRP: Add support for non-discoverable devices and user arguments.
Tweak UI so icons aren't squashed.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
This input sample source plugin gets its samples from a [USRP device](https://www.ettus.com/product-categories/usrp-bus-series/).
|
||||
|
||||
When using a USRP device over a network, you have to create a non discoverable device reference in the [user arguments dialog](https://github.com/f4exb/sdrangel/blob/master/sdrgui/deviceuserargs.md) from the main window Preferences > Devices menu. You must use the USRP hardware ID then specify the device address with an addr parameter in the user arguments for example: addr=192.168.1.10. Note that this will become effective once SDRangel is restarted.
|
||||
|
||||
<h2>Interface</h2>
|
||||
|
||||
The top and bottom bars of the device window are described [here](../../../sdrgui/device/readme.md)
|
||||
|
||||
@@ -212,9 +212,24 @@ bool USRPInput::openDevice()
|
||||
qDebug("USRPInput::openDevice: open device here");
|
||||
|
||||
m_deviceShared.m_deviceParams = new DeviceUSRPParams();
|
||||
char serial[256];
|
||||
strcpy(serial, qPrintable(m_deviceAPI->getSamplingDeviceSerial()));
|
||||
m_deviceShared.m_deviceParams->open(serial, false);
|
||||
QString deviceStr;
|
||||
// If a non-discoverable device, serial with be of the form USRP-N
|
||||
if (m_deviceAPI->getSamplingDeviceSerial().startsWith("USRP"))
|
||||
{
|
||||
deviceStr = m_deviceAPI->getHardwareUserArguments();
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceStr = m_deviceAPI->getSamplingDeviceSerial();
|
||||
if (m_deviceAPI->getHardwareUserArguments().size() != 0) {
|
||||
deviceStr = deviceStr + ',' + m_deviceAPI->getHardwareUserArguments();
|
||||
}
|
||||
}
|
||||
if (!m_deviceShared.m_deviceParams->open(deviceStr, false))
|
||||
{
|
||||
qCritical("USRPInput::openDevice: failed to open device");
|
||||
return false;
|
||||
}
|
||||
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
|
||||
}
|
||||
|
||||
@@ -499,33 +514,69 @@ void USRPInput::setCenterFrequency(qint64 centerFrequency)
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t USRPInput::getChannelIndex()
|
||||
int USRPInput::getChannelIndex()
|
||||
{
|
||||
return m_deviceShared.m_channel;
|
||||
}
|
||||
|
||||
void USRPInput::getLORange(float& minF, float& maxF) const
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_loRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_loRangeRx.stop();
|
||||
try
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_loRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_loRangeRx.stop();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
qDebug() << "USRPInput::getLORange: exception: " << e.what();
|
||||
minF = 0.0f;
|
||||
maxF = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void USRPInput::getSRRange(float& minF, float& maxF) const
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_srRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_srRangeRx.stop();
|
||||
try
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_srRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_srRangeRx.stop();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
qDebug() << "USRPInput::getSRRange: exception: " << e.what();
|
||||
minF = 0.0f;
|
||||
maxF = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void USRPInput::getLPRange(float& minF, float& maxF) const
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_lpfRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_lpfRangeRx.stop();
|
||||
try
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_lpfRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_lpfRangeRx.stop();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
qDebug() << "USRPInput::getLPRange: exception: " << e.what();
|
||||
minF = 0.0f;
|
||||
maxF = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void USRPInput::getGainRange(float& minF, float& maxF) const
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_gainRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_gainRangeRx.stop();
|
||||
try
|
||||
{
|
||||
minF = m_deviceShared.m_deviceParams->m_gainRangeRx.start();
|
||||
maxF = m_deviceShared.m_deviceParams->m_gainRangeRx.stop();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
qDebug() << "USRPInput::getGainRange: exception: " << e.what();
|
||||
minF = 0.0f;
|
||||
maxF = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
QStringList USRPInput::getRxAntennas() const
|
||||
|
||||
@@ -208,7 +208,7 @@ public:
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
std::size_t getChannelIndex();
|
||||
int getChannelIndex();
|
||||
void getLORange(float& minF, float& maxF) const;
|
||||
void getSRRange(float& minF, float& maxF) const;
|
||||
void getLPRange(float& minF, float& maxF) const;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>174</height>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -19,13 +19,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>174</height>
|
||||
<height>192</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>221</height>
|
||||
<height>192</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
@@ -56,7 +56,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="freqLeftLayout">
|
||||
@@ -145,7 +145,6 @@
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -162,12 +161,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="freqRightLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="freqRightTopLayout">
|
||||
<item>
|
||||
@@ -225,6 +218,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
@@ -359,7 +359,6 @@
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -454,6 +453,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="gainLayout">
|
||||
<property name="topMargin">
|
||||
@@ -534,13 +540,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
@@ -554,13 +553,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="dcOffset">
|
||||
<property name="toolTip">
|
||||
@@ -623,7 +615,6 @@
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -674,7 +665,6 @@
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
const PluginDescriptor USRPInputPlugin::m_pluginDescriptor = {
|
||||
QStringLiteral("USRP"),
|
||||
QStringLiteral("USRP Input"),
|
||||
QStringLiteral("7.0.0"),
|
||||
QStringLiteral("7.3.1"),
|
||||
QStringLiteral("(c) Jon Beniston, M7RCE and Edouard Griffiths, F4EXB"),
|
||||
QStringLiteral("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -43,7 +43,7 @@ const PluginDescriptor USRPInputPlugin::m_pluginDescriptor = {
|
||||
};
|
||||
|
||||
static constexpr const char* const m_hardwareID = "USRP";
|
||||
static constexpr const char* const m_deviceTypeID = USRP_DEVICE_TYPE_ID;
|
||||
const char* const USRPInputPlugin::m_deviceTypeID = USRP_DEVICE_TYPE_ID;
|
||||
|
||||
USRPInputPlugin::USRPInputPlugin(QObject* parent) :
|
||||
QObject(parent)
|
||||
|
||||
@@ -46,6 +46,10 @@ public:
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
|
||||
|
||||
virtual QString getDeviceTypeId() const { return m_deviceTypeID; }
|
||||
|
||||
static const char* const m_deviceTypeID;
|
||||
|
||||
private:
|
||||
static const PluginDescriptor m_pluginDescriptor;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user