弱网
2025-10-15 23:10:33 0 举报
项目架构
作者其他创作
大纲/内容
DBusMessage* msg
// 匹配// msg 收到的消息, interface_name需要匹配的接口名,method_name 匹配的方法名font color=\"#a66a30\
MessageHandlerStatic
server.hpp
dbus_service.hppDbusService
NetPing
start_server()
init_dbus(ServerContext* ctx)
register_on_connection(DBusConnection* conn)定义DBus 对象路径(Object Path)的行为回调
struct ServerContext { // DBus 连接 ::DBusConnection* connection = nullptr; // 运行标志 std::atomic<bool> running{true}; // 网卡监控线程 std::thread iface_thread; // 当前上网网卡监控线程 std::thread using_thread; // RTT 监控线程(detach 管理,保留占位以便未来 join) std::thread rtt_thread; // TCP丢包率监控线程 std::thread tcp_loss_thread; // 流量分析线程 std::thread traffic_analysis_thread; // 网络质量监控线程 std::thread network_quality_thread; // 共享的可上网网卡列表(NetInfo) std::mutex iface_mutex; std::vector<NetInfo> iface_list; // 服务对象(方法处理与信号发送) DbusService* service = nullptr; // 弱网管理器 WeakNetMgr* weak_mgr = nullptr;};
NetInfo
DbusService::register_on_connection(DBusConnection* conn)
main.cpp
main()
kBusName \"com.example.WeakNet\" 服务名kObjectPath \"/com/example/WeakNet\" 对象路径kInterface \"com.example.WeakNet\" 接口名
DBusConnection* conn
收藏
0 条评论
下一页