mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-06 07:42:27 -04:00
Web API: implemented device run APIs for File Sink and SDRdaeon output sink i.e. the rest of sink device plugins
This commit is contained in:
parent
84b6c7bdc9
commit
731c2c3f60
@ -20,6 +20,7 @@ QMAKE_CXXFLAGS += -std=c++11
|
|||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
INCLUDEPATH += ../../../sdrbase
|
INCLUDEPATH += ../../../sdrbase
|
||||||
INCLUDEPATH += ../../../sdrgui
|
INCLUDEPATH += ../../../sdrgui
|
||||||
|
INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||||
|
|
||||||
CONFIG(Release):build_subdir = release
|
CONFIG(Release):build_subdir = release
|
||||||
CONFIG(Debug):build_subdir = debug
|
CONFIG(Debug):build_subdir = debug
|
||||||
@ -40,5 +41,6 @@ FORMS += filesinkgui.ui
|
|||||||
|
|
||||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
||||||
|
LIBS += -L../../../swagger/$${build_subdir} -lswagger
|
||||||
|
|
||||||
RESOURCES = ../../../sdrgui/resources/res.qrc
|
RESOURCES = ../../../sdrgui/resources/res.qrc
|
||||||
|
@ -16,8 +16,12 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "SWGDeviceSettings.h"
|
||||||
|
#include "SWGDeviceState.h"
|
||||||
|
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
@ -271,3 +275,32 @@ void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FileSinkOutput::webapiRunGet(
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FileSinkOutput::webapiRun(
|
||||||
|
bool run,
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MsgStartStop *message = MsgStartStop::create(run);
|
||||||
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue)
|
||||||
|
{
|
||||||
|
MsgStartStop *messagetoGui = MsgStartStop::create(run);
|
||||||
|
m_guiMessageQueue->push(messagetoGui);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +184,15 @@ public:
|
|||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
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:
|
private:
|
||||||
DeviceSinkAPI *m_deviceAPI;
|
DeviceSinkAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
project(sdrdaemonsink)
|
project(sdrdaemonsink)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
if (HAS_SSSE3)
|
if (HAS_SSSE3)
|
||||||
message(STATUS "SDRdaemonFEC: use SSSE3 SIMD" )
|
message(STATUS "SDRdaemonFEC: use SSSE3 SIMD" )
|
||||||
elseif (HAS_NEON)
|
elseif (HAS_NEON)
|
||||||
@ -37,6 +39,7 @@ if (BUILD_DEBIAN)
|
|||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||||
${LIBCM256CCSRC}
|
${LIBCM256CCSRC}
|
||||||
${LIBNANOMSG_INCLUDE_DIR}
|
${LIBNANOMSG_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
@ -44,6 +47,7 @@ else (BUILD_DEBIAN)
|
|||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||||
${CMAKE_SOURCE_DIR}/devices
|
${CMAKE_SOURCE_DIR}/devices
|
||||||
${CM256CC_INCLUDE_DIR}
|
${CM256CC_INCLUDE_DIR}
|
||||||
${LIBNANOMSG_INCLUDE_DIR}
|
${LIBNANOMSG_INCLUDE_DIR}
|
||||||
@ -67,6 +71,7 @@ target_link_libraries(outputsdrdaemonsink
|
|||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
sdrgui
|
sdrgui
|
||||||
|
swagger
|
||||||
cm256cc
|
cm256cc
|
||||||
${LIBNANOMSG_LIBRARIES}
|
${LIBNANOMSG_LIBRARIES}
|
||||||
)
|
)
|
||||||
@ -75,6 +80,7 @@ target_link_libraries(outputsdrdaemonsink
|
|||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
sdrgui
|
sdrgui
|
||||||
|
swagger
|
||||||
${CM256CC_LIBRARIES}
|
${CM256CC_LIBRARIES}
|
||||||
${LIBNANOMSG_LIBRARIES}
|
${LIBNANOMSG_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
@ -16,8 +16,12 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "SWGDeviceSettings.h"
|
||||||
|
#include "SWGDeviceState.h"
|
||||||
|
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
@ -292,5 +296,33 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
|
|||||||
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate, m_settings.m_centerFrequency);
|
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate, m_settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SDRdaemonSinkOutput::webapiRunGet(
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SDRdaemonSinkOutput::webapiRun(
|
||||||
|
bool run,
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MsgStartStop *message = MsgStartStop::create(run);
|
||||||
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue)
|
||||||
|
{
|
||||||
|
MsgStartStop *messagetoGui = MsgStartStop::create(run);
|
||||||
|
m_guiMessageQueue->push(messagetoGui);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,6 +165,15 @@ public:
|
|||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
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:
|
private:
|
||||||
DeviceSinkAPI *m_deviceAPI;
|
DeviceSinkAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user