mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-08 08:54:49 -04:00
Web API: implemented device run APIs for BladeRF output, HackRF, PlutoSDR and LimeSDR ourput
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
@@ -564,13 +563,12 @@ int BladerfInput::webapiRun(
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
DSPEngine::instance()->startAudioOutputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
project(hackrfinput)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
set(hackrfinput_SOURCES
|
||||
hackrfinputgui.cpp
|
||||
hackrfinput.cpp
|
||||
@@ -24,6 +26,7 @@ if (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${CMAKE_SOURCE_DIR}/devices
|
||||
${LIBHACKRFSRC}
|
||||
${LIBHACKRFSRC}/libhackrf/src
|
||||
@@ -32,6 +35,7 @@ else (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${CMAKE_SOURCE_DIR}/devices
|
||||
${LIBHACKRF_INCLUDE_DIR}
|
||||
)
|
||||
@@ -58,6 +62,7 @@ target_link_libraries(inputhackrf
|
||||
hackrf
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
hackrfdevice
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
@@ -66,6 +71,7 @@ target_link_libraries(inputhackrf
|
||||
${LIBHACKRF_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
hackrfdevice
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
@@ -486,6 +489,36 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
|
||||
return true;
|
||||
}
|
||||
|
||||
int HackRFInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int HackRFInput::webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
if (run)
|
||||
{
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
//hackrf_device *HackRFInput::open_hackrf_from_sequence(int sequence)
|
||||
//{
|
||||
// hackrf_device_list_t *hackrf_devices = hackrf_device_list();
|
||||
|
||||
@@ -104,6 +104,16 @@ public:
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
|
||||
private:
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
|
||||
@@ -22,6 +22,7 @@ CONFIG(MINGW64):LIBHACKRFSRC = "D:\softs\hackrf\host"
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += ../../../sdrbase
|
||||
INCLUDEPATH += ../../../sdrgui
|
||||
INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||
INCLUDEPATH += ../../../devices
|
||||
!macx:INCLUDEPATH += $$LIBHACKRFSRC
|
||||
macx:INCLUDEPATH += /opt/local/include
|
||||
@@ -45,6 +46,7 @@ FORMS += hackrfinputgui.ui
|
||||
|
||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
||||
LIBS += -L../../../swagger/$${build_subdir} -lswagger
|
||||
!macx:LIBS += -L../../../libhackrf/$${build_subdir} -llibhackrf
|
||||
macx:LIBS += -L/opt/local/lib -lhackrf
|
||||
LIBS += -L../../../devices/$${build_subdir} -ldevices
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
|
||||
QString("HackRF Input"),
|
||||
QString("3.8.2"),
|
||||
QString("3.8.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGLimeSdrInputSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/filerecord.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "limesdrinput.h"
|
||||
#include "limesdrinputthread.h"
|
||||
#include "limesdr/devicelimesdrparam.h"
|
||||
@@ -1243,3 +1245,33 @@ int LimeSDRInput::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int LimeSDRInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int LimeSDRInput::webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
if (run)
|
||||
{
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,6 +207,15 @@ public:
|
||||
SWGSDRangel::SWGDeviceSettings& response, // query + response
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
std::size_t getChannelIndex();
|
||||
void getLORange(float& minF, float& maxF, float& stepF) const;
|
||||
void getSRRange(float& minF, float& maxF, float& stepF) const;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
project(plutosdrinput)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
set(plutosdrinput_SOURCES
|
||||
plutosdrinputgui.cpp
|
||||
plutosdrinput.cpp
|
||||
@@ -24,6 +26,7 @@ if (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${CMAKE_SOURCE_DIR}/devices
|
||||
${LIBIIOSRC}
|
||||
)
|
||||
@@ -31,6 +34,7 @@ else (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${CMAKE_SOURCE_DIR}/devices
|
||||
${LIBIIO_INCLUDE_DIR}
|
||||
)
|
||||
@@ -56,6 +60,7 @@ target_link_libraries(inputplutosdr
|
||||
iio
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
plutosdrdevice
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
@@ -64,6 +69,7 @@ target_link_libraries(inputplutosdr
|
||||
${LIBIIO_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
plutosdrdevice
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "dsp/filerecord.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "plutosdr/deviceplutosdrparams.h"
|
||||
@@ -560,3 +564,34 @@ float PlutoSDRInput::getTemperature()
|
||||
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
||||
return plutoBox->getTemp();
|
||||
}
|
||||
|
||||
int PlutoSDRInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PlutoSDRInput::webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
if (run)
|
||||
{
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,15 @@ public:
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
uint32_t getADCSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; }
|
||||
uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; }
|
||||
void getRSSI(std::string& rssiStr);
|
||||
|
||||
@@ -23,6 +23,7 @@ CONFIG(MINGW64):LIBIIOSRC = "D:\softs\libiio"
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += ../../../sdrbase
|
||||
INCLUDEPATH += ../../../sdrgui
|
||||
INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||
INCLUDEPATH += ../../../devices
|
||||
INCLUDEPATH += ../../../libiio/includemw
|
||||
INCLUDEPATH += $$LIBIIOSRC
|
||||
@@ -46,6 +47,7 @@ FORMS += plutosdrinputgui.ui
|
||||
|
||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
||||
LIBS += -L../../../swagger/$${build_subdir} -lswagger
|
||||
LIBS += -L../../../libiio/$${build_subdir} -llibiio
|
||||
LIBS += -L../../../devices/$${build_subdir} -ldevices
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class DeviceSourceAPI;
|
||||
|
||||
const PluginDescriptor PlutoSDRInputPlugin::m_pluginDescriptor = {
|
||||
QString("PlutoSDR Input"),
|
||||
QString("3.8.0"),
|
||||
QString("3.8.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
||||
@@ -546,13 +546,12 @@ int RTLSDRInput::webapiRun(
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
DSPEngine::instance()->startAudioOutputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
@@ -228,13 +227,12 @@ int SDRdaemonSourceInput::webapiRun(
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
DSPEngine::instance()->startAudioOutputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
@@ -588,13 +587,12 @@ int SDRPlayInput::webapiRun(
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
DSPEngine::instance()->startAudioOutputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
|
||||
Reference in New Issue
Block a user