mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-09 09:25:07 -04:00
Web API: implemented device run APIs for BladeRF output, HackRF, PlutoSDR and LimeSDR ourput
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
project(hackrfoutput)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
set(hackrfoutput_SOURCES
|
||||
hackrfoutputgui.cpp
|
||||
hackrfoutput.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(outputhackrf
|
||||
hackrf
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
hackrfdevice
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
@@ -66,6 +71,7 @@ target_link_libraries(outputhackrf
|
||||
${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"
|
||||
@@ -396,3 +399,34 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int HackRFOutput::webapiRunGet(
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int HackRFOutput::webapiRun(
|
||||
bool run,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
if (run)
|
||||
{
|
||||
if (m_deviceAPI->initGeneration())
|
||||
{
|
||||
m_deviceAPI->startGeneration();
|
||||
DSPEngine::instance()->startAudioInputImmediate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopGeneration();
|
||||
}
|
||||
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,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();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
const PluginDescriptor HackRFOutputPlugin::m_pluginDescriptor = {
|
||||
QString("HackRF Output"),
|
||||
QString("3.8.0"),
|
||||
QString("3.8.6"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user