18 #include <QCoreApplication> 19 #include <QPluginLoader> 69 QString applicationDirPath = QCoreApplication::instance()->applicationDirPath();
70 QStringList PluginsPath;
74 PluginsPath << applicationDirPath +
"/../lib/sdrangel/" + pluginsSubDir;
76 PluginsPath << applicationDirPath +
"/lib/" + pluginsSubDir;
79 PluginsPath << applicationDirPath +
"/../Resources/lib/" + pluginsSubDir;
80 #elif defined(_WIN32) || defined(WIN32) 81 PluginsPath << applicationDirPath +
"/" + pluginsSubDir;
86 foreach (QString dir, PluginsPath)
89 if (d.entryList(QDir::Files).count() == 0) {
90 qDebug(
"PluginManager::loadPluginsPart folder %s is empty", qPrintable(dir));
101 qCritical(
"No plugins found. Exit immediately.");
122 qDebug() <<
"PluginManager::registerRxChannel " 124 <<
" with channel name " << channelIdURI;
131 qDebug() <<
"PluginManager::registerTxChannel " 133 <<
" with channel name " << channelIdURI;
140 qDebug() <<
"PluginManager::registerSampleSource " 142 <<
" with source name " << sourceName.toStdString().c_str();
149 qDebug() <<
"PluginManager::registerSampleSink " 151 <<
" with sink name " << sinkName.toStdString().c_str();
158 qDebug() <<
"PluginManager::registerSampleMIMO " 160 <<
" with MIMO name " << mimoName.toStdString().c_str();
167 QDir pluginsDir(dir);
169 foreach (QString fileName, pluginsDir.entryList(QDir::Files))
171 if (QLibrary::isLibrary(fileName))
173 qDebug(
"PluginManager::loadPluginsDir: fileName: %s", qPrintable(fileName));
175 QPluginLoader* pluginLoader =
new QPluginLoader(pluginsDir.absoluteFilePath(fileName));
176 if (!pluginLoader->load())
178 qWarning(
"PluginManager::loadPluginsDir: %s", qPrintable(pluginLoader->errorString()));
184 if (instance ==
nullptr)
186 qWarning(
"PluginManager::loadPluginsDir: Unable to get main instance of plugin: %s", qPrintable(fileName) );
191 delete(pluginLoader);
193 qInfo(
"PluginManager::loadPluginsDir: loaded plugin %s", qPrintable(fileName));
205 const PluginDescriptor& pluginDescipror = it->m_plugin->getPluginDescriptor();
216 const PluginDescriptor& pluginDesciptor = it->m_plugin->getPluginDescriptor();
void listRxChannels(QList< QString > &list)
static const QString m_remoteInputHardwareID
Remote input hardware ID.
const QString displayedName
static const QString m_fileSinkHardwareID
FileSink sink hardware ID.
void enumerateTxDevices(PluginManager *pluginManager)
virtual BasebandSampleSink * createRxChannelBS(DeviceAPI *deviceAPI)
void loadPlugins(const QString &pluginsSubDir)
static const QString m_testMIMODeviceTypeID
Test MIMO plugin ID.
static const QString m_localOutputDeviceTypeID
Local output plugin ID.
PluginAPI::ChannelRegistrations m_rxChannelRegistrations
Channel plugins register here.
virtual const PluginDescriptor & getPluginDescriptor() const =0
static const QString m_remoteOutputDeviceTypeID
Remote output plugin ID.
static const QString m_localOutputHardwareID
Local output hardware ID.
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
static const QString m_fileSinkDeviceTypeID
FileSink sink plugin ID.
void registerSampleSink(const QString &sinkName, PluginInterface *plugin)
void registerRxChannel(const QString &channelIdURI, const QString &channelId, PluginInterface *plugin)
PluginAPI::SamplingDeviceRegistrations m_sampleMIMORegistrations
MIMO sink plugins (one per device kind) register here.
static const QString m_localInputHardwareID
Local input hardware ID.
void enumerateMIMODevices(PluginManager *pluginManager)
void loadPluginsDir(const QDir &dir)
static const QString m_testMIMOHardwareID
Test MIMO hardware ID.
void createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI)
static const QString m_fileInputHardwareID
File input hardware ID.
PluginAPI::SamplingDeviceRegistrations m_sampleSinkRegistrations
Output sink plugins (one per device kind) register here.
void enumerateRxDevices(PluginManager *pluginManager)
virtual PluginInstanceGUI * createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
void loadPluginsPart(const QString &pluginsSubDir)
static const QString m_remoteInputDeviceTypeID
Remote input plugin ID.
static const QString m_remoteOutputHardwareID
Remote output hardware ID.
static const QString m_localInputDeviceTypeID
Local input plugin ID.
< This is the device registration
void registerTxChannel(const QString &channelIdURI, const QString &channelId, PluginInterface *plugin)
void listTxChannels(QList< QString > &list)
void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI)
virtual PluginInstanceGUI * createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
void registerSampleMIMO(const QString &mimoName, PluginInterface *plugin)
static const QString m_fileInputDeviceTypeID
File input plugin ID.
PluginAPI::ChannelRegistrations m_txChannelRegistrations
Channel plugins register here.
PluginManager(QObject *parent=0)
virtual BasebandSampleSource * createTxChannelBS(DeviceAPI *deviceAPI)
static DeviceEnumerator * instance()
PluginAPI::SamplingDeviceRegistrations m_sampleSourceRegistrations
Input source plugins (one per device kind) register here.