This commit is contained in:
flowerstonezl
2026-03-11 11:21:53 +08:00
parent 993581b2a4
commit fef874e0e3
5 changed files with 163 additions and 7 deletions

View File

View File

@@ -0,0 +1,62 @@
/**
* @file Ipc_dbus.h
* @brief D-Bus 服务接口 - 提供核心服务状态和负载查询
*/
#ifndef IPC_DBUS_H
#define IPC_DBUS_H
#include <QObject>
/**
* @brief D-Bus 服务适配器 - 暴露核心服务接口
*/
class IpcDBus : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.softbus.Daemon")
public:
explicit IpcDBus(CoreService* coreService, QObject* parent = nullptr);
~IpcDBus();
public slots:
/**
* @brief 检查核心服务是否运行
* @return true 如果核心服务正在运行
*/
bool isRunning() const;
/**
* @brief 获取核心服务状态信息
* @return JSON 格式的状态信息
*/
QString getStatus() const;
/**
* @brief 获取守护进程的进程ID
* @return 进程ID如果无法获取则返回0
*/
qint64 getPid() const;
/**
* @brief 关闭守护进程
*/
void shutdown();
private slots:
void updateLoadInfo();
private:
};
#endif // IPC_DBUS_H