添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
胆小的茴香  ·  dbnetlib ...·  9 月前    · 
愉快的香槟  ·  Java【问题记录 ...·  1 年前    · 
奔放的针织衫  ·  CHE 10300: 11. File ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I would like to find out what are the available objects and interfaces in the bluez dbus bus. I wrote a simple python script to list all the bus names in the dbus session.

import dbus
for service in dbus.SystemBus().list_names():
    print(service)

However, I am only interested in the interfaces inside bluez /org/bluez. How can a python script be written to list down the interfaces inside /org/bluez?

I am using Ubuntu 14.04 and python 2.7

system_bus = dbus.SystemBus()
objectManager = system_bus.get_object('org.bluez', '/')
om_iface = dbus.Interface(objectManager, 'org.freedesktop.DBus.ObjectManager')
ifacelist = om_iface.GetManagedObjects()

Where ifacelist is a Dict of {ObjectPath, Dictof{String, Variant}}}

I got the following error. What are some possibilities of what went wrong? Thanks. dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "GetManagedObjects" with signature "" on interface "org.freedesktop.DBus.ObjectManager" doesn't exist – guagay_wk May 15, 2015 at 1:48 Ubuntu 14.04 is using Bluez 4.XX. I think it is 4.101 ubuntuupdates.org/package/core/trusty/main/base/bluez – guagay_wk May 15, 2015 at 5:13 Oops my solution works with bluez 5. See bluez.org/bluez-5-api-introduction-and-porting-guide – Jorge Martinez May 15, 2015 at 5:15

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.