mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
Web API: implemented device run APIs for BladeRF input, SDRdaemon input and SDRplay
This commit is contained in:
parent
7d122b6b67
commit
9819e01da5
@ -1,5 +1,7 @@
|
||||
project(bladerfinput)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
set(bladerfinput_SOURCES
|
||||
bladerfinputgui.cpp
|
||||
bladerfinput.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
|
||||
${LIBBLADERFLIBSRC}/include
|
||||
${LIBBLADERFLIBSRC}/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
|
||||
${LIBBLADERF_INCLUDE_DIR}
|
||||
)
|
||||
@ -57,6 +61,7 @@ target_link_libraries(inputbladerf
|
||||
bladerf
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
bladerfdevice
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
@ -65,6 +70,7 @@ target_link_libraries(inputbladerf
|
||||
${LIBBLADERF_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
bladerfdevice
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
@ -20,6 +20,10 @@
|
||||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
@ -542,6 +546,37 @@ bladerf_lna_gain BladerfInput::getLnaGain(int lnaGain)
|
||||
}
|
||||
}
|
||||
|
||||
int BladerfInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int BladerfInput::webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
if (run)
|
||||
{
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
//struct bladerf *BladerfInput::open_bladerf_from_serial(const char *serial)
|
||||
//{
|
||||
// int status;
|
||||
|
@ -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);
|
||||
|
||||
private:
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
|
@ -22,6 +22,7 @@ CONFIG(MINGW64):LIBBLADERFSRC = "D:\softs\bladeRF\host\libraries\libbladeRF\incl
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += ../../../sdrbase
|
||||
INCLUDEPATH += ../../../sdrgui
|
||||
INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||
INCLUDEPATH += ../../../devices
|
||||
INCLUDEPATH += $$LIBBLADERFSRC
|
||||
|
||||
@ -44,6 +45,7 @@ FORMS += bladerfinputgui.ui
|
||||
|
||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
||||
LIBS += -L../../../swagger/$${build_subdir} -lswagger
|
||||
LIBS += -L../../../libbladerf/$${build_subdir} -llibbladerf
|
||||
LIBS += -L../../../devices/$${build_subdir} -ldevices
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
const PluginDescriptor BlderfInputPlugin::m_pluginDescriptor = {
|
||||
QString("BladerRF Input"),
|
||||
QString("3.8.2"),
|
||||
QString("3.8.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -1,5 +1,7 @@
|
||||
project(sdrdaemonsource)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
if (HAS_SSSE3)
|
||||
message(STATUS "SDRdaemonSource: use SSSE3 SIMD" )
|
||||
elseif (HAS_NEON)
|
||||
@ -49,6 +51,7 @@ if (BUILD_DEBIAN)
|
||||
target_include_directories(inputsdrdaemonsource PUBLIC
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${LIBCM256CCSRC}
|
||||
${LIBNANOMSG_INCLUDE_DIR}
|
||||
)
|
||||
@ -56,6 +59,7 @@ else (BUILD_DEBIAN)
|
||||
target_include_directories(inputsdrdaemonsource PUBLIC
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${CM256CC_INCLUDE_DIR}
|
||||
${LIBNANOMSG_INCLUDE_DIR}
|
||||
)
|
||||
@ -68,6 +72,7 @@ target_link_libraries(inputsdrdaemonsource
|
||||
${LIBNANOMSG_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
target_link_libraries(inputsdrdaemonsource
|
||||
@ -76,6 +81,7 @@ target_link_libraries(inputsdrdaemonsource
|
||||
${LIBNANOMSG_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
|
@ -20,6 +20,7 @@ CONFIG(MINGW64):LIBCM256CCSRC = "D:\softs\cm256cc"
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += ../../../sdrbase
|
||||
INCLUDEPATH += ../../../sdrgui
|
||||
INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||
INCLUDEPATH += $$LIBNANOMSGSRC/src
|
||||
INCLUDEPATH += $$LIBCM256CCSRC
|
||||
|
||||
@ -55,6 +56,7 @@ FORMS += sdrdaemonsourcegui.ui
|
||||
|
||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
||||
LIBS += -L../../../swagger/$${build_subdir} -lswagger
|
||||
LIBS += -L../../../nanomsg/$${build_subdir} -lnanomsg
|
||||
LIBS += -L../../../cm256cc/$${build_subdir} -lcm256cc
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
@ -206,3 +210,34 @@ void SDRdaemonSourceInput::setMessageQueueToGUI(MessageQueue *queue)
|
||||
m_SDRdaemonUDPHandler->setMessageQueueToGUI(queue);
|
||||
}
|
||||
|
||||
int SDRdaemonSourceInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int SDRdaemonSourceInput::webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
if (run)
|
||||
{
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
@ -320,6 +320,15 @@ public:
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
const PluginDescriptor SDRdaemonSourcePlugin::m_pluginDescriptor = {
|
||||
QString("SDRdaemon source input"),
|
||||
QString("3.8.0"),
|
||||
QString("3.8.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -1,5 +1,7 @@
|
||||
project(sdrplay)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
set(sdrplay_SOURCES
|
||||
sdrplaygui.cpp
|
||||
sdrplayinput.cpp
|
||||
@ -24,6 +26,7 @@ if (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${LIBMIRISDRSRC}/include
|
||||
${LIBMIRISDRSRC}/src
|
||||
)
|
||||
@ -31,6 +34,7 @@ else (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${LIBMIRISDR_INCLUDE_DIR}
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
@ -52,6 +56,7 @@ target_link_libraries(inputsdrplay
|
||||
mirisdr
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
target_link_libraries(inputsdrplay
|
||||
@ -59,6 +64,7 @@ target_link_libraries(inputsdrplay
|
||||
${LIBMIRISDR_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
@ -566,4 +570,34 @@ bool SDRPlayInput::setCenterFrequency(quint64 freq_hz)
|
||||
}
|
||||
}
|
||||
|
||||
int SDRPlayInput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int SDRPlayInput::webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
if (run)
|
||||
{
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,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);
|
||||
|
||||
private:
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
const PluginDescriptor SDRPlayPlugin::m_pluginDescriptor = {
|
||||
QString("SDRPlay RSP1 Input"),
|
||||
QString("3.8.0"),
|
||||
QString("3.8.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
Loading…
Reference in New Issue
Block a user