1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-19 06:41:47 -05:00

SDRdaemon: Web API: implemented daemonReportGet

This commit is contained in:
f4exb 2018-08-19 20:11:31 +02:00
parent b169ccefad
commit ef3bc466d6

View File

@ -328,12 +328,30 @@ int WebAPIAdapterDaemon::daemonRunDelete(
}
int WebAPIAdapterDaemon::daemonReportGet(
SWGSDRangel::SWGDeviceReport& response __attribute__((unused)),
SWGSDRangel::SWGDeviceReport& response,
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
*error.getMessage() = "Not implemented";
return 501;
if (m_sdrDaemonMain.m_deviceSourceEngine) // Rx
{
response.setDeviceHwType(new QString(m_sdrDaemonMain.m_deviceSourceAPI->getHardwareId()));
response.setTx(0);
DeviceSampleSource *source = m_sdrDaemonMain.m_deviceSourceAPI->getSampleSource();
return source->webapiReportGet(response, *error.getMessage());
}
else if (m_sdrDaemonMain.m_deviceSinkEngine) // Tx
{
response.setDeviceHwType(new QString(m_sdrDaemonMain.m_deviceSinkAPI->getHardwareId()));
response.setTx(1);
DeviceSampleSink *sink = m_sdrDaemonMain.m_deviceSinkAPI->getSampleSink();
return sink->webapiReportGet(response, *error.getMessage());
}
else
{
*error.getMessage() = QString("DeviceSet error");
return 500;
}
}
// TODO: put in library in common with SDRangel. Can be static.