mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
Web API: implemented device report interface. Applied to Airspy
This commit is contained in:
@@ -17,9 +17,12 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGAirspyReport.h"
|
||||
|
||||
#include "airspygui.h"
|
||||
#include "airspyinput.h"
|
||||
@@ -699,6 +702,17 @@ int AirspyInput::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int AirspyInput::webapiReportGet(
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setAirspyReport(new SWGSDRangel::SWGAirspyReport());
|
||||
response.getAirspyReport()->init();
|
||||
webapiFormatDeviceReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings)
|
||||
{
|
||||
response.getAirspySettings()->setCenterFrequency(settings.m_centerFrequency);
|
||||
@@ -723,3 +737,15 @@ void AirspyInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
|
||||
response.getAirspySettings()->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||
}
|
||||
}
|
||||
|
||||
void AirspyInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
|
||||
{
|
||||
response.setAirspyReport(new SWGSDRangel::SWGAirspyReport());
|
||||
response.getAirspyReport()->setSampleRates(new QList<SWGSDRangel::SWGAirspyReport_sampleRates*>);
|
||||
|
||||
for (std::vector<uint32_t>::const_iterator it = getSampleRates().begin(); it != getSampleRates().end(); ++it)
|
||||
{
|
||||
response.getAirspyReport()->getSampleRates()->append(new SWGSDRangel::SWGAirspyReport_sampleRates);
|
||||
response.getAirspyReport()->getSampleRates()->back()->setSampleRate(*it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,10 @@ public:
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGDeviceReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static const qint64 loLowLimitFreq;
|
||||
static const qint64 loHighLimitFreq;
|
||||
|
||||
@@ -140,6 +144,7 @@ private:
|
||||
struct airspy_device *open_airspy_from_sequence(int sequence);
|
||||
void setDeviceCenterFrequency(quint64 freq);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspySettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
|
||||
Reference in New Issue
Block a user