1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-27 10:19:15 -05:00

Compare commits

...

6 Commits

13 changed files with 84 additions and 8 deletions

View File

@ -40,4 +40,6 @@ if(ENABLE_USRP AND UHD_FOUND)
add_subdirectory(usrp) add_subdirectory(usrp)
endif() endif()
add_subdirectory(metis) if(ENABLE_METIS)
add_subdirectory(metis)
endif()

View File

@ -150,6 +150,7 @@ void RemoteTCPInputTCPHandler::connectToHost(const QString& address, quint16 por
m_readMetaData = false; m_readMetaData = false;
if (protocol == "SDRangel wss") if (protocol == "SDRangel wss")
{ {
#ifndef QT_NO_OPENSSL
m_webSocket = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this); m_webSocket = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this);
connect(m_webSocket, &QWebSocket::binaryFrameReceived, this, &RemoteTCPInputTCPHandler::dataReadyRead); connect(m_webSocket, &QWebSocket::binaryFrameReceived, this, &RemoteTCPInputTCPHandler::dataReadyRead);
connect(m_webSocket, &QWebSocket::connected, this, &RemoteTCPInputTCPHandler::connected); connect(m_webSocket, &QWebSocket::connected, this, &RemoteTCPInputTCPHandler::connected);
@ -160,6 +161,9 @@ void RemoteTCPInputTCPHandler::connectToHost(const QString& address, quint16 por
connect(m_webSocket, &QWebSocket::sslErrors, this, &RemoteTCPInputTCPHandler::sslErrors); connect(m_webSocket, &QWebSocket::sslErrors, this, &RemoteTCPInputTCPHandler::sslErrors);
m_webSocket->open(QUrl(QString("wss://%1:%2").arg(address).arg(port))); m_webSocket->open(QUrl(QString("wss://%1:%2").arg(address).arg(port)));
m_dataSocket = new WebSocket(m_webSocket); m_dataSocket = new WebSocket(m_webSocket);
#else
qWarning() << "RemoteTCPInput unable to use wss protocol as SSL is not supported";
#endif
} }
else else
{ {
@ -202,6 +206,7 @@ void RemoteTCPInputTCPHandler::cleanup()
FLAC__stream_decoder_delete(m_decoder); FLAC__stream_decoder_delete(m_decoder);
m_decoder = nullptr; m_decoder = nullptr;
} }
#ifndef QT_NO_OPENSSL
if (m_webSocket) if (m_webSocket)
{ {
qDebug() << "RemoteTCPInputTCPHandler::cleanup: Closing and deleting web socket"; qDebug() << "RemoteTCPInputTCPHandler::cleanup: Closing and deleting web socket";
@ -212,6 +217,7 @@ void RemoteTCPInputTCPHandler::cleanup()
disconnect(m_webSocket, &QWebSocket::errorOccurred, this, &RemoteTCPInputTCPHandler::errorOccurred); disconnect(m_webSocket, &QWebSocket::errorOccurred, this, &RemoteTCPInputTCPHandler::errorOccurred);
#endif #endif
} }
#endif
if (m_tcpSocket) if (m_tcpSocket)
{ {
qDebug() << "RemoteTCPInputTCPHandler::cleanup: Closing and deleting TCP socket"; qDebug() << "RemoteTCPInputTCPHandler::cleanup: Closing and deleting TCP socket";
@ -1071,11 +1077,13 @@ void RemoteTCPInputTCPHandler::errorOccurred(QAbstractSocket::SocketError socket
} }
} }
#ifndef QT_NO_OPENSSL
void RemoteTCPInputTCPHandler::sslErrors(const QList<QSslError> &errors) void RemoteTCPInputTCPHandler::sslErrors(const QList<QSslError> &errors)
{ {
qDebug() << "RemoteTCPInputTCPHandler::sslErrors: " << errors; qDebug() << "RemoteTCPInputTCPHandler::sslErrors: " << errors;
m_webSocket->ignoreSslErrors(); // FIXME: Add a setting whether to do this? m_webSocket->ignoreSslErrors(); // FIXME: Add a setting whether to do this?
} }
#endif
void RemoteTCPInputTCPHandler::dataReadyRead() void RemoteTCPInputTCPHandler::dataReadyRead()
{ {

View File

@ -187,7 +187,9 @@ public slots:
void connected(); void connected();
void disconnected(); void disconnected();
void errorOccurred(QAbstractSocket::SocketError socketError); void errorOccurred(QAbstractSocket::SocketError socketError);
#ifndef QT_NO_OPENSSL
void sslErrors(const QList<QSslError> &errors); void sslErrors(const QList<QSslError> &errors);
#endif
private: private:

View File

@ -157,8 +157,10 @@ int RTPUDPTransmitter::Create(std::size_t maximumpacketsize, const RTPTransmissi
} }
m_maxpacksize = maximumpacketsize; m_maxpacksize = maximumpacketsize;
m_multicastInterface = params->GetMulticastInterface(); #ifndef QT_NO_NETWORKINTERFACE
m_receivemode = RTPTransmitter::AcceptAll; m_multicastInterface = params->GetMulticastInterface();
#endif
m_receivemode = RTPTransmitter::AcceptAll;
m_waitingfordata = false; m_waitingfordata = false;
m_created = true; m_created = true;
@ -306,7 +308,8 @@ void RTPUDPTransmitter::ClearDestinations()
bool RTPUDPTransmitter::SupportsMulticasting() bool RTPUDPTransmitter::SupportsMulticasting()
{ {
QNetworkInterface::InterfaceFlags flags = m_multicastInterface.flags(); #ifndef QT_NO_NETWORKINTERFACE
QNetworkInterface::InterfaceFlags flags = m_multicastInterface.flags();
QAbstractSocket::SocketState rtpSocketState = m_rtpsock->state(); QAbstractSocket::SocketState rtpSocketState = m_rtpsock->state();
QAbstractSocket::SocketState rtcpSocketState = m_rtcpsock->state(); QAbstractSocket::SocketState rtcpSocketState = m_rtcpsock->state();
return m_multicastInterface.isValid() return m_multicastInterface.isValid()
@ -315,11 +318,16 @@ bool RTPUDPTransmitter::SupportsMulticasting()
&& (flags & QNetworkInterface::CanMulticast) && (flags & QNetworkInterface::CanMulticast)
&& (flags & QNetworkInterface::IsRunning) && (flags & QNetworkInterface::IsRunning)
&& !(flags & QNetworkInterface::IsLoopBack); && !(flags & QNetworkInterface::IsLoopBack);
#else
return false;
#endif
} }
int RTPUDPTransmitter::JoinMulticastGroup(const RTPAddress &addr) int RTPUDPTransmitter::JoinMulticastGroup(const RTPAddress &addr)
{ {
if (!m_init) { #ifndef QT_NO_NETWORKINTERFACE
if (!m_init) {
return ERR_RTP_UDPV4TRANS_NOTINIT; return ERR_RTP_UDPV4TRANS_NOTINIT;
} }
@ -346,10 +354,14 @@ int RTPUDPTransmitter::JoinMulticastGroup(const RTPAddress &addr)
} }
return 0; return 0;
#else
return ERR_RTP_UDPV6TRANS_NOMULTICASTSUPPORT;
#endif
} }
int RTPUDPTransmitter::LeaveMulticastGroup(const RTPAddress &addr) int RTPUDPTransmitter::LeaveMulticastGroup(const RTPAddress &addr)
{ {
#ifndef QT_NO_NETWORKINTERFACE
if (!m_init) { if (!m_init) {
return ERR_RTP_UDPV4TRANS_NOTINIT; return ERR_RTP_UDPV4TRANS_NOTINIT;
} }
@ -370,6 +382,9 @@ int RTPUDPTransmitter::LeaveMulticastGroup(const RTPAddress &addr)
} }
return 0; return 0;
#else
return ERR_RTP_UDPV6TRANS_NOMULTICASTSUPPORT;
#endif
} }
int RTPUDPTransmitter::SetReceiveMode(RTPTransmitter::ReceiveMode m) int RTPUDPTransmitter::SetReceiveMode(RTPTransmitter::ReceiveMode m)

