mirror of https://github.com/f4exb/sdrangel.git
Daemon channel source new plugin (1)
This commit is contained in:
parent
26bc4d8f8e
commit
5151f38977
|
@ -7,13 +7,11 @@ add_subdirectory(modwfm)
|
||||||
add_subdirectory(udpsink)
|
add_subdirectory(udpsink)
|
||||||
|
|
||||||
find_package(CM256cc)
|
find_package(CM256cc)
|
||||||
|
|
||||||
if(CM256CC_FOUND)
|
if(CM256CC_FOUND)
|
||||||
add_subdirectory(sdrdaemonchannelsource)
|
add_subdirectory(daemonsrc)
|
||||||
endif(CM256CC_FOUND)
|
endif(CM256CC_FOUND)
|
||||||
|
|
||||||
find_package(OpenCV)
|
find_package(OpenCV)
|
||||||
|
|
||||||
if (OpenCV_FOUND)
|
if (OpenCV_FOUND)
|
||||||
add_subdirectory(modatv)
|
add_subdirectory(modatv)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
project(daemonsrc)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
|
set(daemonsrc_SOURCES
|
||||||
|
daemonsrc.cpp
|
||||||
|
# daemonsrcthread.cpp
|
||||||
|
daemonsrcgui.cpp
|
||||||
|
daemonsrcplugin.cpp
|
||||||
|
daemonsrcsettings.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(daemonsrc_HEADERS
|
||||||
|
daemonsrc.h
|
||||||
|
# daemonsrcthread.h
|
||||||
|
daemonsrcgui.h
|
||||||
|
daemonsrcplugin.h
|
||||||
|
daemonsrcsettings.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(daemonsrc_FORMS
|
||||||
|
daemonsrcgui.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
# ${CMAKE_SOURCE_DIR}/sdrdaemon
|
||||||
|
${CM256CC_INCLUDE_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||||
|
)
|
||||||
|
|
||||||
|
#include(${QT_USE_FILE})
|
||||||
|
add_definitions(${QT_DEFINITIONS})
|
||||||
|
add_definitions(-DQT_PLUGIN)
|
||||||
|
add_definitions(-DQT_SHARED)
|
||||||
|
|
||||||
|
qt5_wrap_ui(daemonsrc_FORMS_HEADERS ${daemonsrc_FORMS})
|
||||||
|
|
||||||
|
add_library(daemonsrc SHARED
|
||||||
|
${daemonsrc_SOURCES}
|
||||||
|
${daemonsrc_HEADERS_MOC}
|
||||||
|
${daemonsrc_FORMS_HEADERS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(daemonsrc
|
||||||
|
${QT_LIBRARIES}
|
||||||
|
${CM256CC_LIBRARIES}
|
||||||
|
sdrbase
|
||||||
|
# sdrdaemon
|
||||||
|
sdrgui
|
||||||
|
swagger
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(daemonsrc Qt5::Core Qt5::Widgets Qt5::Network)
|
||||||
|
|
||||||
|
install(TARGETS daemonsrc DESTINATION lib/plugins/channeltx)
|
|
@ -0,0 +1,85 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "device/devicesinkapi.h"
|
||||||
|
#include "dsp/upchannelizer.h"
|
||||||
|
#include "dsp/threadedbasebandsamplesource.h"
|
||||||
|
|
||||||
|
#include "daemonsrc.h"
|
||||||
|
|
||||||
|
const QString DaemonSrc::m_channelIdURI = "sdrangel.channeltx.daemonsrc";
|
||||||
|
const QString DaemonSrc::m_channelId ="DaemonSrc";
|
||||||
|
|
||||||
|
DaemonSrc::DaemonSrc(DeviceSinkAPI *deviceAPI) :
|
||||||
|
ChannelSourceAPI(m_channelIdURI),
|
||||||
|
m_deviceAPI(deviceAPI)
|
||||||
|
{
|
||||||
|
setObjectName(m_channelId);
|
||||||
|
|
||||||
|
m_channelizer = new UpChannelizer(this);
|
||||||
|
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
|
||||||
|
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
|
||||||
|
m_deviceAPI->addChannelAPI(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
DaemonSrc::~DaemonSrc()
|
||||||
|
{
|
||||||
|
m_deviceAPI->removeChannelAPI(this);
|
||||||
|
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||||
|
delete m_threadedChannelizer;
|
||||||
|
delete m_channelizer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrc::pull(Sample& sample)
|
||||||
|
{
|
||||||
|
sample.m_real = 0.0f;
|
||||||
|
sample.m_imag = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrc::pullAudio(int nbSamples __attribute__((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrc::start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrc::stop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DaemonSrc::handleMessage(const Message& cmd __attribute__((unused)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray DaemonSrc::serialize() const
|
||||||
|
{
|
||||||
|
return m_settings.serialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DaemonSrc::deserialize(const QByteArray& data __attribute__((unused)))
|
||||||
|
{
|
||||||
|
if (m_settings.deserialize(data))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_settings.resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "dsp/basebandsamplesource.h"
|
||||||
|
#include "channel/channelsourceapi.h"
|
||||||
|
|
||||||
|
#include "daemonsrcsettings.h"
|
||||||
|
|
||||||
|
class DeviceSinkAPI;
|
||||||
|
class ThreadedBasebandSampleSource;
|
||||||
|
class UpChannelizer;
|
||||||
|
|
||||||
|
class DaemonSrc : public BasebandSampleSource, public ChannelSourceAPI {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DaemonSrc(DeviceSinkAPI *deviceAPI);
|
||||||
|
~DaemonSrc();
|
||||||
|
|
||||||
|
virtual void destroy() { delete this; }
|
||||||
|
|
||||||
|
virtual void pull(Sample& sample);
|
||||||
|
virtual void pullAudio(int nbSamples);
|
||||||
|
virtual void start();
|
||||||
|
virtual void stop();
|
||||||
|
virtual bool handleMessage(const Message& cmd);
|
||||||
|
|
||||||
|
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||||
|
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||||
|
virtual qint64 getCenterFrequency() const { return 0; }
|
||||||
|
|
||||||
|
virtual QByteArray serialize() const;
|
||||||
|
virtual bool deserialize(const QByteArray& data);
|
||||||
|
|
||||||
|
static const QString m_channelIdURI;
|
||||||
|
static const QString m_channelId;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DeviceSinkAPI* m_deviceAPI;
|
||||||
|
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
||||||
|
UpChannelizer* m_channelizer;
|
||||||
|
|
||||||
|
DaemonSrcSettings m_settings;
|
||||||
|
};
|
|
@ -0,0 +1,109 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "device/devicesinkapi.h"
|
||||||
|
#include "device/deviceuiset.h"
|
||||||
|
|
||||||
|
#include "ui_daemonsrcgui.h"
|
||||||
|
#include "daemonsrcgui.h"
|
||||||
|
|
||||||
|
DaemonSrcGUI* DaemonSrcGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
|
||||||
|
{
|
||||||
|
DaemonSrcGUI* gui = new DaemonSrcGUI(pluginAPI, deviceUISet, channelTx);
|
||||||
|
return gui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcGUI::destroy()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcGUI::setName(const QString& name)
|
||||||
|
{
|
||||||
|
setObjectName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DaemonSrcGUI::getName() const
|
||||||
|
{
|
||||||
|
return objectName();
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 DaemonSrcGUI::getCenterFrequency() const {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcGUI::setCenterFrequency(qint64 centerFrequency __attribute__((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcGUI::resetToDefaults()
|
||||||
|
{
|
||||||
|
m_settings.resetToDefaults();
|
||||||
|
displaySettings();
|
||||||
|
applySettings(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray DaemonSrcGUI::serialize() const
|
||||||
|
{
|
||||||
|
return m_settings.serialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DaemonSrcGUI::deserialize(const QByteArray& data)
|
||||||
|
{
|
||||||
|
if(m_settings.deserialize(data)) {
|
||||||
|
displaySettings();
|
||||||
|
applySettings(true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DaemonSrcGUI::handleMessage(const Message& message __attribute__((unused)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DaemonSrcGUI::DaemonSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx __attribute__((unused)), QWidget* parent) :
|
||||||
|
RollupWidget(parent),
|
||||||
|
ui(new Ui::DaemonSrcGUI),
|
||||||
|
m_pluginAPI(pluginAPI),
|
||||||
|
m_deviceUISet(deviceUISet)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
DaemonSrcGUI::~DaemonSrcGUI()
|
||||||
|
{
|
||||||
|
m_deviceUISet->removeTxChannelInstance(this);
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcGUI::blockApplySettings(bool block)
|
||||||
|
{
|
||||||
|
m_doApplySettings = !block;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcGUI::applySettings(bool force __attribute((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcGUI::displaySettings()
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCGUI_H_
|
||||||
|
#define PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCGUI_H_
|
||||||
|
|
||||||
|
#include "plugin/plugininstancegui.h"
|
||||||
|
#include "gui/rollupwidget.h"
|
||||||
|
#include "util/messagequeue.h"
|
||||||
|
|
||||||
|
#include "daemonsrcsettings.h"
|
||||||
|
|
||||||
|
class PluginAPI;
|
||||||
|
class DeviceUISet;
|
||||||
|
class BasebandSampleSource;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DaemonSrcGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DaemonSrcGUI : public RollupWidget, public PluginInstanceGUI {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
static DaemonSrcGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx);
|
||||||
|
virtual void destroy();
|
||||||
|
|
||||||
|
void setName(const QString& name);
|
||||||
|
QString getName() const;
|
||||||
|
virtual qint64 getCenterFrequency() const;
|
||||||
|
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||||
|
|
||||||
|
void resetToDefaults();
|
||||||
|
QByteArray serialize() const;
|
||||||
|
bool deserialize(const QByteArray& data);
|
||||||
|
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||||
|
virtual bool handleMessage(const Message& message);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::DaemonSrcGUI* ui;
|
||||||
|
PluginAPI* m_pluginAPI;
|
||||||
|
DeviceUISet* m_deviceUISet;
|
||||||
|
MessageQueue m_inputMessageQueue;
|
||||||
|
DaemonSrcSettings m_settings;
|
||||||
|
bool m_doApplySettings;
|
||||||
|
|
||||||
|
explicit DaemonSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0);
|
||||||
|
virtual ~DaemonSrcGUI();
|
||||||
|
|
||||||
|
void blockApplySettings(bool block);
|
||||||
|
void applySettings(bool force = false);
|
||||||
|
void displaySettings();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCGUI_H_ */
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DaemonSrcGUI</class>
|
||||||
|
<widget class="RollupWidget" name="DaemonSrcGUI">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>320</width>
|
||||||
|
<height>90</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>320</width>
|
||||||
|
<height>90</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Liberation Sans</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>LoRa Demodulator</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="settingsContainer" native="true">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>301</width>
|
||||||
|
<height>61</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="dataAddressLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="dataAddressLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Data</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="dataAddress">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>120</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Local data listener address</string>
|
||||||
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string>000.000.000.000</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="dataPortSeparator">
|
||||||
|
<property name="text">
|
||||||
|
<string>:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="dataPort">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Local data listener port</string>
|
||||||
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string>00000</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Set local data listener address and port</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Set</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>RollupWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/rollupwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -0,0 +1,79 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <QtPlugin>
|
||||||
|
#include "plugin/pluginapi.h"
|
||||||
|
|
||||||
|
#ifndef SERVER_MODE
|
||||||
|
#include "daemonsrcgui.h"
|
||||||
|
#endif
|
||||||
|
#include "daemonsrc.h"
|
||||||
|
#include "daemonsrcplugin.h"
|
||||||
|
|
||||||
|
const PluginDescriptor DaemonSrcPlugin::m_pluginDescriptor = {
|
||||||
|
QString("Daemon channel source"),
|
||||||
|
QString("4.1.0"),
|
||||||
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
|
true,
|
||||||
|
QString("https://github.com/f4exb/sdrangel")
|
||||||
|
};
|
||||||
|
|
||||||
|
DaemonSrcPlugin::DaemonSrcPlugin(QObject* parent) :
|
||||||
|
QObject(parent),
|
||||||
|
m_pluginAPI(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const PluginDescriptor& DaemonSrcPlugin::getPluginDescriptor() const
|
||||||
|
{
|
||||||
|
return m_pluginDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||||
|
{
|
||||||
|
m_pluginAPI = pluginAPI;
|
||||||
|
|
||||||
|
// register source
|
||||||
|
m_pluginAPI->registerTxChannel(DaemonSrc::m_channelIdURI, DaemonSrc::m_channelId, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SERVER_MODE
|
||||||
|
PluginInstanceGUI* DaemonSrcPlugin::createTxChannelGUI(
|
||||||
|
DeviceUISet *deviceUISet __attribute__((unused)),
|
||||||
|
BasebandSampleSource *txChannel __attribute__((unused)))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
PluginInstanceGUI* DaemonSrcPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
|
||||||
|
{
|
||||||
|
return DaemonSrcGUI::create(m_pluginAPI, deviceUISet, txChannel);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BasebandSampleSource* DaemonSrcPlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)
|
||||||
|
{
|
||||||
|
return new DaemonSrc(deviceAPI);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChannelSourceAPI* DaemonSrcPlugin::createTxChannelCS(DeviceSinkAPI *deviceAPI)
|
||||||
|
{
|
||||||
|
return new DaemonSrc(deviceAPI);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCPLUGIN_H_
|
||||||
|
#define PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCPLUGIN_H_
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "plugin/plugininterface.h"
|
||||||
|
|
||||||
|
class DeviceUISet;
|
||||||
|
class BasebandSampleSource;
|
||||||
|
|
||||||
|
class DaemonSrcPlugin : public QObject, PluginInterface {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(PluginInterface)
|
||||||
|
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.daemonsrc")
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DaemonSrcPlugin(QObject* parent = 0);
|
||||||
|
|
||||||
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
|
void initPlugin(PluginAPI* pluginAPI);
|
||||||
|
|
||||||
|
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
|
||||||
|
virtual BasebandSampleSource* createTxChannelBS(DeviceSinkAPI *deviceAPI);
|
||||||
|
virtual ChannelSourceAPI* createTxChannelCS(DeviceSinkAPI *deviceAPI);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
|
||||||
|
PluginAPI* m_pluginAPI;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCPLUGIN_H_ */
|
|
@ -0,0 +1,84 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "daemonsrcsettings.h"
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
|
#include "util/simpleserializer.h"
|
||||||
|
#include "settings/serializable.h"
|
||||||
|
#include "daemonsrcsettings.h"
|
||||||
|
|
||||||
|
DaemonSrcSettings::DaemonSrcSettings()
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DaemonSrcSettings::resetToDefaults()
|
||||||
|
{
|
||||||
|
m_dataAddress = "127.0.0.1";
|
||||||
|
m_dataPort = 9090;
|
||||||
|
m_rgbColor = QColor(0, 255, 255).rgb();
|
||||||
|
m_title = "SDRDaemon sink";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray DaemonSrcSettings::serialize() const
|
||||||
|
{
|
||||||
|
SimpleSerializer s(1);
|
||||||
|
s.writeString(1, m_dataAddress);
|
||||||
|
s.writeU32(2, m_dataPort);
|
||||||
|
s.writeU32(3, m_rgbColor);
|
||||||
|
s.writeString(4, m_title);
|
||||||
|
|
||||||
|
return s.final();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DaemonSrcSettings::deserialize(const QByteArray& data)
|
||||||
|
{
|
||||||
|
SimpleDeserializer d(data);
|
||||||
|
|
||||||
|
if(!d.isValid())
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(d.getVersion() == 1)
|
||||||
|
{
|
||||||
|
uint32_t tmp;
|
||||||
|
QString strtmp;
|
||||||
|
|
||||||
|
d.readString(1, &m_dataAddress, "127.0.0.1");
|
||||||
|
d.readU32(2, &tmp, 0);
|
||||||
|
|
||||||
|
if ((tmp > 1023) && (tmp < 65535)) {
|
||||||
|
m_dataPort = tmp;
|
||||||
|
} else {
|
||||||
|
m_dataPort = 9090;
|
||||||
|
}
|
||||||
|
|
||||||
|
d.readU32(3, &m_rgbColor, QColor(0, 255, 255).rgb());
|
||||||
|
d.readString(4, &m_title, "AM Modulator");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCSETTINGS_H_
|
||||||
|
#define PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCSETTINGS_H_
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
class Serializable;
|
||||||
|
|
||||||
|
struct DaemonSrcSettings
|
||||||
|
{
|
||||||
|
QString m_dataAddress; //!< Listening (local) data address
|
||||||
|
uint16_t m_dataPort; //!< Listening data port
|
||||||
|
quint32 m_rgbColor;
|
||||||
|
QString m_title;
|
||||||
|
|
||||||
|
Serializable *m_channelMarker;
|
||||||
|
|
||||||
|
DaemonSrcSettings();
|
||||||
|
void resetToDefaults();
|
||||||
|
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||||
|
QByteArray serialize() const;
|
||||||
|
bool deserialize(const QByteArray& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* PLUGINS_CHANNELTX_DAEMONSRC_DAEMONSRCSETTINGS_H_ */
|
Loading…
Reference in New Issue