mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
Sink plugins: put a serializer and deserializer in the core plugin for server
This commit is contained in:
parent
fa1e772383
commit
0dd36d4f3e
@ -194,6 +194,33 @@ void BladerfOutput::stop()
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
QByteArray BladerfOutput::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool BladerfOutput::deserialize(const QByteArray& data)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!m_settings.deserialize(data))
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureBladerf* message = MsgConfigureBladerf::create(m_settings, true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureBladerf* messageToGUI = MsgConfigureBladerf::create(m_settings, true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
const QString& BladerfOutput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
@ -210,6 +237,21 @@ quint64 BladerfOutput::getCenterFrequency() const
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void BladerfOutput::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
BladeRFOutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureBladerf* message = MsgConfigureBladerf::create(settings, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureBladerf* messageToGUI = MsgConfigureBladerf::create(settings, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
bool BladerfOutput::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureBladerf::match(message))
|
||||
|
@ -98,10 +98,14 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
|
@ -127,7 +127,16 @@ bool BladerfOutputGui::deserialize(const QByteArray& data)
|
||||
|
||||
bool BladerfOutputGui::handleMessage(const Message& message)
|
||||
{
|
||||
if (BladerfOutput::MsgReportBladerf::match(message))
|
||||
if (BladerfOutput::MsgConfigureBladerf::match(message))
|
||||
{
|
||||
const BladerfOutput::MsgConfigureBladerf& cfg = (BladerfOutput::MsgConfigureBladerf&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else if (BladerfOutput::MsgReportBladerf::match(message))
|
||||
{
|
||||
displaySettings();
|
||||
return true;
|
||||
|
@ -131,7 +131,16 @@ bool FileSinkGui::deserialize(const QByteArray& data)
|
||||
|
||||
bool FileSinkGui::handleMessage(const Message& message)
|
||||
{
|
||||
if (FileSinkOutput::MsgReportFileSinkGeneration::match(message))
|
||||
if (FileSinkOutput::MsgConfigureFileSink::match(message))
|
||||
{
|
||||
const FileSinkOutput::MsgConfigureFileSink& cfg = (FileSinkOutput::MsgConfigureFileSink&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else if (FileSinkOutput::MsgReportFileSinkGeneration::match(message))
|
||||
{
|
||||
m_generation = ((FileSinkOutput::MsgReportFileSinkGeneration&)message).getAcquisition();
|
||||
updateWithGeneration();
|
||||
|
@ -139,6 +139,33 @@ void FileSinkOutput::stop()
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray FileSinkOutput::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool FileSinkOutput::deserialize(const QByteArray& data)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!m_settings.deserialize(data))
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureFileSink* message = MsgConfigureFileSink::create(m_settings, true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureFileSink* messageToGUI = MsgConfigureFileSink::create(m_settings, true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
const QString& FileSinkOutput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
@ -154,6 +181,21 @@ quint64 FileSinkOutput::getCenterFrequency() const
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void FileSinkOutput::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
FileSinkSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureFileSink* message = MsgConfigureFileSink::create(settings, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureFileSink* messageToGUI = MsgConfigureFileSink::create(settings, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
std::time_t FileSinkOutput::getStartingTimeStamp() const
|
||||
{
|
||||
return m_startingTimeStamp;
|
||||
|
@ -178,10 +178,14 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
std::time_t getStartingTimeStamp() const;
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
@ -169,6 +169,33 @@ void HackRFOutput::stop()
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
QByteArray HackRFOutput::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool HackRFOutput::deserialize(const QByteArray& data)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!m_settings.deserialize(data))
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureHackRF* message = MsgConfigureHackRF::create(m_settings, true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(m_settings, true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
const QString& HackRFOutput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
@ -185,6 +212,21 @@ quint64 HackRFOutput::getCenterFrequency() const
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void HackRFOutput::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
HackRFOutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureHackRF* message = MsgConfigureHackRF::create(settings, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(settings, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
bool HackRFOutput::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureHackRF::match(message))
|
||||
|
@ -98,10 +98,14 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
|
@ -131,7 +131,16 @@ void HackRFOutputGui::blockApplySettings(bool block)
|
||||
|
||||
bool HackRFOutputGui::handleMessage(const Message& message)
|
||||
{
|
||||
if (HackRFOutput::MsgReportHackRF::match(message))
|
||||
if (HackRFOutput::MsgConfigureHackRF::match(message))
|
||||
{
|
||||
const HackRFOutput::MsgConfigureHackRF& cfg = (HackRFOutput::MsgConfigureHackRF&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else if (HackRFOutput::MsgReportHackRF::match(message))
|
||||
{
|
||||
displaySettings();
|
||||
return true;
|
||||
|
@ -407,6 +407,33 @@ void LimeSDROutput::stop()
|
||||
releaseChannel();
|
||||
}
|
||||
|
||||
QByteArray LimeSDROutput::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool LimeSDROutput::deserialize(const QByteArray& data)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!m_settings.deserialize(data))
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureLimeSDR* message = MsgConfigureLimeSDR::create(m_settings, true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureLimeSDR* messageToGUI = MsgConfigureLimeSDR::create(m_settings, true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
const QString& LimeSDROutput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
@ -423,6 +450,21 @@ quint64 LimeSDROutput::getCenterFrequency() const
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void LimeSDROutput::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
LimeSDROutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureLimeSDR* message = MsgConfigureLimeSDR::create(settings, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureLimeSDR* messageToGUI = MsgConfigureLimeSDR::create(settings, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t LimeSDROutput::getChannelIndex()
|
||||
{
|
||||
return m_deviceShared.m_channel;
|
||||
|
@ -192,10 +192,14 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
|
@ -142,7 +142,16 @@ bool LimeSDROutputGUI::deserialize(const QByteArray& data)
|
||||
|
||||
bool LimeSDROutputGUI::handleMessage(const Message& message)
|
||||
{
|
||||
if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
|
||||
if (LimeSDROutput::MsgConfigureLimeSDR::match(message))
|
||||
{
|
||||
const LimeSDROutput::MsgConfigureLimeSDR& cfg = (LimeSDROutput::MsgConfigureLimeSDR&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
|
||||
m_settings.m_devSampleRate = report.getDevSampleRate();
|
||||
|
@ -109,6 +109,33 @@ void PlutoSDROutput::stop()
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
QByteArray PlutoSDROutput::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool PlutoSDROutput::deserialize(const QByteArray& data)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!m_settings.deserialize(data))
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigurePlutoSDR* message = MsgConfigurePlutoSDR::create(m_settings, true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigurePlutoSDR* messageToGUI = MsgConfigurePlutoSDR::create(m_settings, true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
const QString& PlutoSDROutput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
@ -123,6 +150,20 @@ quint64 PlutoSDROutput::getCenterFrequency() const
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void PlutoSDROutput::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
PlutoSDROutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigurePlutoSDR* message = MsgConfigurePlutoSDR::create(settings, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigurePlutoSDR* messageToGUI = MsgConfigurePlutoSDR::create(settings, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
bool PlutoSDROutput::handleMessage(const Message& message)
|
||||
{
|
||||
|
@ -80,10 +80,14 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
|
@ -131,7 +131,16 @@ bool PlutoSDROutputGUI::deserialize(const QByteArray& data)
|
||||
|
||||
bool PlutoSDROutputGUI::handleMessage(const Message& message __attribute__((unused)))
|
||||
{
|
||||
if (DevicePlutoSDRShared::MsgCrossReportToBuddy::match(message)) // message from buddy
|
||||
if (PlutoSDROutput::MsgConfigurePlutoSDR::match(message))
|
||||
{
|
||||
const PlutoSDROutput::MsgConfigurePlutoSDR& cfg = (PlutoSDROutput::MsgConfigurePlutoSDR&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else if (DevicePlutoSDRShared::MsgCrossReportToBuddy::match(message)) // message from buddy
|
||||
{
|
||||
DevicePlutoSDRShared::MsgCrossReportToBuddy& conf = (DevicePlutoSDRShared::MsgCrossReportToBuddy&) message;
|
||||
m_settings.m_devSampleRate = conf.getDevSampleRate();
|
||||
|
@ -171,7 +171,16 @@ bool SDRdaemonSinkGui::deserialize(const QByteArray& data)
|
||||
|
||||
bool SDRdaemonSinkGui::handleMessage(const Message& message)
|
||||
{
|
||||
if (SDRdaemonSinkOutput::MsgReportSDRdaemonSinkStreamTiming::match(message))
|
||||
if (SDRdaemonSinkOutput::MsgConfigureSDRdaemonSink::match(message))
|
||||
{
|
||||
const SDRdaemonSinkOutput::MsgConfigureSDRdaemonSink& cfg = (SDRdaemonSinkOutput::MsgConfigureSDRdaemonSink&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else if (SDRdaemonSinkOutput::MsgReportSDRdaemonSinkStreamTiming::match(message))
|
||||
{
|
||||
m_samplesCount = ((SDRdaemonSinkOutput::MsgReportSDRdaemonSinkStreamTiming&)message).getSamplesCount();
|
||||
updateWithStreamTime();
|
||||
|
@ -105,6 +105,33 @@ void SDRdaemonSinkOutput::stop()
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray SDRdaemonSinkOutput::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool SDRdaemonSinkOutput::deserialize(const QByteArray& data)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!m_settings.deserialize(data))
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureSDRdaemonSink* message = MsgConfigureSDRdaemonSink::create(m_settings, true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureSDRdaemonSink* messageToGUI = MsgConfigureSDRdaemonSink::create(m_settings, true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
const QString& SDRdaemonSinkOutput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
@ -120,6 +147,21 @@ quint64 SDRdaemonSinkOutput::getCenterFrequency() const
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void SDRdaemonSinkOutput::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
SDRdaemonSinkSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureSDRdaemonSink* message = MsgConfigureSDRdaemonSink::create(settings, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureSDRdaemonSink* messageToGUI = MsgConfigureSDRdaemonSink::create(settings, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
std::time_t SDRdaemonSinkOutput::getStartingTimeStamp() const
|
||||
{
|
||||
return m_startingTimeStamp;
|
||||
|
@ -159,10 +159,14 @@ public:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
std::time_t getStartingTimeStamp() const;
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
@ -256,18 +256,32 @@ void DeviceSinkAPI::loadSinkSettings(const Preset* preset)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::loadSinkSettings: Loading preset [%s | %s]", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
|
||||
if(m_sampleSinkPluginInstanceUI != 0)
|
||||
const QByteArray* sinkConfig = preset->findBestDeviceConfig(m_sampleSinkId, m_sampleSinkSerial, m_sampleSinkSequence);
|
||||
qint64 centerFrequency = preset->getCenterFrequency();
|
||||
qDebug("DeviceSinkAPI::loadSinkSettings: center frequency: %llu Hz", centerFrequency);
|
||||
|
||||
if (sinkConfig != 0)
|
||||
{
|
||||
const QByteArray* sourceConfig = preset->findBestDeviceConfig(m_sampleSinkId, m_sampleSinkSerial, m_sampleSinkSequence);
|
||||
qDebug("DeviceSinkAPI::loadSinkSettings: deserializing sink %s[%d]: %s", qPrintable(m_sampleSinkId), m_sampleSinkSequence, qPrintable(m_sampleSinkSerial));
|
||||
|
||||
if (sourceConfig != 0)
|
||||
if (m_sampleSinkPluginInstanceUI != 0) // GUI flavor
|
||||
{
|
||||
qDebug("DeviceSinkAPI::loadSinkSettings: deserializing sink: %s", qPrintable(m_sampleSinkId));
|
||||
m_sampleSinkPluginInstanceUI->deserialize(*sourceConfig);
|
||||
m_sampleSinkPluginInstanceUI->deserialize(*sinkConfig);
|
||||
m_sampleSinkPluginInstanceUI->setCenterFrequency(centerFrequency);
|
||||
}
|
||||
|
||||
qint64 centerFrequency = preset->getCenterFrequency();
|
||||
m_sampleSinkPluginInstanceUI->setCenterFrequency(centerFrequency);
|
||||
else if (m_deviceSinkEngine->getSink() != 0) // Server flavor
|
||||
{
|
||||
m_deviceSinkEngine->getSink()->deserialize(*sinkConfig);
|
||||
m_deviceSinkEngine->getSink()->setCenterFrequency(centerFrequency);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("DeviceSinkAPI::loadSinkSettings: no sink");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("DeviceSinkAPI::loadSinkSettings: sink %s[%d]: %s not found", qPrintable(m_sampleSinkId), m_sampleSinkSequence, qPrintable(m_sampleSinkSerial));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -280,11 +294,17 @@ void DeviceSinkAPI::saveSinkSettings(Preset* preset)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_sampleSinkPluginInstanceUI != NULL)
|
||||
qDebug("DeviceSinkAPI::saveSourceSettings: %s", qPrintable(m_sampleSinkPluginInstanceUI->getName()));
|
||||
|
||||
if (m_sampleSinkPluginInstanceUI != 0) // GUI flavor
|
||||
{
|
||||
qDebug("DeviceSinkAPI::saveSourceSettings: %s saved", qPrintable(m_sampleSinkPluginInstanceUI->getName()));
|
||||
preset->addOrUpdateDeviceConfig(m_sampleSinkId, m_sampleSinkSerial, m_sampleSinkSequence, m_sampleSinkPluginInstanceUI->serialize());
|
||||
preset->setCenterFrequency(m_sampleSinkPluginInstanceUI->getCenterFrequency());
|
||||
preset->addOrUpdateDeviceConfig(m_sampleSinkId, m_sampleSinkSerial, m_sampleSinkSequence, m_deviceSinkEngine->getSink()->serialize());
|
||||
preset->setCenterFrequency(m_deviceSinkEngine->getSink()->getCenterFrequency());
|
||||
}
|
||||
else if (m_deviceSinkEngine->getSink() != 0) // Server flavor
|
||||
{
|
||||
preset->addOrUpdateDeviceConfig(m_sampleSinkId, m_sampleSinkSerial, m_sampleSinkSequence, m_deviceSinkEngine->getSink()->serialize());
|
||||
preset->setCenterFrequency(m_deviceSinkEngine->getSink()->getCenterFrequency());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -245,26 +245,30 @@ void DeviceSourceAPI::loadSourceSettings(const Preset* preset)
|
||||
|
||||
const QByteArray* sourceConfig = preset->findBestDeviceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence);
|
||||
qint64 centerFrequency = preset->getCenterFrequency();
|
||||
qDebug("DeviceSourceAPI::loadSettings: center frequency: %llu Hz", centerFrequency);
|
||||
qDebug("DeviceSourceAPI::loadSourceSettings: center frequency: %llu Hz", centerFrequency);
|
||||
|
||||
if (sourceConfig != 0)
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadSettings: deserializing source %s[%d]: %s", qPrintable(m_sampleSourceId), m_sampleSourceSequence, qPrintable(m_sampleSourceSerial));
|
||||
qDebug("DeviceSourceAPI::loadSourceSettings: deserializing source %s[%d]: %s", qPrintable(m_sampleSourceId), m_sampleSourceSequence, qPrintable(m_sampleSourceSerial));
|
||||
|
||||
if (m_sampleSourcePluginInstanceUI != 0)
|
||||
if (m_sampleSourcePluginInstanceUI != 0) // GUI flavor
|
||||
{
|
||||
m_sampleSourcePluginInstanceUI->deserialize(*sourceConfig);
|
||||
m_sampleSourcePluginInstanceUI->setCenterFrequency(centerFrequency);
|
||||
}
|
||||
else
|
||||
else if (m_deviceSourceEngine->getSource() != 0) // Server flavor
|
||||
{
|
||||
m_deviceSourceEngine->getSource()->deserialize(*sourceConfig);
|
||||
m_deviceSourceEngine->getSource()->setCenterFrequency(centerFrequency);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadSourceSettings: no source");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadSettings: source %s[%d]: %s not found", qPrintable(m_sampleSourceId), m_sampleSourceSequence, qPrintable(m_sampleSourceSerial));
|
||||
qDebug("DeviceSourceAPI::loadSourceSettings: source %s[%d]: %s not found", qPrintable(m_sampleSourceId), m_sampleSourceSequence, qPrintable(m_sampleSourceSerial));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -277,18 +281,22 @@ void DeviceSourceAPI::saveSourceSettings(Preset* preset)
|
||||
{
|
||||
if (preset->isSourcePreset())
|
||||
{
|
||||
qDebug("DeviceSourceAPI::saveSourceSettings: %s saved", qPrintable(m_sampleSourcePluginInstanceUI->getName()));
|
||||
qDebug("DeviceSourceAPI::saveSourceSettings: %s", qPrintable(m_sampleSourcePluginInstanceUI->getName()));
|
||||
|
||||
if (m_sampleSourcePluginInstanceUI != 0)
|
||||
{
|
||||
preset->addOrUpdateDeviceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence, m_sampleSourcePluginInstanceUI->serialize());
|
||||
preset->setCenterFrequency(m_sampleSourcePluginInstanceUI->getCenterFrequency());
|
||||
}
|
||||
else
|
||||
else if (m_deviceSourceEngine->getSource() != 0)
|
||||
{
|
||||
preset->addOrUpdateDeviceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence, m_deviceSourceEngine->getSource()->serialize());
|
||||
preset->setCenterFrequency(m_deviceSourceEngine->getSource()->getCenterFrequency());
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("DeviceSourceAPI::saveSourceSettings: no source");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -42,9 +42,13 @@ public:
|
||||
virtual bool start() = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
virtual QByteArray serialize() const = 0;
|
||||
virtual bool deserialize(const QByteArray& data) = 0;
|
||||
|
||||
virtual const QString& getDeviceDescription() const = 0;
|
||||
virtual int getSampleRate() const = 0; //!< Sample rate exposed by the sink
|
||||
virtual quint64 getCenterFrequency() const = 0; //!< Center frequency exposed by the sink
|
||||
virtual void setCenterFrequency(qint64 centerFrequency) = 0;
|
||||
|
||||
virtual bool handleMessage(const Message& message) = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user