View File

@ -68,10 +68,12 @@ public:
m_bindAddress = bindAddress; m_bindAddress = bindAddress;
} }
/** Sets the multicast interface IP address. */ #ifndef QT_NO_NETWORKINTERFACE
/** Sets the multicast interface IP address. */
void SetMulticastInterface(const QNetworkInterface& mcastInterface) { void SetMulticastInterface(const QNetworkInterface& mcastInterface) {
m_mcastInterface = mcastInterface; m_mcastInterface = mcastInterface;
} }
#endif
/** Sets the RTP portbase to \c pbase, which has to be an even number /** Sets the RTP portbase to \c pbase, which has to be an even number
* unless RTPUDPv4TransmissionParams::SetAllowOddPortbase was called; * unless RTPUDPv4TransmissionParams::SetAllowOddPortbase was called;
@ -87,11 +89,13 @@ public:
return m_bindAddress; return m_bindAddress;
} }
#ifndef QT_NO_NETWORKINTERFACE
/** Returns the multicast interface IP address. */ /** Returns the multicast interface IP address. */
QNetworkInterface GetMulticastInterface() const QNetworkInterface GetMulticastInterface() const
{ {
return m_mcastInterface; return m_mcastInterface;
} }
#endif
/** Returns the RTP portbase which will be used (default is 5000). */ /** Returns the RTP portbase which will be used (default is 5000). */
uint16_t GetPortbase() const uint16_t GetPortbase() const
@ -210,7 +214,9 @@ public:
private: private:
QHostAddress m_bindAddress; QHostAddress m_bindAddress;
#ifndef QT_NO_NETWORKINTERFACE
QNetworkInterface m_mcastInterface; QNetworkInterface m_mcastInterface;
#endif
uint16_t m_portbase; uint16_t m_portbase;
int m_rtpsendbufsz, m_rtprecvbufsz; int m_rtpsendbufsz, m_rtprecvbufsz;
int m_rtcpsendbufsz, m_rtcprecvbufsz; int m_rtcpsendbufsz, m_rtcprecvbufsz;
@ -349,8 +355,10 @@ private:
QUdpSocket *m_rtpsock, *m_rtcpsock; QUdpSocket *m_rtpsock, *m_rtcpsock;
bool m_deletesocketswhendone; bool m_deletesocketswhendone;
QHostAddress m_localIP; //!< from parameters bind IP QHostAddress m_localIP; //!< from parameters bind IP
QNetworkInterface m_multicastInterface; //!< from parameters multicast interface #ifndef QT_NO_NETWORKINTERFACE
uint16_t m_rtpPort, m_rtcpPort; QNetworkInterface m_multicastInterface; //!< from parameters multicast interface
#endif
uint16_t m_rtpPort, m_rtcpPort;
RTPTransmitter::ReceiveMode m_receivemode; RTPTransmitter::ReceiveMode m_receivemode;
std::size_t m_maxpacksize; std::size_t m_maxpacksize;

