我正在使用QDBus在Ubuntu上进行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:
方法“ property1”与
接口上的签名“”
“ org.freedesktop.DBus.Properties.Get”
不存在
但是,当我在shell中发出以下命令时,它将返回正确的值:
dbus org.my.service / data org.freedesktop.DBus.Properties.Get“
“ property1
我该怎么办?
在此先感谢emi
最佳答案
经过一连串的错误和错误:
我宣布
org.freedesktop.DBus.Properties.Get
作为接口,这是不对的。
我只需要使用
org.freedesktop.DBus.Properties
作为接口,然后
call(“ Get”,“”,“ property1”);
可以帮助别人。 :)。