1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

File sample source plugin now functional

This commit is contained in:
f4exb 2015-08-06 01:43:35 +02:00
parent 047e9f3e24
commit 110956ba9c
5 changed files with 45 additions and 5 deletions

View File

@ -127,8 +127,8 @@ Done since the fork
- Spectrum histogram clear
- Trigger line display for all trigger modes
- Coarse and fine trigger level sliders
- Minimalist recording
- Minimalist file source (recording reader) compilable but untested
- Minimalist recording (no file choice)
- File sample source plugin (recording reader)
=====
To Do

View File

@ -38,13 +38,15 @@ FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, QWidget* parent) :
m_sampleRate(0),
m_centerFrequency(0),
m_startingTimeStamp(0),
m_samplesCount(0)
m_samplesCount(0),
m_tickCount(0)
{
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 0, pow(10,7));
ui->fileNameText->setText(m_fileName);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&(m_pluginAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
displaySettings();
m_sampleSource = new FileSourceInput(m_pluginAPI->getMainWindowMessageQueue(), m_pluginAPI->getMainWindow()->getMasterTimer());
@ -133,15 +135,17 @@ bool FileSourceGui::handleMessage(Message* message)
m_sampleRate = ((FileSourceInput::MsgReportFileSourceStreamData*)message)->getSampleRate();
m_centerFrequency = ((FileSourceInput::MsgReportFileSourceStreamData*)message)->getCenterFrequency();
m_startingTimeStamp = ((FileSourceInput::MsgReportFileSourceStreamData*)message)->getStartingTimeStamp();
updateWithStreamData();
message->completed();
updateWithStreamData();
return true;
}
else if(FileSourceInput::MsgReportFileSourceStreamTiming::match(message))
{
m_samplesCount = ((FileSourceInput::MsgReportFileSourceStreamTiming*)message)->getSamplesCount();
std::cerr << "FileSourceGui::handleMessage: MsgReportFileSourceStreamTiming: " << m_samplesCount << std::endl;
//std::cerr << "FileSourceGui::handleMessage: MsgReportFileSourceStreamTiming: " << m_samplesCount << std::endl;
message->completed();
updateWithStreamTime();
return true;
}
else
{
@ -234,3 +238,11 @@ void FileSourceGui::updateWithStreamTime()
QString s_date = dt.toString("yyyyMMdd hh.mm.ss.zzz");
ui->absTimeText->setText(s_date);
}
void FileSourceGui::tick()
{
if ((++m_tickCount & 0xf) == 0) {
FileSourceInput::MsgConfigureFileSourceStreamTiming* message = FileSourceInput::MsgConfigureFileSourceStreamTiming::create();
message->submit(m_pluginAPI->getDSPEngineMessageQueue());
}
}

View File

@ -62,6 +62,7 @@ private:
quint64 m_centerFrequency;
std::time_t m_startingTimeStamp;
int m_samplesCount;
std::size_t m_tickCount;
void displaySettings();
void displayTime();
@ -76,6 +77,7 @@ private slots:
void on_playLoop_toggled(bool checked);
void on_play_toggled(bool checked);
void on_showFileDialog_clicked(bool checked);
void tick();
};
#endif // INCLUDE_FILESOURCEGUI_H

View File

@ -29,6 +29,7 @@
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgConfigureFileSource, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgConfigureFileSourceName, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgConfigureFileSourceWork, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgConfigureFileSourceStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgReportFileSourceAcquisition, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgReportFileSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgReportFileSourceStreamTiming, Message)
@ -217,6 +218,14 @@ bool FileSourceInput::handleMessage(Message* message)
message->completed();
return true;
}
else if (MsgConfigureFileSourceStreamTiming::match(message))
{
if (m_fileSourceThread != 0) {
MsgReportFileSourceStreamTiming::create(m_fileSourceThread->getSamplesCount())->submit(m_guiMessageQueue);
}else {
MsgReportFileSourceStreamTiming::create(0)->submit(m_guiMessageQueue);
}
}
else
{
return false;

View File

@ -100,6 +100,23 @@ public:
{ }
};
class MsgConfigureFileSourceStreamTiming : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgConfigureFileSourceStreamTiming* create()
{
return new MsgConfigureFileSourceStreamTiming();
}
private:
MsgConfigureFileSourceStreamTiming() :
Message()
{ }
};
class MsgReportFileSourceAcquisition : public Message {
MESSAGE_CLASS_DECLARATION