From ef3bc466d6d15fcf1a80586a07755334a0174567 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 19 Aug 2018 20:11:31 +0200 Subject: [PATCH] SDRdaemon: Web API: implemented daemonReportGet --- sdrdaemon/webapi/webapiadapterdaemon.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sdrdaemon/webapi/webapiadapterdaemon.cpp b/sdrdaemon/webapi/webapiadapterdaemon.cpp index c240702fe..a92641bc2 100644 --- a/sdrdaemon/webapi/webapiadapterdaemon.cpp +++ b/sdrdaemon/webapi/webapiadapterdaemon.cpp @@ -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.