Вопрос

Question: Is there any way in which we can find out the methods (and their signatures) which are exposed in a D-Bus interface?

Issue Description: In my phone, I am calling BlueZ methods using D-Bus to adapter interface, when checked on phone 2 of these methods are not available.

Intention is to check if the method name/signatures are modified in other device, I don't have access to code so looking to find the methods in an interface

Это было полезно?

Решение 3

With an extra google search and dbus understanding, using D-Bus Introspection helps to get the methods (with signatures) exposed on that particular interface. More information available at link.

Другие советы

Using dbus-send, you can list the available services on your system:

Session:

dbus-send --session           \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

System:

dbus-send --system            \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

You'll get an answer like that:

   array [
      string "org.freedesktop.DBus"
      string ":1.1"
      string ":1.26"
      string "org.asamk.Signal"
   ]

And if you want to list all methods available behind a dbus service, you can still use dbus-send to introspect the dbus service.

For example with org.asamk.Signal:

  dbus-send --system --type=method_call --print-reply \
      --dest=org.asamk.Signal \
      /org/asamk/Signal \
      org.freedesktop.DBus.Introspectable.Introspect

You'll get this kind of result (truncated)

<node name="/org/asamk/Signal">
 <interface name="org.asamk.Signal">
  <method name="sendMessage" >
   ...parameters
  </method>                      
  <method name="sendGroupMessage" >     
   ...parameters
  </method>
 </interface>
</node>

Here there are 2 methods, sendMessage and sendGroupMessage

You can also take a look at D-Feet.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top