View File

@ -28,6 +28,7 @@
#include "util/timeutil.h" #include "util/timeutil.h"
Command::Command() : Command::Command() :
#if QT_CONFIG(process)
m_currentProcess(nullptr), m_currentProcess(nullptr),
m_currentProcessState(QProcess::NotRunning), m_currentProcessState(QProcess::NotRunning),
m_isInError(false), m_isInError(false),
@ -35,6 +36,7 @@ Command::Command() :
m_hasExited(false), m_hasExited(false),
m_currentProcessExitCode(0), m_currentProcessExitCode(0),
m_currentProcessExitStatus(QProcess::NormalExit), m_currentProcessExitStatus(QProcess::NormalExit),
#endif
m_currentProcessPid(0) m_currentProcessPid(0)
{ {
m_currentProcessStartTimeStampms = 0; m_currentProcessStartTimeStampms = 0;
@ -53,6 +55,7 @@ Command::Command(const Command& command) :
m_keyModifiers(command.m_keyModifiers), m_keyModifiers(command.m_keyModifiers),
m_associateKey(command.m_associateKey), m_associateKey(command.m_associateKey),
m_release(command.m_release), m_release(command.m_release),
#if QT_CONFIG(process)
m_currentProcess(nullptr), m_currentProcess(nullptr),
m_currentProcessState(QProcess::NotRunning), m_currentProcessState(QProcess::NotRunning),
m_isInError(false), m_isInError(false),
@ -60,6 +63,7 @@ Command::Command(const Command& command) :
m_hasExited(false), m_hasExited(false),
m_currentProcessExitCode(0), m_currentProcessExitCode(0),
m_currentProcessExitStatus(QProcess::NormalExit), m_currentProcessExitStatus(QProcess::NormalExit),
#endif
m_currentProcessPid(0) m_currentProcessPid(0)
{ {
m_currentProcessStartTimeStampms = 0; m_currentProcessStartTimeStampms = 0;
@ -68,6 +72,7 @@ Command::Command(const Command& command) :
Command::~Command() Command::~Command()
{ {
#if QT_CONFIG(process)
if (m_currentProcess) if (m_currentProcess)
{ {
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
@ -79,6 +84,7 @@ Command::~Command()
disconnect(m_currentProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); disconnect(m_currentProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState)));
m_currentProcess->deleteLater(); m_currentProcess->deleteLater();
} }
#endif
} }
void Command::resetToDefaults() void Command::resetToDefaults()
@ -164,6 +170,7 @@ QString Command::getKeyLabel() const
void Command::run(const QString& apiAddress, int apiPort, int deviceSetIndex) void Command::run(const QString& apiAddress, int apiPort, int deviceSetIndex)
{ {
#if QT_CONFIG(process)
if (m_currentProcess) if (m_currentProcess)
{ {
qWarning("Command::run: process already running"); qWarning("Command::run: process already running");
@ -212,17 +219,22 @@ void Command::run(const QString& apiAddress, int apiPort, int deviceSetIndex)
QStringList allArgs = args.split(" ", QString::SkipEmptyParts); QStringList allArgs = args.split(" ", QString::SkipEmptyParts);
#endif #endif
m_currentProcess->start(m_command, allArgs); m_currentProcess->start(m_command, allArgs);
#endif
} }
void Command::kill() void Command::kill()
{ {
#if QT_CONFIG(process)
if (m_currentProcess) if (m_currentProcess)
{ {
qDebug("Command::kill: %lld", m_currentProcessPid); qDebug("Command::kill: %lld", m_currentProcessPid);
m_currentProcess->kill(); m_currentProcess->kill();
} }
#endif
} }
#if QT_CONFIG(process)
QProcess::ProcessState Command::getLastProcessState() const QProcess::ProcessState Command::getLastProcessState() const
{ {
return m_currentProcessState; return m_currentProcessState;
@ -307,3 +319,4 @@ void Command::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
m_currentProcess->deleteLater(); // make sure other threads can still access it until all events have been processed m_currentProcess->deleteLater(); // make sure other threads can still access it until all events have been processed
m_currentProcess = nullptr; // for this thread it can assume it was deleted m_currentProcess = nullptr; // for this thread it can assume it was deleted
} }
#endif /* QT_CONFIG(process) */

View File

@ -62,10 +62,12 @@ public:
void run(const QString& apiAddress, int apiPort, int deviceSetIndex = 0); void run(const QString& apiAddress, int apiPort, int deviceSetIndex = 0);
void kill(); void kill();
#if QT_CONFIG(process)
QProcess::ProcessState getLastProcessState() const; QProcess::ProcessState getLastProcessState() const;
bool getLastProcessError(QProcess::ProcessError& error) const; bool getLastProcessError(QProcess::ProcessError& error) const;
bool getLastProcessExit(int& exitCode, QProcess::ExitStatus& exitStatus) const; bool getLastProcessExit(int& exitCode, QProcess::ExitStatus& exitStatus) const;
const QString& getLastProcessLog() const; const QString& getLastProcessLog() const;
#endif
uint64_t getLastProcessStartTimestampms() const { return m_currentProcessStartTimeStampms; } uint64_t getLastProcessStartTimestampms() const { return m_currentProcessStartTimeStampms; }
uint64_t getLastProcessFinishTimestampms() const { return m_currentProcessFinishTimeStampms; } uint64_t getLastProcessFinishTimestampms() const { return m_currentProcessFinishTimeStampms; }
const QString& getLastProcessCommandLine() const { return m_currentProcessCommandLine; } const QString& getLastProcessCommandLine() const { return m_currentProcessCommandLine; }
@ -102,6 +104,7 @@ private:
Qt::KeyboardModifiers m_keyModifiers; Qt::KeyboardModifiers m_keyModifiers;
bool m_associateKey; bool m_associateKey;
bool m_release; bool m_release;
#if QT_CONFIG(process)
QProcess *m_currentProcess; QProcess *m_currentProcess;
QProcess::ProcessState m_currentProcessState; QProcess::ProcessState m_currentProcessState;
bool m_isInError; bool m_isInError;
@ -109,6 +112,7 @@ private:
bool m_hasExited; bool m_hasExited;
int m_currentProcessExitCode; int m_currentProcessExitCode;
QProcess::ExitStatus m_currentProcessExitStatus; QProcess::ExitStatus m_currentProcessExitStatus;
#endif
QString m_log; QString m_log;
uint64_t m_currentProcessStartTimeStampms; uint64_t m_currentProcessStartTimeStampms;
uint64_t m_currentProcessFinishTimeStampms; uint64_t m_currentProcessFinishTimeStampms;
@ -116,9 +120,11 @@ private:
qint64 m_currentProcessPid; qint64 m_currentProcessPid;
private slots: private slots:
#if QT_CONFIG(process)
void processStateChanged(QProcess::ProcessState newState); void processStateChanged(QProcess::ProcessState newState);
void processError(QProcess::ProcessError error); void processError(QProcess::ProcessError error);
void processFinished(int exitCode, QProcess::ExitStatus exitStatus); void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
#endif
}; };
Q_DECLARE_METATYPE(const Command*); Q_DECLARE_METATYPE(const Command*);

View File

@ -22,6 +22,8 @@
#include <QDateTime> #include <QDateTime>
#if QT_CONFIG(process)
CommandOutputDialog::CommandOutputDialog(Command& command, QWidget* parent) : CommandOutputDialog::CommandOutputDialog(Command& command, QWidget* parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::CommandOutputDialog), ui(new Ui::CommandOutputDialog),
@ -167,3 +169,4 @@ void CommandOutputDialog::on_processKill_toggled(bool checked)
} }
} }
#endif // QT_CONFIG(process)

