简体   繁体   English

注册dbus对象并使用低级API进行接口

[英]Register dbus object and interface with low level API

How does one register an object, interface, and methods on the session bus using the D-Bus low-level public API ? 如何使用D-Bus低层公共API在会话总线上注册对象,接口和方法?

I've read many things about DBus and the best resource that I could find for doing what I currently want was Using the DBUS C API which describes how to request a name on the bus (among other things) and I've done that successfully but I'm unable to call a method on it and when I view it with D-Feet , there are no objects listed under the name I created. 我已经阅读了许多有关DBus的内容,并且可以找到做我当前想要的最佳资源的方法是使用DBUS C API ,它描述了如何在总线上请求名称(除其他外),并且我已经成功完成了但是我无法在其上调用方法,当我使用D-Feet查看该方法时,在我创建的名称下没有列出任何对象。 This leads me to think that there are additional steps to register an object, interface, and methods that aren't in the aforementioned guide (unless I missed something even after reading it a dozen times). 这使我认为,还有其他步骤可以注册前面提到的指南中没有的对象,接口和方法(除非我读了十几遍后仍然错过了一些东西)。

I'm confident in my ability to call methods using the low-level public API because I've successfully used it to call DBus methods exposed by off-the-shelf applications. 我对使用低级公共API调用方法的能力充满信心,因为我已经成功地使用它来调用现成应用程序公开的DBus方法。

Please note that I am not interested in any DBus Bindings . 请注意,我对任何DBus绑定都不感兴趣。 Thanks 谢谢

The answer was in the question I think. 答案是我想的问题。 I believe that the reason that I couldn't call the method that I created was that I didn't have a leading slash in my path argument of the method call DBus message. 我相信我无法调用所创建的方法的原因是,在方法调用DBus消息的path参数中没有加斜杠。 As in: 如:

/com/example/whatever correct /com/example/whatever正确的

com/example/whatever incorrect com/example/whatever不正确的地方

The guide I referenced in the question has the minimum requirements to do it. 我在问题中引用的指南对此具有最低要求。 I believe that the reason that I couldn't see the method in D-feet is because it relies on introspection method calls, which I did not implement. 我相信我无法在D英尺中看到该方法的原因是因为它依赖于我没有实现的自省方法调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM