devices modbus rtu 1.0
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QSet>
|
||||
// #include <algorithm>
|
||||
|
||||
@@ -10,7 +11,7 @@
|
||||
#include "message_bus/ingress/DriverIngressAdapter.h"
|
||||
#include "message_bus/pipeline/PipelineEngine.h"
|
||||
#include "core/plugin_system/PluginManager.h"
|
||||
#include "message_bus/pipeline/protocol/modbusrtu/ModbusRtuProtocolPlugin.h"
|
||||
#include "plugins/protocols/modbusrtu/parser/ModbusRtuProtocolPlugin.h"
|
||||
#include "device_bus/manager/SerialDeviceManager.h"
|
||||
#include "devices/DeviceTypes.h"
|
||||
#include "utils/logs/logging.h"
|
||||
@@ -57,7 +58,23 @@ bool DeviceBusManager::initialize(const QJsonObject& rootConfig)
|
||||
if (!m_pluginManager) {
|
||||
m_pluginManager = std::make_shared<softbus::core::plugin_system::PluginManager>();
|
||||
}
|
||||
if (!m_pluginHost) {
|
||||
m_pluginHost = std::make_unique<softbus::core::plugin_system::PluginHost>(m_pluginManager);
|
||||
}
|
||||
m_pluginManager->registerProtocolPlugin(softbus::core::plugin_system::makeModbusRtuProtocolPlugin());
|
||||
const auto pluginsObj = rootConfig.value(QStringLiteral("plugins")).toObject();
|
||||
const auto framerArr = pluginsObj.value(QStringLiteral("framers")).toArray();
|
||||
for (const auto& v : framerArr) {
|
||||
const auto obj = v.toObject();
|
||||
const QString path = obj.value(QStringLiteral("path")).toString();
|
||||
if (path.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
QString err;
|
||||
if (!m_pluginHost->loadPlugin(path, &err)) {
|
||||
LOG_WARNING() << "DeviceBusManager: framer plugin load failed path=" << path << "err=" << err;
|
||||
}
|
||||
}
|
||||
if (m_pipelineEngine) {
|
||||
m_pipelineEngine->setMemoryPool(m_memoryPool);
|
||||
m_pipelineEngine->loadRuntimeConfigFromJson(rootConfig.value(QStringLiteral("pipeline")).toObject());
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "core/memory/MemoryPool.h"
|
||||
#include "core/plugin_system/PluginManager.h"
|
||||
#include "core/plugin_system/PluginHost.h"
|
||||
#include "device_bus/tree/DeviceTreeModel.h"
|
||||
#include "device_bus/registry/IDeviceRegistry.h"
|
||||
#include "devices/DeviceTypes.h"
|
||||
@@ -57,6 +58,7 @@ private:
|
||||
softbus::device_bus::registry::IDeviceRegistry* m_registry = nullptr;
|
||||
std::shared_ptr<softbus::core::memory::MemoryPool> m_memoryPool;
|
||||
std::shared_ptr<softbus::core::plugin_system::PluginManager> m_pluginManager;
|
||||
std::unique_ptr<softbus::core::plugin_system::PluginHost> m_pluginHost;
|
||||
std::unique_ptr<softbus::message_bus::pipeline::PipelineEngine> m_pipelineEngine;
|
||||
std::unique_ptr<softbus::message_bus::ingress::DriverIngressAdapter> m_ingressAdapter;
|
||||
std::unique_ptr<softbus::message_bus::egress::EgressRouter> m_egressRouter;
|
||||
|
||||
Reference in New Issue
Block a user