1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Fixed source plugins virtual methods

This commit is contained in:
f4exb 2015-09-30 08:55:58 +02:00
parent a1efdcc8dc
commit 3ced80e198
11 changed files with 23 additions and 24 deletions

View File

@ -182,6 +182,7 @@ Assuming Debian Jessie is used:
- Many other little things...
<h1>To Do</h1>
- Specialize plugins into channel and sample source plugins since both have almost complete different requirements and only little in common
- Enhance presets management (Edit, Move, Import/Export from/to human readable format like JSON).
- Allow arbitrary sample rate for channelizers and demodulators (not multiple of 48 kHz). Prerequisite for polyphase channelizer
- Implement polyphase channelizer

View File

@ -23,12 +23,12 @@ public:
{
QString filename;
QPluginLoader* loader;
PluginInterface* plugin;
PluginInterface* pluginInterface;
Plugin(const QString& _filename, QPluginLoader* pluginLoader, PluginInterface* _plugin) :
filename(_filename),
loader(pluginLoader),
plugin(_plugin)
pluginInterface(_plugin)
{ }
};
@ -137,7 +137,7 @@ private:
static inline bool operator<(const PluginManager::Plugin& a, const PluginManager::Plugin& b)
{
return a.plugin->getPluginDescriptor().displayedName < b.plugin->getPluginDescriptor().displayedName;
return a.pluginInterface->getPluginDescriptor().displayedName < b.pluginInterface->getPluginDescriptor().displayedName;
}
#endif // INCLUDE_PLUGINMANAGER_H

View File

@ -46,7 +46,7 @@ public:
virtual PluginGUI* createChannel(const QString& channelName) { return 0; }
virtual SampleSourceDevices enumSampleSources() { return SampleSourceDevices(); }
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, const QString& sourceSerial, int sourceSequence) { return 0; }
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId) { return 0; }
};
Q_DECLARE_INTERFACE(PluginInterface, "de.maintech.SDRangelove.PluginInterface/0.1");

View File

@ -74,9 +74,9 @@ PluginInterface::SampleSourceDevices FCDProPlugin::enumSampleSources()
return result;
}
PluginGUI* FCDProPlugin::createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address)
PluginGUI* FCDProPlugin::createSampleSourcePluginGUI(const QString& sourceId)
{
if(sourceName == fcd_traits<Pro>::interfaceIID)
if(sourceId == fcd_traits<Pro>::interfaceIID)
{
FCDProGui* gui = new FCDProGui(m_pluginAPI);
m_pluginAPI->setInputGUI(gui);

View File

@ -17,8 +17,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
SampleSourceDevices enumSampleSources();
PluginGUI* createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address);
virtual SampleSourceDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId);
static const QString m_deviceTypeID;

View File

@ -69,9 +69,9 @@ PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources()
return result;
}
PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address)
PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceId)
{
if(sourceName == "org.osmocom.sdr.samplesource.filesource") {
if(sourceId == "org.osmocom.sdr.samplesource.filesource") {
FileSourceGui* gui = new FileSourceGui(m_pluginAPI);
m_pluginAPI->setInputGUI(gui);
return gui;

View File

@ -31,8 +31,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
SampleSourceDevices enumSampleSources();
PluginGUI* createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address);
virtual SampleSourceDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId);
private:
static const PluginDescriptor m_pluginDescriptor;

View File

@ -119,14 +119,14 @@ PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources()
return result;
}
PluginGUI* HackRFPlugin::createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address)
PluginGUI* HackRFPlugin::createSampleSourcePluginGUI(const QString& sourceId)
{
if (!m_pluginAPI)
{
return 0;
}
if(sourceName == m_deviceTypeID)
if(sourceId == m_deviceTypeID)
{
HackRFGui* gui = new HackRFGui(m_pluginAPI);
m_pluginAPI->setInputGUI(gui);

View File

@ -33,8 +33,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
SampleSourceDevices enumSampleSources();
PluginGUI* createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address);
virtual SampleSourceDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId);
static const QString m_deviceTypeID;

View File

@ -11,7 +11,7 @@ PluginsDialog::PluginsDialog(PluginManager* pluginManager, QWidget* parent) :
const PluginManager::Plugins& plugins = pluginManager->getPlugins();
for(PluginManager::Plugins::const_iterator it = plugins.constBegin(); it != plugins.constEnd(); ++it) {
QStringList sl;
const PluginDescriptor& desc = it->plugin->getPluginDescriptor();
const PluginDescriptor& desc = it->pluginInterface->getPluginDescriptor();
sl.append(desc.displayedName);
sl.append(desc.version);
if(desc.licenseIsGPL)

View File

@ -17,6 +17,8 @@ PluginManager::PluginManager(MainWindow* mainWindow, DSPEngine* dspEngine, QObje
m_mainWindow(mainWindow),
m_dspEngine(dspEngine),
m_sampleSourceId(),
m_sampleSourceSerial(),
m_sampleSourceSequence(0),
m_sampleSourcePluginGUI(NULL)
{
}
@ -38,7 +40,7 @@ void PluginManager::loadPlugins()
for (Plugins::const_iterator it = m_plugins.begin(); it != m_plugins.end(); ++it)
{
it->plugin->initPlugin(&m_pluginAPI);
it->pluginInterface->initPlugin(&m_pluginAPI);
}
updateSampleSourceDevices();
@ -311,9 +313,7 @@ int PluginManager::selectSampleSource(int index)
<< " ser: " << m_sampleSourceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceSequence;
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId,
m_sampleSourceSerial,
m_sampleSourceSequence);
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId);
return index;
}
@ -369,9 +369,7 @@ int PluginManager::selectFirstSampleSource(const QString& sourceId)
<< " ser: " << m_sampleSourceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceSequence;
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId,
m_sampleSourceSerial,
m_sampleSourceSequence);
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId);
return index;
}