View File

@ -24,6 +24,8 @@
#include <QDialog> #include <QDialog>
#include <QProcess> #include <QProcess>
#if QT_CONFIG(process)
#include "export.h" #include "export.h"
namespace Ui { namespace Ui {
@ -54,5 +56,6 @@ private slots:
void on_processKill_toggled(bool checked); void on_processKill_toggled(bool checked);
}; };
#endif
#endif /* SDRGUI_GUI_COMMANDOUTPUTDIALOG_H_ */ #endif /* SDRGUI_GUI_COMMANDOUTPUTDIALOG_H_ */

View File

@ -29,6 +29,8 @@
#include "commandsdialog.h" #include "commandsdialog.h"
#include "ui_commandsdialog.h" #include "ui_commandsdialog.h"
#if QT_CONFIG(process)
CommandsDialog::CommandsDialog(QWidget* parent) : CommandsDialog::CommandsDialog(QWidget* parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::CommandsDialog), ui(new Ui::CommandsDialog),
@ -309,3 +311,5 @@ QTreeWidgetItem* CommandsDialog::addCommandToTree(const Command* command)
//updatePresetControls(); //updatePresetControls();
return item; return item;
} }
#endif // QT_CONFIG(process)

View File

@ -25,6 +25,8 @@
#include "export.h" #include "export.h"
#if QT_CONFIG(process)
class CommandKeyReceiver; class CommandKeyReceiver;
namespace Ui { namespace Ui {
@ -66,4 +68,6 @@ private slots:
void on_commandKeyboardConnect_toggled(bool checked); void on_commandKeyboardConnect_toggled(bool checked);
}; };
#endif // QT_CONFIG(process)
#endif // SDRGUI_GUI_COMMANDSDIALOG_H_ #endif // SDRGUI_GUI_COMMANDSDIALOG_H_

