mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-14 15:33:34 -04:00
LimeSDR: implemeted WEB API for reporting
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGLimeSdrOutputSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGLimeSdrOutputReport.h"
|
||||
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
@@ -1172,6 +1174,15 @@ int LimeSDROutput::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int LimeSDROutput::webapiReportGet(
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setLimeSdrOutputReport(new SWGSDRangel::SWGLimeSdrOutputReport());
|
||||
response.getLimeSdrOutputReport()->init();
|
||||
webapiFormatDeviceReport(response);
|
||||
return 200;
|
||||
}
|
||||
void LimeSDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LimeSDROutputSettings& settings)
|
||||
{
|
||||
response.getLimeSdrOutputSettings()->setAntennaPath((int) settings.m_antennaPath);
|
||||
@@ -1216,3 +1227,36 @@ int LimeSDROutput::webapiRun(
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
void LimeSDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
|
||||
{
|
||||
bool success = false;
|
||||
double temp = 0.0;
|
||||
lms_stream_status_t status;
|
||||
status.active = false;
|
||||
status.fifoFilledCount = 0;
|
||||
status.fifoSize = 1;
|
||||
status.underrun = 0;
|
||||
status.overrun = 0;
|
||||
status.droppedPackets = 0;
|
||||
status.linkRate = 0.0;
|
||||
status.timestamp = 0;
|
||||
|
||||
success = (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0));
|
||||
|
||||
response.getLimeSdrOutputReport()->setSuccess(success ? 1 : 0);
|
||||
response.getLimeSdrOutputReport()->setStreamActive(status.active ? 1 : 0);
|
||||
response.getLimeSdrOutputReport()->setFifoSize(status.fifoSize);
|
||||
response.getLimeSdrOutputReport()->setFifoFill(status.fifoFilledCount);
|
||||
response.getLimeSdrOutputReport()->setUnderrunCount(status.underrun);
|
||||
response.getLimeSdrOutputReport()->setOverrunCount(status.overrun);
|
||||
response.getLimeSdrOutputReport()->setDroppedPacketsCount(status.droppedPackets);
|
||||
response.getLimeSdrOutputReport()->setLinkRate(status.linkRate);
|
||||
response.getLimeSdrOutputReport()->setHwTimestamp(status.timestamp);
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice()) {
|
||||
LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp);
|
||||
}
|
||||
|
||||
response.getLimeSdrOutputReport()->setTemperature(temp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user