devicesbus read data
This commit is contained in:
24
src/core/plugin_system/PluginManager.cpp
Normal file
24
src/core/plugin_system/PluginManager.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "core/plugin_system/PluginManager.h"
|
||||
|
||||
namespace softbus::core::plugin_system
|
||||
{
|
||||
|
||||
void PluginManager::registerProtocolPlugin(std::shared_ptr<IProtocolPlugin> plugin)
|
||||
{
|
||||
if (!plugin) {
|
||||
return;
|
||||
}
|
||||
m_protocolPlugins.insert(plugin->pluginId(), std::move(plugin));
|
||||
}
|
||||
|
||||
std::shared_ptr<IProtocolPlugin> PluginManager::selectProtocolPlugin(const QString& protocolHint) const
|
||||
{
|
||||
for (auto it = m_protocolPlugins.constBegin(); it != m_protocolPlugins.constEnd(); ++it) {
|
||||
if (it.value() && it.value()->supports(protocolHint)) {
|
||||
return it.value();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace softbus::core::plugin_system
|
||||
Reference in New Issue
Block a user