mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
Web API: implemented device run APIs for Airspy, FCD Pro, FCD Pro+ and File Source i.e. the rest of source device plugins
This commit is contained in:
parent
966767a44a
commit
84b6c7bdc9
@ -1,5 +1,7 @@
|
|||||||
project(airspy)
|
project(airspy)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
set(airspy_SOURCES
|
set(airspy_SOURCES
|
||||||
airspygui.cpp
|
airspygui.cpp
|
||||||
airspyinput.cpp
|
airspyinput.cpp
|
||||||
@ -24,6 +26,7 @@ if (BUILD_DEBIAN)
|
|||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||||
${LIBAIRSPYSRC}
|
${LIBAIRSPYSRC}
|
||||||
${LIBAIRSPYSRC}/libairspy/src
|
${LIBAIRSPYSRC}/libairspy/src
|
||||||
)
|
)
|
||||||
@ -31,6 +34,7 @@ else (BUILD_DEBIAN)
|
|||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||||
${LIBAIRSPY_INCLUDE_DIR}
|
${LIBAIRSPY_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
endif (BUILD_DEBIAN)
|
endif (BUILD_DEBIAN)
|
||||||
@ -56,6 +60,7 @@ target_link_libraries(inputairspy
|
|||||||
airspy
|
airspy
|
||||||
sdrbase
|
sdrbase
|
||||||
sdrgui
|
sdrgui
|
||||||
|
swagger
|
||||||
)
|
)
|
||||||
else (BUILD_DEBIAN)
|
else (BUILD_DEBIAN)
|
||||||
target_link_libraries(inputairspy
|
target_link_libraries(inputairspy
|
||||||
@ -63,6 +68,7 @@ target_link_libraries(inputairspy
|
|||||||
${LIBAIRSPY_LIBRARIES}
|
${LIBAIRSPY_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
sdrgui
|
sdrgui
|
||||||
|
swagger
|
||||||
)
|
)
|
||||||
endif (BUILD_DEBIAN)
|
endif (BUILD_DEBIAN)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ CONFIG(MINGW64):LIBAIRSPYSRC = "D:\softs\libairspy"
|
|||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
INCLUDEPATH += ../../../sdrbase
|
INCLUDEPATH += ../../../sdrbase
|
||||||
INCLUDEPATH += ../../../sdrgui
|
INCLUDEPATH += ../../../sdrgui
|
||||||
|
INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||||
INCLUDEPATH += $$LIBAIRSPYSRC
|
INCLUDEPATH += $$LIBAIRSPYSRC
|
||||||
|
|
||||||
DEFINES += LIBAIRSPY_DYN_RATES
|
DEFINES += LIBAIRSPY_DYN_RATES
|
||||||
@ -44,6 +45,7 @@ FORMS += airspygui.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
|
||||||
LIBS += -L../../../libairspy/$${build_subdir} -llibairspy
|
LIBS += -L../../../libairspy/$${build_subdir} -llibairspy
|
||||||
|
|
||||||
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 "airspygui.h"
|
#include "airspygui.h"
|
||||||
#include "airspyinput.h"
|
#include "airspyinput.h"
|
||||||
|
|
||||||
@ -565,3 +569,31 @@ struct airspy_device *AirspyInput::open_airspy_from_sequence(int sequence)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AirspyInput::webapiRunGet(
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AirspyInput::webapiRun(
|
||||||
|
bool run,
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MsgStartStop *message = MsgStartStop::create(run);
|
||||||
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgStartStop *msgToGUI = MsgStartStop::create(run);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,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);
|
||||||
|
|
||||||
static const qint64 loLowLimitFreq;
|
static const qint64 loLowLimitFreq;
|
||||||
static const qint64 loHighLimitFreq;
|
static const qint64 loHighLimitFreq;
|
||||||
|
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "SWGDeviceSettings.h"
|
||||||
|
#include "SWGDeviceState.h"
|
||||||
|
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
@ -697,3 +701,30 @@ void FCDProInput::set_lo_ppm()
|
|||||||
{
|
{
|
||||||
set_center_freq((double) m_settings.m_centerFrequency);
|
set_center_freq((double) m_settings.m_centerFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FCDProInput::webapiRunGet(
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FCDProInput::webapiRun(
|
||||||
|
bool run,
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MsgStartStop *message = MsgStartStop::create(run);
|
||||||
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgStartStop *msgToGUI = MsgStartStop::create(run);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
@ -110,6 +110,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);
|
||||||
|
|
||||||
void set_center_freq(double freq);
|
void set_center_freq(double freq);
|
||||||
void set_bias_t(bool on);
|
void set_bias_t(bool on);
|
||||||
void set_lnaGain(int index);
|
void set_lnaGain(int index);
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "SWGDeviceSettings.h"
|
||||||
|
#include "SWGDeviceState.h"
|
||||||
|
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
@ -409,6 +413,32 @@ void FCDProPlusInput::set_lo_ppm()
|
|||||||
set_center_freq((double) m_settings.m_centerFrequency);
|
set_center_freq((double) m_settings.m_centerFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FCDProPlusInput::webapiRunGet(
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FCDProPlusInput::webapiRun(
|
||||||
|
bool run,
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MsgStartStop *message = MsgStartStop::create(run);
|
||||||
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgStartStop *msgToGUI = MsgStartStop::create(run);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,6 +109,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);
|
||||||
|
|
||||||
void set_center_freq(double freq);
|
void set_center_freq(double freq);
|
||||||
void set_bias_t(bool on);
|
void set_bias_t(bool on);
|
||||||
void set_lna_gain(bool on);
|
void set_lna_gain(bool on);
|
||||||
|
@ -16,10 +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 "SWGDeviceSettings.h"
|
||||||
#include "SWGFileSourceSettings.h"
|
#include "SWGFileSourceSettings.h"
|
||||||
|
#include "SWGDeviceState.h"
|
||||||
|
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
@ -324,3 +326,31 @@ int FileSourceInput::webapiSettingsGet(
|
|||||||
*response.getFileSourceSettings()->getFileName() = m_settings.m_fileName;
|
*response.getFileSourceSettings()->getFileName() = m_settings.m_fileName;
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FileSourceInput::webapiRunGet(
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FileSourceInput::webapiRun(
|
||||||
|
bool run,
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MsgStartStop *message = MsgStartStop::create(run);
|
||||||
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
|
{
|
||||||
|
MsgStartStop *msgToGUI = MsgStartStop::create(run);
|
||||||
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -247,6 +247,15 @@ public:
|
|||||||
SWGSDRangel::SWGDeviceSettings& response,
|
SWGSDRangel::SWGDeviceSettings& response,
|
||||||
QString& errorMessage);
|
QString& errorMessage);
|
||||||
|
|
||||||
|
virtual int webapiRunGet(
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
|
virtual int webapiRun(
|
||||||
|
bool run,
|
||||||
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
|
QString& errorMessage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceSourceAPI *m_deviceAPI;
|
DeviceSourceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
Loading…
Reference in New Issue
Block a user