kopia lustrzana https://github.com/f4exb/sdrangel
Web API: return device information in /sdrangel GET
rodzic
877d6f6fe0
commit
30cd01cad0
|
@ -69,6 +69,7 @@ PluginInterface::SamplingDevices BladerfOutputPlugin::enumSampleSinks()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
false,
|
||||
1,
|
||||
0));
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ PluginInterface::SamplingDevices FileSinkPlugin::enumSampleSinks()
|
|||
0,
|
||||
PluginInterface::SamplingDevice::BuiltInDevice,
|
||||
false,
|
||||
1,
|
||||
0));
|
||||
|
||||
return result;
|
||||
|
|
|
@ -100,6 +100,7 @@ PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
false,
|
||||
1,
|
||||
0));
|
||||
|
||||
qDebug("HackRFOutputPlugin::enumSampleSinks: enumerated HackRF device #%d", i);
|
||||
|
|
|
@ -98,6 +98,7 @@ PluginInterface::SamplingDevices LimeSDROutputPlugin::enumSampleSinks()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
false,
|
||||
limeSDRParams.m_nbTxChannels,
|
||||
j));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ PluginInterface::SamplingDevices PlutoSDROutputPlugin::enumSampleSinks()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
false,
|
||||
1,
|
||||
0));
|
||||
|
||||
qDebug("PlutoSDROutputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i);
|
||||
|
|
|
@ -63,6 +63,7 @@ PluginInterface::SamplingDevices SDRdaemonSinkPlugin::enumSampleSinks()
|
|||
0,
|
||||
PluginInterface::SamplingDevice::BuiltInDevice,
|
||||
false,
|
||||
1,
|
||||
0));
|
||||
|
||||
return result;
|
||||
|
|
|
@ -102,6 +102,7 @@ PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
|
||||
qDebug("AirspyPlugin::enumSampleSources: enumerated Airspy device #%d", i);
|
||||
|
|
|
@ -70,6 +70,7 @@ PluginInterface::SamplingDevices BlderfInputPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ PluginInterface::SamplingDevices FCDProPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
|
||||
device_info = device_info->next;
|
||||
|
|
|
@ -70,6 +70,7 @@ PluginInterface::SamplingDevices FCDProPlusPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
|
||||
device_info = device_info->next;
|
||||
|
|
|
@ -62,6 +62,7 @@ PluginInterface::SamplingDevices FileSourcePlugin::enumSampleSources()
|
|||
0,
|
||||
PluginInterface::SamplingDevice::BuiltInDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
|
||||
return result;
|
||||
|
|
|
@ -101,6 +101,7 @@ PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
|
||||
qDebug("HackRFPlugin::enumSampleSources: enumerated HackRF device #%d", i);
|
||||
|
|
|
@ -98,6 +98,7 @@ PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
limeSDRParams.m_nbRxChannels,
|
||||
j));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ PluginInterface::SamplingDevices PlutoSDRInputPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
|
||||
qDebug("PlutoSDRInputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i);
|
||||
|
|
|
@ -60,6 +60,7 @@ PluginInterface::SamplingDevices RTLSDRPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -63,6 +63,7 @@ PluginInterface::SamplingDevices SDRdaemonSourcePlugin::enumSampleSources()
|
|||
0,
|
||||
PluginInterface::SamplingDevice::BuiltInDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
|
||||
return result;
|
||||
|
|
|
@ -80,6 +80,7 @@ PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources()
|
|||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
true,
|
||||
1,
|
||||
0));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ DeviceSinkAPI::DeviceSinkAPI(int deviceTabIndex,
|
|||
m_deviceTabIndex(deviceTabIndex),
|
||||
m_deviceSinkEngine(deviceSinkEngine),
|
||||
m_sampleSinkSequence(0),
|
||||
m_nbItems(1),
|
||||
m_itemIndex(0),
|
||||
m_pluginInterface(0),
|
||||
m_sampleSinkPluginInstanceUI(0),
|
||||
|
@ -160,6 +161,11 @@ void DeviceSinkAPI::setSampleSinkSequence(int sequence)
|
|||
m_deviceSinkEngine->setSinkSequence(sequence);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setNbItems(uint32_t nbItems)
|
||||
{
|
||||
m_nbItems = nbItems;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setItemIndex(uint32_t index)
|
||||
{
|
||||
m_itemIndex = index;
|
||||
|
@ -175,6 +181,38 @@ void DeviceSinkAPI::setSampleSinkPluginInstanceUI(PluginInstanceGUI *gui)
|
|||
m_sampleSinkPluginInstanceUI = gui;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::getDeviceEngineStateStr(QString& state)
|
||||
{
|
||||
if (m_deviceSinkEngine)
|
||||
{
|
||||
switch(m_deviceSinkEngine->state())
|
||||
{
|
||||
case DSPDeviceSinkEngine::StNotStarted:
|
||||
state = "notStarted";
|
||||
break;
|
||||
case DSPDeviceSinkEngine::StIdle:
|
||||
state = "idle";
|
||||
break;
|
||||
case DSPDeviceSinkEngine::StReady:
|
||||
state = "ready";
|
||||
break;
|
||||
case DSPDeviceSinkEngine::StRunning:
|
||||
state = "running";
|
||||
break;
|
||||
case DSPDeviceSinkEngine::StError:
|
||||
state = "error";
|
||||
break;
|
||||
default:
|
||||
state = "notStarted";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state = "notStarted";
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::loadSinkSettings(const Preset* preset)
|
||||
{
|
||||
if (preset->isSourcePreset())
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
void setSampleSinkSerial(const QString& serial);
|
||||
void setSampleSinkDisplayName(const QString& serial);
|
||||
void setSampleSinkSequence(int sequence);
|
||||
void setNbItems(uint32_t nbItems);
|
||||
void setItemIndex(uint32_t index);
|
||||
void setSampleSinkPluginInterface(PluginInterface *iface);
|
||||
void setSampleSinkPluginInstanceUI(PluginInstanceGUI *gui);
|
||||
|
@ -75,9 +76,11 @@ public:
|
|||
const QString& getSampleSinkSerial() const { return m_sampleSinkSerial; }
|
||||
const QString& getSampleSinkDisplayName() const { return m_sampleSinkDisplayName; }
|
||||
uint32_t getSampleSinkSequence() const { return m_sampleSinkSequence; }
|
||||
uint32_t getNbItems() const { return m_nbItems; }
|
||||
uint32_t getItemIndex() const { return m_itemIndex; }
|
||||
PluginInterface *getPluginInterface() { return m_pluginInterface; }
|
||||
PluginInstanceGUI *getSampleSinkPluginInstanceGUI() { return m_sampleSinkPluginInstanceUI; }
|
||||
void getDeviceEngineStateStr(QString& state);
|
||||
|
||||
void registerChannelInstance(const QString& channelName, PluginInstanceGUI* pluginGUI);
|
||||
void removeChannelInstance(PluginInstanceGUI* pluginGUI);
|
||||
|
@ -111,7 +114,8 @@ protected:
|
|||
QString m_sampleSinkSerial; //!< The device serial number defined by the vendor
|
||||
QString m_sampleSinkDisplayName; //!< The human readable name identifying this instance
|
||||
uint32_t m_sampleSinkSequence; //!< The device sequence. >0 when more than one device of the same type is connected
|
||||
uint32_t m_itemIndex; //!< The Rx stream index. Can be >0 for NxM devices (i.e. 0 or 1 for LimeSDR)
|
||||
uint32_t m_nbItems; //!< Number of items or streams in the device. Can be >1 for NxM devices (i.e. 2 for LimeSDR)
|
||||
uint32_t m_itemIndex; //!< The Tx stream index. Can be >0 for NxM devices (i.e. 0 or 1 for LimeSDR)
|
||||
PluginInterface* m_pluginInterface;
|
||||
PluginInstanceGUI* m_sampleSinkPluginInstanceUI;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ DeviceSourceAPI::DeviceSourceAPI(int deviceTabIndex,
|
|||
m_deviceTabIndex(deviceTabIndex),
|
||||
m_deviceSourceEngine(deviceSourceEngine),
|
||||
m_sampleSourceSequence(0),
|
||||
m_nbItems(1),
|
||||
m_itemIndex(0),
|
||||
m_pluginInterface(0),
|
||||
m_sampleSourcePluginInstanceUI(0),
|
||||
|
@ -152,6 +153,11 @@ void DeviceSourceAPI::setSampleSourceSequence(int sequence)
|
|||
m_deviceSourceEngine->setSourceSequence(sequence);
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::setNbItems(uint32_t nbItems)
|
||||
{
|
||||
m_nbItems = nbItems;
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::setItemIndex(uint32_t index)
|
||||
{
|
||||
m_itemIndex = index;
|
||||
|
@ -167,6 +173,38 @@ void DeviceSourceAPI::setSampleSourcePluginInstanceGUI(PluginInstanceGUI *gui)
|
|||
m_sampleSourcePluginInstanceUI = gui;
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::getDeviceEngineStateStr(QString& state)
|
||||
{
|
||||
if (m_deviceSourceEngine)
|
||||
{
|
||||
switch(m_deviceSourceEngine->state())
|
||||
{
|
||||
case DSPDeviceSourceEngine::StNotStarted:
|
||||
state = "notStarted";
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StIdle:
|
||||
state = "idle";
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StReady:
|
||||
state = "ready";
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StRunning:
|
||||
state = "running";
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StError:
|
||||
state = "error";
|
||||
break;
|
||||
default:
|
||||
state = "notStarted";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state = "notStarted";
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::loadSourceSettings(const Preset* preset)
|
||||
{
|
||||
if (preset->isSourcePreset())
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
void setSampleSourceSerial(const QString& serial);
|
||||
void setSampleSourceDisplayName(const QString& serial);
|
||||
void setSampleSourceSequence(int sequence);
|
||||
void setNbItems(uint32_t nbItems);
|
||||
void setItemIndex(uint32_t index);
|
||||
void setSampleSourcePluginInterface(PluginInterface *iface);
|
||||
void setSampleSourcePluginInstanceGUI(PluginInstanceGUI *gui);
|
||||
|
@ -75,9 +76,11 @@ public:
|
|||
const QString& getSampleSourceSerial() const { return m_sampleSourceSerial; }
|
||||
const QString& getSampleSourceDisplayName() const { return m_sampleSourceDisplayName; }
|
||||
uint32_t getSampleSourceSequence() const { return m_sampleSourceSequence; }
|
||||
uint32_t getNbItems() const { return m_nbItems; }
|
||||
uint32_t getItemIndex() const { return m_itemIndex; }
|
||||
PluginInterface *getPluginInterface() { return m_pluginInterface; }
|
||||
PluginInstanceGUI *getSampleSourcePluginInstanceGUI() { return m_sampleSourcePluginInstanceUI; }
|
||||
void getDeviceEngineStateStr(QString& state);
|
||||
|
||||
void loadSourceSettings(const Preset* preset);
|
||||
void saveSourceSettings(Preset* preset);
|
||||
|
@ -107,6 +110,7 @@ protected:
|
|||
QString m_sampleSourceSerial; //!< The device serial number defined by the vendor or a fake one (SDRplay)
|
||||
QString m_sampleSourceDisplayName; //!< The human readable name identifying this instance
|
||||
uint32_t m_sampleSourceSequence; //!< The device sequence. >0 when more than one device of the same type is connected
|
||||
uint32_t m_nbItems; //!< Number of items or streams in the device. Can be >1 for NxM devices (i.e. 2 for LimeSDR)
|
||||
uint32_t m_itemIndex; //!< The Rx stream index. Can be >0 for NxM devices (i.e. 0 or 1 for LimeSDR)
|
||||
PluginInterface* m_pluginInterface;
|
||||
PluginInstanceGUI* m_sampleSourcePluginInstanceUI;
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
int sequence; //!< The device sequence. >0 when more than one device of the same type is connected
|
||||
SamplingDeviceType type; //!< The sampling device type for behavior information
|
||||
bool rxElseTx; //!< This is the Rx part else the Tx part of the device
|
||||
int deviceNbItems; //!< Number of items (or streams) in the device. >1 for composite devices.
|
||||
int deviceItemIndex; //!< For composite devices this is the Rx or Tx stream index. -1 if not initialized
|
||||
int claimed; //!< This is the device set index if claimed else -1
|
||||
|
||||
|
@ -52,6 +53,7 @@ public:
|
|||
int _sequence,
|
||||
SamplingDeviceType _type,
|
||||
bool _rxElseTx,
|
||||
int _deviceNbItems,
|
||||
int _deviceItemIndex) :
|
||||
displayedName(_displayedName),
|
||||
hardwareId(_hardwareId),
|
||||
|
@ -60,6 +62,7 @@ public:
|
|||
sequence(_sequence),
|
||||
type(_type),
|
||||
rxElseTx(_rxElseTx),
|
||||
deviceNbItems(_deviceNbItems),
|
||||
deviceItemIndex(_deviceItemIndex),
|
||||
claimed(-1)
|
||||
{ }
|
||||
|
|
|
@ -38,18 +38,26 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
|||
|
||||
if (path == WebAPIAdapterInterface::instanceSummaryURL)
|
||||
{
|
||||
Swagger::SWGInstanceSummaryResponse normalResponse;
|
||||
Swagger::SWGErrorResponse errorResponse;
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
Swagger::SWGInstanceSummaryResponse normalResponse;
|
||||
Swagger::SWGErrorResponse errorResponse;
|
||||
|
||||
int status = m_adapter->instanceSummary(normalResponse, errorResponse);
|
||||
int status = m_adapter->instanceSummary(normalResponse, errorResponse);
|
||||
|
||||
if (status == 200) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
if (status == 200) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
|
||||
response.setStatus(status);
|
||||
}
|
||||
else
|
||||
{
|
||||
response.write("Invalid HTTP method");
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
}
|
||||
|
||||
response.setStatus(status);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -162,6 +162,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
|||
|
||||
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(deviceIndex);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSequence(samplingDevice.sequence);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setNbItems(samplingDevice.deviceItemIndex);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setItemIndex(samplingDevice.deviceItemIndex);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setHardwareId(samplingDevice.hardwareId);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceId(samplingDevice.id);
|
||||
|
@ -265,6 +266,7 @@ void MainWindow::addSourceDevice()
|
|||
int fileSourceDeviceIndex = DeviceEnumerator::instance()->getFileSourceDeviceIndex();
|
||||
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileSourceDeviceIndex);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSequence(samplingDevice.sequence);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setNbItems(samplingDevice.deviceNbItems);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setItemIndex(samplingDevice.deviceItemIndex);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setHardwareId(samplingDevice.hardwareId);
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceId(samplingDevice.id);
|
||||
|
@ -335,6 +337,7 @@ void MainWindow::addSinkDevice()
|
|||
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileSinkDeviceIndex();
|
||||
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setSampleSinkSequence(samplingDevice.sequence);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setNbItems(samplingDevice.deviceNbItems);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setItemIndex(samplingDevice.deviceItemIndex);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setHardwareId(samplingDevice.hardwareId);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setSampleSinkId(samplingDevice.id);
|
||||
|
@ -933,6 +936,7 @@ void MainWindow::on_sampleSource_changed()
|
|||
|
||||
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex());
|
||||
deviceUI->m_deviceSourceAPI->setSampleSourceSequence(samplingDevice.sequence);
|
||||
deviceUI->m_deviceSourceAPI->setNbItems(samplingDevice.deviceNbItems);
|
||||
deviceUI->m_deviceSourceAPI->setItemIndex(samplingDevice.deviceItemIndex);
|
||||
deviceUI->m_deviceSourceAPI->setHardwareId(samplingDevice.hardwareId);
|
||||
deviceUI->m_deviceSourceAPI->setSampleSourceId(samplingDevice.id);
|
||||
|
@ -1020,6 +1024,7 @@ void MainWindow::on_sampleSink_changed()
|
|||
|
||||
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex());
|
||||
deviceUI->m_deviceSinkAPI->setSampleSinkSequence(samplingDevice.sequence);
|
||||
deviceUI->m_deviceSinkAPI->setNbItems(samplingDevice.deviceNbItems);
|
||||
deviceUI->m_deviceSinkAPI->setItemIndex(samplingDevice.deviceItemIndex);
|
||||
deviceUI->m_deviceSinkAPI->setHardwareId(samplingDevice.hardwareId);
|
||||
deviceUI->m_deviceSinkAPI->setSampleSinkId(samplingDevice.id);
|
||||
|
|
|
@ -19,10 +19,18 @@
|
|||
#include <QApplication>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "webapiadaptergui.h"
|
||||
#include "loggerwithfile.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
#include "dsp/devicesamplesource.h"
|
||||
#include "dsp/devicesamplesink.h"
|
||||
|
||||
#include "SWGInstanceSummaryResponse.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "webapiadaptergui.h"
|
||||
|
||||
WebAPIAdapterGUI::WebAPIAdapterGUI(MainWindow& mainWindow) :
|
||||
m_mainWindow(mainWindow)
|
||||
{
|
||||
|
@ -38,8 +46,67 @@ int WebAPIAdapterGUI::instanceSummary(
|
|||
{
|
||||
|
||||
*response.getVersion() = qApp->applicationVersion();
|
||||
|
||||
Swagger::SWGLoggingInfo *logging = response.getLogging();
|
||||
logging->init();
|
||||
logging->setDumpToFile(m_mainWindow.m_logger->getUseFileLogger());
|
||||
if (logging->getDumpToFile()) {
|
||||
m_mainWindow.m_logger->getLogFileName(*logging->getFileName());
|
||||
m_mainWindow.m_logger->getFileMinMessageLevelStr(*logging->getFileLevel());
|
||||
}
|
||||
m_mainWindow.m_logger->getConsoleMinMessageLevelStr(*logging->getConsoleLevel());
|
||||
|
||||
Swagger::SWGDeviceSetList *deviceSetList = response.getDevicesetlist();
|
||||
deviceSetList->setDevicesetcount(0);
|
||||
deviceSetList->init();
|
||||
deviceSetList->setDevicesetcount((int) m_mainWindow.m_deviceUIs.size());
|
||||
|
||||
std::vector<DeviceUISet*>::const_iterator it = m_mainWindow.m_deviceUIs.begin();
|
||||
|
||||
for (int i = 0; it != m_mainWindow.m_deviceUIs.end(); ++it, i++)
|
||||
{
|
||||
QList<Swagger::SWGDeviceSet*> *deviceSet = deviceSetList->getDeviceSets();
|
||||
deviceSet->append(new Swagger::SWGDeviceSet());
|
||||
Swagger::SWGSamplingDevice *samplingDevice = deviceSet->back()->getSamplingDevice();
|
||||
samplingDevice->init();
|
||||
samplingDevice->setIndex(i);
|
||||
samplingDevice->setTx((*it)->m_deviceSinkEngine != 0);
|
||||
|
||||
if ((*it)->m_deviceSinkEngine) // Tx data
|
||||
{
|
||||
*samplingDevice->getHwType() = (*it)->m_deviceSinkAPI->getHardwareId();
|
||||
*samplingDevice->getSerial() = (*it)->m_deviceSinkAPI->getSampleSinkSerial();
|
||||
samplingDevice->setSequence((*it)->m_deviceSinkAPI->getSampleSinkSequence());
|
||||
samplingDevice->setNbStreams((*it)->m_deviceSinkAPI->getNbItems());
|
||||
samplingDevice->setStreamIndex((*it)->m_deviceSinkAPI->getItemIndex());
|
||||
(*it)->m_deviceSinkAPI->getDeviceEngineStateStr(*samplingDevice->getState());
|
||||
DeviceSampleSink *sampleSink = (*it)->m_deviceSinkEngine->getSink();
|
||||
|
||||
if (sampleSink) {
|
||||
samplingDevice->setCenterFrequency(sampleSink->getCenterFrequency());
|
||||
samplingDevice->setBandwidth(sampleSink->getSampleRate());
|
||||
}
|
||||
|
||||
deviceSet->back()->setChannelcount(0);
|
||||
}
|
||||
|
||||
if ((*it)->m_deviceSourceEngine) // Rx data
|
||||
{
|
||||
*samplingDevice->getHwType() = (*it)->m_deviceSourceAPI->getHardwareId();
|
||||
*samplingDevice->getSerial() = (*it)->m_deviceSourceAPI->getSampleSourceSerial();
|
||||
samplingDevice->setSequence((*it)->m_deviceSourceAPI->getSampleSourceSequence());
|
||||
samplingDevice->setNbStreams((*it)->m_deviceSourceAPI->getNbItems());
|
||||
samplingDevice->setStreamIndex((*it)->m_deviceSourceAPI->getItemIndex());
|
||||
(*it)->m_deviceSourceAPI->getDeviceEngineStateStr(*samplingDevice->getState());
|
||||
DeviceSampleSource *sampleSource = (*it)->m_deviceSourceEngine->getSource();
|
||||
|
||||
if (sampleSource) {
|
||||
samplingDevice->setCenterFrequency(sampleSource->getCenterFrequency());
|
||||
samplingDevice->setBandwidth(sampleSource->getSampleRate());
|
||||
}
|
||||
|
||||
deviceSet->back()->setChannelcount(0);
|
||||
}
|
||||
}
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
|
|
@ -561,6 +561,7 @@ definitions:
|
|||
- serial
|
||||
- centerFrequency
|
||||
- bandwidth
|
||||
- state
|
||||
properties:
|
||||
index:
|
||||
description: "Index in the list of device sets opened in this instance"
|
||||
|
@ -590,6 +591,9 @@ definitions:
|
|||
bandwidth:
|
||||
description: "Bandwidth in Hz or complex S/s of baseband"
|
||||
type: integer
|
||||
state:
|
||||
description: "State: notStarted, idle, ready, running, error"
|
||||
type: string
|
||||
Channel:
|
||||
description: "Channel summarized information"
|
||||
required:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
2.2.3
|
File diff suppressed because one or more lines are too long
|
@ -46,6 +46,7 @@ SWGSamplingDevice::init() {
|
|||
serial = new QString("");
|
||||
center_frequency = 0L;
|
||||
bandwidth = 0;
|
||||
state = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -65,6 +66,10 @@ SWGSamplingDevice::cleanup() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
if(state != nullptr) {
|
||||
delete state;
|
||||
}
|
||||
}
|
||||
|
||||
SWGSamplingDevice*
|
||||
|
@ -87,6 +92,7 @@ SWGSamplingDevice::fromJsonObject(QJsonObject &pJson) {
|
|||
::Swagger::setValue(&serial, pJson["serial"], "QString", "QString");
|
||||
::Swagger::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", "");
|
||||
::Swagger::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
|
||||
::Swagger::setValue(&state, pJson["state"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -121,6 +127,8 @@ SWGSamplingDevice::asJsonObject() {
|
|||
|
||||
obj->insert("bandwidth", QJsonValue(bandwidth));
|
||||
|
||||
toJsonValue(QString("state"), state, obj, QString("QString"));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -205,6 +213,15 @@ SWGSamplingDevice::setBandwidth(qint32 bandwidth) {
|
|||
this->bandwidth = bandwidth;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGSamplingDevice::getState() {
|
||||
return state;
|
||||
}
|
||||
void
|
||||
SWGSamplingDevice::setState(QString* state) {
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@ public:
|
|||
qint32 getBandwidth();
|
||||
void setBandwidth(qint32 bandwidth);
|
||||
|
||||
QString* getState();
|
||||
void setState(QString* state);
|
||||
|
||||
|
||||
private:
|
||||
qint32 index;
|
||||
|
@ -80,6 +83,7 @@ private:
|
|||
QString* serial;
|
||||
qint64 center_frequency;
|
||||
qint32 bandwidth;
|
||||
QString* state;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue