linux - QDBus问题: getting org. freedesktop.DBus.Error.UnknownMethod,但方法存在

标签 linux ubuntu methods dbus

我正在 Ubuntu 上使用 QDBus 进行 C++ 编程,我得到了以下代码片段:

this->m_cRemoteInterface = new QDBusInterface("org.my.service", "/data", "org.freedesktop.DBus.Properties.Get"); 

QDBusReply<uint64_t> cResult = m_cRemoteInterface->call("property1");

代码抛出以下错误:

org.freedesktop.DBus.Error.UnknownMethod: Method "property1" with signature "" on interface "org.freedesktop.DBus.Properties.Get" doesn't exist

但是当我在 shell 中发出以下命令时,它会返回正确的值:

dbus org.my.service /data org.freedesktop.DBus.Properties.Get " " property1

我可能做错了什么?

提前致谢,艾米

最佳答案

经过一下午的尝试和错误:

我声明了

org.freedesktop.DBus.Properties.Get

作为接口(interface),这是不对的。

我只需要使用

org.freedesktop.DBus.Properties

作为界面,然后

call("Get", " ", "property1");

愿这对某人有帮助。 :)。

关于linux - QDBus问题: getting org. freedesktop.DBus.Error.UnknownMethod,但方法存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3456581/

相关文章:

linux - Bash 命令 `Ctrl+u` 截断当前输入行而不是清除它

azure - 如何在 Azure Ubuntu 虚拟机中从 Azure 注册表提取 docker 镜像

java - 队列实现为数组

java - 将异常传递给自定义异常处理程序方法。 java

Python 脚本仅使用 "python"命令运行

linux - 在 Linux 中驱动声卡

ruby-on-rails - Mavericks,RBENV,你的 Ruby 版本是 2.0.0,但是你的 Gemfile 指定了 2.1.1

linux - 让用户从 CL 重新启动,或者从 CL 重新启动而不是 root

python - docker python flask 得到 "Do you want to continue"然后 "executor failed"

ios - 在类方法之间匹配 2 个 NSString 值