diff --git a/plugins/samplesource/plutosdrinput/CMakeLists.txt b/plugins/samplesource/plutosdrinput/CMakeLists.txt
index 77b76e722..1767b07a0 100644
--- a/plugins/samplesource/plutosdrinput/CMakeLists.txt
+++ b/plugins/samplesource/plutosdrinput/CMakeLists.txt
@@ -2,17 +2,17 @@ project(plutosdrinput)
set(plutosdrinput_SOURCES
plutosdrinputgui.cpp
-# plutosdrinput.cpp
+ plutosdrinput.cpp
plutosdrinputplugin.cpp
-# plutosdrinputsettings.cpp
+ plutosdrinputsettings.cpp
# plutosdrinputthread.cpp
)
set(plutosdrinput_HEADERS
plutosdrinputgui.h
-# plutosdrinput.h
+ plutosdrinput.h
plutosdrinputplugin.h
-# plutosdrinputsettings.h
+ plutosdrinputsettings.h
# plutosdrinputthread.h
)
diff --git a/plugins/samplesource/plutosdrinput/plutosdrinput.cpp b/plugins/samplesource/plutosdrinput/plutosdrinput.cpp
new file mode 100644
index 000000000..42868c805
--- /dev/null
+++ b/plugins/samplesource/plutosdrinput/plutosdrinput.cpp
@@ -0,0 +1,82 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017 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 . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#include "dsp/filerecord.h"
+
+#include "plutosdrinput.h"
+
+MESSAGE_CLASS_DEFINITION(PlutoSDRInput::MsgFileRecord, Message)
+
+PlutoSDRInput::PlutoSDRInput(DeviceSourceAPI *deviceAPI) :
+ m_deviceAPI(deviceAPI),
+ m_fileSink(0),
+ m_deviceDescription("PlutoSDR"),
+ m_running(false)
+{
+ char recFileNameCStr[30];
+ sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
+ m_fileSink = new FileRecord(std::string(recFileNameCStr));
+ m_deviceAPI->addSink(m_fileSink);
+}
+
+
+PlutoSDRInput::~PlutoSDRInput()
+{
+ m_deviceAPI->removeSink(m_fileSink);
+ delete m_fileSink;
+}
+
+bool PlutoSDRInput::start()
+{
+}
+
+void PlutoSDRInput::stop()
+{
+}
+
+const QString& PlutoSDRInput::getDeviceDescription() const
+{
+ return m_deviceDescription;
+}
+int PlutoSDRInput::getSampleRate() const
+{
+ return (m_settings.m_devSampleRate / (1<startRecording();
+ } else {
+ m_fileSink->stopRecording();
+ }
+ }
+ else
+ {
+ return false;
+ }
+}
diff --git a/plugins/samplesource/plutosdrinput/plutosdrinput.h b/plugins/samplesource/plutosdrinput/plutosdrinput.h
new file mode 100644
index 000000000..49e956769
--- /dev/null
+++ b/plugins/samplesource/plutosdrinput/plutosdrinput.h
@@ -0,0 +1,74 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017 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 . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUT_H_
+#define PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUT_H_
+
+#include
+
+#include
+
+#include "plutosdrinputsettings.h"
+
+class DeviceSourceAPI;
+class FileRecord;
+
+class PlutoSDRInput : public DeviceSampleSource {
+public:
+ class MsgFileRecord : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ bool getStartStop() const { return m_startStop; }
+
+ static MsgFileRecord* create(bool startStop) {
+ return new MsgFileRecord(startStop);
+ }
+
+ protected:
+ bool m_startStop;
+
+ MsgFileRecord(bool startStop) :
+ Message(),
+ m_startStop(startStop)
+ { }
+ };
+
+
+ PlutoSDRInput(DeviceSourceAPI *deviceAPI);
+ ~PlutoSDRInput();
+
+ virtual bool start();
+ virtual void stop();
+
+ virtual const QString& getDeviceDescription() const;
+ virtual int getSampleRate() const;
+ virtual quint64 getCenterFrequency() const;
+
+ virtual bool handleMessage(const Message& message);
+
+ private:
+ DeviceSourceAPI *m_deviceAPI;
+ FileRecord *m_fileSink;
+ QString m_deviceDescription;
+ PlutoSDRInputSettings m_settings;
+ bool m_running;
+
+ QMutex m_mutex;
+};
+
+
+#endif /* PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUT_H_ */
diff --git a/plugins/samplesource/plutosdrinput/plutosdrinputsettings.cpp b/plugins/samplesource/plutosdrinput/plutosdrinputsettings.cpp
index da220419c..a34ffc2e3 100644
--- a/plugins/samplesource/plutosdrinput/plutosdrinputsettings.cpp
+++ b/plugins/samplesource/plutosdrinput/plutosdrinputsettings.cpp
@@ -29,13 +29,19 @@ void PlutoSDRInputSettings::resetToDefaults()
{
m_centerFrequency = 435000 * 1000;
m_fcPos = FC_POS_CENTER;
+ m_LOppmTenths = 0;
+ m_log2Decim = 0;
+ m_devSampleRate = 1536 * 1000;
}
QByteArray PlutoSDRInputSettings::serialize() const
{
SimpleSerializer s(1);
+ s.writeS32(1, m_LOppmTenths);
+ s.writeU32(4, m_log2Decim);
s.writeS32(5, m_fcPos);
+ s.writeU64(12, m_devSampleRate);
return s.final();
}
@@ -54,8 +60,11 @@ bool PlutoSDRInputSettings::deserialize(const QByteArray& data)
{
int intval;
+ d.readS32(1, &m_LOppmTenths, 0);
+ d.readU32(4, &m_log2Decim, 0);
d.readS32(5, &intval, 0);
m_fcPos = (fcPos_t) intval;
+ d.readU64(12, &m_devSampleRate, 1536000U);
return true;
}
diff --git a/plugins/samplesource/plutosdrinput/plutosdrinputsettings.h b/plugins/samplesource/plutosdrinput/plutosdrinputsettings.h
index 407ba9066..c5adf9b8c 100644
--- a/plugins/samplesource/plutosdrinput/plutosdrinputsettings.h
+++ b/plugins/samplesource/plutosdrinput/plutosdrinputsettings.h
@@ -28,6 +28,9 @@ struct PlutoSDRInputSettings {
quint64 m_centerFrequency;
fcPos_t m_fcPos;
+ qint32 m_LOppmTenths;
+ quint32 m_log2Decim;
+ quint64 m_devSampleRate;
PlutoSDRInputSettings();
void resetToDefaults();