This commit is contained in:
flower_linux
2026-03-18 16:31:32 +08:00
parent 9a2224f185
commit 91a3361d1f
26 changed files with 478 additions and 119 deletions

View File

@@ -4,20 +4,26 @@
#include <QJsonObject>
#include <QMap>
#include <QList>
#include <functional>
#include <QHash>
#include <QSharedPointer>
#include <memory>
#include "device_bus/tree/DeviceTreeModel.h"
#include "hardware/drivers/serial/SerialQtDriver.h"
#include "device_bus/registry/IDeviceRegistry.h"
#include "devices/DeviceTypes.h"
#include "devices/physical/SerialDevice.h"
class DeviceBusManager
{
public:
void setDeviceTreeModel(std::shared_ptr<DeviceTreeModel> model);
bool initialize(const QJsonObject& rootConfig);
void shutdown();
private:
void initializeSerialDriver(const QString& endpoint, const QJsonObject& params);
void shutdownSerialDriver(const QString& endpoint);
void initializeSerialDevice(const QString& endpoint, const QJsonObject& params);
void shutdownSerialDevice(const QString& endpoint);
// void initializeCanDriver();
// void shutdownCanDriver();
// void initializeTcpDriver();
@@ -28,12 +34,13 @@ private:
private:
DeviceTreeModel m_treeModel;
std::shared_ptr<DeviceTreeModel> m_treeModel;
// 添加map来记住所有设备的endpoint和type的映射
QMap<QString, QString> m_deviceEndpointsMap;
QMap<QString, softbus::devices::DeviceKind> m_deviceEndpointsMap;
QMap<QString, softbus::hardware::drivers::serial::SerialQtDriver*> m_serialDriversMap;
QList<softbus::hardware::drivers::serial::SerialQtDriver*> m_serialDriversList;
QHash<QString, QSharedPointer<softbus::devices::physical::SerialDevice>> m_serialDevicesByEndpoint;
softbus::device_bus::registry::IDeviceRegistry* m_registry = nullptr;
// std::vector<softbus::hardware::drivers::can::CanQtDriver*> m_canDrivers;
// std::vector<softbus::hardware::drivers::tcp::TcpQtDriver*> m_tcpDrivers;