python下使用bluez报错:方法不存在

代码:

$ python
>>> import dbus
>>> bus = dbus.SystemBus()
>>> manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')
>>> foo = manager.DefaultAdapter()

错误提示:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "DefaultAdapter" with signature "" on interface "org.bluez.Manager" doesn't exist
阅读 5.8k
2 个回答

dir(manager)查看所有方法和属性,有时候同样的库,版本不一样,方法也会不同

org.bluez.Service 在bluez5已经被移除 :

The removal of the org.bluez.Service interface (used for registering
SDP records and authorization) and the introduction of a new
org.bluez.Profile1 interface

4)移除org.bluez.Service接口(用于注册SDP records and
authorization),引入新的org.bluez.Profile1接口。

from: http://www.bluez.org/bluez-5-...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题