问题描述
标题。我知道如何使用 QDBus 发送消息,但我不确定如何接收 DBus 事件或 systemd 事件。具体来说,我需要从 org.freedesktop.login1 之类的东西接收休眠/睡眠事件。我也尝试将它与 QDbus 一起使用,但它给出了一个非常奇怪的错误:
QVariant(QString,"The name org.freedesktop.login1 was not provided by any .service files")
显然还有一个 org.freedesktop.PowerManagement
服务,但我似乎也无法弄清楚如何从中接收事件。尝试查看 libdbus-c++
和 QDBus 文档,一无所获。有什么指点吗?
编辑:我也发现了这个:https://serverfault.com/questions/573379/system-suspend-dbus-upower-signals-are-not-seen#582440。所以这显示了我需要监听哪个事件 (org.freedesktop.login1.Manager.PrepareForSleep
),但我又一次不知道如何接收信号。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)