View File

@ -24,6 +24,8 @@
#include "fftwisdomdialog.h" #include "fftwisdomdialog.h"
#include "ui_fftwisdomdialog.h" #include "ui_fftwisdomdialog.h"
#if QT_CONFIG(process)
FFTWisdomDialog::FFTWisdomDialog(QProcess *process, QWidget* parent) : FFTWisdomDialog::FFTWisdomDialog(QProcess *process, QWidget* parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::FFTWisdomDialog), ui(new Ui::FFTWisdomDialog),
@ -132,3 +134,5 @@ void FFTWisdomDialog::updateArguments(int fftMaxLog2, bool includeReverse)
qDebug("FFTWisdomDialog::updateArguments: %s %s", qPrintable(m_fftwExecPath), qPrintable(argStr)); qDebug("FFTWisdomDialog::updateArguments: %s %s", qPrintable(m_fftwExecPath), qPrintable(argStr));
ui->fftwCommand->setText(m_fftwExecPath + " " + argStr); ui->fftwCommand->setText(m_fftwExecPath + " " + argStr);
} }
#endif // QT_CONFIG(process)

View File

@ -25,6 +25,8 @@
#include "export.h" #include "export.h"
#if QT_CONFIG(process)
namespace Ui { namespace Ui {
class FFTWisdomDialog; class FFTWisdomDialog;
} }
@ -55,5 +57,7 @@ private:
QProcess *m_process; QProcess *m_process;
}; };
#endif
#endif // SDRGUI_GUI_FFTWISDOMDIALOG_H_ #endif // SDRGUI_GUI_FFTWISDOMDIALOG_H_