mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-04 16:01:14 -05:00
Server: added devicesetDeviceReportGet method in the API adapter
This commit is contained in:
parent
f05dd1fb8e
commit
4c86106b2a
@ -42,6 +42,7 @@
|
||||
#include "SWGSuccessResponse.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
|
||||
#include "maincore.h"
|
||||
#include "loggerwithfile.h"
|
||||
@ -1274,6 +1275,44 @@ int WebAPIAdapterSrv::devicesetDeviceRunDelete(
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapterSrv::devicesetDeviceReportGet(
|
||||
int deviceSetIndex,
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
|
||||
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
|
||||
{
|
||||
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
|
||||
|
||||
if (deviceSet->m_deviceSourceEngine) // Rx
|
||||
{
|
||||
response.setDeviceHwType(new QString(deviceSet->m_deviceSourceAPI->getHardwareId()));
|
||||
response.setTx(0);
|
||||
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
|
||||
return source->webapiReportGet(response, *error.getMessage());
|
||||
}
|
||||
else if (deviceSet->m_deviceSinkEngine) // Tx
|
||||
{
|
||||
response.setDeviceHwType(new QString(deviceSet->m_deviceSinkAPI->getHardwareId()));
|
||||
response.setTx(1);
|
||||
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
|
||||
return sink->webapiReportGet(response, *error.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapterSrv::devicesetChannelsReportGet(
|
||||
int deviceSetIndex,
|
||||
SWGSDRangel::SWGChannelsDetail& response,
|
||||
|
@ -191,6 +191,11 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int devicesetDeviceReportGet(
|
||||
int deviceSetIndex,
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int devicesetChannelsReportGet(
|
||||
int deviceSetIndex,
|
||||
SWGSDRangel::SWGChannelsDetail& response,
|
||||
|
Loading…
Reference in New Issue
Block a user