mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 11:18:56 -05:00
Web API: implement devicesetDeviceGet (2)
This commit is contained in:
parent
7dafae3fa1
commit
3fb4af82e6
@ -25,6 +25,11 @@
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/export.h"
|
||||
|
||||
namespace SWGSDRangel
|
||||
{
|
||||
class SWGObject;
|
||||
}
|
||||
|
||||
class SDRANGEL_API DeviceSampleSink : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -25,6 +25,11 @@
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/export.h"
|
||||
|
||||
namespace SWGSDRangel
|
||||
{
|
||||
class SWGObject;
|
||||
}
|
||||
|
||||
class SDRANGEL_API DeviceSampleSource : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -38,6 +38,7 @@ namespace SWGSDRangel
|
||||
class SWGDeviceSetList;
|
||||
class SWGDeviceSet;
|
||||
class SWGDeviceListItem;
|
||||
class SWGDeviceSettings;
|
||||
class SWGErrorResponse;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "SWGPresets.h"
|
||||
#include "SWGPresetTransfer.h"
|
||||
#include "SWGPresetIdentifier.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "SWGPresetItem.h"
|
||||
#include "SWGPresetTransfer.h"
|
||||
#include "SWGPresetIdentifier.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "webapiadaptergui.h"
|
||||
@ -698,33 +699,25 @@ int WebAPIAdapterGUI::devicesetDeviceGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
if ((deviceSetIndex >= 0) && (m_mainWindow.m_deviceUIs < (int) m_mainWindow.m_deviceUIs.size()))
|
||||
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
|
||||
{
|
||||
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
|
||||
int tx = response.getTx();
|
||||
|
||||
if ((tx == 0) && (deviceSet->m_deviceSinkEngine))
|
||||
{
|
||||
*error.getMessage() = QString("Device type (Rx) and device set type (Tx) mismatch");
|
||||
return 404;
|
||||
}
|
||||
|
||||
if ((tx != 0) && (deviceSet->m_deviceSourceEngine))
|
||||
{
|
||||
*error.getMessage() = QString("Device type (Tx) and device set type (Rx) mismatch");
|
||||
return 404;
|
||||
}
|
||||
|
||||
if (tx == 0) // Rx
|
||||
if (deviceSet->m_deviceSourceEngine) // Rx
|
||||
{
|
||||
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
|
||||
return source->webapiSettingsGet(response.getData(), *error.getMessage());
|
||||
}
|
||||
else // Tx
|
||||
else if (deviceSet->m_deviceSinkEngine) // Tx
|
||||
{
|
||||
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
|
||||
return sink->webapiSettingsGet(response.getData(), *error.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user