1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-03 14:34:57 -04:00

Device source plugins: implemented an init method for initializations to be done when all collaborating objects are created and possibly connected

This commit is contained in:
f4exb
2017-12-25 09:10:19 +01:00
parent c732fe3862
commit 49d1439981
30 changed files with 112 additions and 69 deletions
@@ -77,6 +77,12 @@ void SDRdaemonSourceInput::destroy()
delete this;
}
void SDRdaemonSourceInput::init()
{
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate/(1<<m_settings.m_log2Decim), m_settings.m_centerFrequency);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
bool SDRdaemonSourceInput::start()
{
qDebug() << "SDRdaemonInput::start";
@@ -326,6 +326,7 @@ public:
virtual ~SDRdaemonSourceInput();
virtual void destroy();
virtual void init();
virtual bool start();
virtual void stop();
@@ -26,7 +26,7 @@ void SDRdaemonSourceSettings::resetToDefaults()
{
m_centerFrequency = 435000*1000;
m_sampleRate = 256000;
m_log2Decim = 4;
m_log2Decim = 1;
m_txDelay = 0.5;
m_nbFECBlocks = 0;
m_address = "127.0.0.1";
@@ -34,6 +34,7 @@ SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo,
m_remoteAddress(QHostAddress::LocalHost),
m_dataPort(9090),
m_dataConnected(false),
m_startInit(true),
m_udpBuf(0),
m_udpReadBytes(0),
m_sampleFifo(sampleFifo),
@@ -92,8 +93,8 @@ void SDRdaemonSourceUDPHandler::start()
}
}
// Need to notify the DSP engine to actually start
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine
// Need to notify the DSP engine to actually start FIXME: may cause transient confusion because at this point sample rate and frequency are unknown
DSPSignalNotification *notif = new DSPSignalNotification(128000, 435000 * 1000); // Frequency in Hz for the DSP engine
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
m_elapsedTimer.start();
}
@@ -113,6 +114,8 @@ void SDRdaemonSourceUDPHandler::stop()
delete m_dataSocket;
m_dataSocket = 0;
}
m_startInit = true;
}
void SDRdaemonSourceUDPHandler::configureUDPLink(const QString& address, quint16 port)
@@ -170,17 +173,23 @@ void SDRdaemonSourceUDPHandler::processData()
change = true;
}
if (change)
if (change || m_startInit)
{
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData::create(
m_samplerate,
m_centerFrequency * 1000, // Frequency in Hz for the GUI
m_tv_sec,
m_tv_usec);
qDebug("SDRdaemonSourceUDPHandler::processData: m_samplerate: %u m_centerFrequency: %u kHz", m_samplerate, m_centerFrequency);
m_outputMessageQueueToGUI->push(report);
if (m_samplerate != 0)
{
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData::create(
m_samplerate,
m_centerFrequency * 1000, // Frequency in Hz for the GUI
m_tv_sec,
m_tv_usec);
m_outputMessageQueueToGUI->push(report);
m_startInit = false;
}
}
}
@@ -56,6 +56,7 @@ private:
QHostAddress m_remoteAddress;
quint16 m_dataPort;
bool m_dataConnected;
bool m_startInit;
char *m_udpBuf;
qint64 m_udpReadBytes;
SampleSinkFifo *m_sampleFifo;