diff --git a/sdrbase/CMakeLists.txt b/sdrbase/CMakeLists.txt
index f61f87a54..f0e1b5250 100644
--- a/sdrbase/CMakeLists.txt
+++ b/sdrbase/CMakeLists.txt
@@ -131,6 +131,8 @@ set(sdrbase_SOURCES
device/deviceuserargs.cpp
device/deviceutils.cpp
+ limerfe/limerfeusbcalib.cpp
+
settings/preferences.cpp
settings/preset.cpp
settings/mainsettings.cpp
@@ -270,6 +272,8 @@ set(sdrbase_HEADERS
device/deviceuserargs.h
device/deviceutils.h
+ limerfe/limerfeusbcalib.h
+
plugin/plugininstancegui.h
plugin/plugininterface.h
plugin/pluginapi.h
diff --git a/sdrbase/limerfe/limerfeusbcalib.cpp b/sdrbase/limerfe/limerfeusbcalib.cpp
new file mode 100644
index 000000000..1502fe246
--- /dev/null
+++ b/sdrbase/limerfe/limerfeusbcalib.cpp
@@ -0,0 +1,71 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2020 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 //
+// (at your option) any later version. //
+// //
+// 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
+#include
+#include
+
+#include "util/simpleserializer.h"
+
+#include "limerfeusbcalib.h"
+
+QByteArray LimeRFEUSBCalib::serialize() const
+{
+ SimpleSerializer s(1);
+ QByteArray data;
+
+ serializeCalibMap(data);
+ s.writeBlob(1, data);
+
+ return s.final();
+}
+
+bool LimeRFEUSBCalib::deserialize(const QByteArray& data)
+{
+ SimpleDeserializer d(data);
+
+ if (!d.isValid()) {
+ return false;
+ }
+
+ if (d.getVersion() == 1)
+ {
+ QByteArray data;
+
+ d.readBlob(1, &data);
+ deserializeCalibMap(data);
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void LimeRFEUSBCalib::serializeCalibMap(QByteArray& data) const
+{
+ QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
+ *stream << m_calibrations;
+ delete stream;
+}
+
+void LimeRFEUSBCalib::deserializeCalibMap(QByteArray& data)
+{
+ QDataStream readStream(&data, QIODevice::ReadOnly);
+ readStream >> m_calibrations;
+}
diff --git a/sdrbase/limerfe/limerfeusbcalib.h b/sdrbase/limerfe/limerfeusbcalib.h
new file mode 100644
index 000000000..dc1e41a78
--- /dev/null
+++ b/sdrbase/limerfe/limerfeusbcalib.h
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2020 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 //
+// (at your option) any later version. //
+// //
+// 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 SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
+#define SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
+
+#include
+#include "export.h"
+
+class QByteArray;
+
+class SDRBASE_API LimeRFEUSBCalib
+{
+public:
+ QByteArray serialize() const;
+ bool deserialize(const QByteArray& data);
+
+ enum ChannelRange
+ {
+ WidebandLow, //!< 1 - 1000 MHz
+ WidebandHigh, //!< 1000 - 4000 MHz
+ HAM_30MHz, //!< Up to 30 MHz
+ HAM_50_70MHz,
+ HAM_144_146MHz,
+ HAM_220_225MHz,
+ HAM_430_440MHz,
+ HAM_902_928MHz,
+ HAM_1240_1325MHz,
+ HAM_2300_2450MHz,
+ HAM_3300_3500MHz,
+ CellularBand1,
+ CellularBand2,
+ CellularBand7,
+ CellularBand38
+ };
+
+ QMap m_calibrations; //!< Channel range to calibration value in centi-Bels
+
+private:
+ void serializeCalibMap(QByteArray& data) const;
+ void deserializeCalibMap(QByteArray& data);
+};
+
+#endif // SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
diff --git a/sdrbase/settings/mainsettings.cpp b/sdrbase/settings/mainsettings.cpp
index aa14c0700..5b23d1b66 100644
--- a/sdrbase/settings/mainsettings.cpp
+++ b/sdrbase/settings/mainsettings.cpp
@@ -93,6 +93,7 @@ void MainSettings::load()
}
m_hardwareDeviceUserArgs.deserialize(qUncompress(QByteArray::fromBase64(s.value("hwDeviceUserArgs").toByteArray())));
+ m_limeRFEUSBCalib.deserialize(qUncompress(QByteArray::fromBase64(s.value("limeRFEUSBCalib").toByteArray())));
}
void MainSettings::save() const
@@ -137,6 +138,7 @@ void MainSettings::save() const
}
s.setValue("hwDeviceUserArgs", qCompress(m_hardwareDeviceUserArgs.serialize()).toBase64());
+ s.setValue("limeRFEUSBCalib", qCompress(m_limeRFEUSBCalib.serialize()).toBase64());
}
void MainSettings::initialize()
diff --git a/sdrbase/settings/mainsettings.h b/sdrbase/settings/mainsettings.h
index 6d3bf251b..3ebfac9be 100644
--- a/sdrbase/settings/mainsettings.h
+++ b/sdrbase/settings/mainsettings.h
@@ -3,6 +3,7 @@
#include
#include "device/deviceuserargs.h"
+#include "limerfe/limerfeusbcalib.h"
#include "preferences.h"
#include "preset.h"
#include "export.h"
@@ -69,6 +70,7 @@ public:
bool getUseLogFile() const { return m_preferences.getUseLogFile(); }
const QString& getLogFileName() const { return m_preferences.getLogFileName(); }
DeviceUserArgs& getDeviceUserArgs() { return m_hardwareDeviceUserArgs; }
+ LimeRFEUSBCalib& getLimeRFEUSBCalib() { return m_limeRFEUSBCalib; }
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
@@ -83,6 +85,7 @@ protected:
typedef QList Commands;
Commands m_commands;
DeviceUserArgs m_hardwareDeviceUserArgs;
+ LimeRFEUSBCalib m_limeRFEUSBCalib;
AMBEEngine *m_ambeEngine;
};