[英]QDBus problem: getting org.freedesktop.DBus.Error.UnknownMethod, but method exists
I'm programming C++ on Ubuntu, using QDBus and I've got the following code snippet: 我正在使用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");
The code throws the following error: 该代码引发以下错误:
org.freedesktop.DBus.Error.UnknownMethod: Method "property1" with signature "" on interface "org.freedesktop.DBus.Properties.Get" doesn't exist
org.freedesktop.DBus.Error.UnknownMethod:接口“ org.freedesktop.DBus.Properties.Get”上具有签名“”的方法“ property1”不存在
But when I issue the following command in a shell, it returns the correct value: 但是,当我在shell中发出以下命令时,它将返回正确的值:
dbus org.my.service /data org.freedesktop.DBus.Properties.Get " " property1
dbus org.my.service / data org.freedesktop.DBus.Properties.Get“” property1
What could I do wrong? 我该怎么办?
Thanks in advance, emi 在此先感谢emi
After an afternoon of trail and error: 经过一连串的错误:
I declared 我宣布
org.freedesktop.DBus.Properties.Get
org.freedesktop.DBus.Properties.Get
as interface, which is not right. 作为接口,这是不对的。
I had to use only 我只用
org.freedesktop.DBus.Properties
org.freedesktop.DBus.Properties
as interface and then 作为接口,然后
call("Get", " ", "property1");
call(“ Get”,“”,“ property1”);
May this help someone. 可以帮助别人。 :).
:)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.