繁体   English   中英

如何定义可以自省的新d-bus接口?

[英]How to define a new d-bus interface that can be introspected?

我已经创建了一个自定义的d-bus服务,该服务似乎已注册并且可以通过dbus调用激活,但是它没有接口定义,并且无法通过d-feet之类的工具进行自检。

我试图弄清楚该如何做,我创建了以下接口文件:

<!DOCTYPE node PUBLIC
    "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd" >
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
  <interface name="com.me.test.Manager">
    <method name="Start">
      <arg name="name" direction="in" type="s">
        <doc:doc><doc:summary>Name of new contact</doc:summary></doc:doc>
      </arg>
      <arg name="email" direction="in" type="s">
        <doc:doc><doc:summary>E-mail address of new contact</doc:summary></doc:doc>
      </arg>
      <arg name="id" direction="out" type="u">
        <doc:doc><doc:summary>ID of newly added contact</doc:summary></doc:doc>
      </arg>
      <doc:doc>
        <doc:description>
          <doc:para>
            Adds a new contact to the address book with their name and
            e-mail address.
          </doc:para>
        </doc:description>
      </doc:doc>
    </method>
  </interface>
</node>

我将文件命名为:

/usr/share/dbus-1/interfaces/com.me.test.Manager.xml

但是,当我使用d-feet浏览器搜索“ com.me.test”时,在会话总线上仍然看不到任何对象。 dbus如何实际注册此接口,dbus会监视此目录吗? 我尝试重新启动dbus,但这没有帮助

您的服务需要调用org.freedesktop.DBus.RequestName以在某些名称下可见,然后对org.freedesktop.DBus.Introspectable.Introspect请求进行响应

这是我在dbus库中实现它的示例-https: //github.com/sidorares/node-dbus/blob/master/lib/stdifaces.js#L24-L92

暂无
暂无

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

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