mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -05:00
LimeSDR: pass center frequency change to buddies of same type
This commit is contained in:
parent
cd5f0c361a
commit
8b93c5f48d
@ -16,7 +16,7 @@
|
||||
|
||||
#include "devicelimesdrshared.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportSampleRateDirChange, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportBuddyChange, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportDeviceInfo, Message)
|
||||
|
||||
const float DeviceLimeSDRShared::m_sampleFifoLengthInSeconds = 0.25;
|
||||
|
@ -27,28 +27,43 @@
|
||||
class DeviceLimeSDRShared
|
||||
{
|
||||
public:
|
||||
class MsgReportSampleRateDirChange : public Message {
|
||||
class MsgReportBuddyChange : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
int getDevSampleRate() const { return m_devSampleRate; }
|
||||
int getLog2HardDecimInterp() const { return m_log2HardDecimInterp; }
|
||||
int getDevSampleRate() const { return m_devSampleRate; }
|
||||
int getLog2HardDecimInterp() const { return m_log2HardDecimInterp; }
|
||||
uint64_t getCenterFrequency() const { return m_centerFrequency; }
|
||||
bool getRxElseTx() const { return m_rxElseTx; }
|
||||
|
||||
static MsgReportSampleRateDirChange* create(int devSampleRate, int log2HardDecimInterp, bool rxElseTx)
|
||||
static MsgReportBuddyChange* create(
|
||||
int devSampleRate,
|
||||
int log2HardDecimInterp,
|
||||
uint64_t centerFrequency,
|
||||
bool rxElseTx)
|
||||
{
|
||||
return new MsgReportSampleRateDirChange(devSampleRate, log2HardDecimInterp, rxElseTx);
|
||||
return new MsgReportBuddyChange(
|
||||
devSampleRate,
|
||||
log2HardDecimInterp,
|
||||
centerFrequency,
|
||||
rxElseTx);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_devSampleRate; //!< device/host sample rate
|
||||
int m_log2HardDecimInterp; //!< log2 of hardware decimation or interpolation
|
||||
bool m_rxElseTx; //!< tells which side initiated the message
|
||||
int m_devSampleRate; //!< device/host sample rate
|
||||
int m_log2HardDecimInterp; //!< log2 of hardware decimation or interpolation
|
||||
uint64_t m_centerFrequency; //!< Center frequency
|
||||
bool m_rxElseTx; //!< tells which side initiated the message
|
||||
|
||||
MsgReportSampleRateDirChange(int devSampleRate, int log2HardDecimInterp, bool rxElseTx) :
|
||||
MsgReportBuddyChange(
|
||||
int devSampleRate,
|
||||
int log2HardDecimInterp,
|
||||
uint64_t centerFrequency,
|
||||
bool rxElseTx) :
|
||||
Message(),
|
||||
m_devSampleRate(devSampleRate),
|
||||
m_log2HardDecimInterp(log2HardDecimInterp),
|
||||
m_centerFrequency(centerFrequency),
|
||||
m_rxElseTx(rxElseTx)
|
||||
{ }
|
||||
};
|
||||
|
@ -441,9 +441,9 @@ bool LimeSDROutput::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message))
|
||||
else if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message;
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
|
||||
|
||||
if (report.getRxElseTx())
|
||||
{
|
||||
@ -452,8 +452,9 @@ bool LimeSDROutput::handleMessage(const Message& message)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.m_devSampleRate = report.getDevSampleRate();
|
||||
m_settings.m_log2HardInterp = report.getLog2HardDecimInterp();
|
||||
m_settings.m_devSampleRate = report.getDevSampleRate();
|
||||
m_settings.m_log2HardInterp = report.getLog2HardDecimInterp();
|
||||
m_settings.m_centerFrequency = report.getCenterFrequency();
|
||||
}
|
||||
|
||||
if (m_settings.m_ncoEnable) // need to reset NCO after sample rate change
|
||||
@ -468,8 +469,8 @@ bool LimeSDROutput::handleMessage(const Message& message)
|
||||
m_settings.m_centerFrequency + ncoShift);
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *reportToGUI = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *reportToGUI = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
|
||||
getMessageQueueToGUI()->push(reportToGUI);
|
||||
|
||||
return true;
|
||||
@ -888,8 +889,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
|
||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
|
||||
(*itSink)->getSampleSinkInputMessageQueue()->push(report);
|
||||
}
|
||||
|
||||
@ -899,8 +900,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
|
||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
|
||||
(*itSource)->getSampleSourceInputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
@ -921,8 +922,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
|
||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
|
||||
(*itSink)->getSampleSinkInputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
@ -141,12 +141,16 @@ bool LimeSDROutputGUI::deserialize(const QByteArray& data)
|
||||
|
||||
bool LimeSDROutputGUI::handleMessage(const Message& message)
|
||||
{
|
||||
if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message))
|
||||
if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message;
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
|
||||
m_settings.m_devSampleRate = report.getDevSampleRate();
|
||||
m_settings.m_log2HardInterp = report.getLog2HardDecimInterp();
|
||||
|
||||
if (!report.getRxElseTx()) {
|
||||
m_settings.m_centerFrequency = report.getCenterFrequency();
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
@ -426,14 +426,15 @@ bool LimeSDRInput::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message))
|
||||
else if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message;
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
|
||||
|
||||
if (report.getRxElseTx())
|
||||
{
|
||||
m_settings.m_devSampleRate = report.getDevSampleRate();
|
||||
m_settings.m_log2HardDecim = report.getLog2HardDecimInterp();
|
||||
m_settings.m_devSampleRate = report.getDevSampleRate();
|
||||
m_settings.m_log2HardDecim = report.getLog2HardDecimInterp();
|
||||
m_settings.m_centerFrequency = report.getCenterFrequency();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -453,8 +454,8 @@ bool LimeSDRInput::handleMessage(const Message& message)
|
||||
m_settings.m_centerFrequency + ncoShift);
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *reportToGUI = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *reportToGUI = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
|
||||
getMessageQueueToGUI()->push(reportToGUI);
|
||||
|
||||
return true;
|
||||
@ -1047,8 +1048,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
|
||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
|
||||
(*itSource)->getSampleSourceInputMessageQueue()->push(report);
|
||||
}
|
||||
|
||||
@ -1058,8 +1059,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
|
||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
|
||||
(*itSink)->getSampleSinkInputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
@ -1080,8 +1081,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
|
||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true);
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
|
||||
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
|
||||
(*itSource)->getSampleSourceInputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
@ -139,12 +139,16 @@ bool LimeSDRInputGUI::deserialize(const QByteArray& data)
|
||||
|
||||
bool LimeSDRInputGUI::handleMessage(const Message& message)
|
||||
{
|
||||
if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message))
|
||||
if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message;
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
|
||||
m_settings.m_devSampleRate = report.getDevSampleRate();
|
||||
m_settings.m_log2HardDecim = report.getLog2HardDecimInterp();
|
||||
|
||||
if (report.getRxElseTx()) {
|
||||
m_settings.m_centerFrequency = report.getCenterFrequency();
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
Loading…
Reference in New Issue
Block a user