1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Web API: implemented device run APIs for BladeRF output, HackRF, PlutoSDR and LimeSDR ourput

This commit is contained in:
f4exb
2017-12-10 01:57:50 +01:00
parent 9819e01da5
commit 565083e5f5
38 changed files with 638 additions and 22 deletions
@@ -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,