1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Presets by source: set center frequency from preset center frequency

This commit is contained in:
f4exb 2015-09-29 03:35:14 +02:00
parent e7a4d16d14
commit 921b511f96
34 changed files with 135 additions and 33 deletions

View File

@ -20,7 +20,8 @@ public:
virtual QByteArray serializeGeneral() const;
virtual bool deserializeGeneral(const QByteArray& data);
virtual qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const = 0;
virtual void setCenterFrequency(qint64 centerFrequency) = 0;
virtual QByteArray serialize() const = 0;
virtual bool deserialize(const QByteArray& data) = 0;

View File

@ -42,6 +42,12 @@ qint64 AMDemodGUI::getCenterFrequency() const {
return m_channelMarker.getCenterFrequency();
}
void AMDemodGUI::setCenterFrequency(qint64 centerFrequency)
{
m_channelMarker.setCenterFrequency(centerFrequency);
applySettings();
}
void AMDemodGUI::resetToDefaults()
{
blockApplySettings(true);

View File

@ -24,7 +24,8 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void resetToDefaults();
QByteArray serialize() const;

View File

@ -43,6 +43,12 @@ qint64 ChannelAnalyzerGUI::getCenterFrequency() const
return m_channelMarker.getCenterFrequency();
}
void ChannelAnalyzerGUI::setCenterFrequency(qint64 centerFrequency)
{
m_channelMarker.setCenterFrequency(centerFrequency);
applySettings();
}
void ChannelAnalyzerGUI::resetToDefaults()
{
blockApplySettings(true);

View File

@ -27,7 +27,8 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void resetToDefaults();
QByteArray serialize() const;

View File

@ -39,6 +39,12 @@ qint64 LoRaDemodGUI::getCenterFrequency() const {
return m_channelMarker.getCenterFrequency();
}
void LoRaDemodGUI::setCenterFrequency(qint64 centerFrequency)
{
m_channelMarker.setCenterFrequency(centerFrequency);
applySettings();
}
void LoRaDemodGUI::resetToDefaults()
{
blockApplySettings(true);

View File

@ -26,7 +26,8 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void resetToDefaults();
QByteArray serialize() const;

View File

@ -43,6 +43,12 @@ qint64 NFMDemodGUI::getCenterFrequency() const
return m_channelMarker.getCenterFrequency();
}
void NFMDemodGUI::setCenterFrequency(qint64 centerFrequency)
{
m_channelMarker.setCenterFrequency(centerFrequency);
applySettings();
}
void NFMDemodGUI::resetToDefaults()
{
blockApplySettings(true);

View File

@ -25,7 +25,8 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void resetToDefaults();
QByteArray serialize() const;

View File

@ -41,6 +41,12 @@ qint64 SSBDemodGUI::getCenterFrequency() const
return m_channelMarker.getCenterFrequency();
}
void SSBDemodGUI::setCenterFrequency(qint64 centerFrequency)
{
m_channelMarker.setCenterFrequency(centerFrequency);
applySettings();
}
void SSBDemodGUI::resetToDefaults()
{
blockApplySettings(true);

View File

@ -26,7 +26,8 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void resetToDefaults();
QByteArray serialize() const;

View File

@ -30,6 +30,12 @@ qint64 TCPSrcGUI::getCenterFrequency() const
return m_channelMarker.getCenterFrequency();
}
void TCPSrcGUI::setCenterFrequency(qint64 centerFrequency)
{
m_channelMarker.setCenterFrequency(centerFrequency);
applySettings();
}
QString TCPSrcGUI::getName() const
{
return objectName();

View File

@ -26,7 +26,8 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void resetToDefaults();
QByteArray serialize() const;

View File

@ -53,6 +53,12 @@ qint64 WFMDemodGUI::getCenterFrequency() const
return m_channelMarker.getCenterFrequency();
}
void WFMDemodGUI::setCenterFrequency(qint64 centerFrequency)
{
m_channelMarker.setCenterFrequency(centerFrequency);
applySettings();
}
void WFMDemodGUI::resetToDefaults()
{
blockApplySettings(true);

View File

@ -24,7 +24,8 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void resetToDefaults();
QByteArray serialize() const;

View File

@ -76,6 +76,13 @@ qint64 AirspyGui::getCenterFrequency() const
return m_settings.m_centerFrequency;
}
void AirspyGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray AirspyGui::serialize() const
{
return m_settings.serialize();

View File

@ -43,7 +43,8 @@ public:
QString getName() const;
void resetToDefaults();
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual bool handleMessage(const Message& message);

View File

@ -73,6 +73,13 @@ qint64 BladerfGui::getCenterFrequency() const
return m_settings.m_centerFrequency;
}
void BladerfGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray BladerfGui::serialize() const
{
return m_settings.serialize();

View File

@ -41,7 +41,8 @@ public:
QString getName() const;
void resetToDefaults();
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual bool handleMessage(const Message& message);

View File

@ -151,6 +151,13 @@ qint64 FCDProGui::getCenterFrequency() const
return m_settings.centerFrequency;
}
void FCDProGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray FCDProGui::serialize() const
{
return m_settings.serialize();

View File

@ -24,7 +24,8 @@ public:
QString getName() const;
void resetToDefaults();
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
QByteArray serialize() const;
bool deserialize(const QByteArray& data);

View File

@ -69,6 +69,13 @@ qint64 FCDProPlusGui::getCenterFrequency() const
return m_settings.centerFrequency;
}
void FCDProPlusGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray FCDProPlusGui::serialize() const
{
return m_settings.serialize();

View File

@ -24,7 +24,8 @@ public:
QString getName() const;
void resetToDefaults();
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
QByteArray serialize() const;
bool deserialize(const QByteArray& data);

View File

@ -87,6 +87,13 @@ qint64 FileSourceGui::getCenterFrequency() const
return m_centerFrequency;
}
void FileSourceGui::setCenterFrequency(qint64 centerFrequency)
{
m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray FileSourceGui::serialize() const
{
return m_settings.serialize();

View File

@ -40,7 +40,8 @@ public:
QString getName() const;
void resetToDefaults();
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual bool handleMessage(const Message& message);

View File

@ -77,6 +77,13 @@ qint64 HackRFGui::getCenterFrequency() const
return m_settings.m_centerFrequency;
}
void HackRFGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray HackRFGui::serialize() const
{
return m_settings.serialize();

View File

@ -50,7 +50,8 @@ public:
QString getName() const;
void resetToDefaults();
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual bool handleMessage(const Message& message);

View File

@ -60,7 +60,7 @@ void HackRFInput::Settings::resetToDefaults()
QByteArray HackRFInput::Settings::serialize() const
{
HackRFSerializer::AirspyData data;
HackRFSerializer::HackRFData data;
data.m_data.m_frequency = m_centerFrequency;
data.m_LOppmTenths = m_LOppmTenths;
@ -82,7 +82,7 @@ QByteArray HackRFInput::Settings::serialize() const
bool HackRFInput::Settings::deserialize(const QByteArray& serializedData)
{
HackRFSerializer::AirspyData data;
HackRFSerializer::HackRFData data;
bool valid = HackRFSerializer::readSerializedData(serializedData, data);

View File

@ -16,7 +16,7 @@
#include "hackrfserializer.h"
void HackRFSerializer::writeSerializedData(const AirspyData& data, QByteArray& serializedData)
void HackRFSerializer::writeSerializedData(const HackRFData& data, QByteArray& serializedData)
{
QByteArray sampleSourceSerialized;
SampleSourceSerializer::writeSerializedData(data.m_data, sampleSourceSerialized);
@ -37,7 +37,7 @@ void HackRFSerializer::writeSerializedData(const AirspyData& data, QByteArray& s
serializedData = s.final();
}
bool HackRFSerializer::readSerializedData(const QByteArray& serializedData, AirspyData& data)
bool HackRFSerializer::readSerializedData(const QByteArray& serializedData, HackRFData& data)
{
bool valid = SampleSourceSerializer::readSerializedData(serializedData, data.m_data);
@ -75,7 +75,7 @@ bool HackRFSerializer::readSerializedData(const QByteArray& serializedData, Airs
}
}
void HackRFSerializer::setDefaults(AirspyData& data)
void HackRFSerializer::setDefaults(HackRFData& data)
{
data.m_LOppmTenths = 0;
data.m_sampleRateIndex = 0;

View File

@ -22,7 +22,7 @@
class HackRFSerializer
{
public:
struct AirspyData
struct HackRFData
{
SampleSourceSerializer::Data m_data;
qint32 m_LOppmTenths;
@ -36,9 +36,9 @@ public:
bool m_lnaExt;
};
static void writeSerializedData(const AirspyData& data, QByteArray& serializedData);
static bool readSerializedData(const QByteArray& serializedData, AirspyData& data);
static void setDefaults(AirspyData& data);
static void writeSerializedData(const HackRFData& data, QByteArray& serializedData);
static bool readSerializedData(const QByteArray& serializedData, HackRFData& data);
static void setDefaults(HackRFData& data);
};

View File

@ -55,6 +55,13 @@ qint64 RTLSDRGui::getCenterFrequency() const
return m_settings.m_centerFrequency;
}
void RTLSDRGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray RTLSDRGui::serialize() const
{
return m_settings.serialize();

View File

@ -24,7 +24,8 @@ public:
QString getName() const;
void resetToDefaults();
qint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual bool handleMessage(const Message& message);

View File

@ -9,8 +9,3 @@ bool PluginGUI::deserializeGeneral(const QByteArray& data)
{
return false;
}
qint64 PluginGUI::getCenterFrequency() const
{
return 0;
}

View File

@ -144,15 +144,16 @@ void PluginManager::loadSettings(const Preset* preset)
if(m_sampleSourcePluginGUI != 0)
{
/* FIXME: remove in pluginGUI and preset
qDebug() << "m_sampleSourcePluginGUI->deserializeGeneral (" << m_sampleSourcePluginGUI->getName().toStdString().c_str() << ")";
m_sampleSourcePluginGUI->deserializeGeneral(preset->getSourceGeneralConfig());
*/
// TODO: have one set of source presets per identified source (preset -> find source with name)
if(m_sampleSourceName == preset->getSource())
{
qDebug() << " - deserializing source " << qPrintable(m_sampleSourceName);
m_sampleSourcePluginGUI->deserialize(preset->getSourceConfig());
}
// FIXME: get center frequency from preset center frequency
qint64 centerFrequency = preset->getCenterFrequency();
m_sampleSourcePluginGUI->setCenterFrequency(centerFrequency);
}
}